Mathematics Reference Series Foundations for Machine Learning
Reference

Introduction to
Linear Algebra

A structured mathematical reference covering vector spaces, linear transformations, matrices, determinants, eigenvalues, the SVD, and the optimization theory that underpins modern machine learning — presented through definitions, theorems, and proofs.

Status Open Reference
Sections 130 Sections
Numbering A1.1 — A1.130
Domain Linear Algebra · Vector Spaces · Optimization
Prerequisites High School Algebra
Light
Linear Algebra Definitions · Theorems · Proofs — Reference
Linear algebra is the study of vector spaces and linear transformations between them. It provides the mathematical language for geometry, physics, optimization, and nearly all of modern machine learning — from linear regression to deep neural networks. This reference builds from first principles: notation and set‑theoretic preliminaries (A1.1–A1.19), then the axioms of a vector space and onward through subspaces, bases, linear transformations, determinants, inner products, eigenvalues, the singular value decomposition, and the calculus of optimization (A1.20–A1.130), with each claim stated as a formal definition, theorem, or lemma accompanied by a proof or proof sketch.
A1.1

Power Set

For any set A, the power set of A, denoted P(A), is the set whose elements are all subsets of A. Formally,

P(A) = { B ∣ B ⊆ A }.

If A has n elements, then P(A) has 2n elements.

  • P(A)the power set of A — the collection of all subsets of A.
A1.2

Set of Functions

If A and B are two sets, the notation BA refers to the set of all functions from A to B:

BA = { f : A → B }.

Each function f ∈ BA assigns to every element of A exactly one element of B.

  • BAthe set of all functions f : A → B.
A1.3

Real‑Valued Function Space

When the codomain is the field of real numbers , the set A is the space of all real‑valued functions on A. This set becomes a vector space with pointwise addition and scalar multiplication:

(f + g)(x) = f(x) + g(x), (α f)(x) = α · f(x)

for all f, g ∈ ℝA, α ∈ ℝ, and x ∈ A.

  • Athe vector space of real‑valued functions on A.
A1.4

Cardinality of a Finite Set

For a finite set A, the cardinality |A| is the number of elements in A. If A is finite, then A can be identified with the familiar coordinate space |A| by enumerating the elements of A.

  • |A|cardinality (number of elements) of the finite set A.
  • |A|the standard coordinate space of dimension |A|, isomorphic to ℝA when A is finite.
A1.5

Indicator Function

For a subset C ⊆ A, the indicator function of C is the function 1C : A → {0,1} defined by

1C(x) = { 1 if x ∈ C,
0 if x ∉ C. }

The notation 1x∈C is sometimes used as a compact equivalent of 1C(x).

  • 1Cindicator function of the set C; maps any x to 1 if x ∈ C, else 0.
  • 1x∈Calternative compact notation for 1C(x).
A1.6

Euclidean Space and Coordinate Notation

The d-dimensional Euclidean space d consists of all ordered d-tuples of real numbers. Its elements (called vectors) are usually written as column vectors with coordinates indexed by parenthesized exponents:

x = (x(1), x(2), …, x(d))T.

The parentheses around the index distinguish a coordinate from a power. Thus x(i) denotes the i-th coordinate, not the i-th power of x.

  • dthe d-dimensional Euclidean space.
  • x(i)the i-th coordinate of vector x, i = 1,…, d.
A1.7

Points, Vectors, and the Affine Viewpoint

Geometrically, d can be seen in two ways:

  • As an affine space: its elements are points — fixed locations.
  • As a vector space: its elements are vectors — directions and magnitudes that can be added and scaled.

After choosing the origin 0d, every point can be identified with the vector from the origin to that point. In this text we will not distinguish notationally between points and vectors; both are treated as elements of the vector space d.

  • affine spacea set of points; a point is a position.
  • vector spacea set of vectors; a vector is a translation (direction + magnitude).
A1.8

Zero Vector, Ones Vector, and Identity Matrix

Three fundamental objects are given special notation:

  • Zero vector 0d: the vector in d with all coordinates 0.
  • Ones vector 1d: the vector in d with all coordinates 1.
  • Identity matrix Id: the d × d matrix with 1 on the main diagonal and 0 elsewhere.
  • 0dthe d-dimensional zero vector.
  • 1dthe d-dimensional ones vector.
  • Idthe d × d identity matrix.
A1.9

Canonical Basis

The columns of the identity matrix Id form the canonical basis (or standard basis) of d. They are denoted e1, e2, …, ed, where ei has a 1 in the i-th coordinate and zeros elsewhere:

ei = (0, …, 0, 1, 0, …, 0)T (1 at position i).

Every x ∈ ℝd can be uniquely expressed as x = ∑i=1d x(i) ei.

  • eithe i-th standard basis vector, i = 1,…, d.
A1.10

Euclidean Norm (ℓ2 Norm)

The Euclidean norm (or 2 norm) of a vector x ∈ ℝd is denoted |x| and defined by

|x| = √( (x(1))2 + (x(2))2 + ⋯ + (x(d))2 ).

It satisfies the axioms of a norm: positive definiteness, homogeneity, and the triangle inequality. The notation ∥x∥2 is also used.

  • |x|the Euclidean (ℓ2) norm of x.
  • ∥x∥2alternative notation for the Euclidean norm.
A1.11

p Norm for p ≥ 1

For any real number p ≥ 1, the p norm of x ∈ ℝd is defined by

∥x∥p = ( |x(1)|p + |x(2)|p + ⋯ + |x(d)|p )1/p. (1.1)

