A unit square sits on a grid. Move one entry and the grid moves with it.
Signed area ad − bc = 1.00. Columns (1.0, 0.0) and (0.0, 1.0).
The four sliders are the entries of a matrix
The amber arrow is the first column, where lands. The teal arrow is the second column, where lands. The tinted parallelogram is the image of the unit square. Its signed area is . A positive area keeps the square's orientation. A negative area flips it. Zero flattens the square onto a line.
The grid is where the integer lines go. Because the map sends lines to lines, the whole grid is fixed once those two columns are known.
What the sliders are doing#
A map from the plane to the plane is linear when it respects both operations from Week 1.
Those two rules decide everywhere once you know and . The matrix stores exactly those two images as its columns, and
Set and leave the other sliders at the identity. Horizontal distances double, and the signed area goes from to . Set instead. The square shears into a parallelogram and the area stays , because . Set . The teal arrow reverses and the area becomes negative.
Composition#
The product is the matrix of "do , then do ".
The columns of are applied to the columns of . Order matters. A shear followed by a rotation is not a rotation followed by that shear. The same rule builds the elementary matrices of Week 3.
Three maps worth naming#
Rotation by counterclockwise.
goes to . The square keeps its area, since . The lab plots this turn.
Scale. doubles horizontal distances and leaves vertical ones alone.
Projection onto the -axis. sends to . The square collapses to a segment, the signed area is , and applying the map twice changes nothing.
These three are the language of rigid motion in Robot Learning Week 1.
The unit square and its image under the shear with columns and . The signed area stays .
Knowledge Check#
If T(u+v) = T(u) + T(v) and T(cu) = cT(u) for all vectors u, v and scalars c, T is called a ___ transformation.
Browser lab: rotation matrix on a square#
The cell applies the rotation. Run it, then set the sliders to , , , and compare the picture with the plot.
import numpy as np
import matplotlib.pyplot as plt
theta = np.pi / 2
R = np.array([[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]])
square = np.array([[0, 1, 1, 0, 0],
[0, 0, 1, 1, 0]])
rotated = R @ square
fig, ax = plt.subplots(figsize=(5, 5))
ax.plot(square[0], square[1], "o-", color="tab:blue", label="original")
ax.plot(rotated[0], rotated[1], "o-", color="tab:orange", label="rotated 90°")
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.set_aspect("equal")
ax.axhline(0, color="gray", linewidth=0.5)
ax.axvline(0, color="gray", linewidth=0.5)
ax.legend()
ax.set_title("A square before and after applying R")
plt.show()
print("R =\n", R)
Key takeaways#
- A linear map of the plane is the two columns of a matrix.
- The grid is the image of the integer lines.
- The signed area of the unit square is .
- The product means do , then do .
Further reading#
- Gilbert Strang, Introduction to Linear Algebra (5th ed., Wellesley-Cambridge Press, 2016). Chapter 2.
- David C. Lay, Steven R. Lay, and Judi J. McDonald, Linear Algebra and Its Applications (6th ed., Pearson, 2021). Sections 1.8 and 1.9.
- 3Blue1Brown, Essence of Linear Algebra. The videos on linear transformations and on matrix multiplication.
- Stephen Boyd and Lieven Vandenberghe, Introduction to Applied Linear Algebra (Cambridge University Press, 2018). Chapter 6, free at vmls-book.stanford.edu.
Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.