Linear Algebra

Canonical T1 reference. Companion deep notes:

1. At a glance

Linear algebra is the theory of vector spaces, linear maps between them, and the decompositions that expose their structure. It is the most reused mathematical machinery in applied science:

  • Numerical computing — every PDE discretisation, every regression, every neural-network forward pass reduces to matrix-vector multiplication, factorisation, or eigenvalue extraction.
  • Geometry + graphics + robotics — rigid transforms are 4×4 matrices; rotations live in SO(3); cameras are projective maps.
  • Statistics + ML — covariance matrices, design matrices, kernel Gram matrices, attention’s QKᵀ all sit at the centre of inference.
  • Quantum mechanics — observables are Hermitian operators on Hilbert spaces; time evolution is unitary.
  • Networks + graphs — adjacency + Laplacian matrices encode connectivity; their spectra determine clustering, diffusion, and centrality.

This note is the conceptual spine. For computational depth on any sub-topic, follow the cross-links to the companion notes above.

Three views of a matrix A ∈ ℝᵐˣⁿ

Master all three; switch fluidly depending on the question:

  1. Linear map, . Captures what A does to space. Dominant for geometry, dynamics, change of basis.
  2. Column collection, with . Captures what outputs are reachable. Dominant for solving .
  3. Bilinear form coefficients. Captures quadratic energy / inner products / quadratic constraints. Dominant for optimisation, statistics (precision matrices), physics (Hamiltonians).

A fourth less common view — data table (rows = samples, columns = features) — emerges in statistics and ML. SVD blurs the distinction by treating rows and columns symmetrically.

2. Vector spaces and subspaces

A vector space V over a field F (almost always ℝ or ℂ) is a set with an addition and scalar multiplication satisfying eight axioms — associativity and commutativity of , distributivity, identity 0 and scalar 1, additive inverses, and compatibility of . The axioms abstract the operational behaviour of arrows in ℝⁿ.

Canonical examples.

  • — n-tuples of reals; the prototype.
  • — complex vectors; the natural setting for spectral theory.
  • — matrices themselves form a vector space of dimension .
  • — polynomials of degree ; dimension , basis .
  • — k-times continuously differentiable functions on an interval; infinite-dimensional. The natural home of differential operators (see functional-analysis).
  • — square-summable sequences; the discrete prototype of a Hilbert space.

A subspace is a non-empty subset closed under addition and scalar multiplication. Equivalently: contains 0, closed under linear combinations.

Operations on subspaces.

  • Sum.
  • Intersection is always a subspace; union is not (it fails closure).
  • Direct sum iff and , equivalently every has a unique decomposition . Dimension is additive: .
  • Quotient is the set of cosets ; useful in algebraic geometry, homological algebra, and the abstract construction of tangent spaces.

3. Linear independence, basis, dimension

A set is linearly independent iff forces all . Otherwise linearly dependent — some is a linear combination of the others.

The span of a set is the subspace of all finite linear combinations; the smallest subspace containing the set.

A basis for V is a linearly independent set whose span is V. Equivalently: every has a unique representation as a linear combination of basis vectors.

Dimension theorem (Hamel). Every vector space has a basis (in finite dimensions: choose a maximal independent set; in infinite dimensions: Zorn’s Lemma; see mathematical-logic-and-foundations). Any two bases of V have the same cardinality — that cardinality is the dimension .

Standard basis of ℝⁿ. has a 1 in coordinate i and 0 elsewhere. Any decomposes as ; the components are the coordinates in the standard basis.

Change of basis. If is another basis, the change-of-basis matrix has columns in standard coordinates; for any , and . Linear maps transform by similarity: . This is the algebraic content of “choose better coordinates”.

4. Linear transformations and matrix representation

A linear transformation satisfies . Given bases of V and of W, T is encoded by the matrix whose j-th column is written in the W-basis. Then in coordinates equals .

Composition = product. If and , then . The non-commutativity of matrix multiplication is the non-commutativity of function composition.

