Hello! Welcome to your next lesson in the Linear Algebra Foundations module.
In our last session, we saw that multiplying matrices is equivalent to composing, or chaining together, linear transformations. We treated the transformations themselves as a bit of a black box. Today, we're going to open that box.
This lesson is all about building a strong geometric intuition for what these transformations do. Our goal is to describe common linear transformations—specifically scaling, rotation, and shear—and understand their corresponding matrix representations. This is a cornerstone of linear algebra; it bridges the gap between abstract matrix operations and their visual, tangible effects on data and space. Understanding this is key for grasping many machine learning concepts, from Principal Component Analysis (PCA) to data augmentation in computer vision.
1. What is a Linear Transformation?
Before we get into specific examples, let's first establish what makes a transformation "linear." In essence, transformations are just functions that take an input vector and produce an output vector. We can visualize this as the input vector moving to the position of the output vector. A linear transformation is a special, "well-behaved" type of transformation.
To build a strong visual intuition for this, there's no better resource than 3Blue1Brown's "Essence of linear algebra" series.
Linear transformations and matrices | Chapter 3, Essence of linear algebra
Let's start by watching a segment from the video 'Linear transformations and matrices' by 3Blue1Brown. It brilliantly illustrates how transformations work and what makes them linear.
Please watch from 00:35 to 03:23. Focus on the two key visual properties that define a linear transformation: All lines in space must remain lines (they can't get curved). The origin must stay fixed in place. Notice how these rules result in the grid lines staying parallel and evenly spaced.
As the video shows, you can think of a linear transformation as a process that might stretch, squish, or rotate the entire space, but it does so in a consistent way that preserves the grid's structure.
2. The Key Insight: Matrices as Transformed Basis Vectors
So, how do we connect this geometric idea of "moving space" to the matrices we've been working with? Herein lies the most elegant idea in this topic. A 2D linear transformation is completely defined by just four numbers: the two coordinates for where the first basis vector () lands, and the two coordinates for where the second basis vector () lands.
Let's continue with the video to see this idea unfold.
Linear transformations and matrices | Chapter 3, Essence of linear algebra
This next segment explains the crucial link between the geometry of a transformation and the numbers inside a matrix. This is the 'why' behind matrix-vector multiplication.
Continue watching from 03:23 to 08:00. The main takeaway is this: the columns of a 2x2 transformation matrix are nothing more than the coordinates of where the basis vectors \hat{i} and \hat{j} land after the transformation.
To summarize this fundamental concept:
Suppose you have a linear transformation.
- The first basis vector, , is transformed and lands at the coordinates .
- The second basis vector, , is transformed and lands at the coordinates .
The matrix that represents this entire transformation is simply:
The first column is the transformed , and the second column is the transformed . When you multiply this matrix by any vector , you are effectively calculating where that vector lands: .
3. A Gallery of Linear Transformations
Now we can use this key idea to build the matrices for the specific transformations mentioned in our learning outcome: scaling, rotation, and shear.
Scaling
A scaling transformation stretches or squishes space along the axes. Let's say we want to scale by a factor of along the x-axis and along the y-axis.
- (the vector ) is stretched along the x-axis to become .
- (the vector ) is stretched along the y-axis to become .
Placing these into the columns of our matrix, we get the scaling matrix:
For example, a matrix would double the x-component of a vector and halve its y-component.
Rotation
Let's rotate the entire plane counter-clockwise by an angle . We just need to figure out where and land.
- starts at . After rotating by , basic trigonometry tells us it lands at .
- starts at . After rotating by , it lands at .
This gives us the rotation matrix:
Shear
A shear transformation slants the space, as if you pushed a deck of cards sideways. In a horizontal shear, the x-axis stays fixed, but points move horizontally depending on their y-value.
- lies on the x-axis, so it doesn't move. It stays at .
- is pushed horizontally by some factor . It moves from to .
The horizontal shear matrix is:

The video you watched earlier also provides quick visual derivations for rotation and shear. You can re-watch that short segment if you'd like to see it animated.
Linear transformations and matrices | Chapter 3, Essence of linear algebra
Let's quickly revisit the 3Blue1Brown video to see animated derivations for rotation and shear.
Watch the segment from 08:00 to 09:48. It demonstrates how to construct the matrices for a 90-degree rotation and a shear just by observing where the basis vectors move.
Finally, the following document provides a great cheat-sheet that formally lists the matrices for these common transformations. It's a useful reference to have.
This document from a BYU course provides a concise, formal list of the matrices for the most common transformations. This is a great reference to solidify your understanding.
Read the section titled 'Types of Linear Transformations'. It provides the general matrix forms for Stretch (Scaling), Shear, Reflection, and Rotation. Compare these formulas with the examples you saw in the video.
Notice the document uses the term "Stretch" for scaling. It also shows an example of applying these transformations to a set of points forming a horse. This highlights a practical application in computer graphics and data manipulation: to transform thousands of points, you just need to multiply the transformation matrix by the matrix of all point coordinates. For example: TransformedHorse = R @ Horse.
Test your understanding!
- What is the 2x2 matrix that rotates any vector 180 degrees counter-clockwise? (Hint: and ).
- Describe in words what the transformation represented by the matrix does to the space.
- If you apply a horizontal shear with the matrix , where does the vector land?
Show answer
-
Using the rotation matrix formula with :
This makes sense: it flips the sign of both the x and y components, which is a 180-degree rotation around the origin.
-
This is a scaling matrix where and . The transformation leaves the x-coordinates of all points unchanged but stretches the space vertically by a factor of 3.
-
We perform matrix-vector multiplication:
The vector lands on .
Conclusion
Excellent work! Today you've translated abstract matrix operations into concrete, visual transformations of space. This geometric viewpoint is incredibly powerful and will make subsequent topics in linear algebra much more intuitive.
Key Takeaways:
- A linear transformation is a mapping of vectors that keeps the origin fixed and preserves straight lines. Visually, grid lines remain parallel and evenly spaced.
- Any 2D linear transformation can be fully described by a 2x2 matrix.
- The columns of the matrix are the coordinates of the transformed basis vectors, and . This is the key to constructing any transformation matrix.
- We derived the specific matrix representations for:
- Scaling:
- Rotation (counter-clockwise):
- Horizontal Shear:
Preview of the Next Lesson:
We've seen how transformations can stretch, squish, and rotate space. This naturally leads to two questions:
- By how much does a transformation change the area of a region?
- Can we "undo" a transformation?
The answer to the first question is a special number called the determinant of a matrix. The answer to the second involves the matrix inverse. In our next lesson, we will explore both of these concepts and see how they relate directly to the geometric intuition we've built today.