For every p ≥ 1, ∥·∥p satisfies the triangle inequality (Minkowski's inequality) and therefore is a genuine norm. Important special cases:

  • p = 1: Manhattan (or ℓ1) norm.
  • p = 2: Euclidean norm (|x|).
  • p → ∞: maximum norm (the largest absolute coordinate).
  • ∥x∥pthe ℓp norm of x, p ≥ 1.
A1.12

p for 0 < p < 1 and the ℓ0 "Norm"

For 0 < p < 1 the formula (1.1) remains well‑defined, but it does not define a norm: the triangle inequality fails. Despite this, the family is used in the study of sparsity because the limit

∥x∥0 ≝ limp→0 ∥x∥pp = limp→0i=1d |x(i)|p

counts exactly the number of non‑zero coordinates of x. This quantity is called the 0 "norm" (though it is not a norm). It is the natural measure of sparsity.

  • ∥x∥p (0 < p < 1)a non‑norm quantity; fails the triangle inequality.
  • ∥x∥0the number of non‑zero entries of x; the ℓ0 "norm".
A1.13

Norm Notation Conventions

Throughout the text we follow these conventions:

  • Single bars |·| are used for norms of finite‑dimensional vectors (typically the Euclidean norm).
  • Double bars ∥·∥ are reserved for norms of infinite‑dimensional objects, such as functions in Hilbert spaces.
  • The notation |A| with a set A denotes the cardinality of A; the meaning (vector norm vs. set size) is always clear from context.
  • |·|norm on a finite‑dimensional space.
  • ∥·∥norm on an infinite‑dimensional space.
  • |A|cardinality of the set A.
A1.14

Matrix Spaces

The set of all m × d real matrices (i.e., matrices with m rows and d columns, all entries real) is denoted Mm,d(ℝ), or simply Mm,d. When m = d we also write Md for the space of square matrices of size d × d.

The subset of d × d matrices that are invertible (i.e., have a two‑sided multiplicative inverse) is the general linear group, denoted GLd(ℝ):

GLd(ℝ) = { A ∈ Md ∣ there exists A−1 ∈ Md with A A−1 = A−1 A = Id }.
  • Mm,d(ℝ)the set of all real m × d matrices; often just Mm,d.
  • Mdshorthand for Md,d, the set of d × d square matrices.
  • GLd(ℝ)the general linear group: the set of invertible d × d real matrices.
A1.15

Matrix Construction from Column Vectors

Given m column vectors x1, …, xm ∈ ℝd, the notation [x1, …, xm] stands for the d × m matrix whose j-th column is xj. Thus the d × d identity matrix can be written as

Id = [e1, e2, …, ed],

where e1, …, ed are the canonical basis vectors.

  • [x1, …, xm]the d × m matrix formed by horizontally stacking the column vectors x1, …, xm.
A1.16

Matrix Entries, Rows, and Columns Notation

For a matrix A ∈ Mm,d(ℝ), the entry in row i and column j is denoted either A(i, j) or A(i)j. The whole i-th row (as a row vector) is denoted A(i), and the j-th column (as a column vector) is denoted Aj. Thus

A = (A1 A2 ⋯ Ad) = (A(1); A(2); …; A(m)).
  • A(i, j)the entry of A in row i, column j (first index = row).
  • A(i)jalternative notation for the same entry; superscript in parentheses = row.
  • A(i)the i-th row of A (a row vector).
  • Ajthe j-th column of A (a column vector).
A1.17

Operator Norm of a Matrix

For a matrix A ∈ Mm,d, its operator norm (induced by the Euclidean vector norm) is defined by

|A|op = max{ |Ax| : x ∈ ℝd, |x| = 1 }.

It measures the maximum factor by which A can stretch a unit vector. Equivalently, |A|op is the largest singular value of A.

  • |A|opthe operator norm of A (induced by the Euclidean norm).
A1.18

Symmetric, PSD, and PD Matrices

The set of d × d real symmetric matrices (satisfying AT = A) is denoted Sd. Two important subsets are defined by the sign of the quadratic form xT A x:

  • Positive semi‑definite (PSD) matrices: S+d = { A ∈ Sd ∣ xT A x ≥ 0 for all x ∈ ℝd }.
  • Positive definite (PD) matrices: S++d = { A ∈ Sd ∣ xT A x > 0 for all non‑zero x ∈ ℝd }.

Every A ∈ S++d is invertible, but the converse is false.

  • Sdthe set of d × d real symmetric matrices.
  • S+dthe set of positive semi‑definite d × d matrices.
  • S++dthe set of positive definite d × d matrices.
A1.19

Orthogonal and Rotation Matrices

For m ≤ d, the set Om,d consists of all m × d real matrices A whose rows are orthonormal, i.e.,

A AT = Im.

When m = d, we write Od for the set of orthogonal matrices (square matrices with orthonormal rows and columns). A matrix A ∈ Od satisfies AT = A−1 and has determinant ±1.

The special orthogonal group SOd is the subset of Od consisting of orthogonal matrices with determinant exactly 1; these are precisely the rotation matrices in d.

  • Om,d (m ≤ d)set of m × d matrices with orthonormal rows (A AT = Im).
  • Odthe orthogonal group: d × d matrices with AT A = Id.
  • SOdthe special orthogonal group: { A ∈ Od ∣ det(A) = 1 }, i.e., rotation matrices.
A1.20

Vector Space (Definition)

A vector space over a field 𝔽 (we take 𝔽 = ℝ throughout, unless noted) is a set V together with an addition + : V × V → V and a scalar multiplication · : 𝔽 × V → V satisfying, for all u, v, w ∈ V and α, β ∈ 𝔽:

(i) (u + v) + w = u + (v + w) (associativity)
(ii) u + v = v + u (commutativity)
(iii) ∃ 0 ∈ V : v + 0 = v for all v (additive identity)
(iv) ∀ v, ∃ (−v) : v + (−v) = 0 (additive inverse)
(v) α(βv) = (αβ)v (associativity of scaling)
(vi) 1·v = v (scalar identity)
(vii) α(u + v) = αu + αv (distributivity over V)
(viii) (α + β)v = αv + βv (distributivity over 𝔽)

Elements of V are called vectors. The spaces d, Mm,d, and A introduced earlier are all examples of vector spaces over ℝ.

ML relevance: feature vectors, weight vectors, gradients, and parameter tensors all live in vector spaces — this is the algebraic scaffolding underneath every model.
  • Va vector space over 𝔽.
  • 0 ∈ Vthe additive identity (zero vector) of V.
  • −vthe additive inverse of v.
A1.21

Subspace

A subset W ⊆ V is a subspace of V if W is itself a vector space under the addition and scalar multiplication inherited from V. Equivalently, W is a subspace if and only if:

(i) 0 ∈ W,
(ii) u, v ∈ W ⇒ u + v ∈ W (closed under addition),
(iii) v ∈ W, α ∈ ℝ ⇒ αv ∈ W (closed under scalar multiplication).

Conditions (ii) and (iii) can be combined into a single closure condition: αu + βv ∈ W for all u, v ∈ W, α, β ∈ ℝ.

  • W ⊆ Va subspace of V.
A1.22

Sum of Subspaces

If U, W are subspaces of V, their sum is

U + W = { u + w : u ∈ U, w ∈ W }.

U + W is itself a subspace of V, and is in fact the smallest subspace containing both U and W.

  • U + Wthe sum of subspaces U and W.
A1.23

Theorem — Intersection of Subspaces is a Subspace

If U and W are subspaces of V, then U ∩ W is also a subspace of V.

Proof. Since 0 ∈ U and 0 ∈ W, we have 0 ∈ U ∩ W. Now let x, y ∈ U ∩ W and α, β ∈ ℝ. Since x, y ∈ U and U is a subspace, αx + βy ∈ U. Likewise αx + βy ∈ W. Hence αx + βy ∈ U ∩ W, so U ∩ W is closed under linear combinations and contains 0 — it is a subspace. ∎

Note: U ∪ W is generally NOT a subspace — closure under addition typically fails.
A1.24

Direct Sum

The sum U + W is called a direct sum, written U ⊕ W, if every element of U + W can be written uniquely as u + w with u ∈ U, w ∈ W. This holds if and only if U ∩ W = {0}.

U ⊕ W := U + W, provided U ∩ W = {0}.
  • U ⊕ Wdirect sum of U and W; well‑defined exactly when U ∩ W = {0}.
A1.25

Linear Combination

Given vectors v1, …, vk ∈ V and scalars α1, …, αk ∈ ℝ, the vector

v = α1v1 + α2v2 + ⋯ + αkvk

is called a linear combination of v1, …, vk. The scalars αi are the coefficients of the combination.

  • αicoefficient of vi in the linear combination.
A1.26

Span

The span of a set S = {v1, …, vk} ⊆ V is the set of all linear combinations of its elements:

span(S) = { α1v1 + ⋯ + αkvk : αi ∈ ℝ }.

By convention, span(∅) = {0}. A set S is said to span V (or to be a generating set) if span(S) = V.

  • span(S)the set of all finite linear combinations of vectors in S.
A1.27

Theorem — Span is the Smallest Containing Subspace

For any S ⊆ V, span(S) is a subspace of V, and it is the smallest subspace of V containing S: if W is any subspace with S ⊆ W, then span(S) ⊆ W.

Proof sketch. Closure under linear combinations is immediate from the definition of span. For minimality: any subspace containing S must, by closure, contain every linear combination of elements of S, hence must contain span(S). ∎

A1.28

Linear Independence

Vectors v1, …, vk ∈ V are linearly independent if the only solution to

α1v1 + α2v2 + ⋯ + αkvk = 0

is the trivial one, α1 = α2 = ⋯ = αk = 0. If a non‑trivial solution exists, the vectors are linearly dependent.

ML relevance: linearly dependent features are redundant — this is the algebraic root of multicollinearity in regression.
  • linearly independentno non‑trivial linear combination of the vectors equals 0.
A1.29

Lemma — Linear Dependence Characterization

Vectors v1, …, vk (with k ≥ 2) are linearly dependent if and only if at least one vi can be written as a linear combination of the others.

Proof. (⇒) If dependent, some non‑trivial combination ∑ αivi = 0 has a coefficient αj ≠ 0. Solving for vj gives vj = −αj−1i≠j αivi, a combination of the others. (⇐) If vj = ∑i≠j βivi, then vj − ∑i≠j βivi = 0 is a non‑trivial combination summing to zero (coefficient of vj is 1 ≠ 0). ∎

A1.30

Steinitz Exchange Lemma

If {v1, …, vm} is linearly independent and {w1, …, wn} spans V, then m ≤ n, and it is possible to replace m of the wi with the vi so that the resulting set still spans V.

This single combinatorial lemma is the engine behind the "all bases have the same size" theorem (A1.39) and, ultimately, the well‑definedness of dimension.
A1.31

Basis

A set B = {v1, …, vd} ⊆ V is a basis of V if it is both:

  • linearly independent, and
  • spanning, i.e., span(B) = V.

Equivalently, B is a basis if and only if every v ∈ V can be written uniquely as a linear combination of elements of B.

ML relevance: choosing a basis is choosing a coordinate system for representing data — feature engineering and learned embeddings are, in this sense, basis‑construction problems.
  • Ba basis of V.
A1.32

Theorem — Every Finitely Spanned Vector Space Has a Basis

If V is spanned by a finite set, then V has a basis. Moreover, any spanning set contains a basis, and any linearly independent set can be extended to a basis.

Proof sketch. Start with a finite spanning set S. If S is linearly dependent, remove a vector that is a linear combination of the others (A1.29); the smaller set still spans V. Repeat until the remaining set is linearly independent — it is then a basis (the process terminates since S is finite). ∎

A1.33

Theorem — All Bases of V Have the Same Cardinality

If V has a finite basis, then every basis of V has the same number of elements.

Proof. Let B1 = {v1,…,vm} and B2 = {w1,…,wn} both be bases. Since B1 is linearly independent and B2 spans V, the Exchange Lemma (A1.30) gives m ≤ n. By symmetry (swapping the roles), n ≤ m. Hence m = n. ∎

This theorem is what makes "dimension" a well‑defined number rather than a choice‑dependent quantity.
A1.34

Dimension

The dimension of a vector space V, denoted dim(V), is the number of vectors in any basis of V (well‑defined by A1.33). A vector space is finite‑dimensional if it has a finite basis, and infinite‑dimensional otherwise (e.g., , the space of all real sequences).

  • dim(V)the dimension of V; size of any basis of V.
A1.35

Theorem — Dimension Formula

If U, W are finite‑dimensional subspaces of V, then

dim(U + W) = dim(U) + dim(W) − dim(U ∩ W).

In particular, if the sum is direct (U ∩ W = {0}), then dim(U ⊕ W) = dim(U) + dim(W).

A1.36

Coordinate Vector

Fix an ordered basis B = (v1, …, vd) of V. By the basis property, every v ∈ V has a unique representation v = ∑i=1d αivi. The coordinate vector of v relative to B is

[v]B = (α1, …, αd)T ∈ ℝd.

The map v ↦ [v]B is a linear bijection (an isomorphism, A1.50) between V and d.

  • [v]Bthe coordinate vector of v relative to ordered basis B.
A1.37

Change‑of‑Basis Matrix

If B = (v1,…,vd) and B′ = (v′1,…,v′d) are two ordered bases of V, the change‑of‑basis matrix P from B to B′ is the matrix whose j-th column is [vj]B′. It satisfies

[v]B′ = P [v]B for every v ∈ V.

P is always invertible, with P−1 the change‑of‑basis matrix from B′ to B.

  • Pchange‑of‑basis matrix from B to B′.
A1.38

Theorem — Dimension Bounds for Subspaces

If W is a subspace of a finite‑dimensional V, then dim(W) ≤ dim(V), with equality if and only if W = V.

Proof. Any linearly independent subset of W is also linearly independent in V, so by the Exchange Lemma its size cannot exceed dim(V); hence a basis of W has at most dim(V) elements. If dim(W) = dim(V), a basis of W is a maximal independent set in V and therefore must already span V, so W = V. ∎

A1.39

Linear Transformation (Linear Map)

A function T : V → W between vector spaces is a linear transformation (or linear map, or linear operator when V = W) if for all u, v ∈ V and α ∈ ℝ:

T(u + v) = T(u) + T(v) (additivity)
T(αv) = α T(v) (homogeneity)

Equivalently, T(αu + βv) = αT(u) + βT(v) for all scalars α, β — linear maps "commute" with linear combinations. The set of all linear maps from V to W is denoted ℒ(V, W); it is itself a vector space.

ML relevance: the layers of a linear model (and the linear part of every neural network layer, before the nonlinearity) are linear transformations.
  • T : V → Wa linear transformation from V to W.
  • ℒ(V, W)the vector space of all linear maps from V to W.
A1.40

Lemma — Linear Maps Preserve the Zero Vector

If T : V → W is linear, then T(0V) = 0W.

Proof. T(0) = T(0 · 0) = 0 · T(0) = 0, using homogeneity with α = 0. ∎

A1.41

Theorem — A Linear Map is Determined by its Action on a Basis

Let {v1,…,vd} be a basis of V, and let w1,…,wd ∈ W be arbitrary. There exists a unique linear map T : V → W with T(vi) = wi for each i, given by

T(α1v1 + ⋯ + αdvd) = α1w1 + ⋯ + αdwd.
This is precisely why a matrix (which records where each basis vector is sent) fully specifies a linear map — see A1.59.
A1.42

Kernel (Null Space)

The kernel (or null space) of a linear map T : V → W is

ker(T) = { v ∈ V : T(v) = 0W }.

ker(T) is always a subspace of V (it is non‑empty since T(0) = 0, and closed under linear combinations by linearity of T).

  • ker(T)the kernel/null space of T; preimage of 0.
A1.43

Image (Range)

The image (or range) of T : V → W is

im(T) = { T(v) : v ∈ V } ⊆ W.

im(T) is a subspace of W. The dimension of im(T) is called the rank of T, denoted rank(T), and the dimension of ker(T) is called the nullity of T.

  • im(T)the image/range of T.
  • rank(T)dim(im(T)).
  • nullity(T)dim(ker(T)).
A1.44

Theorem — Injectivity ⟺ Trivial Kernel

A linear map T : V → W is injective (one‑to‑one) if and only if ker(T) = {0}.

Proof. (⇒) If T is injective and v ∈ ker(T), then T(v) = 0 = T(0), so v = 0. (⇐) Suppose ker(T) = {0} and T(u) = T(v). By linearity, T(u − v) = 0, so u − v ∈ ker(T) = {0}, i.e., u = v. ∎

A1.45

Rank–Nullity Theorem

Let T : V → W be a linear map with V finite‑dimensional. Then

dim(V) = rank(T) + nullity(T) = dim(im(T)) + dim(ker(T)).

Proof sketch. Extend a basis {u1,…,uk} of ker(T) to a basis {u1,…,uk,v1,…,vr} of V. One shows {T(v1),…,T(vr)} is a basis of im(T), giving dim(V) = k + r = nullity(T) + rank(T). ∎

ML relevance: this theorem explains why a linear layer mapping ℝⁿ → ℝᵏ with k < n necessarily has a non‑trivial null space — information is provably lost whenever you project to a lower dimension.
A1.46

Isomorphism

A linear map T : V → W is an isomorphism if it is bijective (both injective and surjective). Two vector spaces are isomorphic, written V ≅ W, if there exists an isomorphism between them. Isomorphic spaces are "the same" as far as linear‑algebraic structure is concerned.

  • V ≅ WV and W are isomorphic (related by a bijective linear map).
A1.47

Theorem — Classification of Finite‑Dimensional Vector Spaces

Two finite‑dimensional vector spaces V and W are isomorphic if and only if dim(V) = dim(W). In particular, every d-dimensional real vector space is isomorphic to d (via the coordinate map of A1.36).

This is why we can always "just work in ℝ^d with matrices" — every finite‑dimensional vector space and linear map can be represented this way without loss of generality.
A1.48

Matrix Representation of a Linear Map

Fix bases B = (v1,…,vd) of V and C = (w1,…,wm) of W. For a linear map T : V → W, the matrix representation [T]C,B ∈ Mm,d is the matrix whose j-th column is the coordinate vector [T(vj)]C:

[T]C,B = [ [T(v1)]C, …, [T(vd)]C ].

It satisfies [T(v)]C = [T]C,B [v]B for every v ∈ V — applying T corresponds exactly to matrix–vector multiplication in coordinates.

  • [T]C,Bmatrix of T relative to bases B (domain) and C (codomain).
A1.49

Matrix–Vector Product

For A ∈ Mm,d and x ∈ ℝd, the product Ax ∈ ℝm is defined coordinate‑wise by

(Ax)(i) = ∑j=1d A(i,j) x(j), i = 1,…,m.

Equivalently, Ax = ∑j=1d x(j) Aj — a linear combination of the columns of A, weighted by the entries of x. The map x ↦ Ax is linear, and every linear map d → ℝm arises this way for a unique A (A1.41).

ML relevance: a linear layer's forward pass, x ↦ Wx + b, is exactly this operation — A1.49 is the single most‑executed equation in machine learning.
A1.50

Matrix Addition and Scalar Multiplication

For A, B ∈ Mm,d and α ∈ ℝ, addition and scalar multiplication are defined entrywise:

(A + B)(i,j) = A(i,j) + B(i,j),
(αA)(i,j) = α · A(i,j).

Under these operations Mm,d is itself a vector space, isomorphic to md, with dim(Mm,d) = md.

A1.51

Matrix Multiplication

For A ∈ Mm,n and B ∈ Mn,d, the product AB ∈ Mm,d is defined by

(AB)(i,j) = ∑k=1n A(i,k) B(k,j).

Equivalently, the j-th column of AB is A applied to the j-th column of B: (AB)j = A Bj. The number of columns of A must equal the number of rows of B.

  • ABmatrix product, defined when A is m×n and B is n×d.
A1.52

Theorem — Composition of Linear Maps ⟺ Matrix Multiplication

If S : U → V and T : V → W are linear maps with matrix representations [S] and [T] (relative to compatible bases), then the composition T ∘ S : U → W is linear and

[T ∘ S] = [T] [S].

Proof sketch. Both sides agree on every basis vector of U by direct computation using A1.49; by A1.41, agreement on a basis implies the maps (matrices) are identical. ∎

This is why stacking neural network layers corresponds to multiplying their weight matrices when the activations are linear — and why a composition of purely linear layers collapses to a single linear layer.
A1.53

Properties of Matrix Multiplication

For matrices of compatible sizes:

(AB)C = A(BC) (associativity)
A(B + C) = AB + AC (left distributivity)
(A + B)C = AC + BC (right distributivity)
AI = IA = A (identity)

Crucially, matrix multiplication is not commutative in general: AB ≠ BA, even when both products are defined (e.g., when A, B are square).

A1.54

Transpose

The transpose of A ∈ Mm,d is the matrix AT ∈ Md,m defined by AT(i,j) = A(j,i). Transposition satisfies:

(AT)T = A,
(A + B)T = AT + BT,
(AB)T = BTAT (order reverses).
  • ATthe transpose of A.
A1.55

Trace

The trace of a square matrix A ∈ Md is the sum of its diagonal entries:

tr(A) = ∑i=1d A(i,i).

Trace is linear (tr(αA + βB) = α tr(A) + β tr(B)) and satisfies the cyclic property: for compatible A, B, tr(AB) = tr(BA) (even though AB ≠ BA in general).

  • tr(A)the trace of square matrix A.
A1.56

Trace Identity for Quadratic Forms

For x ∈ ℝd and A ∈ Md, the scalar quadratic form can be rewritten using trace:

xTAx = tr(A x xT).

This identity is heavily used to manipulate expectations of quadratic forms, since tr and expectation (a linear operator) commute: 𝔼[xTAx] = tr(A · 𝔼[xxT]).

ML relevance: this is the standard trick for computing expected squared error and variance terms in closed form (e.g., bias–variance decompositions, Gaussian process kernels).
A1.57

Invertible Matrix

A matrix A ∈ Md is invertible if there exists A−1 ∈ Md such that AA−1 = A−1A = Id (see A1.14, GLd(ℝ)). If it exists, the inverse is unique.

Proof of uniqueness. If B and C both satisfy AB = I = AC, then B = B(AC) = (BA)C = IC = C. ∎

A1.58

Theorem — Equivalent Characterizations of Invertibility

For A ∈ Md, the following are equivalent:

  • (i) A is invertible;
  • (ii) the linear map x ↦ Ax is bijective on d;
  • (iii) ker(A) = {0} (the only solution to Ax = 0 is x = 0);
  • (iv) rank(A) = d (the columns of A are linearly independent and span d);
  • (v) det(A) ≠ 0 (see A1.65).

Proof sketch. (i)⟺(ii) is the definition of an inverse function. (ii)⟺(iii) is A1.44 combined with rank–nullity (A1.45), since for a square matrix injective implies surjective. (iii)⟺(iv) follows directly from the definition of linear independence and span applied to the columns. (iv)⟺(v) is proved once the determinant is introduced. ∎

ML relevance: this equivalence is exactly why a design matrix XᵀX must be full rank for ordinary least squares to have a unique solution — see A1.130.
A1.59

Determinant (Axiomatic Definition)

The determinant det : Md → ℝ is the unique function satisfying:

  • (i) det is linear in each column of A separately, with the other columns fixed (multilinearity, cf. A1.20 in the earlier notation block);
  • (ii) det changes sign when two columns are swapped (alternating);
  • (iii) det(Id) = 1 (normalization).

These three properties determine det uniquely on all of Md.

  • det(A)the determinant of A; also written |A| in some texts (context disambiguates from the norm, A1.13).
A1.60

Cofactor (Laplace) Expansion

For A ∈ Md, let Aij denote the (d−1)×(d−1) submatrix obtained by deleting row i and column j. Expanding along row i:

det(A) = ∑j=1d (−1)i+j A(i,j) det(Aij).

The quantity Cij = (−1)i+j det(Aij) is the cofactor of entry (i,j). For the base case d = 1, det([a]) = a; for d = 2, det = ad − bc for A = [[a,b],[c,d]].

  • Aijthe (d−1)×(d−1) minor obtained by deleting row i and column j.
  • Cijthe (i,j) cofactor.
A1.61

Theorem — Multiplicativity of the Determinant

For A, B ∈ Md,

det(AB) = det(A) det(B).

Consequently, if A is invertible, det(A−1) = 1/det(A), and det(A) ≠ 0 is necessary for invertibility — this completes the proof of A1.58 (v).

A1.62

Determinant of the Transpose

det(AT) = det(A).

A direct consequence is that the alternating/multilinear properties of A1.59 hold equally well for rows as for columns.

A1.63

Determinant of a Triangular Matrix

If A is upper‑ or lower‑triangular (all entries on one side of the diagonal are zero), then

det(A) = ∏i=1d A(i,i)

— the determinant is simply the product of the diagonal entries. This is the computational basis for evaluating determinants via LU‑type decompositions.

A1.64

Geometric Interpretation — Signed Volume

|det(A)| equals the d-dimensional volume of the parallelepiped spanned by the columns of A. The sign of det(A) records whether the linear map x ↦ Ax preserves orientation (det > 0) or reverses it (det < 0). A linear map scales every volume by exactly the factor |det(A)|.

ML relevance: this is exactly the Jacobian determinant correction factor used in the change‑of‑variables formula for probability densities — the backbone of normalizing flows.
A1.65

Theorem — det(A) ≠ 0 ⟺ A Invertible

A square matrix A is invertible if and only if det(A) ≠ 0, in which case

A−1 = (1/det(A)) · adj(A),

where adj(A), the adjugate, is the transpose of the cofactor matrix: adj(A)(i,j) = Cji.

A1.66

Determinant of Block‑Triangular Matrices

If A is block upper‑triangular with square diagonal blocks A1,…,Ak,

det(A) = det(A1) det(A2) ⋯ det(Ak).
A1.67

Determinant of an Orthogonal Matrix

If A ∈ Od (A1.19 in the earlier notation block), then AAT = Id, so by A1.61 and A1.62, det(A)2 = det(AAT) = det(Id) = 1, hence

det(A) ∈ {+1, −1}.

det(A) = +1 corresponds to a rotation (A ∈ SOd); det(A) = −1 corresponds to a rotation composed with a reflection.

A1.68

Inner Product

An inner product on a real vector space V is a function ⟨·,·⟩ : V × V → ℝ satisfying, for all u, v, w ∈ V and α ∈ ℝ:

(i) ⟨u, v⟩ = ⟨v, u⟩ (symmetry)
(ii) ⟨αu + v, w⟩ = α⟨u,w⟩ + ⟨v,w⟩ (linearity in first argument)
(iii) ⟨v, v⟩ ≥ 0, with equality iff v = 0 (positive definiteness)

The standard (Euclidean) inner product, or dot product, on d is ⟨x,y⟩ = xTy = ∑i=1d x(i)y(i), and induces the Euclidean norm via |x| = √⟨x,x⟩.

  • ⟨u, v⟩inner product of u and v.
  • xTythe standard dot product on ℝd.
A1.69

Cauchy–Schwarz Inequality

For all x, y in an inner product space,

|⟨x, y⟩| ≤ |x| |y|,

with equality if and only if x and y are linearly dependent (parallel).

Proof sketch. For any t ∈ ℝ, 0 ≤ ⟨x − ty, x − ty⟩ = |x|2 − 2t⟨x,y⟩ + t2|y|2. This quadratic in t is non‑negative for all t, so its discriminant must be ≤ 0, which rearranges directly to the inequality. ∎

A1.70

Angle Between Two Vectors / Cosine Similarity

For non‑zero x, y ∈ ℝd, the Cauchy–Schwarz inequality guarantees that the quantity

cos(θ) = ⟨x, y⟩ / (|x| |y|)

lies in [−1, 1], defining the angle θ between x and y. This quantity, also called cosine similarity, is widely used directly (without inverting to recover θ) as a similarity score.

ML relevance: cosine similarity is the standard comparison metric for word/sentence embeddings, recommendation systems, and retrieval.
A1.71

Orthogonality

Vectors x, y are orthogonal, written x ⟂ y, if ⟨x, y⟩ = 0. A set of vectors is orthogonal if every distinct pair is orthogonal, and orthonormal if it is orthogonal and every vector has unit norm.

  • x ⟂ yx is orthogonal to y, i.e., ⟨x,y⟩ = 0.
A1.72

Pythagorean Theorem (Vector Form)

If x ⟂ y, then

|x + y|2 = |x|2 + |y|2.

Proof. |x+y|2 = ⟨x+y,x+y⟩ = |x|2 + 2⟨x,y⟩ + |y|2 = |x|2 + |y|2, using ⟨x,y⟩=0. ∎

A1.73

Theorem — Orthogonal Non‑zero Vectors are Linearly Independent

If v1,…,vk are pairwise orthogonal and non‑zero, they are linearly independent.

Proof. Suppose i αivi = 0. Taking the inner product of both sides with vj: i αi⟨vi,vj⟩ = αj|vj|2 = 0 (all cross terms vanish by orthogonality). Since vj ≠ 0, αj = 0, for every j. ∎

A1.74

Orthonormal Basis

A basis {u1,…,ud} of V that is orthonormal is called an orthonormal basis. The canonical basis {e1,…,ed} of d is the prototypical example. Relative to an orthonormal basis, coordinates are obtained simply by inner products:

v = ∑i=1d ⟨v, ui⟩ ui.
No matrix inversion is needed to find coordinates in an orthonormal basis — this is exactly why orthogonal/orthonormal bases (e.g., from SVD or Fourier analysis) are so computationally convenient.
A1.75

Theorem — Gram–Schmidt Orthogonalization

Given linearly independent v1,…,vk, define recursively

u1 = v1,
ui = vi − ∑j=1i−1 ( ⟨vi, uj⟩ / ⟨uj, uj⟩ ) uj, i = 2,…,k.

Then {u1,…,uk} is an orthogonal set with span(u1,…,ui) = span(v1,…,vi) for every i. Normalizing each ui by its norm produces an orthonormal set spanning the same subspace, and underlies the QR decomposition A = QR with Q orthonormal columns and R upper triangular.

A1.76

Orthogonal Complement

For a subspace W ⊆ V, the orthogonal complement is

W = { v ∈ V : ⟨v, w⟩ = 0 for all w ∈ W }.

W is always a subspace, and when V is finite‑dimensional, V = W ⊕ W (direct sum, A1.24), so dim(W) + dim(W) = dim(V).

  • Worthogonal complement of W.
A1.77

Orthogonal Projection Theorem

Let W ⊆ ℝd be a subspace. For every x ∈ ℝd there is a unique p ∈ W, called the orthogonal projection of x onto W and written p = projW(x), satisfying (x − p) ⟂ W. It is also the unique closest point of W to x:

projW(x) = argminw ∈ W |x − w|.

If {u1,…,uk} is an orthonormal basis of W, then projW(x) = ∑i=1k ⟨x,ui⟩ ui.

ML relevance: this minimization characterization is precisely the least‑squares problem — see A1.130.
A1.78

Projection Matrix

If U ∈ Md,k has orthonormal columns spanning W, the orthogonal projection onto W is given by the matrix

PW = U UT, with projW(x) = PW x.

A projection matrix P is characterized algebraically by being idempotent and symmetric: P2 = P and PT = P.

  • PWorthogonal projection matrix onto subspace W.
A1.79

Bessel's Inequality

If {u1,…,uk} is orthonormal in V, then for any x ∈ V,

i=1k ⟨x, ui2 ≤ |x|2,

with equality if and only if x ∈ span(u1,…,uk). This is an immediate consequence of the Pythagorean theorem applied to x = projW(x) + (x − projW(x)).

A1.80

Parseval's Identity

If {u1,…,ud} is an orthonormal basis of d, then for any x,

|x|2 = ∑i=1d ⟨x, ui2.

Norm is preserved exactly when expressed in orthonormal coordinates — a special case of Bessel's inequality (A1.79) becoming an equality because the basis spans the whole space.

A1.81

Eigenvalue and Eigenvector

For A ∈ Md, a non‑zero vector v ∈ ℝd is an eigenvector of A with corresponding eigenvalue λ ∈ ℂ if

A v = λ v.

Geometrically, A acts on an eigenvector purely by scaling — it does not rotate or change the direction of v. The set of all eigenvalues of A is the spectrum of A.

  • λan eigenvalue of A.
  • van eigenvector of A associated with λ.
A1.82

Eigenspace

For an eigenvalue λ of A, the eigenspace is

Eλ = { v ∈ ℝd : Av = λv } = ker(A − λI).

Eλ is a subspace of d (the null space of A − λI) of dimension at least 1. Its dimension is the geometric multiplicity of λ.

  • Eλeigenspace of A for eigenvalue λ.
A1.83

Characteristic Polynomial

λ is an eigenvalue of A if and only if A − λI is not invertible, i.e., det(A − λI) = 0 (A1.65). The function

pA(λ) = det(A − λI)

is the characteristic polynomial of A, a degree‑d polynomial in λ. Its roots are exactly the eigenvalues of A. The multiplicity of λ as a root of pA is the algebraic multiplicity of λ, and is always ≥ the geometric multiplicity (A1.82).

  • pA(λ)the characteristic polynomial det(A − λI).
A1.84

Theorem — Existence of Eigenvalues (Fundamental Theorem of Algebra)

Every A ∈ Md(ℂ) has at least one (complex) eigenvalue, since the characteristic polynomial pA has degree d ≥ 1 and, by the fundamental theorem of algebra, every non‑constant complex polynomial has a root. Real matrices may have genuinely complex eigenvalues (occurring in conjugate pairs), which is why the spectrum is defined over even for real A.

A1.85

Eigenvalues of a Triangular Matrix

If A is triangular, its eigenvalues are exactly its diagonal entries A(1,1),…,A(d,d), since A − λI is also triangular and (A1.63) det(A − λI) = ∏i(A(i,i) − λ).

A1.86

Theorem — Trace and Determinant via Eigenvalues

If λ1,…,λd are the eigenvalues of A (with multiplicity, over ℂ), then

tr(A) = ∑i=1d λi,
det(A) = ∏i=1d λi.

This follows from expanding the characteristic polynomial pA(λ) = ∏ii − λ) and comparing coefficients with det(A − λI).