Kernel and image.

  • — the null space in matrix terms, written .
  • — the column space (range) in matrix terms.

Both are subspaces. The kernel measures how much T collapses; the image measures how much T can reach.

5. Rank-nullity theorem

For :

i.e. nullity + rank = number of columns. Equivalently: . The theorem expresses conservation: every input dimension either contributes to the output (rank) or gets collapsed (nullity).

Corollaries.

  • A square is invertible iff iff iff columns are linearly independent iff .
  • row rank equals column rank. Provable by Gaussian elimination or by recognising both as the number of nonzero singular values.

6. The four fundamental subspaces (Strang)

For , every vector in decomposes into the row space and null space ; every vector in decomposes into the column space and left null space . The four spaces and their dimensions:

SubspaceLives inDimensionOrthogonal complement
Column space
Row space
Null space
Left null space

where .

Geometric interpretation. A maps the row space isomorphically onto the column space; it sends the null space to 0. Every splits as , and .

This four-subspace picture (Strang 1980s) is the conceptual heart of the singular value decomposition: SVD is the algorithm that produces orthonormal bases for all four spaces at once, with the singular values measuring the gain along each row-space → column-space direction.

7. Determinants

For , the determinant is the unique alternating multilinear function on the columns satisfying .

Geometric meaning. is the volume of the image of the unit cube under A; iff A preserves orientation; iff it reverses it. For 2×2: is the area of the parallelogram spanned by the columns. For 3×3: the signed volume of the parallelepiped.

Algebraic properties.

  • .
  • .
  • .
  • (n-homogeneity).
  • Swapping two rows or columns negates the determinant.

Computation.

  • Cofactor expansion along any row or column — pedagogical, , impractical for .
  • LU decomposition (with sign for row swaps). , the standard numerical method.
  • Volumes via Gram determinant for V the matrix of column vectors.

Practical note. In numerical work the determinant is rarely what you want. For invertibility, check the condition number; for volumes, accumulate log-determinants (avoiding overflow); for linear systems, never solve via Cramer’s rule.

8. Eigenvalues and eigenvectors

A scalar is an eigenvalue of if there exists a nonzero with ; v is the corresponding eigenvector. The set of eigenvalues is the spectrum .

Characteristic polynomial. is a degree-n monic polynomial whose roots are exactly the eigenvalues (with algebraic multiplicity). By the fundamental theorem of algebra, A always has n complex eigenvalues counted with multiplicity.

Eigenspaces and geometric multiplicity. is the eigenspace at ; its dimension is the geometric multiplicity . Always where is algebraic multiplicity. When the matrix is defective and not diagonalisable.

Trace and determinant.

  • (sum of eigenvalues with algebraic multiplicity).
  • .

Spectral theorem (real symmetric / complex Hermitian case). If (real) or (complex), then:

  1. All eigenvalues are real.
  2. Eigenvectors for distinct eigenvalues are orthogonal.
  3. A admits an orthonormal eigenbasis: where Q is orthogonal and is diagonal.

This is the single most important theorem in linear algebra. It guarantees that symmetric problems — covariance matrices, Hessians at minima, Hamiltonians, kernel Gram matrices — have a clean orthogonal eigendecomposition.

Normal matrices. — the broadest class admitting a unitary diagonalisation. Includes Hermitian, skew-Hermitian, unitary, and (real) orthogonal matrices.

For non-symmetric matrices, see also eigenvalue-problems for Krylov methods, Schur decomposition, and the more delicate perturbation theory.

9. Diagonalisation and Jordan form

Diagonalisation. is diagonalisable iff there exists invertible P with , diagonal. The columns of P are the eigenvectors; the diagonal of are the eigenvalues. Equivalent conditions:

  • A has n linearly independent eigenvectors.
  • Geometric multiplicity equals algebraic multiplicity for every eigenvalue.
  • The minimal polynomial has only simple roots.

