geometry

Vector

A vector is a quantity with both magnitude and direction. Notation: ⟨x, y⟩ or ⟨x, y, z⟩. Vectors add componentwise and underpin physics, graphics, and ML.

A vector has both magnitude and direction, in contrast to a scalar which has only magnitude.

Coordinates: v=x,y\vec{v} = \langle x, y \rangle (2D) or x,y,z\langle x, y, z \rangle (3D). Magnitude v=x2+y2+|\vec{v}| = \sqrt{x^2 + y^2 + \cdots}.

Operations:

  • Addition / subtraction: componentwise.
  • Scalar multiplication: scale magnitude.
  • Dot product: uv=uivi=uvcosθ\vec{u} \cdot \vec{v} = \sum u_i v_i = |\vec{u}||\vec{v}|\cos\theta — measures alignment, gives a scalar.
  • Cross product (3D only): u×v\vec{u} \times \vec{v} — perpendicular to both, magnitude uvsinθ|\vec{u}||\vec{v}|\sin\theta.

Vectors describe physics (force, velocity), graphics (positions, normals), ML (feature vectors, gradients, embeddings), and geometry. Generalising to higher dimensions and abstract spaces (Hilbert spaces) is the foundation of much of modern mathematics.