A1.87

Theorem — Eigenvectors of Distinct Eigenvalues are Linearly Independent

If λ1,…,λk are distinct eigenvalues of A with eigenvectors v1,…,vk, then {v1,…,vk} is linearly independent.

Proof sketch (induction). Suppose, for contradiction, a minimal dependent relation ∑ αivi = 0 with all αi ≠ 0. Apply A: ∑ αiλivi = 0. Subtract λk times the original relation: i<k αii − λk)vi = 0, a shorter non‑trivial relation (since λi ≠ λk) — contradicting minimality. ∎

A1.88

Diagonalizable Matrix

A ∈ Md is diagonalizable if there exists an invertible P ∈ Md and diagonal D ∈ Md such that

A = P D P−1.

The columns of P are eigenvectors of A, and the diagonal entries of D are the corresponding eigenvalues. Diagonalization expresses A as "the same scaling operation as D, viewed in a different basis."

A1.89

Theorem — Criterion for Diagonalizability

A ∈ Md is diagonalizable if and only if d (or d) has a basis of eigenvectors of A, which holds if and only if, for every eigenvalue, the geometric multiplicity equals the algebraic multiplicity. A sufficient (but not necessary) condition is that A has d distinct eigenvalues (by A1.87).

Not every matrix is diagonalizable — e.g., [[0,1],[0,0]] has eigenvalue 0 with algebraic multiplicity 2 but geometric multiplicity 1.
A1.90