When diagonalisation works. Symmetric / Hermitian / normal matrices always diagonalise (with orthonormal P). Generic matrices over ℂ diagonalise (the non-diagonalisable matrices form a measure-zero set), but generic matrices over ℝ may have complex eigenvalues, requiring a real block-diagonal form with 2×2 rotation-scaling blocks for complex conjugate pairs.

Jordan canonical form (Jordan 1870). Over ℂ, every matrix is similar to a Jordan form

where each Jordan block is a upper bidiagonal block. Diagonalisable matrices are the special case where every block is 1×1. The Jordan form is theoretically unique up to block order but numerically unstable — tiny perturbations split a Jordan block into nearby diagonal entries. In computation, use the Schur form (Q unitary, T upper triangular) instead.

Matrix functions via diagonalisation. If then and more generally for any analytic f, where . This is how matrix exponentials, square roots, and logarithms are defined and computed.

10. Inner products and orthogonality

An inner product on a real vector space V is a map that is:

  • Bilinear — linear in each argument.
  • Symmetric.
  • Positive definite with equality iff .

For complex spaces, replace symmetry with Hermitian symmetry and bilinearity becomes sesquilinearity (conjugate-linear in one argument).

Canonical example. Dot product on ℝⁿ: . Induces the Euclidean norm .

General inner products. for any symmetric positive definite M defines an inner product (the Mahalanobis inner product when , a covariance inverse). On function spaces, defines the inner product (see functional-analysis).

Orthogonality. iff . A set is orthonormal iff .

Cauchy-Schwarz inequality. with equality iff u, v are colinear. The single most-used inequality in analysis.

Triangle inequality. .

Gram-Schmidt orthogonalisation

Given linearly independent , produce orthonormal with the same span:

Each step subtracts the projection of onto the span of earlier , leaving the orthogonal component. Classical Gram-Schmidt as written is numerically unstable; Modified Gram-Schmidt (subtract projections sequentially as you build them) is the working algorithm. Even better numerically: Householder reflections (the basis of practical QR; see numerical-linear-algebra).

The output of Gram-Schmidt on the columns of A is the QR decomposition: with Q orthogonal and R upper triangular. QR is the standard tool for least squares and for the QR-algorithm for eigenvalues.

11. Projections

Given a subspace , the orthogonal projection sends to the closest point in W:

If is an orthonormal basis of W and , then . If has linearly independent columns spanning W (not necessarily orthonormal), .

Properties.

  • (idempotent).
  • (symmetric — this is what makes the projection orthogonal vs oblique).
  • ; eigenvalues are 0 and 1.
  • projects onto .

Orthogonal decomposition. and every . Pythagoras: .

Projections are the geometric content of least squares: minimise over x; the optimal is the projection of b onto .

12. Singular value decomposition (SVD)

Theorem (Eckart-Young-style statement; existence due to Beltrami 1873, Jordan 1874). Every factorises as

where:

  • is orthogonal; columns are left singular vectors.
  • is orthogonal; columns are right singular vectors.
  • is “diagonal” with nonnegative entries — the singular values.

Connection to eigendecompositions. — the right singular vectors are eigenvectors of ; singular values are square roots of its eigenvalues. Symmetrically, left singular vectors are eigenvectors of .

Four subspaces from SVD. Let = number of nonzero singular values. Then:

  • Columns 1..r of U = orthonormal basis of .
  • Columns r+1..m of U = orthonormal basis of .
  • Columns 1..r of V = orthonormal basis of .
  • Columns r+1..n of V = orthonormal basis of .

The SVD produces orthonormal bases of all four fundamental subspaces simultaneously — this is its geometric punchline.

Computation

Practical SVD: bidiagonalise A by Householder reflections from both sides, then run a divide-and-conquer or QR-style iteration on the bidiagonal form. operations. LAPACK routines ?gesdd (divide-and-conquer) and ?gesvd (Golub-Reinsch) are the standard implementations. See numerical-linear-algebra for details; for truncated SVD on very large matrices, use randomised methods (Halko, Martinsson, Tropp 2011) or Lanczos bidiagonalisation.

