Linear Transformations
Recognize linear transformations, build their matrices from the images of basis vectors, and use rotations, reflections, shears and projections.
Welcome back!
Step 1 of 11Learn
Functions that respect lines
In 3D graphics, every frame of a game moves millions of points: rotate the camera, scale a character, project the 3D world onto a flat screen. These operations share a crucial property: they are linear transformations.
A function T from ℝⁿ to ℝᵐ is linear if, for all vectors u, v and scalars c,
- T(u + v) = T(u) + T(v), and
- T(cu) = cT(u).
In words, it doesn't matter whether you add or scale before or after transforming. Geometrically, linear transformations keep the origin fixed, send lines to lines (or to a single point), and keep evenly spaced grid lines evenly spaced and parallel.
Some functions fail the test. T(x, y) = (x + 1, y) is a translation; it moves the origin, so it's not linear (T(0) must be 0 for any linear map). T(x, y) = (x², y) bends lines into curves.
Every matrix gives a linear transformation, T(x) = Ax, because matrix multiplication distributes over sums and scalars. The surprising converse is also true: every linear transformation from ℝⁿ to ℝᵐ is multiplication by some m × n matrix. Linear transformations and matrices are two views of the same thing. Graphics programmers even handle translations by adding an extra coordinate, so that a shift in 3D becomes a linear map in 4D; this trick is called homogeneous coordinates.
Step 2 of 11Practice · Select all that apply
Which of these functions from ℝ² to ℝ² are linear? Select all that apply.
Select all that apply.
Step 3 of 11Compare
Linear or not?
| Aspect | Linear | Not linear |
|---|---|---|
| Sends 0 to | 0, always | Possibly somewhere else |
| Formula looks like | Each output is a sum of constants times inputs | Constants added, products or powers of inputs |
| Geometric examples | Rotation, reflection, scaling, shear, projection | Translation, bending, squaring |
| Has a matrix? | Yes | No |
Step 4 of 11Learn
Building the matrix from basis vectors
How do you find the matrix of a transformation? Just ask where it sends the standard basis vectors.
Any vector (x, y) equals x·e₁ + y·e₂, with e₁ = (1, 0) and e₂ = (0, 1). By linearity,
T(x, y) = x·T(e₁) + y·T(e₂).
So T is completely determined by two vectors, T(e₁) and T(e₂), and these are the columns of its matrix:
A = [ T(e₁) T(e₂) ] (as columns).
Example: rotation by 90° counterclockwise. e₁ = (1, 0) rotates to (0, 1), and e₂ = (0, 1) rotates to (−1, 0). So the matrix has columns (0, 1) and (−1, 0): A = [0 −1; 1 0]. Check: A(3, 1) = (−1, 3), which is (3, 1) turned a quarter turn.
General rotation by angle θ: e₁ goes to (cos θ, sin θ) and e₂ goes to (−sin θ, cos θ):
R(θ) = [cos θ −sin θ; sin θ cos θ].
Reflection across the line y = x: swaps the coordinates, so A = [0 1; 1 0].
Horizontal shear: pushes points sideways in proportion to their height, (x, y) → (x + ky, y). Its matrix is [1 k; 0 1]. Shears turn rectangles into parallelograms without changing their area, which you can confirm: the determinant is 1.
Projection onto the x-axis: (x, y) → (x, 0), matrix [1 0; 0 0], determinant 0. It flattens the plane, which is why it can't be undone.
Step 5 of 11Try the calculator
Rotate a point
The rotation matrix R(θ) = [cos θ −sin θ; sin θ cos θ] turns any point about the origin by θ degrees counterclockwise. Enter a point and an angle. Notice the distance from the origin never changes, because rotation matrices have determinant 1 and preserve lengths.
- New x
- -1
- New y
- 3
- Distance from origin (before and after)
- 3.1623
Step 6 of 11Practice · Match the pairs
Match each transformation of the plane with its matrix.
Tap an answer, then tap the place where it belongs (or drag it there).
- Rotation by 90° counterclockwise
- Reflection across the x-axis
- Horizontal shear with factor 2
- Scaling everything by 3
- Projection onto the y-axis
Step 7 of 11Learn
Composition, kernel and range
Composition is multiplication. If you apply transformation B and then transformation A, the combined transformation has matrix AB. The order reads right to left, matching the order of application to a vector: (AB)x = A(Bx).
Example. Rotate by 90° (R = [0 −1; 1 0]), then reflect across the x-axis (F = [1 0; 0 −1]). The combined matrix is FR = [0 −1; −1 0]. Reverse the order and you get RF = [0 1; 1 0], a different transformation. This is the geometric reason matrix multiplication isn't commutative.
Rotations compose nicely: R(α)R(β) = R(α + β). Multiplying out the matrices and comparing entries gives exactly the angle-addition formulas from trigonometry, which is one of the most elegant derivations of those identities.
Kernel and range. For a transformation T(x) = Ax:
- The kernel is the set of inputs sent to 0. It's the null space of A.
- The range is the set of all outputs. It's the column space of A.
T is one-to-one (never sends two inputs to the same output) exactly when its kernel is just {0}. T is onto (reaches every vector in the output space) exactly when its range is the whole output space. For a square matrix, these two conditions are equivalent to each other and to invertibility.
The projection onto the x-axis has kernel equal to the whole y-axis and range equal to the x-axis: it's neither one-to-one nor onto ℝ².
Step 8 of 11Diagram
Composition reads right to left
Tap a shape with to see more.
- Vector x
- Apply B first
Result: Bx.
- Then apply A
Result: A(Bx).
- Same as (AB)x
The first transformation sits closest to x, on the right.
Step 9 of 11Note
Step 10 of 11Practice · Work it out
A linear transformation T has T(1, 0) = (2, 5) and T(0, 1) = (−1, 3). What is the second entry of T(4, 2)?
Step 11 of 11Practice · Choose one
Which matrix represents "first rotate by 90° counterclockwise with R = [0 −1; 1 0], then scale the x-coordinate by 2 with S = [2 0; 0 1]"?
Lesson complete!