Tutorials › Linear Algebra › Order Matters in Composing Plane Transformations

Linear Transformations of R^n · Tutorial 205 of 1000

Order Matters in Composing Plane Transformations

Learn to compute and compare rotation-reflection compositions, and see with exact examples why reversing the order usually changes the output.

Intermediate 9 min read

What You'll Learn

  • Write the standard matrices for a rotation and a reflection across the x-axis.
  • Translate “first this, then that” into the correct matrix product.
  • Compute rotation-then-reflection and reflection-then-rotation.
  • Verify composite outputs by applying each transformation in sequence.
  • Determine exactly when these two transformations commute.

Why the Order of Two Actions Matters

In the plane, rotating a vector and reflecting it are each simple transformations. Applying both is also straightforward, but the order of the actions can change the result. To keep the comparison precise, we will use a rotation about the origin and a reflection across the \(x\)-axis. We will compute both possible orders and test them on vectors, including a case where the two orders happen to agree.

Vectors in \(\mathbb{R}^2\) are columns. Let \(R_\theta:\mathbb{R}^2\to\mathbb{R}^2\) be counterclockwise rotation through an angle \(\theta\), and let \(S:\mathbb{R}^2\to\mathbb{R}^2\) be reflection across the \(x\)-axis. Their standard matrices are

$$ \mathbf{R}_\theta= \begin{bmatrix} \cos\theta&-\sin\theta\\ \sin\theta&\cos\theta \end{bmatrix}, \qquad \mathbf{S}= \begin{bmatrix} 1&0\\ 0&-1 \end{bmatrix}. $$

Thus \(S(x,y)=(x,-y)\), while \(R_\theta(x,y)=(x\cos\theta-y\sin\theta,\;x\sin\theta+y\cos\theta)\). For composition, \(S\circ R_\theta\) means apply \(R_\theta\) first and then \(S\). Its matrix is \(\mathbf{S}\mathbf{R}_\theta\): the matrix for the action performed last is on the left. Conversely, \(R_\theta\circ S\), reflection first and rotation second, has matrix \(\mathbf{R}_\theta\mathbf{S}\).

Definition: The two orders are rotation then reflection, \(S\circ R_\theta\), and reflection then rotation, \(R_\theta\circ S\). They commute for a given angle if these two composite transformations have the same output for every vector in \(\mathbb{R}^2\), equivalently if their standard matrices are equal.

Compute the Two Products

Write \(c=\cos\theta\) and \(s=\sin\theta\) to keep the multiplication readable. Multiplying in the order for rotation followed by reflection gives

$$ \mathbf{S}\mathbf{R}_\theta = \begin{bmatrix}1&0\\0&-1\end{bmatrix} \begin{bmatrix}c&-s\\s&c\end{bmatrix} = \begin{bmatrix}c&-s\\-s&-c\end{bmatrix}. $$

For reflection followed by rotation, multiply in the reverse order:

$$ \mathbf{R}_\theta\mathbf{S} = \begin{bmatrix}c&-s\\s&c\end{bmatrix} \begin{bmatrix}1&0\\0&-1\end{bmatrix} = \begin{bmatrix}c&s\\s&-c\end{bmatrix}. $$

The products differ in the signs of their off-diagonal entries. That observation suggests how to compare them, but the meaning of the difference is easiest to see by applying each composite to the same input.

Proposition: For every real angle \(\theta\), the matrix of rotation followed by reflection is \(\mathbf{S}\mathbf{R}_\theta=\begin{bmatrix}\cos\theta&-\sin\theta\\-\sin\theta&-\cos\theta\end{bmatrix}\), and the matrix of reflection followed by rotation is \(\mathbf{R}_\theta\mathbf{S}=\begin{bmatrix}\cos\theta&\sin\theta\\\sin\theta&-\cos\theta\end{bmatrix}\).

Proof. The standard matrix for a composition is the product of the matrices in reverse order of the actions: the first action is applied to the input first, and the matrix of the second action multiplies its output. Therefore the two matrices are respectively \(\mathbf{S}\mathbf{R}_\theta\) and \(\mathbf{R}_\theta\mathbf{S}\). In the first product, the first row remains \((c,-s)\), and the second row of \(\mathbf{R}_\theta\) is multiplied by \(-1\), giving \((-s,-c)\). In the second product, multiplying on the right by \(\mathbf{S}\) leaves the first column unchanged and multiplies the second column by \(-1\), giving columns \((c,s)^\top\) and \((s,-c)^\top\). Substituting \(c=\cos\theta\) and \(s=\sin\theta\) gives the stated matrices. \(\square\)