Matrix Powers via Diagonalization

If A = PDP−1, then for any integer k ≥ 1,

Ak = P Dk P−1,

where Dk is obtained by simply raising each diagonal entry to the k-th power — turning an expensive repeated matrix product into d scalar exponentiations.

ML relevance: this underlies the convergence analysis of iterative algorithms (e.g., power iteration, gradient descent on quadratics) — convergence rate is governed by the ratio of eigenvalues.
A1.91

Spectral Theorem for Symmetric Matrices

If A ∈ Sd (real symmetric, AT=A), then:

  • (i) all eigenvalues of A are real;
  • (ii) eigenvectors corresponding to distinct eigenvalues are orthogonal;
  • (iii) A is diagonalizable by an orthogonal matrix: there exists U ∈ Od and diagonal D such that
A = U D UT = ∑i=1d λi ui uiT.

This is arguably the single most important theorem in applied linear algebra: every symmetric matrix has a complete orthonormal eigenbasis.

ML relevance: covariance matrices, Hessians, and kernel/Gram matrices are all symmetric — this theorem is what makes PCA (A1.108), Newton's method, and kernel methods analytically tractable.
  • Uorthogonal matrix of eigenvectors (eigenbasis) of A.
  • i λi ui uiTthe spectral decomposition of A.
A1.92

Proof Sketch — Spectral Theorem

Real eigenvalues: if Av = λv with v possibly complex, then TAv = λ v̄Tv; taking conjugate transposes and using AT=A real shows λ̄ = λ, so λ is real.

Orthogonality: if Av = λv, Aw = μw with λ ≠ μ, then λ⟨v,w⟩ = ⟨Av,w⟩ = ⟨v,ATw⟩ = ⟨v,Aw⟩ = μ⟨v,w⟩, forcing ⟨v,w⟩=0.

Full diagonalization: by induction on dimension using the existence of at least one real eigenvector (from (i)) and restricting A to the orthogonal complement of that eigenvector, which is itself invariant under A. ∎

A1.93

Theorem — Eigenvalue Test for PSD / PD Matrices

For A ∈ Sd with eigenvalues λ1,…,λd (all real, by A1.91):

A ⪰ 0 ⟺ λi ≥ 0 for all i,
A ≻ 0 ⟺ λi > 0 for all i.

Proof sketch. Write x = ∑ ciui in the eigenbasis; then xTAx = ∑i λici2 by orthonormality. This is non‑negative for all x (all ci) iff every λi ≥ 0, and strictly positive for all x≠0 iff every λi > 0. ∎

ML relevance: a stationary point of a loss function is a local minimum exactly when the Hessian there is PSD — this theorem makes that check computable via eigenvalues.
A1.94

