Linear algebra from scratch
Vectors and matrices built up from geometry rather than formulas, with live transformations you can bend yourself.
Most linear algebra courses start with rules for pushing numbers around a grid. That works for passing exams and badly for intuition. This one starts from the other end: a matrix is a transformation of space, and almost every result — determinants, rank, eigenvectors, SVD — is a statement about what that transformation does to the grid.
The animations here are live. Drag the sliders and the geometry answers back, so you can ask “what if this entry were negative?” and watch rather than compute.
Prerequisites
None beyond school algebra. Familiarity with Python helps if you want to run the notebooks alongside.
Running the notebooks
The source is a series of Jupyter notebooks worked through in order:
cd linear_algebra_from_scratch
jupyter notebook
They use NumPy, SciPy and Matplotlib, and two data files (real_matrices.mat and EEG_RT_data.mat) for the applied sections.
Lessons
- 1 Matrices as transformationsWhat a matrix really does to space — and why the determinant, rank and eigenvectors all fall out of that one picture.
- 2 Vectors and the dot productA vector is an arrow and a list of numbers at the same time. The dot product is where those two views meet.
- 3 Matrix multiplicationMultiplying matrices is doing one transformation after another — which is why the order matters.
- 4 Rank and the four subspacesRank counts the dimensions a matrix keeps. Everything it throws away lives in the null space.
- 5 Systems of equations and row reductionSolving equations by row operations — and why those operations can never move the solution.
- 6 Determinant and inverseThe determinant says whether a transformation can be undone. The inverse is the undo.
- 7 Projection and orthogonalityFinding the closest point on a line or subspace — the single idea behind least squares.
- 8 Least squaresFitting a model to data that no model fits exactly — which turns out to be projection in disguise.
- 9 EigendecompositionFinding the directions a matrix only stretches, and using them to make powers of a matrix easy.
- 10 Singular value decompositionEvery matrix, of any shape, is a rotation, a stretch along the axes, and another rotation.
- 11 Quadratic forms and definitenessThe surface xᵀAx — bowl, saddle or trough — and how the eigenvalues decide which.