Worked Comparisons

Worked Example: A Quarter-Turn and the x-Axis Reflection

Compare rotation through \(\theta=\frac{\pi}{2}\) followed by reflection with reflection followed by that rotation. Use the input \(\mathbf{x}=(1,0)^\top\).

For this angle, \(\cos\theta=0\) and \(\sin\theta=1\), so

$$ \mathbf{R}_{\pi/2}= \begin{bmatrix}0&-1\\1&0\end{bmatrix}, \qquad \mathbf{S}= \begin{bmatrix}1&0\\0&-1\end{bmatrix}. $$

First rotate, then reflect. The product is

$$ \mathbf{S}\mathbf{R}_{\pi/2} = \begin{bmatrix}1&0\\0&-1\end{bmatrix} \begin{bmatrix}0&-1\\1&0\end{bmatrix} = \begin{bmatrix}0&-1\\-1&0\end{bmatrix}. $$

Applying it to the input gives \(\begin{bmatrix}0&-1\\-1&0\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}=\begin{bmatrix}0\\-1\end{bmatrix}\). Checking the actions in sequence gives the same result: \(\mathbf{x}\) rotates to \((0,1)^\top\), and reflecting that vector gives \((0,-1)^\top\).

Now reflect first, then rotate:

$$ \mathbf{R}_{\pi/2}\mathbf{S} = \begin{bmatrix}0&-1\\1&0\end{bmatrix} \begin{bmatrix}1&0\\0&-1\end{bmatrix} = \begin{bmatrix}0&1\\1&0\end{bmatrix}. $$

The product sends \(\mathbf{x}\) to \(\begin{bmatrix}0&1\\1&0\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}=\begin{bmatrix}0\\1\end{bmatrix}\). Directly, reflection leaves \((1,0)^\top\) unchanged, and the quarter-turn sends it to \((0,1)^\top\). The outputs \((0,-1)^\top\) and \((0,1)^\top\) differ, so the order matters for this input.

Worked Example: An Exact Rotation with a Non-Unit Input

Use a rotation with cosine \(\frac35\) and sine \(\frac45\), and compare the two orders on \(\mathbf{x}=(1,2)^\top\). The rotation matrix is

$$ \mathbf{R}= \begin{bmatrix}\frac35&-\frac45\\[2pt]\frac45&\frac35\end{bmatrix}. $$

For rotation then reflection, first multiply the matrices:

$$ \mathbf{S}\mathbf{R} = \begin{bmatrix}1&0\\0&-1\end{bmatrix} \begin{bmatrix}\frac35&-\frac45\\[2pt]\frac45&\frac35\end{bmatrix} = \begin{bmatrix}\frac35&-\frac45\\[2pt]-\frac45&-\frac35\end{bmatrix}. $$

Applying this product to the input gives

$$ \begin{bmatrix}\frac35&-\frac45\\[2pt]-\frac45&-\frac35\end{bmatrix} \begin{bmatrix}1\\2\end{bmatrix} = \begin{bmatrix}\frac35-\frac85\\[2pt]-\frac45-\frac65\end{bmatrix} = \begin{bmatrix}-1\\-2\end{bmatrix}. $$

Check the sequence directly: \(\mathbf{R}\begin{bmatrix}1\\2\end{bmatrix}=\begin{bmatrix}\frac35-\frac85\\[2pt]\frac45+\frac65\end{bmatrix}=\begin{bmatrix}-1\\2\end{bmatrix}\), and reflection sends this to \(\begin{bmatrix}-1\\-2\end{bmatrix}\).

For reflection then rotation, the product and its action are

$$ \mathbf{R}\mathbf{S} = \begin{bmatrix}\frac35&-\frac45\\[2pt]\frac45&\frac35\end{bmatrix} \begin{bmatrix}1&0\\0&-1\end{bmatrix} = \begin{bmatrix}\frac35&\frac45\\[2pt]\frac45&-\frac35\end{bmatrix}, $$ $$ \begin{bmatrix}\frac35&\frac45\\[2pt]\frac45&-\frac35\end{bmatrix} \begin{bmatrix}1\\2\end{bmatrix} = \begin{bmatrix}\frac35+\frac85\\[2pt]\frac45-\frac65\end{bmatrix} = \begin{bmatrix}\frac{11}{5}\\[2pt]-\frac25\end{bmatrix}. $$

The sequential check agrees: reflection sends \((1,2)^\top\) to \((1,-2)^\top\), and rotation sends that vector to \((\frac35+\frac85,\frac45-\frac65)^\top=(\frac{11}{5},-\frac25)^\top\). This differs from the output for the other order.

