Skip to content

Linear Transformations

A linear transformation is a function that maps vectors to vectors while preserving the structure of the space. In this lesson you’ll see how matrices naturally represent these transformations and why that connection is so powerful.

A linear transformation TT takes vectors as input and produces vectors as output, while satisfying two properties:

T(u+v)=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}) T(cu)=cT(u)T(c\mathbf{u}) = c \, T(\mathbf{u})

These rules mean the transformation “plays nicely” with addition and scaling.

Every linear transformation from Rn\mathbb{R}^n to Rm\mathbb{R}^m can be represented by an m×nm \times n matrix AA:

T(x)=AxT(\mathbf{x}) = A\mathbf{x}

Common linear transformations:

Rotation by θ\theta:

[cosθsinθsinθcosθ]\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}

Scaling by sxs_x and sys_y:

[sx00sy]\begin{bmatrix} s_x & 0 \\ 0 & s_y \end{bmatrix}

Projection onto x-axis:

[1000]\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}

Reflection across x-axis:

[1001]\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}

Not all transformations are linear. Translation (shifting by a constant vector) is not linear because T(0)0T(\mathbf{0}) \neq \mathbf{0}.

Rotation (90°) original rotated Scaling (2x, 0.5y) original scaled Projection (x-axis) original projected Original Rotated Scaled Projected

The diagram shows three transformations applied to the same L-shape: rotation turns it, scaling stretches it, and projection onto the x-axis flattens it down to a line. Each is defined by a single matrix.

Example 1: Rotation by 90°

R=[0110]R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}

Apply to 3,1\langle 3, 1 \rangle:

[0110][31]=[13]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 3 \\ 1 \end{bmatrix} = \begin{bmatrix} -1 \\ 3 \end{bmatrix}

The point (3,1)(3, 1) moves to (1,3)(-1, 3), a quarter turn counterclockwise.

Example 2: Scaling

S=[2000.5]S = \begin{bmatrix} 2 & 0 \\ 0 & 0.5 \end{bmatrix}

Apply to 3,4\langle 3, 4 \rangle: result is 6,2\langle 6, 2 \rangle. The x-component doubles, the y-component halves.

Example 3: Projection onto x-axis

P=[1000]P = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}

Apply to 3,4\langle 3, 4 \rangle: result is 3,0\langle 3, 0 \rangle. The y-component is completely removed.

Linear transformations are everywhere in games and graphics:

  • Every time you rotate, scale, or reflect a 3D model, you’re applying a linear transformation via a matrix
  • Camera systems use view matrices (linear transformations)
  • Animation blending involves linear combinations of transformations
  • Lighting calculations transform normal vectors
  • Physics engines transform force vectors between coordinate systems

Example: When your character turns left, the game engine applies a rotation matrix to every vertex of the character model. When the camera zooms in, it applies a scaling transformation. These happen every frame, thousands of times per second.

A linear transformation must satisfy:
Every linear transformation from $\mathbb{R}^n$ to $\mathbb{R}^m$ can be represented by:
Which of the following is NOT a linear transformation?
If $P = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$, what is $P \langle 5, 3 \rangle$?
Matrix representation of transformations is useful because: