Lesson 3.2.1 multiplied a matrix A by a vector x. Now read that product as a function: A takes each point x of the plane and sends it to Ax. A function that takes vectors to vectors is called a map, and Ax is the image of x.
Take the matrix
H=(1011)
It sends (x1,x2) to (x1+x2,x2): each point slides sideways by its own height. This map is called a shear.
point x
(0,0)
(1,0)
(0,1)
(1,1)
(−1,2)
(0,−1)
image Hx
(0,0)
(1,0)
(1,1)
(2,1)
(1,2)
(−1,−1)
Points on the horizontal axis, the x1-axis, stay where they are. Points above it move right, and points below it move left, each by its height. The unit square, with corners (0,0), (1,0), (1,1) and (0,1), leans over into a parallelogram.
What makes a map linear
A map T is linear when it keeps sums and scalings. Adding two vectors and then mapping gives the same as mapping each and then adding. Scaling by a number c and then mapping gives the same as mapping and then scaling.
Rule: A linear map
T(u+v)=T(u)+T(v)T(cu)=cT(u)
Together these say that T keeps linear combinations (lesson 3.1.1): T(au+bv)=aT(u)+bT(v). Every matrix gives a linear map: A(u+v)=Au+Av and A(cu)=cAu.
Check it on the shear with u=(1,2) and v=(3,−1). Adding first, H(4,1)=(5,1). Mapping first, Hu+Hv=(3,2)+(2,−1), the same (5,1).
Scaling works too: H(3u)=(9,6), which is 3⋅(3,2), three times Hu.
Linearity shows in the picture. The origin never moves, since T(0)=T(0u)=0T(u)=0. Straight lines stay straight, and evenly spaced parallel grid lines stay parallel and evenly spaced (or collapse together).
Two maps that are not linear:
A shift, T(x)=x+(1,0). Then T(u+v)=(5,1) but T(u)+T(v)=(6,1): the shift is counted twice. It also moves the origin to (1,0), so no matrix can shift the plane.
Squaring each component.T(2u)=(4,16), but 2T(u)=(2,8).
Try it
The first two lines check both rules for the shear: each pair is equal.
shift and square fail. The shift gives (5,1) against (6,1) and sends the origin to (1,0); squaring gives (4,16) against (2,8).
⌘/Ctrl + Enter runs the cell
The columns are where e₁ and e₂ go
Write e1=(1,0) and e2=(0,1), the standard basis of the plane. Every vector is a combination of them: (x1,x2)=x1e1+x2e2.
So for a linear map, T(x)=x1T(e1)+x2T(e2). That is the column picture of lesson 3.2.1, with columns T(e1) and T(e2). Once you know where two arrows go, you know where everything goes.
Rule: The columns are the images of the basis
Ax=x1Ae1+x2Ae2column j of A=Aej
Every linear map of the plane is a 2×2 matrix. To find it, see where e1 and e2 land, and write those two images as the columns.
The matrix A=(2−113) of lesson 3.2.1 sends e1 to (2,−1) and e2 to (1,3), its two columns. So A(3,2)=3(2,−1)+2(1,3)=(8,3).
Going the other way, suppose a map sends e1 to (1,2) and e2 to (−1,1). Its matrix has those columns, (12−11), and it sends (2,3) to 2(1,2)+3(−1,1)=(−1,7). For the shear, e1 stays put and e2 moves to (1,1).
The explorer starts on the shear. Its two coloured arrows are Ae1 and Ae2, the columns, and the shaded shape is the image of the unit square. Slide the entry b from 1 to 0.5, then to −1, and watch the grid lean the other way.
Then try the rotation and the reflection, and drag the probe x to see Ax. The readout also shows two numbers that lesson 3.4.1 and module 3.6 explain.
Explore
Pick a matrix or set its entries. Its first column is where e₁ lands and its second where e₂ lands; the whole grid follows. Then drag the probe x and look for directions that A only stretches.
Probe x = (1, 2) (drag its tip)
Matrix
A=(1011)
Columns
Ae₁ = (1, 0), Ae₂ = (1, 1)
det A
1 × 1 − 1 × 0 = 1: every area is multiplied by 1.
Probe
Ax = (3, 2): a different direction.
Eigenvalues
one, λ = 1
Try it
The loop rebuilds the shear's table of images. Then Ae1 and Ae2 come out as the columns of A, and A(3,2) matches 3Ae1+2Ae2.
np.column_stack builds a matrix from the two images, as columns.
⌘/Ctrl + Enter runs the cell
A gallery of maps
Five kinds of map appear again and again. Each one is fixed by where it sends e1 and e2; the examples use the point (3,2).
The unit square, the grid and the images of e1 and e2 under six maps. The two arrows in each panel are the columns of its matrix.
Stretch.(2000.5) doubles every horizontal distance and halves every vertical one: (3,2) goes to (6,1). A negative entry also turns arrows round: (−100−1) scales every vector by −1 (lesson 3.1.1).
Shear.(10k1) slides each point sideways by k times its height. With k=1, (3,2) goes to (5,2).
Rotation. A turn through the angle θ, anticlockwise about the origin, keeps every length. It sends e1 to (cosθ,sinθ), the point at angle θ on the unit circle (lesson 1.7.1). It sends e2 a quarter turn further on, to (−sinθ,cosθ); a quarter turn takes (a,b) to (−b,a), as in lesson 1.7.2.
Reflection.(100−1) flips the plane over the x1-axis: (3,2) goes to (3,−2). (0110) flips it over the line x2=x1 by swapping the components: (3,2) goes to (2,3).
Projection onto an axis.(1000) keeps the first component and drops the second. It sends (3,2) to (3,0), and (3,−5) there too. The whole plane lands on one line, and many points share an image; lesson 3.2.3 shows that such a map cannot be undone.
Rule: Rotation through θ
Rθ=(cosθsinθ−sinθcosθ)
The first column is the image of e1 and the second the image of e2. For a quarter turn, θ=90°, this is (01−10).
The quarter turn sends (3,2) to (−2,3), the same move as i(3+2i)=−2+3i in lesson 1.7.2. A turn through 30° sends it to (1.5981,3.2321). Both points lie 3.605551 from the origin, so the length is kept.
Maps change areas too. The projection squashes the unit square to a segment of area 0, while the shear and this stretch keep its area at 1. The factor by which a map multiplies every area is its determinant (lesson 3.4.1).
Try it
Each map of the gallery applied to (3,2), then the 30° rotation and the length of (3,2) before and after.
np.cos and np.sin take radians, so rotation converts degrees with np.radians (lesson 1.7.1). The stretch prints decimals because one of its entries is 0.5.
⌘/Ctrl + Enter runs the cell
One map after another
Apply B first and then A: x goes to Bx, then to A(Bx). Brackets can move in a product (lesson 3.2.1), so A(Bx)=(AB)x: the single matrix AB does both steps.
Rule: One map after another
A(Bx)=(AB)x
AB means "B first, then A". Read a product from right to left: the matrix next to x acts first, as in the composition f∘g of lesson 1.1.3.
Take the quarter turn R=(01−10) and the reflection F=(100−1), and follow (3,2) both ways.
order
after the first map
after the second
one matrix
rotate, then reflect
R(3,2)=(−2,3)
(−2,−3)
FR
reflect, then rotate
F(3,2)=(3,−2)
(2,3)
RF
The products agree with the table:
FR=(0−1−10)RF=(0110)
RF is the reflection in the line x2=x1 from the gallery. FR is the reflection in the line x2=−x1. Both are reflections, but in different lines, so the order matters.
Some pairs give the same result in either order. Turning through 30° and then 60° is a turn through 90°, and so is 60° then 30°. Repeating a map multiplies it by itself:
Two quarter turns make a half turn, RR=(−100−1): every vector is scaled by −1, as i2=−1 in lesson 1.7.2.
Three shears make a shear by 3: HHH=(1031).
A stretch and a shear do not commute. With S=(2000.5), shearing first gives SH=(2020.5), while stretching first gives HS=(200.50.5).
Try it
The first two lines follow (3,2) step by step and with one matrix, in both orders. Then the two products, and np.allclose confirms both orders of the 30° and 60° turns give the 90° turn.
The last lines are RR, HHH, SH and HS.
⌘/Ctrl + Enter runs the cell
Lesson 3.2.3 asks which maps can be undone, and finds the matrix that undoes them. Module 3.6 looks for the directions that a map only stretches.
Common mistakes
Columns, not rows. Column j of A is where ej goes. Writing the images as rows gives a different matrix, and a different map.
AB means B first. To rotate and then reflect, use FR, not RF.
A shift is not linear. A linear map always keeps the origin where it is, so no 2×2 matrix can shift the plane.
Mind the sign in a rotation. For an anticlockwise turn, −sinθ sits in row 1, column 2. Moving the minus sign to row 2 turns the other way.
Radians in code.np.cos and np.sin take radians; convert degrees with np.radians.
A projection loses information. Many points land on the same image, so you cannot tell which one you started from.
Matrices as maps
0 of 12 correct
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
How to type answers
Powers with ^: x^7, 2^(1/3), a^-2.
Multiply with * or by writing side by side: 3x^2, 2(x+1).
ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
Your first answer to each question is saved: it counts towards your score and brings the question back for review.
Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.
Summary card
A matrix A is a map: it sends each point x to its image Ax.
A map is linear when T(u+v)=T(u)+T(v) and T(cu)=cT(u). It keeps the origin, straight lines and evenly spaced grids; a shift is not linear.
Column j of A is Aej, the image of the basis vector ej. Every linear map of the plane is a 2×2 matrix.