Rayleigh Quotient and the Variational Characterization of Eigenvalues

For A ∈ Sd, the Rayleigh quotient is

R(x) = (xTAx) / (xTx), x ≠ 0.

If λmax and λmin are the largest and smallest eigenvalues of A, then

λmin ≤ R(x) ≤ λmax for all x ≠ 0,

with equality at the corresponding eigenvectors. More generally, the eigenvectors are exactly the stationary points of R, and successive eigenvalues solve constrained maximizations of R over the orthogonal complement of previously found eigenvectors.

ML relevance: this variational principle is precisely how PCA's top components are characterized as directions of maximum variance — see A1.108.
A1.95

Theorem — Operator Norm of a Symmetric Matrix

For A ∈ Sd,

|A|op = max{ |λ1|, …, |λd| } = maxii|,

i.e., the operator norm (A1.17) equals the largest eigenvalue in absolute value, a direct consequence of the Rayleigh quotient bound (A1.94) applied to ±A.

A1.96

Singular Value Decomposition (SVD)

Every matrix A ∈ Mm,d (not necessarily square or symmetric) admits a decomposition

A = U Σ VT,

where U ∈ Om, V ∈ Od are orthogonal, and Σ ∈ Mm,d is rectangular‑diagonal with non‑negative entries σ1 ≥ σ2 ≥ ⋯ ≥ σr > 0 (and zeros elsewhere), called the singular values of A, where r = rank(A).

  • U, Vorthogonal matrices of left/right singular vectors.
  • σithe i‑th singular value of A.
A1.97

Theorem — Existence of the SVD and Its Connection to Eigendecomposition

The matrices ATA ∈ Sd and AAT ∈ Sm are both positive semidefinite (A1.93), since xT(ATA)x = |Ax|2 ≥ 0. By the spectral theorem (A1.91), they are orthogonally diagonalizable, and:

columns of V = eigenvectors of ATA,
columns of U = eigenvectors of AAT,
σi2 = the corresponding (shared, non‑zero) eigenvalue.

Proof sketch. Diagonalize ATA = VΛVT. Set σi = √λi for λi > 0, and ui = Avii; one checks these ui are orthonormal and extend to a full orthogonal basis U of ℝm, giving A = UΣVT. ∎

A1.98

SVD and the Four Fundamental Subspaces

Given A = UΣVT with rank r, the singular vectors decompose the domain and codomain exactly:

  • v1,…,vr: orthonormal basis for im(AT) ("row space");
  • vr+1,…,vd: orthonormal basis for ker(A);
  • u1,…,ur: orthonormal basis for im(A) ("column space");
  • ur+1,…,um: orthonormal basis for ker(AT).

This refines the rank–nullity theorem (A1.45) into an explicit, orthogonal geometric picture of how A acts.

A1.99

Eckart–Young Theorem — Optimal Low‑Rank Approximation

Given the SVD A = ∑i=1r σi ui viT, the best rank‑k approximation to A (for k < r) in operator norm — and also in the Frobenius norm — is obtained by truncating the sum:

Ak = ∑i=1k σi ui viT = argmin{ |A − B|op : rank(B) ≤ k },

with approximation error |A − Ak|op = σk+1.

ML relevance: this is the mathematical foundation of PCA‑based compression, recommender system matrix factorization, and model/weight compression via low‑rank approximation (e.g., LoRA‑style adaptation).
A1.100

Frobenius Norm

The Frobenius norm of A ∈ Mm,d is defined by

|A|F = √( ∑i,j A(i,j)2 ) = √tr(ATA) = √( ∑i σi2 ).

It treats A as a vector in md and applies the Euclidean norm — it is the matrix analogue of the ℓ² norm and is the natural choice for measuring reconstruction error in matrix factorization.

  • |A|FFrobenius norm of A.
A1.101

Moore–Penrose Pseudoinverse

For A = UΣVT (possibly non‑square, non‑invertible), the pseudoinverse is

