Linear Algebra
A first university course in linear algebra, computational and geometric. Solve systems by row reduction, see a matrix as a map that stretches, turns and flattens the plane, and work with span, bases, determinants, eigenvalues, projections, least squares and the SVD. Every method comes with its reason and its picture, and a small matrix to work by hand.
Lessons
- Vectors and linear combinations: A vector is a list of numbers drawn as an arrow; adding goes tip to tail and scaling stretches, so a linear combination of two vectors is a walk along each of them in turn.
- The dot product, length and angle: The dot product multiplies matching entries and adds them up, and it equals the two lengths times the cosine of the angle between, so it gives lengths and angles and is zero exactly for perpendicular vectors.
- Lines and planes in space: A line is a point plus every multiple of a direction vector, and a plane is every point whose step from a fixed point is perpendicular to a normal vector, which turns into one linear equation.
- Systems of linear equations: Each linear equation is a line or a plane, and the solutions of a system are the points on all of them at once, which is why there are always none, exactly one or infinitely many.
- Row reduction: Swapping two equations, scaling one and adding a multiple of one to another never change the solutions, so elimination turns any system into a triangular one that is solved from the bottom up.
- Echelon forms and pivots: Every matrix row reduces to exactly one reduced echelon form, and its pivots answer a system's two questions, since a pivot in the last column means no solution and a column with no pivot means a free variable.
- Solution sets in parametric form: Writing the pivot variables in terms of the free ones gives every solution as one particular solution plus any combination of fixed direction vectors, a point, line or plane shifted off the origin.
- The matrix equation Ax = b: $A\mathbf{x}$ is the combination of the columns of $A$ with the entries of $\mathbf{x}$ as weights, so a system, a vector equation and $A\mathbf{x} = \mathbf{b}$ all ask whether $\mathbf{b}$ is a combination of the columns.
- Span: The span of some vectors is every combination of them, a line, a plane or all of space, and $\mathbf{b}$ is in the span exactly when the system with those vectors as columns and $\mathbf{b}$ on the right is consistent.
- Linear independence: Vectors are independent when the only combination of them giving zero has every weight zero, which means none of them is a combination of the others and every column of their matrix has a pivot.
- Linear transformations: A transformation is linear when it keeps sums and multiples, which in the plane means it fixes the origin and carries the grid to a grid of parallel, evenly spaced lines.
- The matrix of a linear transformation: A linear transformation is decided by where it sends $\mathbf{e}_1, \dots, \mathbf{e}_n$, so its matrix has those images as columns, and rotations, reflections, shears and projections can be written down at a glance.
- Matrix multiplication: $AB$ is the matrix of doing $B$ first and then $A$, so its columns are $A$ times the columns of $B$, and since the order of two moves matters, $AB$ and $BA$ usually differ.
- The inverse of a matrix: The inverse of $A$ undoes it, so $A^{-1}\mathbf{b}$ solves $A\mathbf{x} = \mathbf{b}$; a 2 by 2 inverse has a short formula, and row reducing $[A \mid I]$ turns the $I$ into $A^{-1}$.
- The invertible matrix theorem: For a square matrix, a pivot in every row, a pivot in every column, independent columns, columns that span, a one-to-one map and an onto map are all the same condition, that the matrix is invertible.
- The determinant as area: The determinant of $A$ is the factor by which $A$ scales every area (every volume, in space), negative when it turns the plane over, so $A$ is invertible exactly when its determinant isn't zero.
- Computing determinants: A determinant can be expanded along any row or column, and row operations change it in known ways, so reducing to a triangular matrix and multiplying its diagonal is the fast way for a large one.
- The determinant of a product: Doing $B$ then $A$ scales areas by one factor and then the other, so $\det(AB) = \det A \det B$, which gives the determinant of an inverse and of a power; a transpose has the same determinant as the matrix.
- Subspaces: A subspace is a set of vectors that contains zero and stays closed under adding and scaling, which is why lines and planes through the origin are subspaces and shifted ones aren't.
- Null space and column space: The null space of $A$ is every $\mathbf{x}$ with $A\mathbf{x} = \mathbf{0}$, living among the inputs, and the column space is every $A\mathbf{x}$, living among the outputs; one is found by solving, the other by spanning.
- Basis: A basis is an independent set that spans, the fewest vectors that reach everything; the pivot columns of $A$ are a basis for its column space and the vectors of the parametric solution a basis for its null space.
- Dimension and rank: Every basis of a subspace has the same number of vectors, its dimension, and since each column of $A$ either has a pivot or gives a free variable, the rank plus the nullity is the number of columns.
- Coordinates and change of basis: The coordinates of $\mathbf{x}$ in a basis are the weights that build $\mathbf{x}$ from it, and the matrix with that basis as columns turns those coordinates into standard ones, its inverse turning them back.
- Eigenvectors and eigenvalues: An eigenvector of $A$ is a nonzero vector that $A$ only stretches, $A\mathbf{v} = \lambda\mathbf{v}$, so along its line the matrix acts like multiplying by the one number $\lambda$.
- The characteristic equation: $\lambda$ is an eigenvalue exactly when $A - \lambda I$ squashes some nonzero vector to zero, so the eigenvalues solve $\det(A - \lambda I) = 0$ and their eigenvectors fill the null space of $A - \lambda I$.
- Diagonalization: With $n$ independent eigenvectors, $A = PDP^{-1}$, a pure stretch along the eigenvector axes, which makes powers of $A$ easy; a shear has too few eigenvectors and can't be diagonalized.
- Markov chains: A Markov matrix moves a probability vector one step, and its powers settle on the steady state, the eigenvector for the eigenvalue $1$, whatever the start.
- Discrete dynamical systems: Writing the start as a combination of eigenvectors splits $\mathbf{x}_{k+1} = A\mathbf{x}_k$ into pieces that each grow or shrink by their own $\lambda^k$, so in the long run the direction of the largest eigenvalue wins.
- Orthogonal bases: In an orthogonal basis each coordinate is a dot product divided by a length squared, with no system to solve, and a matrix with orthonormal columns keeps every length and angle.
- Orthogonal projection: The projection of $\mathbf{y}$ onto a subspace is the point of the subspace closest to $\mathbf{y}$, the one whose error is perpendicular to the whole subspace, and with an orthogonal basis it is a sum of projections onto lines.
- Gram-Schmidt and QR: Subtracting from each vector its shadows on the ones already straightened leaves a piece perpendicular to all of them with the same span, so any basis can be made orthonormal, and the weights used make $A = QR$.
- Least squares: When $A\mathbf{x} = \mathbf{b}$ has no solution, the best $\hat{\mathbf{x}}$ makes $A\hat{\mathbf{x}}$ the projection of $\mathbf{b}$ onto the column space, so the residual is perpendicular to every column and $A^TA\hat{\mathbf{x}} = A^T\mathbf{b}$; fitting a line to data is the classic case.
- Symmetric matrices and the spectral theorem: A matrix equal to its own transpose has real eigenvalues and perpendicular eigenvectors, so it factors as $A = QDQ^T$ with $Q$ orthogonal, a stretch along perpendicular axes.
- The singular value decomposition: Every matrix sends some perpendicular pair of unit vectors to a perpendicular pair stretched by the singular values, the axes of the ellipse it makes from the unit circle, so every matrix factors as $A = U\Sigma V^T$, and setting the smallest singular values to $0$ gives the closest matrix of lower rank.