Phase 01: Math Foundations

Matrix Transformations

A matrix is a machine that reshapes space. Learn what it does to every point, and you understand the whole transformation. Construct rotation, scaling, shearing, and reflection matrices and apply them to 2D and 3D points. Compose multiple transformations by matrix multiplication and verify that order matters. Compute eigenvalues and eigenvectors of 2x2 matrices from the characteristic equation. Explain why eigenvalues determine PCA directions, RNN stability, and spectral clustering behavior. You read about PCA and see "find the eigenvectors of the covariance matrix." You read about model stability and see "check if all eigenvalues have magnitude less than 1." You read about data augmentation and see "apply a random rotation." None of this makes sense until you understand what matrices do to space geometrically. Matrices are not just grids of numbers. They are spatial machines. A rotation matrix spins points. A scaling matrix stretches them. A shearing matrix tilts them. Every transformation a neural network applies to data is one of these operations or a composition of them. This lesson makes those operations concrete. Every linear transformation in 2D can be written as a 2x2 matrix. The matrix tells you exactly where the basis vectors [1, 0] and [0, 1] end up. Everything else follows. A 2D rotation by angle theta keeps distances and angles intact. It moves every point…

Matrix Transformations: A matrix is a machine that reshapes space. Learn what it does to every point, and you understand the whole transformation.

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.