Matrices, hands on
A matrix is a grid of numbers that follows rules. Poke each example below and the rules will show themselves.
What a matrix is
A matrix is a rectangle of numbers. Its size is rows × columns, and each number is an entry, named by its row and column. Tap an entry.
The entry in row i, column j is written aij. Rows come first, always.
Adding and scaling
Matrices of the same size add entry by entry. Multiplying by a single number (a scalar) multiplies every entry. Edit any value.
Try A + B with a different size in mind: a 2 × 2 and a 2 × 3 can’t be added, because some entries would have no partner.
Multiplying matrices
Each entry of AB is a row of A paired with a column of B: multiply the pairs, then add. Tap an entry of the result.
The inner sizes must match: (2 × 3)(3 × 2) works, and the result takes the outer sizes, 2 × 2. Order matters too: AB and BA are usually different, and here BA would be 3 × 3.
Matrices move space
A 2 × 2 matrix turns every point (x, y) into a new point. The first column is where the point (1, 0) lands, the second column is where (0, 1) lands. Drag the sliders and watch the F get pushed around.
Teal is the original F; orange is the result. The arrows are the two columns. The determinant, ad − bc, says how much areas scale. A negative value means the picture was flipped, and zero means everything collapses onto a line.
Determinants and inverses
The determinant of a 2 × 2 matrix [[a, b], [c, d]] is a·d − b·c. It tells you how much the matrix scales area. The inverse is the matrix that undoes it. Drag the sliders to change a, b, c and d.
1. Calculate the determinant
2. Is it invertible?
The rule: a square matrix is invertible exactly when its determinant is not 0. Picture it below: the determinant is the area of the orange shape that the unit square turns into. If that area is 0, the plane has been flattened and the move can’t be undone.
3. Calculate the inverse
Three moves: swap a and d, negate b and c, then divide every entry by the determinant.
Bigger matrices. For a 3 × 3 matrix [[a, b, c], [d, e, f], [g, h, i]], det = a(ei − fh) − b(di − fg) + c(dh − eg). For [[2, 0, 1], [1, 3, 2], [0, 1, 4]] that is 2(12 − 2) − 0(4 − 0) + 1(1 − 0) = 21, which is not 0, so it is invertible.
Check yourself
Pick a player to save scores on this device, then choose a level. Choosing a level starts it, and Restart begins it again (Mix reshuffles).