Prerequisite · Matrix Algebra Foundations

Vector Spaces and Geometry

14 min read
0:00
Audio overview generated with
By the end of this reading you will be able to:
  • Test whether a subset of a vector space is a subspace using the closure conditions
  • Determine whether a set of vectors is linearly independent and, if not, express one as a linear combination of the others
  • Describe the column space, row space, and null space of a matrix and explain what each represents geometrically
  • Interpret a matrix as a linear transformation and explain how it maps vectors from the domain to the codomain

Geometric Thinking About Matrices

The previous readings treated matrices as arrays of numbers obeying algebraic rules. This reading builds the geometric picture — what matrices do to space — which is essential for understanding covariance, projections, and transformations in ML.

Vector Spaces

A vector space VV is a set of objects (vectors) that can be added together and scaled by scalars, with results that stay in the set. The formal axioms are satisfied by all the vector types we use: column vectors in Rn\mathbb{R}^n, matrices, functions.

The standard example: Rn\mathbb{R}^n, the set of all nn-dimensional column vectors with real entries.

Linear Combinations

A linear combination of vectors a1,a2,,aK\mathbf{a}_1, \mathbf{a}_2, \ldots, \mathbf{a}_K is any vector of the form:

c1a1+c2a2++cKaKc_1 \mathbf{a}_1 + c_2 \mathbf{a}_2 + \cdots + c_K \mathbf{a}_K

where c1,,cKc_1, \ldots, c_K are scalars. This is the fundamental building block of linear algebra.

From the previous reading: the product AbA\mathbf{b} is a linear combination of the columns of AA with coefficients from b\mathbf{b}. Every matrix-vector product is a linear combination.

Span

The span of a set of vectors {a1,,aK}\{\mathbf{a}_1, \ldots, \mathbf{a}_K\} is the set of all linear combinations of those vectors:

span{a1,,aK}={k=1Kckak  :  ckR}\text{span}\{\mathbf{a}_1, \ldots, \mathbf{a}_K\} = \left\{ \sum_{k=1}^K c_k \mathbf{a}_k \;:\; c_k \in \mathbb{R} \right\}

Geometrically:

  • Span of one nonzero vector = a line through the origin
  • Span of two linearly independent vectors in R3\mathbb{R}^3 = a plane through the origin
  • Span of nn linearly independent vectors in Rn\mathbb{R}^n = all of Rn\mathbb{R}^n

The span of the columns of a matrix AA is called the column space of AA, written C(A)\mathcal{C}(A). The system Ax=bA\mathbf{x} = \mathbf{b} has a solution if and only if bC(A)\mathbf{b} \in \mathcal{C}(A).

Linear Independence

Vectors a1,,aK\mathbf{a}_1, \ldots, \mathbf{a}_K are linearly independent if the only solution to:

c1a1+c2a2++cKaK=0c_1 \mathbf{a}_1 + c_2 \mathbf{a}_2 + \cdots + c_K \mathbf{a}_K = \mathbf{0}

is c1=c2==cK=0c_1 = c_2 = \cdots = c_K = 0. Otherwise they are linearly dependent — at least one vector is a linear combination of the others and contributes no new direction.

Why this matters for ML: a covariance matrix whose columns are linearly dependent is singular (non-invertible). PCA exploits linear dependence to find lower-dimensional representations.

Basis and Dimension

A basis for a vector space VV is a set of vectors that:

  1. Spans VV — every vector in VV is a linear combination of the basis vectors
  2. Is linearly independent — no basis vector is redundant

The number of vectors in any basis for VV is the dimension of VV, written dim(V)\dim(V).

The standard basis for Rn\mathbb{R}^n is {e1,e2,,en}\{\mathbf{e}_1, \mathbf{e}_2, \ldots, \mathbf{e}_n\}, where ek\mathbf{e}_k has a 1 in position kk and zeros elsewhere. Any vector xRn\mathbf{x} \in \mathbb{R}^n is uniquely expressed as x=x1e1++xnen\mathbf{x} = x_1 \mathbf{e}_1 + \cdots + x_n \mathbf{e}_n — the coordinates are the coefficients.

Key fact: if a set of nn vectors in Rn\mathbb{R}^n is linearly independent, it automatically spans Rn\mathbb{R}^n and is therefore a basis.

Column Space, Row Space, and Null Space

Three fundamental subspaces are associated with any n×Kn \times K matrix AA:

Subspace Definition Lives in
Column space C(A)\mathcal{C}(A) Span of the columns of AA Rn\mathbb{R}^n
Row space R(A)\mathcal{R}(A) Span of the rows of AA RK\mathbb{R}^K
Null space N(A)\mathcal{N}(A) All x\mathbf{x} such that Ax=0A\mathbf{x} = \mathbf{0} RK\mathbb{R}^K

The null space and row space are orthogonal complements in RK\mathbb{R}^K: every vector in the null space is perpendicular to every vector in the row space, and their dimensions sum to KK.

Matrices as Linear Transformations

Multiplying by an n×Kn \times K matrix AA defines a linear map T:RKRnT: \mathbb{R}^K \to \mathbb{R}^n, written T(x)=AxT(\mathbf{x}) = A\mathbf{x}. The map is linear because:

A(cx+dy)=cAx+dAyA(c\mathbf{x} + d\mathbf{y}) = c A\mathbf{x} + d A\mathbf{y}

Every linear map between finite-dimensional spaces can be represented as a matrix. This correspondence — matrix ↔ linear transformation — is the central insight of linear algebra.

Geometric operations as matrices:

  • Rotation by angle θ\theta in R2\mathbb{R}^2: [cosθsinθsinθcosθ]\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}
  • Scaling axes independently: diagonal matrix with scale factors on the diagonal
  • Projection onto a subspace: an idempotent matrix (P2=PP^2 = P)
  • Reflection: orthogonal matrix with determinant 1-1

In 3D Gaussian Splatting, the covariance matrix Σ=RSSR\Sigma = RSS'R' decomposes the Gaussian's shape into a rotation (RR) applied to an independent scaling (SS) — a direct application of these geometric operations.

Orthogonality

Two vectors are orthogonal if their inner product is zero: ab=0\mathbf{a}'\mathbf{b} = 0. Orthogonality generalizes perpendicularity to any dimension.

A set of vectors is orthonormal if they are mutually orthogonal and each has unit length (ak=1\|\mathbf{a}_k\| = 1). An orthonormal basis is maximally convenient: coordinates are computed by simple inner products, and lengths are preserved under transformation.

A square matrix QQ is orthogonal if its columns form an orthonormal set:

QQ=QQ=IQ'Q = QQ' = I

Orthogonal matrices represent pure rotations (and reflections) — they preserve lengths and angles. The eigendecomposition of a symmetric matrix (Reading 5) is built entirely from orthogonal matrices.

References
Strang 2016 — Introduction to Linear Algebra, 5th ed., Ch. 3
Greene 2003 — Econometric Analysis, 5th ed., Appendix A.3