Vectors are one of the core objects of linear algebra. They represent direction and magnitude, and they are used in geometry, physics, graphics, optimization, and machine learning.
The essentials are built in a strict order: representation, vectors from points, position vectors, length and normalization, basic operations, and linear interpolation. The dot product and 3D cross product are treated in their own chapters.
Definition and Notation
A vector \(\mathbf{v}\in\mathbb{R}^n\) is an ordered list of \(n\) real values:
\[ \mathbf{v}=\langle v_1,v_2,\dots,v_n\rangle. \]
The same vector is often written as a transposed column vector:
\[ \mathbf{v}=[v_1,v_2,\dots,v_n]^{\mathsf T}. \]
In three dimensions, with basis vectors \(\hat{\mathbf{x}}=\langle1,0,0\rangle\), \(\hat{\mathbf{y}}=\langle0,1,0\rangle\), \(\hat{\mathbf{z}}=\langle0,0,1\rangle\), vectors can be read as linear combinations of basis directions:
\[ \mathbf{v}=v_1\hat{\mathbf{x}}+v_2\hat{\mathbf{y}}+v_3\hat{\mathbf{z}} \]
and in \(n\) dimensions analogously:
\[ \mathbf{v}=\sum_{i=1}^n v_i\,\mathbf{e}_i. \]
The geometric vector is independent of coordinates, but its component values \(v_i\) depend on the chosen basis. Changing the basis changes the coordinate tuple, not the underlying geometric object.
Vectors from Points
Let \(P_1,P_2\in\mathbb{R}^n\). The vector from \(P_1\) to \(P_2\) is
\[ \mathbf{v}=P_2-P_1. \]
So subtraction of coordinates is not only arithmetic: it encodes displacement.
Distance Between Two Points
The Euclidean distance between two points is the norm of their difference vector:
\[ d(P,Q)=\|Q-P\|. \]
Position Vector
A position vector is a vector anchored at the origin \(\mathcal{O}=(0,0,\dots,0)\) and pointing to a point in space. In coordinates, the point and its position vector have the same entries. The difference is conceptual: a point denotes a location, while its position vector denotes the displacement from the origin to that location.
Vector Length (Norm)
The Euclidean length (magnitude) is
\[ \|\mathbf{v}\|=\sqrt{\sum_{i=1}^n v_i^2} =\sqrt{v_1^2+v_2^2+\dots+v_n^2}. \]
This is the \(n\)-dimensional extension of Pythagoras.
Example: for \(\mathbf{v}=[1,2,3]^{\mathsf T}\),
\[ \|\mathbf{v}\|=\sqrt{1^2+2^2+3^2}=\sqrt{14}\approx 3.74. \]
A vector of length \(1\) is a unit vector, often written as \(\hat{\mathbf{v}}\).
Normalization
For \(\mathbf{v}\neq\mathbf{0}\), normalization scales to unit length:
\[ \hat{\mathbf{v}}=\frac{1}{\|\mathbf{v}\|}\,\mathbf{v}. \]
This keeps direction and sets magnitude to \(1\).
Core Properties of the Euclidean Norm
For all vectors \(\mathbf{u},\mathbf{v}\in\mathbb{R}^n\) and all scalars \(a\in\mathbb{R}\), the Euclidean norm satisfies:
\[ \|\mathbf{v}\|\ge 0,\qquad \|\mathbf{v}\|=0\iff\mathbf{v}=\mathbf{0}, \]
\[ \|a\mathbf{v}\|=|a|\,\|\mathbf{v}\|, \]
\[ \|\mathbf{u}+\mathbf{v}\|\le\|\mathbf{u}\|+\|\mathbf{v}\|. \]
The last inequality is the triangle inequality and is fundamental for geometry and analysis.
Basic Vector Operations
Geometric Interpretation
The algebraic formulas have direct geometric meaning:
- \(\mathbf{v}+\mathbf{w}\): diagonal of the parallelogram spanned by \(\mathbf{v}\) and \(\mathbf{w}\),
- \(\mathbf{v}-\mathbf{w}\): vector from the tip of \(\mathbf{w}\) to the tip of \(\mathbf{v}\),
- \(a\mathbf{v}\): scaling by \(|a|\), with direction reversal for \(a<0\).
Vector Addition
For \(\mathbf{v},\mathbf{w}\in\mathbb{R}^n\):
\[ \begin{array}{rl} \mathbf{v}+\mathbf{w} =&[v_1,v_2,\dots,v_n]^{\mathsf T}+[w_1,w_2,\dots,w_n]^{\mathsf T}\\ =&[v_1+w_1,v_2+w_2,\dots,v_n+w_n]^{\mathsf T}. \end{array} \]
Addition is commutative componentwise, so \(\mathbf{v}+\mathbf{w}=\mathbf{w}+\mathbf{v}\).
Vector Subtraction
\[ \begin{array}{rl} \mathbf{v}-\mathbf{w} =&[v_1,v_2,\dots,v_n]^{\mathsf T}-[w_1,w_2,\dots,w_n]^{\mathsf T}\\ =&[v_1-w_1,v_2-w_2,\dots,v_n-w_n]^{\mathsf T}. \end{array} \]
Scalar Multiplication
For a scalar \(a\in\mathbb{R}\):
\[ a\mathbf{v}=[av_1,av_2,\dots,av_n]^{\mathsf T}. \]
This scales each component (and therefore the length) by \(|a|\), and reverses direction for \(a<0\).
Rules of Scalar Multiplication
\[ a(\mathbf{v}_1+\mathbf{v}_2)=a\mathbf{v}_1+a\mathbf{v}_2 \]
\[ (a+b)\mathbf{v}=a\mathbf{v}+b\mathbf{v} \]
\[ (-1)\mathbf{v}=-\mathbf{v},\qquad 0\mathbf{v}=\mathbf{0}. \]
Basic Algebraic Laws
The basic vector-space laws used throughout linear algebra are:
\[ (\mathbf{u}+\mathbf{v})+\mathbf{w}=\mathbf{u}+(\mathbf{v}+\mathbf{w}), \]
\[ \mathbf{v}+\mathbf{0}=\mathbf{v},\qquad \mathbf{v}+(-\mathbf{v})=\mathbf{0}, \]
\[ a(\mathbf{u}+\mathbf{v})=a\mathbf{u}+a\mathbf{v},\qquad (a+b)\mathbf{v}=a\mathbf{v}+b\mathbf{v}, \]
\[ (ab)\mathbf{v}=a(b\mathbf{v}). \]
Linear Interpolation (Lerp)
Linear interpolation between two points \(P_0\) and \(P_1\) with parameter \(a\in[0,1]\) is
\[ \operatorname{lerp}(P_0,P_1;a) =(1-a)P_0+aP_1 =P_0+a(P_1-P_0). \]
If we define \(\mathbf{v}=P_1-P_0\), then
\[ \operatorname{lerp}(P_0,P_1;a)=P_0+a\mathbf{v}. \]
Drag \(P_0\) or \(P_1\), or move the slider to change \(a\). The green point always sits at \(\operatorname{lerp}(P_0,P_1;a)=P_0+a\mathbf{v}\) along the vector \(\mathbf{v}=P_1-P_0\); \(a=0\) and \(a=1\) reproduce the two endpoints exactly, and values outside \([0,1]\) on the slider would extrapolate past them.
Affine vs. Linear Combinations
The expression \((1-a)P_0+aP_1\) is an affine combination because coefficients sum to \(1\). This is why lerp between points stays on the line through \(P_0\) and \(P_1\).
A linear combination of vectors has the form \(c_1\mathbf{v}_1+\dots+c_k\mathbf{v}_k\) with no sum-to-one constraint. Distinguishing affine and linear combinations avoids confusion between point geometry and free-vector algebra.
So lerp is exactly "move from \(P_0\) along a scaled direction vector". Endpoints are immediate: \(a=0\Rightarrow P_0\), \(a=1\Rightarrow P_1\).
In practice this works for more than geometric points:
- 1D values (lengths, temperatures, scalar signals),
- 2D and 3D coordinates,
- angles (with periodic caveats),
- RGB color channels (componentwise interpolation).
Worked Examples
Example 1: Norm and Normalization in 2D
Let \(\mathbf{v}=\langle3,4\rangle\). Then
\[ \|\mathbf{v}\|=\sqrt{3^2+4^2}=5, \]
so the normalized vector is
\[ \hat{\mathbf{v}}=\frac{1}{5}\langle3,4\rangle=\left\langle\frac{3}{5},\frac{4}{5}\right\rangle. \]
Example 2: Translation and Lerp in 3D
Let \(P_0=\langle1,2,0\rangle\), \(P_1=\langle5,4,2\rangle\), and \(\mathbf{d}=\langle-2,1,3\rangle\).
Translation by \(\mathbf{d}\):
\[ P_0+\mathbf{d}=\langle-1,3,3\rangle. \]
For interpolation, \(P_1-P_0=\langle4,2,2\rangle\), hence
\[ \operatorname{lerp}(P_0,P_1;a)=P_0+a\langle4,2,2\rangle. \]
Selected values:
- \(a=0\): \(\langle1,2,0\rangle\),
- \(a=0.25\): \(\langle2,2.5,0.5\rangle\),
- \(a=0.5\): \(\langle3,3,1\rangle\),
- \(a=1\): \(\langle5,4,2\rangle\).
Common Pitfalls
- Normalizing the zero vector is undefined because division by \(\|\mathbf{0}\|=0\) is impossible.
- Points and vectors can share coordinates, but they play different roles (location vs. displacement).
- Componentwise formulas require consistent units across components.
- For lerp, \(a\in[0,1]\) gives points between endpoints; outside this interval it becomes extrapolation.
Where This Leads Next
With these foundations in place, the next operations are natural extensions: the dot product for angle and projection, and the 3D cross product for oriented area and perpendicular directions.