Linear algebra, 12 min read

Matrices as transformations

A matrix is not a table of numbers. It is a recipe for moving all of space.

  • Key idea
  • Definition
  • Intuition
  • Example
  • Watch out

At school matrices show up as tables with strange multiplication rules. This is a different view: a matrix is a movement of space. Rotating, stretching, shearing. Everything you can do to a grid without tearing or bending it.

Two arrows are enough

The plane has two basic vectors: ı^=(1,0)\hat{\imath} = (1, 0) points right and ȷ^=(0,1)\hat{\jmath} = (0, 1) points up. Every other vector is a combination of them, for example (3,2)(3, 2) means “three times ı^\hat{\imath} and twice ȷ^\hat{\jmath}”.

That is exactly what you see in the playground below. The red arrow is ı^\hat{\imath}, the green one is ȷ^\hat{\jmath}. Drag their tips.

Playground: drag the arrows
î = (1.00, 0.00)ĵ = (0.00, 1.00)square area = 1.00

Matrices are columns

We write the coordinates of the new arrows side by side and a matrix appears. The first column is where ı^\hat{\imath} landed, the second is where ȷ^\hat{\jmath} landed.

A matrix as a function
import numpy as np

A = np.array([[0, -1],
[1,  0]])   # rotation by 90°

v = np.array([3, 2])
print("A @ v =", A @ v)

# determinant: how many times the area changes
print("det A =", np.linalg.det(A))

A matrix has columns (2, 0) and (0, 2). What does it do to space?