Worked Example: A Half-Turn Is an Exception

Let the rotation be a half-turn, \(\theta=\pi\), and use \(\mathbf{x}=(2,-1)^\top\). Since \(\cos\pi=-1\) and \(\sin\pi=0\),

$$ \mathbf{R}_{\pi}= \begin{bmatrix}-1&0\\0&-1\end{bmatrix}, \qquad \mathbf{S}\mathbf{R}_{\pi} = \begin{bmatrix}-1&0\\0&1\end{bmatrix}, \qquad \mathbf{R}_{\pi}\mathbf{S} = \begin{bmatrix}-1&0\\0&1\end{bmatrix}. $$

Both products send the input to \(\begin{bmatrix}-1&0\\0&1\end{bmatrix}\begin{bmatrix}2\\-1\end{bmatrix}=\begin{bmatrix}-2\\-1\end{bmatrix}\). Check the sequential actions: rotation first gives \((-2,1)^\top\), then reflection gives \((-2,-1)^\top\). In the other order, reflection first gives \((2,1)^\top\), then rotation gives \((-2,-1)^\top\). Here the orders agree on this input, and the matrices show that they agree on every input.

Exactly When Do These Orders Agree?

The examples show that different orders can produce different outputs, but also that they need not always do so. The matrix formulas give a complete test for this particular rotation and reflection. Equality of transformations means equality of their standard matrices, so the entries can be compared directly.

Theorem: Rotation through \(\theta\) and reflection across the \(x\)-axis commute if and only if \(\sin\theta=0\). If \(\sin\theta\ne0\), they give different outputs for the input \(\mathbf{e}_1=(1,0)^\top\).

Proof. Put \(c=\cos\theta\) and \(s=\sin\theta\). If \(s=0\), the two product matrices are both \(\begin{bmatrix}c&0\\0&-c\end{bmatrix}\), so they send every input to the same output. Conversely, suppose the two transformations commute. Their matrices must then be equal. Comparing the entry in row 1, column 2 gives \(-s=s\), hence \(2s=0\). Since the scalars are real, \(s=0\). Finally, when \(s\ne0\), applying the products to \(\mathbf{e}_1\) gives \(\mathbf{S}\mathbf{R}_\theta\mathbf{e}_1=(c,-s)^\top\) and \(\mathbf{R}_\theta\mathbf{S}\mathbf{e}_1=(c,s)^\top\). Their second coordinates differ because \(s\ne0\), so this input explicitly witnesses the order difference. \(\square\)

For real angles, \(\sin\theta=0\) at integer multiples of \(\pi\). Thus the two transformations agree when the rotation is by a full turn or a half-turn (including repeated turns), and they do not commute at other angles. The half-turn case is not evidence that composition order is generally irrelevant; it is a specific case covered by the condition just proved.

A Common Matrix-Order Mistake

A frequent error is to reverse the matrix factors while keeping the verbal order unchanged. For example, for “rotate, then reflect,” writing \(\mathbf{R}_{\pi/2}\mathbf{S}\) is wrong: that product applies reflection first. On \(\mathbf{e}_1\), this incorrect choice gives \(\begin{bmatrix}0&1\\1&0\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}=(0,1)^\top\), whereas the stated actions rotate \(\mathbf{e}_1\) to \((0,1)^\top\) and then reflect it to \((0,-1)^\top\). The correct matrix is \(\mathbf{S}\mathbf{R}_{\pi/2}\), and it gives \((0,-1)^\top\).

To avoid this mistake, apply the actions to a test vector in words before multiplying. The first matrix encountered by the input must represent the first transformation, so it appears on the right of the product. Then check the result in both ways: multiply the composite matrix by the input, and carry out the transformations one at a time.

Check Your Understanding

For each comparison, keep track of which action occurs first and verify outputs by applying the actions in sequence.

  1. Write the matrices for rotation through \(\frac{\pi}{2}\) followed by reflection across the \(x\)-axis, and for the reverse order.
  2. Apply both orders in question 1 to \(\mathbf{x}=(0,1)^\top\). Do the outputs agree?
  3. For a rotation with \(\cos\theta=\frac{5}{13}\) and \(\sin\theta=\frac{12}{13}\), find both composite matrices and apply them to \(\mathbf{e}_1\).
  4. Prove that if the two composite matrices are equal, then \(\sin\theta=0\).
  5. Explain why agreement for the half-turn does not imply that rotation and reflection commute for every angle.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon