Chapter 3

Linear Transformations

What if you could take the entire plane and move it — stretch it, rotate it, squish it — but keep all the grid lines straight and evenly spaced?

That's the central idea of linear algebra. Not just individual vectors, but entire operations on space. Picture a rubber sheet (the plane) pinned at the origin. You can stretch it, rotate it, shear it — as long as the grid lines stay straight and evenly spaced, you've got a linear transformation.

Let's see what that looks like.

The Original Grid

Here's our starting point: a clean coordinate plane with the two basis vectors — ı^\hat{\imath} in blue pointing right, ȷ^\hat{\jmath} in green pointing up. We've marked three reference points so you can track where they end up after each transformation.

î ĵ (1, 1) (2, −1) (−1, 2)

The original grid. Everything is about to move.

After a Shear

Now we apply a shear. The rule is simple: ı^\hat{\imath} stays at (1,0)(1, 0), but ȷ^\hat{\jmath} slides over to (1,1)(1, 1). Every point (x,y)(x, y) in the plane moves to (x+y,  y)(x + y,\; y).

Watch what happens to the grid. The horizontal lines don't move at all. But the vertical lines tilt — they become diagonal. The critical thing: every line is still straight, and the spacing between them is still even. That's what makes this a linear transformation.

î (1, 0) ĵ → (1, 1) (2, 1) (1, −1) (1, 2)

A shear tilts the grid, but lines stay straight and parallel. That's what makes it linear.

Track those reference points. (1,1)(1, 1) slid right to (2,1)(2, 1). The point (1,2)(-1, 2) moved from the far left to (1,2)(1, 2). Every point moved in a predictable, uniform way — no stretching in some places and compressing in others.

NOT a Linear Transformation

Now look at what happens when we break the rules. Here's a transformation that bends and curves the grid lines. Points that were evenly spaced get bunched together in some areas and spread apart in others.

NOT LINEAR

Curved grid lines means it's not linear. The structure is broken.

This is the kind of warping you get from, say, a fish-eye lens or a gravity well in a game. The grid lines curve. Parallel lines stop being parallel. Evenly-spaced points bunch up and spread out. Whatever nice properties we had — gone.

The distinction matters: linear transformations are the ones where math stays clean. Non-linear transformations are harder by orders of magnitude.

Rotation

Rotation is the most satisfying linear transformation to watch. The entire grid spins as a rigid unit — every angle preserved, every distance preserved, every grid line still straight and evenly spaced.

Here's a 30° counter-clockwise rotation:

î′ ĵ′ (0.37, 1.37) (2.23, 0.13) (−1.87, 1.23)

Rotation preserves the grid perfectly. Distances, angles, everything. It's linear.

Notice the dashed lines showing where ı^\hat{\imath} and ȷ^\hat{\jmath} used to be. The whole plane turned 30° counter-clockwise as a single rigid sheet. No distortion, no stretching. That's rotation for you.

The Formal Bit

So what exactly is a linear transformation? Two properties. That's it.

A function TT that takes vectors in and spits vectors out is a linear transformation if:

T(v+w)=T(v)+T(w)T(\vec{v} + \vec{w}) = T(\vec{v}) + T(\vec{w})

T(cv)=cT(v)T(c\vec{v}) = cT(\vec{v})

The first rule says: transform then add gives the same result as add then transform.

The second says: transform then scale gives the same result as scale then transform.

These two rules might look abstract, but they're exactly what forces the grid to behave. If you add two vectors and then transform, you get the same thing as transforming each one separately and then adding. That means the transformation can't do anything "weird" to the space — it can't treat different regions differently.

Together, these two properties guarantee three things about the grid:

  1. Grid lines stay straight — no curving allowed
  2. Grid lines stay evenly spaced — no bunching or spreading
  3. The origin stays fixedT(0)=0T(\vec{0}) = \vec{0}, always

That third one is free. Set c=0c = 0 in the second rule: T(0v)=0T(v)=0T(0 \cdot \vec{v}) = 0 \cdot T(\vec{v}) = \vec{0}.

Worked Example: Rotating a Game Sprite

Let's make this concrete. You're building a 2D game, and you need to rotate a sprite — say, a small square representing a character — by 45°.

Your character has four corner vertices:

Vertex Position
Top-right (1,1)(1, 1)
Top-left (1,1)(-1, 1)
Bottom-left (1,1)(-1, -1)
Bottom-right (1,1)(1, -1)

For a counter-clockwise rotation by angle θ\theta, the formulas are:

x=xcosθysinθx' = x\cos\theta - y\sin\theta

y=xsinθ+ycosθy' = x\sin\theta + y\cos\theta

For 45°, cos(45°)=sin(45°)=220.707\cos(45°) = \sin(45°) = \tfrac{\sqrt{2}}{2} \approx 0.707.

Let's transform each vertex:

Original Calculation Result
(1,1)(1, 1) (0.7070.707,  0.707+0.707)(0.707 - 0.707,\; 0.707 + 0.707) (0,1.414)(0, 1.414)
(1,1)(-1, 1) (0.7070.707,  0.707+0.707)(-0.707 - 0.707,\; -0.707 + 0.707) (1.414,0)(-1.414, 0)
(1,1)(-1, -1) (0.707+0.707,  0.7070.707)(-0.707 + 0.707,\; -0.707 - 0.707) (0,1.414)(0, -1.414)
(1,1)(1, -1) (0.707+0.707,  0.7070.707)(0.707 + 0.707,\; 0.707 - 0.707) (1.414,0)(1.414, 0)

The square rotated into a diamond. But it's still a square — same side lengths, same angles. The shape didn't distort because rotation is a linear transformation: it preserves relative positions.

before after (0, 1.41) (−1.41, 0) (0, −1.41) (1.41, 0) 45°

In code, this is exactly what happens when you call a rotation function in a game engine or graphics library. Under the hood, it applies the same linear transformation to every vertex. Because it's linear, you know the shape won't get mangled — just moved.

Key Takeaway: A linear transformation moves the entire plane while keeping grid lines parallel and evenly spaced. That constraint — straight lines in, straight lines out — is what makes the math tractable and the computations fast.

What's Next

We've seen what linear transformations do to the plane. But how do you describe one concretely? You don't need to specify what happens to every single point — you just need to say where two special vectors land. Those two destinations are enough to reconstruct the entire transformation.

That idea leads us directly to matrices.