A+ = V Σ+ UT,

where Σ+ replaces each non‑zero singular value σi with 1/σi and transposes the rectangular shape. When A is square and invertible, A+ = A−1. In general, x = A+b gives the minimum‑norm solution to the least‑squares problem minx|Ax − b|.

  • A+the Moore–Penrose pseudoinverse of A.
A1.102

Quadratic Form (Recap and Diagonal Form)

Recall (A1.24–A1.25 of the notation block) that a quadratic form is q(x) = xTAx for symmetric A. Using the spectral theorem, substituting x = Uy (a rotation of coordinates) diagonalizes the form:

q(Uy) = yT(UTAU)y = yTDy = ∑i=1d λi yi2.

In the eigenbasis, every quadratic form is simply a weighted sum of squares — geometrically, level sets q(x)=c are ellipsoids (PD case) whose axes point along eigenvectors and whose lengths scale as 1/√λi.

ML relevance: this is exactly the geometric picture behind interpreting loss landscapes, confidence ellipses of Gaussian distributions, and Newton's method step directions.
A1.103

Condition Number

For invertible A, the condition number (in the operator norm) is

κ(A) = |A|op |A−1|op = σmax(A) / σmin(A).

A large condition number indicates A is "nearly singular" and that solving Ax = b (or optimizing a quadratic with Hessian A) is numerically sensitive to perturbations — small changes in input can produce large changes in output.

ML relevance: a poorly conditioned Hessian or feature covariance matrix is the textbook explanation for slow, zig‑zagging convergence of gradient descent — see A1.130.
A1.104

Gradient of a Scalar Function

For a differentiable function f : ℝd → ℝ, the gradient at x is the vector of partial derivatives

∇f(x) = ( ∂f/∂x(1), …, ∂f/∂x(d) )T,

characterized as the unique vector satisfying the first‑order approximation f(x+h) = f(x) + ⟨∇f(x), h⟩ + o(|h|) as h → 0. The gradient points in the direction of steepest increase of f.

  • ∇f(x)gradient of f at x.
A1.105

Standard Gradient Identities

For a ∈ ℝd and symmetric A ∈ Sd:

x(aTx) = a,
x(xTAx) = 2Ax (A symmetric),
x(|x|2) = 2x.

If A is not symmetric, the more general identity is x(xTAx) = (A + AT)x.

ML relevance: these three identities alone are sufficient to derive the gradients used in linear regression, ridge regression, and the quadratic approximation in Newton's method.
A1.106

Jacobian Matrix

For a differentiable vector‑valued function F : ℝd → ℝm, the Jacobian at x is the m × d matrix of partial derivatives

JF(x)(i,j) = ∂Fi/∂x(j),

which gives the best local linear approximation: F(x+h) ≈ F(x) + JF(x) h. Each row of JF is the gradient (transposed) of the corresponding component function Fi.

ML relevance: backpropagation is precisely the systematic application of the chain rule for Jacobians, layer by layer, through a computational graph.
  • JF(x)the Jacobian matrix of F at x.
A1.107

Chain Rule (Jacobian Form)

If G : ℝn → ℝd and F : ℝd → ℝm are differentiable, then F ∘ G is differentiable and

JF∘G(x) = JF(G(x)) · JG(x),

i.e., Jacobians compose by matrix multiplication, exactly mirroring composition of linear maps (A1.52). This single identity, applied recursively through a network's layers, is the chain rule that backpropagation implements.

A1.108

Hessian Matrix

For a twice‑differentiable f : ℝd → ℝ, the Hessian at x is the matrix of second partial derivatives

Hf(x)(i,j) = ∂2f / (∂x(i) ∂x(j)).

By equality of mixed partials (Clairaut's theorem, under mild continuity assumptions), Hf(x) is symmetric: Hf(x) ∈ Sd. It is the Jacobian of the gradient: Hf(x) = J∇f(x).

  • Hf(x)the Hessian of f at x.
A1.109

Second‑Order Taylor Expansion

For twice‑differentiable f,

f(x+h) ≈ f(x) + ∇f(x)Th + (1/2) hT Hf(x) h.

This is the quadratic local model of f: a linear term (gradient) plus a curvature correction (Hessian). The Hessian term captures exactly the "bowl shape" of the function near x.

ML relevance: Newton's method minimizes this quadratic approximation exactly at each step, giving the update x ← x − Hf(x)−1∇f(x).
A1.110

Theorem — Second‑Order Optimality Conditions

Suppose x⋆ is a critical point of f (i.e. ∇f(x⋆) = 0). Then:

  • if Hf(x⋆) ≻ 0 (positive definite), x⋆ is a strict local minimum;
  • if Hf(x⋆) ≺ 0 (negative definite), x⋆ is a strict local maximum;
  • if Hf(x⋆) is indefinite (mixed‑sign eigenvalues), x⋆ is a saddle point.

This follows directly from A1.93 and A1.102 applied to the quadratic term of A1.109.

ML relevance: in high‑dimensional non‑convex loss landscapes (as in deep learning), saddle points — not bad local minima — are now understood to be the dominant obstacle to optimization.
A1.111

Convexity via the Hessian

A twice‑differentiable function f : ℝd → ℝ is convex on a convex domain if and only if Hf(x) ⪰ 0 for every x in the domain, and strictly convex if Hf(x) ≻ 0 everywhere. Convex functions have the crucial property that every local minimum is a global minimum.

ML relevance: showing a loss function (e.g. squared error, logistic loss) is convex is almost always done by checking that its Hessian is PSD — this guarantees gradient descent cannot get permanently stuck.
A1.112

Covariance Matrix

Given a random vector x ∈ ℝd with mean μ = 𝔼[x], the covariance matrix is

Σ = Cov(x) = 𝔼[ (x − μ)(x − μ)T ] ∈ Sd+.

Σ is always symmetric positive semidefinite (A1.93): for any w, wTΣw = Var(wTx) ≥ 0. For a data matrix X ∈ Mn,d with rows being n centered observations, the empirical covariance is Σ̂ = (1/n) XTX.

  • Σthe covariance matrix of x.
A1.113

Principal Component Analysis — Variational Formulation

Given centered data with empirical covariance Σ̂, the first principal component direction u1 is the unit vector maximizing the variance of the projected data:

u1 = argmax|u|=1 uT Σ̂ u.

Subsequent components u2, u3, … solve the same maximization subject to being orthogonal to all previously found components.

  • u1the first principal component direction.
A1.114

Theorem — PCA Solves an Eigenvalue Problem

The variational problem of A1.113 is solved exactly by the eigenvectors of Σ̂: if Σ̂ = ∑i λi ui uiT with λ1 ≥ λ2 ≥ ⋯ ≥ 0 (spectral theorem, A1.91), then ui is the i-th principal component, and the maximal variance achieved is exactly λi.

Proof sketch. This is the Rayleigh quotient maximization of A1.94, restricted to the unit sphere and, successively, to orthogonal complements — exactly the setting in which the variational characterization of eigenvalues applies. ∎

ML relevance: PCA is implemented either by eigendecomposing the covariance matrix directly, or — more numerically stably for high‑dimensional data — by taking the SVD of the centered data matrix X directly (A1.115).
A1.115

PCA via the SVD of the Data Matrix

If X ∈ Mn,d is the centered data matrix and X = UΣVT is its SVD, then since XTX = VΣ2VT, the columns of V are exactly the principal component directions, and the principal component scores (projected coordinates) are the columns of XV = UΣ.

XTX / n = V (Σ2/n) VT ⇒ principal directions = columns of V.

This avoids ever explicitly forming the (potentially ill‑conditioned) covariance matrix Σ̂.

A1.116

Theorem — Reconstruction Error of PCA

Projecting onto the top k principal components and reconstructing minimizes the total squared reconstruction error among all rank‑k linear projections, with

min error = ∑i=k+1d λi,

the sum of the discarded eigenvalues — a direct corollary of the Eckart–Young theorem (A1.99) applied to the data matrix.

This is the formal justification for the common heuristic of choosing k via the "elbow" of the eigenvalue/explained‑variance plot.
A1.117

Whitening Transformation

Given Σ = UΛUT ≻ 0, the matrix square root Σ1/2 = UΛ1/2UT and inverse square root Σ−1/2 = UΛ−1/2UT are well‑defined symmetric PD matrices satisfying Σ1/2Σ1/2 = Σ. The whitening transform

z = Σ−1/2(x − μ)

produces a random vector z with identity covariance: Cov(z) = Id — uncorrelated, unit‑variance coordinates.

ML relevance: whitening is a standard preprocessing step, and is also the construction used to sample from any multivariate Gaussian by transforming standard normal noise.
A1.118

Mahalanobis Distance

Given a PD covariance matrix Σ, the Mahalanobis distance between x and a reference point μ is

dΣ(x, μ) = √( (x−μ)T Σ−1 (x−μ) ).

It equals the ordinary Euclidean distance after the whitening transform of A1.117: dΣ(x,μ) = |Σ−1/2(x−μ)|. It accounts for the scale and correlation of each coordinate, unlike the raw Euclidean norm.

A1.119

The A‑Norm Induced by a PD Matrix

For A ≻ 0, the function |x|A = √(xTAx) defines a genuine norm on d (the "A‑norm" or "energy norm"), since positive definiteness of A supplies exactly the positive‑definiteness axiom required of a norm, and the triangle inequality follows from Cauchy–Schwarz applied to the inner product ⟨x,y⟩A = xTAy.

ML relevance: the A‑norm with A = Hessian appears throughout convergence analyses of optimization methods (e.g., conjugate gradient).
A1.120

Linear Least Squares — Problem Statement

Given X ∈ Mn,d and y ∈ ℝn, the least squares problem seeks

β̂ = argminβ ∈ ℝd |Xβ − y|2.

Geometrically (A1.77), this asks for the point in im(X) closest to y — i.e., Xβ̂ is the orthogonal projection of y onto the column space of X.

  • Xthe design (feature) matrix.
  • β̂the least squares estimate.
A1.121

Theorem — The Normal Equations

The least squares objective f(β) = |Xβ − y|2 is convex (its Hessian is 2XTX ⪰ 0, A1.111), and setting the gradient (A1.105) to zero gives the normal equations:

XTX β = XTy.

Proof. β|Xβ−y|2 = ∇βTXTXβ − 2yTXβ + yTy) = 2XTXβ − 2XTy; setting to 0 gives the claim. Since f is convex, any solution of the normal equations is a global minimizer. ∎