Low-rank approximation (Eckart-Young 1936)

The best rank-k approximation to A in both Frobenius and spectral norm is

Errors:

This is the only deterministic optimal low-rank approximation; PCA, latent semantic analysis, image compression, recommender systems all use it. See svd-pca-spectral for the application landscape.

Pseudoinverse (Moore 1920, Penrose 1955)

The Moore-Penrose pseudoinverse generalises the inverse to rectangular and rank-deficient matrices. The minimum-norm least-squares solution to is . Characterised by four axioms: , , , .

13. Least squares

Problem. Given (often , overdetermined) and , find x minimising .

Normal equations. Setting gives . If A has full column rank, is invertible and .

Geometric reading. is the unique such that — the projection of b onto the column space of A. The residual is orthogonal to .

Numerical caveat. Never solve via normal equations when A is even moderately ill-conditioned: , so you double the condition number’s penalty. Two stable alternatives:

  • QR-based: , then solve by back-substitution. .
  • SVD-based: , then . More expensive but exposes near-rank-deficiency and lets you regularise by truncating tiny singular values.

Regularised least squares (Tikhonov / ridge). Minimise for . Closed form: . Always well-posed regardless of ‘s rank.

14. Positive (semi)definite matrices and Cholesky

A symmetric is positive definite (PD) iff for all , equivalently iff all eigenvalues are positive. Positive semidefinite (PSD) allows and eigenvalues .

Characterisations of PD M.

  1. All eigenvalues positive.
  2. All leading principal minors positive (Sylvester’s criterion).
  3. for some invertible L with positive diagonal (Cholesky).
  4. for some B with full column rank.
  5. Quadratic form has a strict minimum at 0.

Where PD/PSD matrices appear.

  • Covariance matrices — always PSD; PD iff data spans the full space.
  • Hessians at minima — PD at strict local minima (and PSD generally).
  • Gram matrices is PSD; PD iff linearly independent.
  • Kernel matrices in ML — PSD by Mercer’s theorem.

Cholesky decomposition (Cholesky ca. 1910)

For PD , the unique factorisation with L lower triangular, positive diagonal, can be computed in operations — half the cost of LU. Algorithm: process columns left-to-right, computing and .

Used pervasively as:

  • Cheapest way to solve when M is symmetric PD.
  • Square root of a PSD matrix (in the lower-triangular sense; cf. the symmetric matrix square root from the eigendecomposition).
  • Drawing samples from a multivariate Gaussian: with gives .
  • Sequential Monte Carlo, Kalman filtering covariance updates (“square-root Kalman” forms).

15. Condition number and numerical stability

For an invertible the condition number in the 2-norm is

It governs the worst-case amplification of relative input error to relative output error when solving :

Rough rule of thumb: solving in IEEE double precision (machine epsilon ) loses digits. means you may have zero correct digits.

Forward vs backward stability. Modern algorithms (LU with partial pivoting, QR via Householder, Cholesky, SVD via Golub-Reinsch) are backward stable: the computed answer is the exact answer for a slightly perturbed input. Forward error then bounds by machine epsilon. See numerical-linear-algebra for the analysis.

Ill-conditioning is a property of the problem, not the algorithm. No clever algorithm can rescue badly conditioned data; you need to reformulate (regularise, change basis, drop redundant features).

16. Catalogue of matrix decompositions

DecompositionFormWhen it existsCostPrimary use
LU ( for pivoting)Square invertibleSolving linear systems
QRAny Least squares, eigenvalue iteration
CholeskySymmetric PDSPD systems, Gaussian sampling
LDLSymmetric (allowing indefinite)Symmetric indefinite systems
Eigen (symmetric)SymmetricSpectral analysis, diagonalisation
Eigen (general)Always (Jordan) over ℂTheoretical; numerically use Schur
SchurAny squarePractical eigenvalue extraction
SVDAny matrixRank, pseudoinverse, low-rank approx
Polar ( orthogonal, PSD)SquareProcrustes, robotics rotation extraction
Hessenberg ( upper Hessenberg)AnyPre-step for QR-algorithm eigenvalues
Bidiagonal ( bidiagonal)AnyPre-step for SVD

