← Back to modules

Vectors & Operations

Vector arithmetic, linear combinations, span, and independence.

Vectors are the atomic units of linear algebra. Everything else — matrices, transformations, eigenvalues, the SVD — is ultimately built on top of vectors. Before any of those ideas make sense, you must be fluent with what a vector is, how vectors combine, and what the dot product measures.

Geometrically, a vector in R2\mathbb{R}^2 or R3\mathbb{R}^3 is an arrow: it has a length (magnitude) and a direction. Algebraically, it is an ordered list of real numbers. The power of linear algebra is that the same algebraic rules work in any number of dimensions, even when there is no geometric picture to draw.

This chapter covers vector arithmetic, the dot product, projections, and the cross product. These tools recur in every subsequent topic.

What is a vector?

A vector in Rn\mathbb{R}^n is an ordered nn-tuple of real numbers: v=v1,v2,,vn\mathbf{v} = \langle v_1, v_2, \ldots, v_n \rangle. In R2\mathbb{R}^2, a vector is an arrow in the plane; in R3\mathbb{R}^3, an arrow in space. In Rn\mathbb{R}^n for n>3n > 3, there is no geometric picture, but the algebra is identical.

What defines a vector is its displacement, not its starting point. Two arrows with the same length and direction, drawn anywhere on the page, are the same vector. This is why vectors model velocities, forces, and displacements — all of these are directional quantities independent of position.

Two vectors are equal if and only if every corresponding component is equal: u1,u2=v1,v2\langle u_1, u_2 \rangle = \langle v_1, v_2 \rangle iff u1=v1u_1 = v_1 and u2=v2u_2 = v_2. A vector in R2\mathbb{R}^2 and a vector in R3\mathbb{R}^3 can never be equal — they live in different spaces.

The zero vector 0=0,0,,0\mathbf{0} = \langle 0, 0, \ldots, 0 \rangle has zero magnitude and no defined direction. It is the additive identity: v+0=v\mathbf{v} + \mathbf{0} = \mathbf{v} for any v\mathbf{v}.

The magnitude (length, norm) is v=v12+v22++vn2\|\mathbf{v}\| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}, a direct generalisation of the Pythagorean theorem. For v=3,4\mathbf{v} = \langle 3, 4 \rangle: v=9+16=5\|\mathbf{v}\| = \sqrt{9+16} = 5. Magnitude is always nonneg.

Helpful?

Vector addition and scalar multiplication

Addition is component-wise: u+v=u1+v1,u2+v2,,un+vn\mathbf{u} + \mathbf{v} = \langle u_1+v_1, u_2+v_2, \ldots, u_n+v_n \rangle. Geometrically, place the tail of v\mathbf{v} at the head of u\mathbf{u}; the sum is the arrow from the tail of u\mathbf{u} to the head of v\mathbf{v}. This is called the parallelogram law.

Scalar multiplication scales every component: cv=cv1,cv2,,cvnc\mathbf{v} = \langle cv_1, cv_2, \ldots, cv_n \rangle. If c>0c > 0, direction is preserved and magnitude is multiplied by cc. If c<0c < 0, direction reverses. If c=0c = 0, the result is 0\mathbf{0}.

The magnitude satisfies cv=cv\|c\mathbf{v}\| = |c|\,\|\mathbf{v}\| — scaling a vector scales its length by the absolute value of the scalar.

A unit vector has magnitude exactly 11. To normalise any nonzero vector: v^=v/v\hat{\mathbf{v}} = \mathbf{v}/\|\mathbf{v}\|. The result v^\hat{\mathbf{v}} points in the same direction as v\mathbf{v} but has length 11.

The standard unit vectors in R3\mathbb{R}^3 are e1=1,0,0\mathbf{e}_1 = \langle 1,0,0 \rangle, e2=0,1,0\mathbf{e}_2 = \langle 0,1,0 \rangle, e3=0,0,1\mathbf{e}_3 = \langle 0,0,1 \rangle (also written i,j,k\mathbf{i}, \mathbf{j}, \mathbf{k}). Every vector in R3\mathbb{R}^3 is a linear combination of these: a,b,c=ae1+be2+ce3\langle a,b,c \rangle = a\mathbf{e}_1 + b\mathbf{e}_2 + c\mathbf{e}_3.

These two operations — addition and scalar multiplication — satisfy eight axioms (commutativity, associativity, distributivity, and so on) that define what it means to be a vector space. Any collection of objects obeying these axioms, whether arrows, polynomials, or signals, is a vector space and the same theory applies.

Helpful?

The dot product

The dot product (inner product) of u,vRn\mathbf{u}, \mathbf{v} \in \mathbb{R}^n is uv=u1v1+u2v2++unvn\mathbf{u} \cdot \mathbf{v} = u_1v_1 + u_2v_2 + \cdots + u_nv_n. It takes two vectors and returns a single scalar — not a vector.

The geometric interpretation is fundamental: uv=uvcosθ\mathbf{u}\cdot\mathbf{v} = \|\mathbf{u}\|\,\|\mathbf{v}\|\cos\theta, where θ[0,π]\theta \in [0,\pi] is the angle between the vectors. This ties algebraic computation directly to geometry.

