What Is a Linear Transformation#
A map from to is normally unknowable: to know one, you would have to inspect where every single point goes. The linear transformations (or linear maps) are the maps that respect the two vector-space operations, addition and scalar multiplication — a single constraint that is enough to store the whole map as a finite table of numbers. Formally, is linear when both of the following hold for all vectors and every scalar :
Together these say the map can be pulled through either operation in either order: “transform first, then add or scale” gives the same result as “add or scale first, then transform.” For any linear combination,
Linear example: scaling. Define by . Then
and . Scaling by a fixed factor is linear. Reflection through the origin (), rotation about the origin, and projection onto a line through the origin are also linear — we will meet them as matrices below.
Non-linear counterexample: adding a constant. Define for a fixed nonzero shift (translation). Then
These agree only when . The obstruction is the origin: a linear map must fix , since , so any translation by a nonzero vector fails linearity.
Why this matters. Linearity is the contract that makes composition cheap. Once a map is stored as a matrix, applying it to any input is one matrix–vector product, and composing two maps is one matrix multiplication. Everything from solving to changing bases and projecting data reduces to these operations.
Matrices as Transformations#
An matrix is a rectangular array of real numbers with rows and columns. Write its columns as vectors . For a vector , the matrix–vector product is the linear combination of those columns weighted by the entries of :
The result lives in . In components, the -th entry of is the dot product of the -th row of with .
Worked example. Let
The columns are and , so
Linearity of . By the column definition,
So every matrix defines a linear transformation from to .
Every linear map has a matrix. Conversely, if is linear, let be the standard basis of and form the matrix whose -th column is . Then for any ,
So linear transformations and matrices are two views of the same object: the map, and the table that stores where the basis goes.
Matrix Multiplication as Composition#
If is and is , the product is the matrix defined so that
for every . In words: applying means apply first, then apply — the right-hand factor acts first and its output feeds the left-hand factor. So is exactly the matrix of the composition .
How to compute . The -th column of is times the -th column of . Equivalently, entry of is the dot product of row of with column of . The product is defined only when the inner dimensions match ( above).
Numeric example. Compose two maps. Let
Then
Check on :
Order matters. In general . Here
Shear then scale is not the same as scale then shear. Composition of linear maps is associative, as function composition always is, so — but it is not commutative.
Geometric Examples#
Three families of matrices appear constantly in geometry, graphics, and robotics. Each is linear, so each is completely determined by where it sends the standard basis vectors and .
Rotation by angle (counterclockwise about the origin).
The first column is where goes: . The second is where goes: . For , and , so
This sends to : the unit square’s corner maps to , and maps to . Rotation is a rigid motion: , the cross terms cancelling — so lengths, and therefore the angles between vectors, are unchanged.
Scaling (stretch or shrink along the axes).
sends to . If , the map is a uniform scale (similarity). If , a circle becomes an ellipse elongated along the axis with larger absolute factor. For example, doubles horizontal distances and leaves vertical ones unchanged. Negative or also reflects through the corresponding axis.
Projection onto the -axis.
sends to . Every point collapses vertically onto the horizontal axis. A unit square with vertices at , , , becomes the segment from to (the top edge lands on the bottom). Projection is linear but not invertible: many inputs share the same output, and applying it twice is the same as applying it once (it is a projection operator: ).
Acting on a simple shape. Take the unit square’s vertices as columns of a matrix of points (or a closed path with five points including the return to the start). Multiplying on the left by , by a diagonal scale matrix, or by the -axis projection transforms every vertex the same way. The browser lab below rotates a square by and plots original versus image — the same recipe works for scaling and projection.
These geometric maps are the building blocks of Week 3’s elementary matrices (row operations as left-multiplication) and of the four-subspace picture in Week 6 (kernel and range of ). Rotation, scaling, and projection matrices are also the working language of rigid-body motion in Robot Learning Week 1: Robot Modeling and Kinematics.
The unit square (dashed) and its image under the shear . The columns of are where and land, so the image is the parallelogram spanned by those columns.
Which 2×2 matrix rotates every vector in the plane by 90° counterclockwise?
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#
Apply a 90° rotation matrix to a square and plot the result.
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)
print("Notice: R ≈ [[0, -1], [1, 0]] — the square keeps its shape and every corner rotates 90° counter-clockwise.")
Done when#
You can state the linear transformation a given 2×2 matrix represents, compute its action on a vector, and multiply two matrices as composed transformations. Check it against the browser lab: the printed R is the 90° rotation , the plot shows the square rotated a quarter-turn counter-clockwise, and matches your hand computation.
Further Reading#
- Gilbert Strang, Introduction to Linear Algebra (5th ed., Wellesley-Cambridge Press, 2016). Chapter 2 covers linear transformations and matrix multiplication, with the "matrix as a function" viewpoint.
- David C. Lay, Steven R. Lay & Judi J. McDonald, Linear Algebra and Its Applications (6th ed., Pearson, 2021). §§1.8–1.9 introduce linear transformations and their standard matrices.
- 3Blue1Brown, Essence of Linear Algebra. The videos "Linear transformations and matrices", "Matrix multiplication as composition", and "Three-dimensional linear transformations" are the geometric companion to this week.
- Stephen Boyd & Lieven Vandenberghe, Introduction to Applied Linear Algebra (Cambridge University Press, 2018). Chapter 6 treats linear transformations as matrices from an applied perspective. Freely available at vmls-book.stanford.edu.