A1.122

Theorem — Uniqueness and the Closed‑Form Solution

If XTX is invertible — equivalently (A1.58), if X has full column rank (its columns/features are linearly independent) — the least squares solution is unique:

β̂ = (XTX)−1 XTy = X+y.

If XTX is singular (e.g., more features than samples, or collinear features, A1.28), infinitely many minimizers exist; the pseudoinverse X+ (A1.101) selects the minimum‑norm one among them.

ML relevance: this is precisely why perfectly collinear features make ordinary least squares regression coefficients ill‑defined, and why regularization (A1.123) is introduced.
A1.123

Ridge Regression (ℓ² Regularization)

Ridge regression modifies the least‑squares objective by adding a penalty on the norm of β:

β̂ridge = argminβ |Xβ − y|2 + γ|β|2, γ > 0.

Setting the gradient to zero gives (XTX + γI)β = XTy, so

β̂ridge = (XTX + γI)−1 XTy.

Crucially, XTX + γI ≻ 0 for any γ > 0, regardless of the rank of X (since adding γI shifts every eigenvalue of the PSD matrix XTX up by γ, by A1.93) — so the ridge solution is always unique, even when ordinary least squares is not.

A1.124

Shrinkage in the Eigenbasis

Using the SVD X = UΣVT, the ridge fitted values can be written

Xβ̂ridge = ∑i=1r ui ( σi2 / (σi2 + γ) ) (uiTy).

Each principal direction of X is shrunk by the factor σi2/(σi2+γ) ∈ (0,1) — directions with small singular values (i.e., noisy or poorly‑determined directions) are shrunk the most.

A1.125

Gradient Descent on a Quadratic Objective

For f(x) = (1/2)xTAx − bTx with A ≻ 0 (so ∇f(x) = Ax − b), the gradient descent update with step size η is

xk+1 = xk − η(Axk − b) = (I − ηA)xk + ηb.

Writing the error ek = xk − x⋆ in the eigenbasis of A, each coordinate evolves independently as ek+1(i) = (1 − ηλi)ek(i) — a direct application of A1.90.

A1.126

Theorem — Convergence Rate of Gradient Descent on Quadratics

Gradient descent on the quadratic of A1.125 converges (xk → x⋆) if and only if |1 − ηλi| < 1 for every eigenvalue λi of A, i.e., 0 < η < 2/λmax. The optimal step size η⋆ = 2/(λmin + λmax) gives an asymptotic convergence rate governed by

(κ(A) − 1) / (κ(A) + 1), κ(A) = λmaxmin (the condition number, A1.103).
ML relevance: this single formula explains why ill‑conditioned loss surfaces (e.g., from unnormalized or correlated features) cause slow, zig‑zagging gradient descent, motivating feature normalization, momentum, and adaptive optimizers.
A1.127

Fisher's Linear Discriminant Direction

Given two classes with means μ1, μ2 and a shared (pooled) within‑class covariance ΣW ≻ 0, Fisher's linear discriminant seeks the direction w maximizing the ratio of between‑class to within‑class variance:

w⋆ = argmaxw ( wT1−μ2)(μ1−μ2)Tw ) / ( wTΣWw ) ∝ ΣW−11 − μ2).

This is a generalized eigenvalue problem; the closed‑form solution follows from a whitening change of variables (A1.117) that reduces it to an ordinary Rayleigh quotient maximization (A1.94).

A1.128

Generalized Eigenvalue Problem

For symmetric A and symmetric PD B, the generalized eigenvalue problem seeks (λ, v) with v ≠ 0 satisfying

A v = λ B v.

Substituting v = B−1/2u (A1.117) transforms this into the ordinary eigenvalue problem (B−1/2AB−1/2)u = λu, so all guarantees of the spectral theorem (A1.91) — real eigenvalues, orthogonal (in the B‑inner‑product) eigenvectors — carry over.

ML relevance: this single template covers Fisher discriminant analysis (A1.127), canonical correlation analysis, and generalized PCA under non‑Euclidean metrics.
A1.129

Submultiplicativity of the Operator Norm

For compatible matrices A, B and a vector x:

|Ax| ≤ |A|op |x|,
|AB|op ≤ |A|op |B|op.

Proof. The first is immediate from the definition of the operator norm (A1.17). For the second, |ABx| ≤ |A|op|Bx| ≤ |A|op|B|op|x|, and taking the max over unit x gives the claim. ∎

ML relevance: these inequalities are the basic tool for bounding how much error propagates through a composition of linear layers — a foundational ingredient in Lipschitz‑based generalization and robustness bounds for neural networks.
A1.130

Closing Note — How These Pieces Fit Together

The chain of results above forms a single continuous argument: vector spaces and bases (A1.20–A1.41) give us coordinates; linear maps and matrices (A1.39–A1.58) give us the operations of models; determinants (A1.59–A1.67) certify when those operations are reversible; inner products and orthogonality (A1.68–A1.80) give us geometry — angle, distance, projection; eigenvalues and the spectral theorem (A1.81–A1.95) diagonalize symmetric structure wherever it appears (covariance, Hessians, kernels); the SVD (A1.96–A1.101) extends that diagonalization to arbitrary matrices and underlies optimal compression; and finally, quadratic forms, gradients, and Hessians (A1.102–A1.129) connect all of the above to the calculus of optimization — gradient descent, Newton's method, least squares, ridge regression, and PCA are, in the end, applications of the spectral theorem and the variational characterization of eigenvalues to specific quadratic objectives.

Every major linear‑algebraic concept used in machine learning traces back to one of three theorems: rank–nullity (A1.45), the spectral theorem (A1.91), and the SVD (A1.96–A1.99).