Three key cases from the geometric formula: uv>0\mathbf{u}\cdot\mathbf{v} > 0 means the angle is acute (vectors point broadly the same way); uv<0\mathbf{u}\cdot\mathbf{v} < 0 means obtuse (they point away from each other); uv=0\mathbf{u}\cdot\mathbf{v} = 0 means θ=90°\theta = 90° — the vectors are orthogonal (perpendicular).

Self-dot product gives magnitude squared: vv=v2\mathbf{v}\cdot\mathbf{v} = \|\mathbf{v}\|^2. So v=vv\|\mathbf{v}\| = \sqrt{\mathbf{v}\cdot\mathbf{v}}.

The Cauchy-Schwarz inequality states uvuv|\mathbf{u}\cdot\mathbf{v}| \leq \|\mathbf{u}\|\,\|\mathbf{v}\|, with equality iff the vectors are parallel. Rearranging gives the formula for cosθ\cos\theta; since cosθ1|\cos\theta| \leq 1, the inequality is automatically satisfied.

Algebraic properties: uv=vu\mathbf{u}\cdot\mathbf{v} = \mathbf{v}\cdot\mathbf{u} (commutative), u(v+w)=uv+uw\mathbf{u}\cdot(\mathbf{v}+\mathbf{w}) = \mathbf{u}\cdot\mathbf{v}+\mathbf{u}\cdot\mathbf{w} (distributive), (cu)v=c(uv)(c\mathbf{u})\cdot\mathbf{v} = c(\mathbf{u}\cdot\mathbf{v}) (scalar associativity). These hold in any dimension.

Helpful?

Projections

The projection of u\mathbf{u} onto v\mathbf{v} is the component of u\mathbf{u} that lies exactly in the direction of v\mathbf{v} — the 'shadow' of u\mathbf{u} on the line through the origin in the direction of v\mathbf{v}.

Vector projection: projvu=uvvvv=uvv2v\text{proj}_{\mathbf{v}}\mathbf{u} = \dfrac{\mathbf{u}\cdot\mathbf{v}}{\mathbf{v}\cdot\mathbf{v}}\,\mathbf{v} = \dfrac{\mathbf{u}\cdot\mathbf{v}}{\|\mathbf{v}\|^2}\,\mathbf{v}. The result is a vector parallel to v\mathbf{v}.

Scalar projection (signed length of the shadow): compvu=uv^=uvv\text{comp}_{\mathbf{v}}\mathbf{u} = \mathbf{u}\cdot\hat{\mathbf{v}} = \dfrac{\mathbf{u}\cdot\mathbf{v}}{\|\mathbf{v}\|}. Positive if they lean the same way, negative if opposite.

Orthogonal decomposition: every vector splits as u=projvuv+(uprojvu)v\mathbf{u} = \underbrace{\text{proj}_{\mathbf{v}}\mathbf{u}}_{\parallel\mathbf{v}} + \underbrace{(\mathbf{u}-\text{proj}_{\mathbf{v}}\mathbf{u})}_{\perp\mathbf{v}}. The error uprojvu\mathbf{u} - \text{proj}_{\mathbf{v}}\mathbf{u} is perpendicular to v\mathbf{v}, as you can verify by dotting with v\mathbf{v}.

Projections are the building block of the Gram-Schmidt process (Chapter 7), least-squares regression, and Fourier series. The single idea of 'drop a perpendicular' reappears throughout mathematics, statistics, and signal processing.

Helpful?

The cross product (R³ only)

The cross product u×v\mathbf{u}\times\mathbf{v} is defined only in R3\mathbb{R}^3 and produces a vector, not a scalar. The result is perpendicular to both u\mathbf{u} and v\mathbf{v}.

Determinant formula: u×v=det(e1e2e3u1u2u3v1v2v3)=u2v3u3v2,  u3v1u1v3,  u1v2u2v1\mathbf{u}\times\mathbf{v} = \det\begin{pmatrix}\mathbf{e}_1&\mathbf{e}_2&\mathbf{e}_3\\u_1&u_2&u_3\\v_1&v_2&v_3\end{pmatrix} = \langle u_2v_3-u_3v_2,\;u_3v_1-u_1v_3,\;u_1v_2-u_2v_1\rangle.

Magnitude: u×v=uvsinθ\|\mathbf{u}\times\mathbf{v}\| = \|\mathbf{u}\|\,\|\mathbf{v}\|\sin\theta. This equals the area of the parallelogram spanned by u\mathbf{u} and v\mathbf{v}. If the vectors are parallel (sinθ=0\sin\theta = 0), the cross product is 0\mathbf{0}.

Anti-commutativity: u×v=(v×u)\mathbf{u}\times\mathbf{v} = -(\mathbf{v}\times\mathbf{u}). Reversing the order flips the sign. This is why the cross product is not commutative.

Direction follows the right-hand rule: curl the fingers of your right hand from u\mathbf{u} toward v\mathbf{v}; your thumb points in the direction of u×v\mathbf{u}\times\mathbf{v}.

Applications: computing the normal vector to a plane, finding the area of a triangle (12u×v\frac{1}{2}\|\mathbf{u}\times\mathbf{v}\|), computing torque in physics (τ=r×F\boldsymbol{\tau} = \mathbf{r}\times\mathbf{F}).

Helpful?