Linear Algebra
Linear algebra studies spaces and transformations that preserve addition and scaling. A durable learning sequence is:
- vectors, span, independence, basis, and dimension;
- linear maps and their matrix representations;
- systems of equations, elimination, rank, and null spaces;
- inner products, orthogonality, projections, and least squares;
- determinants, eigenvalues, and eigenvectors;
- singular value decomposition and low-rank approximation;
- applications to optimization, data analysis, and machine learning.
The reference below covers finite-dimensional real vectors, linear systems, and least squares. It assumes elementary algebra; MIT OpenCourseWare 18.06SC develops the proofs and the later factorization topics in the sequence above.
Vectors, bases, and shapes
A vector in has real coordinates relative to a chosen basis. The span of some vectors is the set of their linear combinations. They are linearly independent if the only combination giving zero has every coefficient zero. A basis is an independent spanning set; its size is the dimension. For example, and form a basis of , while and span only a line.
A linear map satisfies . With column vectors, a matrix maps an input to . Its columns are the images of the input basis vectors. Thus is a weighted sum of columns. If , then applies first, then ; may not even be defined. Adding a nonzero bias, , gives an affine map, not a linear one.
Watch the basis vectors and grid move together in 3Blue1Brown’s lesson on linear transformations. Reading the images of the basis vectors as matrix columns gives a visual counterpart to the column-vector convention used here.
When does a system have a solution?
The column space of is the span of its columns: all vectors that can be written as . The rank of is the dimension of that space. Its null space, written , consists of vectors with ; denotes dimension. For a matrix with columns, rank–nullity gives . In the tests below, means the matrix formed by appending as an extra column.
- is solvable exactly when lies in the column space, equivalently .
- If is one solution, all solutions are with .
- A solvable system has a unique solution exactly when the columns are independent. A square matrix is invertible exactly when its rank is ; a nonzero determinant is the equivalent square-matrix test.
For example, and describe the same line. The rank is 1 and every solution is . Replacing the second right-hand side by 7 makes the equations inconsistent. Counting equations alone does not establish solvability or uniqueness.
Orthogonality and least squares
The dot product is ; vectors are orthogonal when it is zero. The Euclidean norm is . When exact fitting is impossible, least squares minimizes . At a minimum the residual is orthogonal to every column, giving the normal equations .
Fit one constant to observations 1 and 3: and . The normal equation is , so , with residual orthogonal to . The fitted vector is the orthogonal projection of onto the column space. This projection is unique; the coefficients are unique only if has full column rank. Then is invertible, but numerical code should normally solve with QR or SVD rather than explicitly form an inverse.
Follow the perpendicular from the tip of v to the line: its foot gives the closest point on that line. The remaining segment is the residual. This is the geometry behind least squares; this drawing uses direction (2, 1), while the constant-fit example above uses (1, 1).
What factorizations answer
For a square matrix, with identifies a vector scaled by the map (possibly to zero). Not every real matrix has real eigenvalues or enough eigenvectors to form a basis. In contrast, every real matrix has a singular value decomposition , with orthogonal and nonnegative singular values in rectangular . The number of nonzero singular values is the rank. Keeping the largest singular values gives a best low-rank approximation in the Frobenius norm; singular values very small relative to the largest warn that solving may amplify perturbations. This connects linear algebra to numerical analysis.