Matrices for Transformations (Intermediate Introduction)
From the Transformation of the plane curriculum
TL;DR
Matrices are powerful tools that let you represent geometric transformations like rotations, reflections, and scaling in a compact way. By multiplying a position vector by a transformation matrix, you can find its new coordinates after the transformation. This approach simplifies complex transformations and makes them easy to combine.
1. The Mental Model
Think of a transformation matrix as a special kind of "operator" that changes where points are in space. You give it a point's coordinates, and it tells you the point's new location after a specific movement or change.
2. The Core Material
When we talk about transformations like rotations, reflections, scaling, and shears, we can represent them using matrices. This is super useful because it allows us to apply these changes consistently to any point and even combine multiple transformations into a single matrix.
A point in a 2D plane can be written as a column vector: $\begin{pmatrix} x \\ y \end{pmatrix}$. A transformation matrix for 2D is a 2x2 matrix: $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$.
To transform a point $(x, y)$, you multiply the transformation matrix by the point's vector:
New Point Vector = Transformation Matrix × Original Point Vector
$\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}$
This multiplication works out to:
$x' = ax + by$
$y' = cx + dy$
Let's look at some common 2D transformation matrices.
Scaling
Scaling changes the size of an object. If you want to scale by a factor of $s_x$ in the x-direction and $s_y$ in the y-direction, the matrix is:
$S = \begin{pmatrix} s_x & 0 \\ 0 & s_y \end{pmatrix}$
If $s_x = s_y$, it's a uniform scale.
Rotation
Rotation turns an object around the origin. For a rotation by an angle $\theta$ (counter-clockwise) around the origin, the matrix is:
$R = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix}$
Reflection
Reflecting across an axis or line flips the object.
* Reflection across the x-axis: $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$
* Reflection across the y-axis: $\begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix}$
* Reflection across the line y=x: $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$
Shear
Shearing "skews" an object.
* Shear in x-direction (by factor $k$): $\begin{pmatrix} 1 & k \\ 0 & 1 \end{pmatrix}$
* Shear in y-direction (by factor $k$): $\begin{pmatrix} 1 & 0 \\ k & 1 \end{pmatrix}$
Combining Transformations
This is where matrices really shine! If you want to apply multiple transformations, say a rotation then a scale, you just multiply their matrices together. The order matters! To apply transformation A then transformation B, the combined matrix is B multiplied by A (reading from right to left for the order of operations).
Combined Matrix = $M_2 \times M_1$ (Apply $M_1$ first, then $M_2$)
graph TD
A["Original Point (x, y)"] --> B{{"Apply Transformation 1 (Matrix M1)"}};
B --> C["Intermediate Point (x', y')"];
C --> D{{"Apply Transformation 2 (Matrix M2)"}};
D --> E["Final Point (x'', y'')"];
subgraph Combined Transformation
M_combined{{"M_combined = M2 x M1"}};
end
A --> M_combined;
M_combined --> E;
Notice how applying $M_1$ then $M_2$ is equivalent to applying one combined matrix $(M_2 \times M_1)$ directly to the original point. This is very efficient for computer graphics!
Homogeneous Coordinates (Briefly)
The transformations above all keep the origin in place. What about translations (moving without rotating, scaling, etc.)? For translations, we use something called homogeneous coordinates. We add an extra dimension, typically setting it to 1 for points.
A 2D point $(x, y)$ becomes $(x, y, 1)$. Now, a translation can be represented by a 3x3 matrix:
$T = \begin{pmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{pmatrix}$
where $t_x$ and $t_y$ are the translation amounts. This allows all affine transformations (translation, rotation, scaling, shear) to be represented as matrix multiplications, making combined transformations even more powerful. For now, focus on 2x2 matrices for non-translational changes.
3. Worked Example
Let's rotate a point (3, 2) by 90 degrees counter-clockwise around the origin and then scale it by 2 in the x-direction and 0.5 in the y-direction.
Step 1: Define the original point.
$P = \begin{pmatrix} 3 \\ 2 \end{pmatrix}$
Step 2: Define the rotation matrix for 90 degrees.
$\theta = 90^\circ = \pi/2$ radians.
$\cos(90^\circ) = 0$
$\sin(90^\circ) = 1$
$R = \begin{pmatrix} \cos 90^\circ & -\sin 90^\circ \\ \sin 90^\circ & \cos 90^\circ \end{pmatrix} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$
Step 3: Define the scaling matrix.
$s_x = 2$, $s_y = 0.5$
$S = \begin{pmatrix} 2 & 0 \\ 0 & 0.5 \end{pmatrix}$
Step 4: Combine the transformations.
Since we rotate then scale, the combined matrix $M = S \times R$.
$M = \begin{pmatrix} 2 & 0 \\ 0 & 0.5 \end{pmatrix} \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$
$M = \begin{pmatrix} (2 \times 0 + 0 \times 1) & (2 \times -1 + 0 \times 0) \\ (0 \times 0 + 0.5 \times 1) & (0 \times -1 + 0.5 \times 0) \end{pmatrix}$
$M = \begin{pmatrix} 0 & -2 \\ 0.5 & 0 \end{pmatrix}$
Step 5: Apply the combined matrix to the point.
$P' = M \times P = \begin{pmatrix} 0 & -2 \\ 0.5 & 0 \end{pmatrix} \begin{pmatrix} 3 \\ 2 \end{pmatrix}$
$P' = \begin{pmatrix} (0 \times 3 + -2 \times 2) \\ (0.5 \times 3 + 0 \times 2) \end{pmatrix}$
$P' = \begin{pmatrix} -4 \\ 1.5 \end{pmatrix}$
So, the point (3, 2) becomes (-4, 1.5) after being rotated 90 degrees and then scaled.
4. Key Takeaways
- Matrices provide a concise way to represent geometric transformations in a coordinate system.
- To transform a point, you multiply the transformation matrix by the point's position vector.
- Common 2D transformations (scaling, rotation, reflection, shear) each have a specific 2x2 matrix representation.
- You can combine multiple transformations by multiplying their matrices together, but the order of multiplication is crucial.
- The order of matrix multiplication represents the sequence of transformations applied to the original point.
- Matrices make it easy to apply the same complex transformation to many points efficiently.
- For translations, you typically need to use homogeneous coordinates and 3x3 matrices in 2D.
Common Mistakes to Avoid:
- Incorrect Order of Multiplication: Always remember that for transformations $M_1$ then $M_2$, the combined matrix is $M_2 \times M_1$.
- Confusing Row/Column Vectors: Always represent points as column vectors when multiplying with transformation matrices.
- Math Errors: Be careful with the signs in rotation matrices and when performing matrix multiplication.
- Not Resetting for Transformations around an Arbitrary Point: If you need to rotate or scale around a point other than the origin, you'll need to translate the object so that point is at the origin, perform the transformation, and then translate back. (This involves homogeneous coordinates).
5. Now Try It
You have a square with vertices at (0,0), (1,0), (1,1), and (0,1).
1. First, reflect the square across the y-axis.
2. Then, rotate the reflected square by -90 degrees (90 degrees clockwise) around the origin.
Calculate the final coordinates of all four vertices after these two transformations. What would be the single combined 2x2 matrix that performs both of these transformations? What does this final combined matrix look like?
Try it yourself: 2×2 matrices: determinant and inverse
Frequently asked about Matrices for Transformations (Intermediate Introduction)
More from Transformation of the plane
Get the full Transformation of the plane curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free