Maths › Matrices › Matrix algebra and transformations
Matrix algebra and transformations
A matrix represents a linear transformation through the images of the basis vectors, which form its columns. In a product AB, B acts first and A acts second. Matrix multiplication is generally non-commutative, so changing the order can change the transformation. Construct the matrices for rotations, reflections, stretches, shears and enlargements, and find the equation of the image of a curve.
Builds on Vectors in two dimensions and Graphs, proportion and transformations.
IN THIS TOPIC
- Add and multiply conformable matrices, respecting the size rules and the order of factors.
- Use the zero and identity matrices, and say why AB = 0 does not force A or B to be zero.
- Read a transformation matrix from the images of the unit vectors.
- Identify and construct rotations, reflections, stretches, shears and enlargements in the plane.
- Find the equation of a curve's image under a single or composite transformation.
- Write down the standard 3 × 3 reflections in coordinate planes and rotations about axes.
- Read the area scale factor and the change of orientation off the determinant.
COMMON MISCONCEPTION
Matrix multiplication, like ordinary multiplication, gives the same answer in either order.
Matrix multiplication does not commute in general. With A of rows (2, 1), (0, 3) and B of rows (1, 4), (2, 5), AB has rows (4, 13), (6, 15) while BA has rows (2, 13), (4, 17). The order carries the meaning: applying B and then A is the product AB, with the first-applied matrix nearest the vector.
An arithmetic for grids
A matrix is a rectangular array of numbers, added entry by entry when the shapes match. Multiplication is defined differently: the entry in row i, column j of AB comes from row i of A paired with column j of B, products summed. AB exists only when A has as many columns as B has rows.
Shapes are quoted rows first, so an m × n matrix has m rows and n columns, and is square when m and n agree and rectangular otherwise. Two matrices are equal when they have the same shape and match entry by entry. A pair of matrices whose shapes admit the product is called conformable, and the word carries the order with it, since AB can exist while BA does not. Nothing in any of this requires the entries to be real numbers. A matrix of complex entries is added, multiplied and inverted by the same rules, and one turns up as soon as the eigenvectors of a rotation are wanted.
WORKED EXAMPLE
A product, row by column
For A with rows (2, 1), (0, 3) and B with rows (1, 4), (2, 5), find AB and BA.
AB: top-left is 2 × 1 + 1 × 2 = 4; top-right 2 × 4 + 1 × 5 = 13; the bottom row gives 6 and 15. So AB has rows (4, 13), (6, 15).
BA: the same calculation gives rows (2, 13), (4, 17).
AB ≠ BA. Matrix multiplication does not commute in general; only special pairs commute.
The identity matrix I, with ones on the leading diagonal and zeros elsewhere, satisfies AI = IA = A. It is the identity element for matrix multiplication and is used to define the inverse.
The zero matrix 0, also called the null matrix, has every entry zero, so A + 0 = A and A0 = 0A = 0. One rule of ordinary arithmetic does not carry over: for numbers ab = 0 forces a = 0 or b = 0, but for matrices AB = 0 does not.
WORKED EXAMPLE
A zero product from two matrices that are not zero
Let A have rows (1, 1), (1, 1) and let B have rows (1, 1), (−1, −1). Find AB.
Top-left is 1 × 1 + 1 × (−1) = 0, and every other entry works out the same way, so AB is the zero matrix.
Neither factor is the zero matrix. Both are singular, and in the 2 × 2 case that is what makes a zero product possible.
BA has rows (2, 2), (−2, −2), so the order matters here too.
So AB = 0 does not imply A = 0 or B = 0, although it does constrain the pair: A must map every column of B to zero, which is why both factors here are singular. Similarly, AB = AC does not imply B = C unless A is invertible, in which case multiplying on the left by A⁻¹ gives the cancellation.
Matrix multiplication is associative: A(BC) = (AB)C whenever the shapes allow the products. That is why a chain of factors needs no brackets and why An is unambiguous. Associativity permits the brackets to be moved; it does not permit the factors to be reordered.
Matrices as linear transformations of the plane
A 2 × 2 matrix acts on column vectors, and that action is a linear transformation: the origin is fixed and straight lines map to straight lines. A matrix represents a linear transformation through the images of the basis vectors, which form its columns: the first column is the image of i and the second is the image of j.
The standard matrices follow from that fact. Rotation anticlockwise by θ about the origin has columns (cos θ, sin θ) and (−sin θ, cos θ). Reflection in y = x swaps the unit vectors, so its columns are (0, 1) and (1, 0). Reflection in y = −x swaps them and negates both, giving columns (0, −1) and (−1, 0). Enlargement by scale factor k about the origin is k times the identity, and k is allowed to be negative.
A stretch parallel to the x-axis with scale factor a multiplies every x coordinate by a and leaves y unchanged. So i maps to (a, 0), j is fixed, and the matrix has rows (a, 0) and (0, 1). A stretch parallel to the y-axis has rows (1, 0) and (0, b). Applying both gives rows (a, 0) and (0, b), which is an enlargement only when a = b.
A shear fixes every point of one axis and translates every other point parallel to that axis by an amount proportional to its distance from it. With the x-axis invariant, i is fixed and j maps to (k, 1), so the matrix has rows (1, k) and (0, 1) and the transformation is (x, y) → (x + ky, y). A point on the x-axis is fixed, and a point one unit above it moves k to the right.
Describing a shear therefore requires two pieces of information: the invariant axis and the image of one point off it, which determines k. A shear with the x-axis invariant carrying (0, 1) to (3, 1) has k = 3. For a shear parallel to the y-axis the matrix has rows (1, 0) and (k, 1): the y-axis is invariant and (1, 0) maps to (1, k).
The determinant ad − bc gives the area scale factor as its absolute value, and its sign records whether orientation is preserved or reversed. The x-stretch has determinant a, so areas scale by |a|. Enlargement by k has determinant k², since both directions are scaled. Rotations have determinant 1 and reflections determinant −1: both preserve area, and the negative sign records that a reflection reverses orientation.
A shear has determinant 1 for every k, because the sheared unit square is a parallelogram on the same base with the same height. Determinant 1 therefore does not imply that lengths and angles are preserved: a rotation preserves both, while a shear with the same determinant changes both.
GUIDED PRACTICE
From picture to matrix
Write down the matrices for reflection in y = −x, and for the stretch parallel to the y-axis with scale factor 3. Give the area scale factor of each.
Show the working
Reflection in y = −x sends i to (0, −1) and j to (−1, 0), so the matrix has rows (0, −1) and (−1, 0). Its determinant is 0 × 0 − (−1)(−1) = −1, so areas are unchanged and the orientation flips.
The stretch leaves i at (1, 0) and sends j to (0, 3), so the matrix has rows (1, 0) and (0, 3). Its determinant is 3, so areas triple.
Both matrices were obtained the same way: from the images of i and j.
Composition is multiplication
Applying transformation B and then transformation A is the single transformation with matrix AB. The right-hand factor acts first, because it is adjacent to the vector in ABv. Since multiplication is generally non-commutative, a rotation followed by a reflection is generally a different transformation from the reflection followed by the rotation. Write the first-applied matrix on the right, not in the order the transformations are described.
Associativity makes a longer chain unambiguous. Applying C, then B, then A is the product ABC, and BC or AB may be evaluated first: the resulting transformation is the same. The grouping may be chosen for convenience; the order of the factors may not be changed.
Moving a curve rather than a point
A transformation acts on every point of the plane at once, so it acts on a curve as well. Reading off the image curve's equation means running backwards through the matrix. If (x, y) lies on the curve and M carries it to (X, Y), then (x, y) = M⁻¹(X, Y), and substituting those two expressions into the original equation leaves a relation between X and Y that the image points satisfy. It is the inverse that is substituted, for the same reason that replacing x by x − 3 in y = f(x) translates a graph three to the right.
The inverse-substitution method requires M to be invertible. If M is singular, parameterise the original curve and map its points directly; the image may be a line, a point or another lower-dimensional set.
WORKED EXAMPLE
A parabola enlarged and turned
The curve y = x² is enlarged by scale factor 2 about the origin, and the image is then rotated through 90° anticlockwise about the origin. Find the equation of the final curve.
The enlargement is 2I and the rotation has rows (0, −1), (1, 0). The rotation acts second, so it goes on the left, and M has rows (0, −2) and (2, 0). An enlargement about the origin commutes with everything, so this particular pair could be taken in either order, which is not true of most pairs.
M sends (x, y) to (−2y, 2x), so X = −2y and Y = 2x, giving x = Y/2 and y = −X/2.
Substituting into y = x² gives −X/2 = Y²/4, so Y² = −2X, a parabola twice the size of the original, opening along the negative x-axis.
Check on one point. (1, 1) lies on y = x², M carries it to (−2, 2), and Y² = 4 while −2X = 4 as well.
The same substitution handles reflection in y = −x, whose matrix has rows (0, −1) and (−1, 0) and is its own inverse, so the image of a curve is found by writing −y for x and −x for y throughout. Under it y = x² becomes −x = y², a congruent parabola opening along the negative x-axis.
GUIDED PRACTICE
A hyperbola rotated into standard position
The rectangular hyperbola xy = 1 is rotated through 45° anticlockwise about the origin. Find the equation of its image.
Show the working
The rotation is 1/√2 times the matrix with rows (1, −1), (1, 1), and its inverse is the rotation through −45°, 1/√2 times rows (1, 1), (−1, 1).
So x = (X + Y)/√2 and y = (Y − X)/√2.
Then xy = 1 becomes (X + Y)(Y − X)/2 = 1, that is Y² − X² = 2.
Check with (1, 1), which lies on xy = 1. The rotation carries it to (0, √2), and 2 − 0 = 2. The asymptotes were the two axes and they have turned into y = ±x, which is the standard position the conics unit works in.
Transformations in three dimensions
Describe the drawing
Two axonometric sketches of the unit cube with the vectors i, j and k drawn from one corner and a three-by-three matrix above each: reflection in the plane x equals zero sends i to minus i and leaves j and k alone, while a quarter turn about the z-axis carries i onto the old j and j to minus i, and in both panels the columns of the matrix are exactly the marked images.
The 3 × 3 transformations required here form a short list, and each matrix is again read from the images of i, j and k. Reflection in the plane x = 0 negates the first coordinate, giving the diagonal matrix diag(−1, 1, 1), and reflections in y = 0 and z = 0 negate the second and third instead. Rotation about the z-axis leaves k alone and rotates the x and y coordinates, so it is the familiar 2 × 2 rotation sitting in the top-left corner with a 1 in the bottom-right.
Rotation about the x-axis is the same construction in the lower-right corner. For rotation about the y-axis the sine entries carry the opposite signs, with rows (cos θ, 0, sin θ), (0, 1, 0) and (−sin θ, 0, cos θ). State the sense convention being used for a rotation about an axis, such as the right-hand rule or the direction from which the rotation is viewed; the matrices above use the right-hand rule. Check a matrix by rotating a unit vector through 90° and comparing the image with that convention.
ASSESSMENT FOCUS
- Check sizes before multiplying. A product taken the wrong way round may not even exist.
- State that the columns are the images of the unit vectors when constructing a matrix.
- Describing a stretch requires both the direction and the scale factor.
- For combined transformations, write the first-applied matrix on the right.
- State the sense convention for a rotation. The matrices here are anticlockwise in the plane; a clockwise rotation uses −θ, which reverses the signs of the sine entries.
- Cancel a matrix off both sides of an equation only once it is known to be invertible. AB = AC forces B = C only when A has an inverse.
- Describing a shear requires the invariant axis and the image of one point off it. Its determinant is 1, so area is preserved.
- To transform a curve, substitute (x, y) = M⁻¹(X, Y) into its equation; substitute the inverse, not M. If M is singular, parameterise the curve and map its points directly.
CHECK YOURSELF
Find the single matrix for reflection in y = x followed by enlargement, scale factor 3, about the origin.
Show a hint
Write the enlargement matrix on the left of the reflection matrix.
Show the answer
The reflection has rows (0, 1), (1, 0), and the enlargement is 3I with rows (3, 0), (0, 3). The composite is (3I)(reflection), with rows (0, 3), (3, 0). Each unit vector is swapped and then tripled.
A matrix's columns are the images of the unit vectors, so a stretch reads as rows (a, 0) and (0, b), a shear with the x-axis invariant as rows (1, k) and (0, 1), and the size of the determinant gives the area scale factor.
Doing B then A is the product AB, with the first-applied matrix nearest the vector, and A(BC) = (AB)C leaves the bracketing free; for invertible M a curve's image comes from substituting M⁻¹(X, Y), and for singular M from parameterising the curve.
In 3-D, reflections in coordinate planes reverse one sign; rotations place a 2 × 2 rotation in the other two coordinates, with a stated sense convention.
AB = 0 does not make A or B zero, so cancelling a matrix off both sides needs that matrix to be invertible.
WORKBOOK
Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.
Or read them with their worked answers on the matrix algebra and transformations questions page.
USED LATER IN
CHECK YOUR PROGRESS
Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device, unless you sign in.
- Add and multiply conformable matrices, respecting the size rules and the order of factors.
- Use the zero and identity matrices, and say why AB = 0 does not force A or B to be zero.
- Read a transformation matrix from the images of the unit vectors.
- Identify and construct rotations, reflections, stretches, shears and enlargements in the plane.
- Find the equation of a curve's image under a single or composite transformation.
- Write down the standard 3 × 3 reflections in coordinate planes and rotations about axes.
- Read the area scale factor and the change of orientation off the determinant.
Open the full revision checklist to see every objective in the course in one place.