For algorithmic detail see numerical-linear-algebra; for spectral applications see svd-pca-spectral and eigenvalue-problems.

17. Norms

A norm satisfies positivity, homogeneity, and the triangle inequality. Common vector norms on ℝⁿ:

  • p-norms (): .
    • : Manhattan / Taxicab norm — sparsity-inducing in optimisation (LASSO).
    • : Euclidean norm — the geometric default.
    • : max norm .

Common matrix norms on :

  • Operator (induced) p-norms: .
    • (largest singular value).
    • (max column sum).
    • (max row sum).
  • Frobenius norm: .
  • Nuclear norm (Schatten-1): . Used as a convex surrogate for rank in matrix completion.
  • Schatten p-norms: . Generalises Frobenius (), nuclear (), spectral ().

Equivalence of norms (finite-dimensional spaces). Any two norms on a finite-dimensional space satisfy for fixed constants. So they induce the same topology — convergence in one means convergence in all. In infinite-dimensional spaces this fails, and the choice of norm matters profoundly (see functional-analysis).

18. Special matrix classes

ClassDefinitionKey property
Diagonal for Trivial algebra; entry-wise
TriangularZero above/below diagonalLinear systems by back/forward substitution
PermutationOne 1 per row and column, else 0Orthogonal,
Orthogonal ()Preserves Euclidean norm; columns orthonormal
Unitary ()Complex analogue of orthogonal
SymmetricReal spectrum; orthogonal eigenbasis
Skew-symmetricPure imaginary spectrum; exponential is orthogonal
HermitianComplex analogue of symmetric
NormalUnitarily diagonalisable
Positive definiteAll eigenvalues positive; Cholesky factor exists
Stochastic (row)Rows nonneg, sum to 1Largest eigenvalue is 1 (Perron-Frobenius)
SparseMost entries zeroSpecialised storage and algorithms
ToeplitzConstant along diagonalsFFT-accelerated multiplication
CirculantEach row is rotated previousDiagonal in Fourier basis
HankelConstant along anti-diagonalsSignal processing, system identification
VandermondePolynomial interpolation; often ill-conditioned
HilbertCanonical ill-conditioned example
Hadamard entries, orthogonalCombinatorial designs, fast transforms
TridiagonalNonzero only on main and adjacent diagonalsThomas algorithm solver
BandedNonzero in -band around diagonalGeneralised Thomas

19. Block matrices and Schur complements

A block matrix

with A invertible has Schur complement . Then

  • .
  • invertible iff S is.
  • Inverse:

Schur complements appear in: block LU decomposition; conditioning of multivariate Gaussians (the conditional covariance of is the Schur complement of in ); KKT systems in optimisation; and the Sherman-Morrison-Woodbury identity

— invaluable when A is easy to invert and is a low-rank update (Kalman filter covariance updates, online learning, leave-one-out diagnostics).

20. Tensor extension — a one-paragraph pointer

Linear algebra deals with and (vectors and matrices). Multilinear algebra generalises: a tensor of type is an element of , equivalently a multilinear map taking covectors and vectors to a scalar. Coordinates carry upper and lower indices; transformations between coordinate systems use the Jacobian and its inverse the appropriate number of times.

Tensors live everywhere: stress and strain in continuum mechanics (rank-2), the Riemann curvature tensor (rank-4) in general relativity, neural-network parameter banks (high-rank, but typically just multidimensional arrays without intrinsic linear-algebraic structure). Tensor decompositions (CP, Tucker, tensor-train) generalise SVD but have very different computational character — most are NP-hard in the worst case. See tensor-calculus for the index-notation, transformation-law treatment.

