Matrix Representation of Transformations

Many geometric transformations can be written as matrix multiplication: a point (x, y) is written as a column vector and multiplied by a 2 × 2 matrix to give its image. In brief: the matrix [[0, −1], [1, 0]] rotates points 90° counterclockwise about the origin, so (3, 2) goes to (−2, 3). Combining transformations means multiplying their matrices.

Matrices put all linear transformations of the plane in a single format. They make it easy to combine several steps into one and to compute the effect on many points at once, which is how computer graphics work. This guide explains the matrices for reflections, rotations and dilations, shows how to compose them and covers translation with an extended matrix.

How does a matrix transform a point?

Write the point as a column (x, y) and the matrix as M = [[a, b], [c, d]]. The image is M times the column: (ax + by, cx + dy). The first row gives the new x and the second row gives the new y.

For M = [[2, 0], [0, 2]] and (3, 1): the image is (6, 2), a dilation with factor 2. A useful trick: the columns of M are the images of the unit vectors (1, 0) and (0, 1). For the rotation by 90°, (1, 0) goes to (0, 1) and (0, 1) goes to (−1, 0), so the columns are (0, 1) and (−1, 0), which gives [[0, −1], [1, 0]].

What are the matrices of standard transformations?

Example 1

Reflect (4, −3) in the y-axis: [[−1, 0], [0, 1]] · (4, −3) = (−4, −3).

Example 2: rotation by 60°

cos 60° = 1/2 and sin 60° = √3/2, so the matrix is [[1/2, −√3/2], [√3/2, 1/2]]. The point (2, 0) goes to (1, √3). Its distance from the origin is still 2.

Example 3: shear

The shear [[1, 2], [0, 1]] sends (1, 1) to (3, 1) and leaves (x, 0) fixed. A unit square becomes a parallelogram with the same area, because the determinant is 1.

How do you combine transformations?

To apply first A and then B, multiply the matrices in the reverse order: the combined matrix is BA. The order matters, because matrix multiplication is not commutative.

Example 4: reflect, then rotate

Reflect in the x-axis (A = [[1, 0], [0, −1]]) and then rotate by 90° (B = [[0, −1], [1, 0]]). BA = [[0·1 + (−1)·0, 0·0 + (−1)(−1)], [1·1 + 0·0, 1·0 + 0·(−1)]] = [[0, 1], [1, 0]]. This is the reflection in y = x. Check with (3, 2): reflecting gives (3, −2), rotating gives (2, 3), and the swap of (3, 2) is (2, 3) ✓.

Example 5: the determinant

The determinant of M tells how the area changes: a dilation by 3 has determinant 9, a rotation has determinant 1 and a reflection has determinant −1, where the sign indicates a reversal of orientation.

How can translations be written with matrices?

A translation (x, y) → (x + a, y + b) is not a multiplication by a 2 × 2 matrix, since it moves the origin. The standard solution is to use homogeneous coordinates: write the point as (x, y, 1) and use 3 × 3 matrices. The translation matrix is [[1, 0, a], [0, 1, b], [0, 0, 1]]. Rotations and dilations become [[A, 0], [0, 1]] blocks, so all transformations can be combined by multiplying 3 × 3 matrices. A rotation about a point C is a translation by −C, then a rotation, then a translation by C.

Matrix table of transformations

Matrices of basic transformations and their effect on (x, y)
Transformation Matrix Image Determinant
Identity[[1, 0], [0, 1]](x, y)1
Dilation by k[[k, 0], [0, k]](kx, ky)k2
Reflection in x-axis[[1, 0], [0, −1]](x, −y)−1
Reflection in y-axis[[−1, 0], [0, 1]](−x, y)−1
Reflection in y = x[[0, 1], [1, 0]](y, x)−1
Rotation 90°[[0, −1], [1, 0]](−y, x)1
Rotation 180°[[−1, 0], [0, −1]](−x, −y)1
Shear by s[[1, s], [0, 1]](x + sy, y)1

Where does the idea come from?

Matrices were developed in the nineteenth century, with Arthur Cayley publishing the first abstract treatment of matrix algebra in 1858. The link between matrices and geometric transformations became a standard teaching approach in the twentieth century. Homogeneous coordinates came from projective geometry and were adopted in computer graphics in the 1960s and later.

Where is it used today?

Every 2D and 3D graphics program, from games to CAD software, applies transformation matrices to the vertices of objects. Robotics combines rotation matrices for each joint. Image processing uses them to rotate, scale and skew pictures, and physics uses them for coordinate changes.

Which mistakes are common?

Multiplying in the wrong order

For “first A, then B” the matrix is BA. The matrix closest to the point acts first.

Mixing up rows and columns

The first row of the matrix gives the new x-coordinate. The columns of the matrix are the images of the unit vectors.

Trying to write a translation as a 2 × 2 matrix

Translations need the extended 3 × 3 form with homogeneous coordinates.

Wrong angle direction

The matrix with −sin θ in the top right rotates counterclockwise. Changing θ to −θ gives the clockwise rotation.