Matrices

A matrix is a rectangular grid of numbers. Matrices can be added, multiplied and used to represent transformations, solve equations and much more in computing and science.

Key facts

  • Add matrices of the same size entry by entry.
  • Multiply rows of the first by columns of the second.
  • Matrix multiplication is not commutative: AB ≠ BA usually.
  • The columns of a 2 × 2 transformation matrix show where (1, 0) and (0, 1) go.
  • The identity matrix I leaves everything unchanged.

Worked examples

Example 1

Find AB where A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]].

  1. Row 1 × column 1: 1×0 + 2×1 = 2. Row 1 × column 2: 1×1 + 2×0 = 1.
  2. Row 2: 3×0 + 4×1 = 4, 3×1 + 4×0 = 3.
  3. AB = [[2, 1], [4, 3]]

Answer: [[2, 1], [4, 3]]

Example 2

What transformation does [[0, −1], [1, 0]] represent?

  1. (1, 0) goes to (0, 1).
  2. (0, 1) goes to (−1, 0).
  3. That’s a quarter turn anticlockwise.

Answer: Rotation 90° anticlockwise about the origin