21. Key applications across the Compendium

  • Optimisation — gradient and Hessian are linear-algebraic objects; convex problems’ KKT systems are linear; Newton’s method solves linear systems at each step. convex-optimization, gradient-descent-variants.
  • Statistics + ML — OLS, ridge, PCA, GLMs, kernel methods, deep learning forward/backward passes all reduce to matrix operations. probability-and-statistics, bayesian-inference.
  • PDEs — discretisation yields huge sparse linear systems; multigrid, Krylov methods, preconditioning. pde-methods, numerical-linear-algebra.
  • Signal processing — DFT/FFT are unitary transforms; filtering is matrix-vector; system identification is rank decomposition. fft-spectral.
  • Robotics — SO(3), SE(3) are matrix Lie groups; Jacobians are linear maps between tangent spaces. lie-groups-so3-se3.
  • Networks — adjacency and Laplacian spectra drive PageRank, spectral clustering, expander graphs. graph-theory.
  • Quantum — observables are Hermitian operators on Hilbert spaces; gates are unitary matrices.
  • Coding theory — linear codes are subspaces over finite fields; generator and parity-check matrices.

22. Pitfalls and folklore

  • Never invert a matrix to solve . Use LU/QR/Cholesky on the system directly; explicit is rarely needed and always less accurate.
  • Avoid normal equations for ill-conditioned least squares. Use QR or SVD.
  • Cholesky over LU for SPD problems — half the work, more numerically robust.
  • The Jordan form is not for computation. Use Schur form instead.
  • Single precision can be enough if your problem is well-conditioned and you’re OK with ~ accuracy; many ML training runs successfully use bf16 or fp16. Conditioning is the deciding factor.
  • det A’s magnitude is not a useful “near-singular” diagnostic — a well-conditioned matrix can have (e.g. ). Use the condition number or the smallest singular value.
  • Block-matrix tricks beat brute force in many problems with low-rank structure; learn Woodbury, Schur complements, and matrix-determinant lemma early.
  • Eigen-decomposition is not unique when eigenvalues coincide — eigenvectors within a degenerate eigenspace can be rotated arbitrarily. Numerical algorithms return some basis; do not interpret individual eigenvector entries as physically meaningful in degenerate cases.

23. Originators and key references

  • Cayley (1858), Sylvester (1850s) — matrix algebra named and formalised.
  • Jordan (1870) — Jordan canonical form.
  • Frobenius (1870s-90s) — matrix theory, characteristic polynomial, rank, normal forms.
  • Beltrami (1873), Jordan (1874), Sylvester (1889), Autonne (1915) — independent derivations of SVD.
  • Schmidt (1907), Gram (earlier) — Gram-Schmidt orthogonalisation.
  • Cholesky (ca. 1910, published 1924 posthumously by Benoît) — Cholesky decomposition.
  • Moore (1920), Penrose (1955) — pseudoinverse.
  • Eckart-Young (1936) — optimal low-rank approximation theorem.
  • Wilkinson (1965), Golub + Van Loan (1983, 1989, 1996, 2013) — modern numerical linear algebra.
  • Strang (1976 onward) — the four-subspace pedagogy and MIT 18.06.
  • Trefethen + Bau (1997)Numerical Linear Algebra, the modern textbook.

24. Further reading

  • Strang, Introduction to Linear Algebra (6th ed.) — the standard undergraduate text emphasising the four-subspace picture.
  • Axler, Linear Algebra Done Right (4th ed.) — finite-dimensional theory without determinants; clean and proof-oriented.
  • Trefethen + Bau, Numerical Linear Algebra (1997) — the practitioner’s bible. 40 short, dense lectures.
  • Golub + Van Loan, Matrix Computations (4th ed.) — the encyclopaedic reference.
  • Horn + Johnson, Matrix Analysis (2nd ed.) — exhaustive theoretical reference.
  • Boyd + Vandenberghe, Introduction to Applied Linear Algebra (2018) — modern data-and-vectors-first treatment.

25. Companion notes in this library