Math · Linear Algebra

Vectors

A vector has magnitude and direction. Move its endpoint to see how components, length, and angle describe the same object.

Concept

A point names a location. A vector describes a displacement: how far and in which direction to move. The arrow can be translated without changing the vector.

Equation

∥v∥=x2+y2

Manipulate

Drag either endpoint, or focus it and use arrow keys. Endpoints snap to whole coordinates from −5 to 5.

Addition and scalar multiplication

The translated blue arrow shows head-to-tail addition: u+v adds components one at a time. The dashed arrow is kv: values above one stretch it, values between zero and one shrink it, and negative values reverse it.

Dot product

u·v=u1v1+u2v2=∥u∥∥v∥cosθ

A positive dot product means an acute angle; zero means perpendicular; a negative value means an obtuse angle. The presets make each case visible without relying on color alone.

Observe

The same pair of component values determines the arrow’s endpoint, its magnitude, and its direction. A zero vector has no direction, so an angle involving it is undefined.

Computing, data & machine learning

Vectors represent position, velocity, and direction in graphics. A data observation is a feature vector, such as x=(feature1,feature2,…). ML uses vectors for features, weights, gradients, and high-dimensional embeddings; the idea is the same even when the dimensions cannot be drawn.

Matrix transformations

A matrix can transform a vector.

[ a  b ] [ x ] → transformed vector
[ c  d ] [ y ]