Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Matrices and Transforms  ›  Lesson

Linear Transformations: Scale and Rotate

Linear Transformation 15 minA linear transformation such as a scale or a rotation is fully described by where the x and y unit arrows land, and those two landing points are the columns of its matrix.

Linear Transformations: Scale and Rotate

When the drone clips a gull, it tumbles through the air. Each frame of that tumble turns the sprite a little further, and each turn is a matrix. That sounds like a formula to memorise, but there's a way to build any such matrix from scratch in seconds: watch where two small arrows go.

The rule

A matrix's columns are where the x and y arrows land.

Multiply any matrix by (1,0)(1, 0) and out comes its first column; multiply by (0,1)(0, 1) and out comes its second. Every other vector is a mix of those two, so knowing where they land tells you everything. A transformation that works like this is linear: it keeps the origin fixed, keeps straight lines straight, and keeps evenly spaced grid lines evenly spaced.

Scale. Stretch x by sxs_x and y by sys_y: (1,0)(1, 0) lands on (sx,0)(s_x, 0) and (0,1)(0, 1) on (0,sy)(0, s_y), so the matrix is [sx00sy]\begin{bmatrix} s_x & 0 \\ 0 & s_y \end{bmatrix}. The landing squash from the last lesson is one of these.

Rotate by an angle θ\theta, counter-clockwise. The x arrow swings to (cos⁡θ,sin⁡θ)(\cos\theta, \sin\theta) and the y arrow to (−sin⁡θ,cos⁡θ)(-\sin\theta, \cos\theta), so

R(θ)=[cos⁡θ−sin⁡θsin⁡θcos⁡θ]R(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}

For a quarter-turn, 90°, that is [0−110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, which sends (x,y)(x, y) to (−y,x)(-y, x).

Combine two transformations by multiplying their matrices. "First A, then B" is the product BABA, read right to left, because the vector meets A first. The order matters. Stretch x by 2 and then turn 90°: (1,0)→(2,0)→(0,2)(1, 0) \to (2, 0) \to (0, 2). Turn first and then stretch x: (1,0)→(0,1)→(0,1)(1, 0) \to (0, 1) \to (0, 1). Two different answers.

The shortcut

Don't memorise matrices — build them. Ask where (1,0)(1, 0) lands and write it down as the first column; ask where (0,1)(0, 1) lands and write it as the second.

Building the quarter-turn of the tumbleStep 1 of 5
  1. Where does the x arrow go?

    Turning (1, 0) a quarter-turn counter-clockwise points it straight up: (0, 1). That's the first column.

The trap is writing where the arrows land as rows instead of columns. For a rotation that quietly gives you the rotation the other way round.

Drills

Answer fast — trust the rule.

quick drill

A transformation sends (1, 0) to (3, 0) and (0, 1) to (0, 2). Which matrix is it?

quick drill

Rotate (0, 3) by 90° counter-clockwise. Where does it land?

quick drill

Rotate (4, 0) by 30° counter-clockwise. Where does it land?

quick drill

Stretch x by 2, then rotate 90° counter-clockwise. Where does (1, 0) end up?

quick drill

Which of these is NOT a linear transformation?

Remember

  • A matrix's columns are where (1, 0) and (0, 1) land.
  • Rotation by θ has columns (cos θ, sin θ) and (−sin θ, cos θ); a quarter-turn sends (x, y) to (−y, x).
  • "First A, then B" is BA: order matters, and writing rows for columns reverses a rotation.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainMirror the drone

Build the matrix that mirrors the drone sprite left-to-right so that it faces the other way. Explain how you found each column, and say where the point (2, 1) ends up.