Matrices as transformations

What a matrix really does to space — and why the determinant, rank and eigenvectors all fall out of that one picture.

What you'll learn
  • Read a matrix as "where the basis vectors land"
  • See the determinant as the area or volume the transformation produces
  • Recognise an eigenvector as a direction that survives the transformation

Write down a 2×2 matrix:

\[A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\]

The useful way to read it is by columns. The first column is where the basis vector \(\hat{\imath} = (1,0)\) ends up; the second is where \(\hat{\jmath} = (0,1)\) ends up. Everything else follows, because every vector is just a combination of those two:

\[A\begin{bmatrix} x \\ y \end{bmatrix} = x\begin{bmatrix} a \\ c \end{bmatrix} + y\begin{bmatrix} b \\ d \end{bmatrix}\]

So a matrix does not act on vectors one at a time — it moves all of space at once, keeping the origin fixed and keeping grid lines parallel and evenly spaced.

Grid lines stay parallel and evenly spaced; only their spacing and direction change. The faint grid is where space started. Move a, b, c, d and watch where î and ĵ land.

Try setting the matrix to \(a=0, b=-1, c=1, d=0\): a quarter turn. Or \(a=1, b=1, c=0, d=1\): a shear, where \(\hat{\imath}\) stays put and \(\hat{\jmath}\) slides sideways.

The determinant is an area

The shaded square above starts as the unit square, with area 1. After the transformation its area is exactly

\[\det A = ad - bc\]

That is the whole meaning of the determinant: the factor by which the transformation scales areas. Three cases are worth forcing in the animation:

  • det > 1 — space is stretched.
  • det = 0 — the square collapses to a line segment. Two columns pointing the same way means the whole plane is squashed onto a line, information is lost, and the matrix has no inverse. This is a rank-deficient matrix. Try \(a=1, b=2, c=2, d=4\).
  • det < 0 — the square is flipped over. Orientation reverses.

Eigenvectors: the directions that survive

Under most transformations, a vector gets knocked off its original line. But some directions are only stretched or squashed, never rotated:

\[A\mathbf{v} = \lambda \mathbf{v}\]

Those are the eigenvectors, and \(\lambda\) is the eigenvalue — the factor by which that particular direction is scaled.

The grey arrow sweeps around the unit circle; the coloured arrow is its image under A. Dashed lines are the eigen-directions. Watch the two arrows line up as the sweep crosses them.

The cross product \(x v_y - y v_x\) in the read-out is the test: it hits zero exactly when \(\mathbf{v}\) and \(A\mathbf{v}\) are parallel. Set \(b = -1, c = 1\) for a rotation and the dashed lines disappear — a rotation leaves no real direction unmoved, which is what complex eigenvalues mean.

Into three dimensions

Nothing above was special to the plane. In 3D a matrix is still “where the basis vectors land” — now three of them — and the determinant is still a scaling factor, except it scales volume instead of area.

The unit cube under a 3×3 matrix, with the camera orbiting. The three arrows are the columns of the matrix. Set the diagonal entries to 0 to flatten the cube and watch the determinant fall to zero.

A 3×3 determinant of zero means the cube has been flattened into a plane, a line or a point — the transformation has lost at least one dimension, and again there is no way back.

Where this goes next

Every later topic in this course is a question about this picture:

Topic The question it asks
Rank How many dimensions survive the transformation?
Matrix spaces Which vectors land on zero, and which outputs are reachable?
Inverse Can the transformation be undone? (Only if det ≠ 0.)
Projection What is the closest point on a subspace?
Eigendecomposition Which directions are merely scaled?
SVD Every matrix as rotate → scale → rotate

Try it yourself. Find a matrix other than the identity whose determinant is exactly 1 — a transformation that moves space but preserves area. Then find one with two identical columns and confirm from the animation why it cannot be inverted. Finally, open 3_Intro_to_matrices.ipynb and check your answers with np.linalg.det and np.linalg.eig.

View source on GitHub →