LINEAR ALGEBRA / 2. MATRICES & TRANSFORMATIONS
Matrices — Linear Transformations
3Blue1Brown: a matrix is a transformation of space
EXPLANATION
3Blue1Brown's core insight: don't think of a matrix as a grid of numbers. Think of it as a transformation — a function that takes vectors and moves them in space. Every matrix encodes a linear transformation: • Where does [1,0] (the x-hat vector) land? • Where does [0,1] (the y-hat vector) land? • The columns of the matrix tell you exactly this. A 2×2 matrix [[a,b],[c,d]] means: • x-hat [1,0] → [a,c] • y-hat [0,1] → [b,d] • Any vector [x,y] → x*[a,c] + y*[b,d] Types of transformations: • Identity matrix I → no change • Scaling → stretch/compress along axes • Rotation → rotate space • Shear → slant space • Projection → flatten onto a lower dimension This visual understanding is critical for ML: • Each neural network layer applies a matrix transformation • W in y = Wx + b rotates and scales the input space • Deep networks compose many transformations in sequence
DIAGRAM
Matrix as transformation (2D):
Identity [[1,0],[0,1]]: Rotation 90°: [[0,-1],[1,0]]:
x-hat → [1,0] x-hat → [0,1]
y-hat → [0,1] y-hat → [-1,0]
Space unchanged Space rotated 90°
Scaling [[2,0],[0,3]]: Shear [[1,1],[0,1]]:
x stretched ×2 x-hat unchanged
y stretched ×3 y-hat → [1,1]
Reading column by column:
A = [[a, b], col1=[a,c]: where x-hat lands
[c, d]] col2=[b,d]: where y-hat lands
Matrix × vector = applying the transformation:
[[2,0],[0,3]] × [1,2] = [2,6] (x scaled ×2, y scaled ×3)CODE