mathlinear algebra

matrices

a grid of numbers that moves every point by one rule: turns, stretches and shears.

report a mistake
.md

a 2 × 2 matrix moves every point of the plane by one rule. its first column is where i = (1, 0) lands and its second is where j = (0, 1) lands, and every other point follows, since (x, y) is x of i plus y of j. straight lines stay straight, the origin stays put.

the columns
Ai, Aj where i and j land. read a matrix by its columns, not its rows
A(x, y)
x·Ai + y·Aj x times the first column plus y times the second
AB
B first, then A AB and BA are different moves
det A
ad − bc the factor every area is scaled by. negative: flipped over. 0: squashed flat
inverse
[d −b; −c a] / det swap a and d, negate b and c, divide by det. none when det = 0
turn by θ
cos θ, sin θ the columns are i and j turned by θ: (cos θ, sin θ) and (−sin θ, cos θ)
reach for it
  • turning, stretching and leaning shapes in 2d, and in 3d with one row and column more
  • the arrows of the vectors page, all moved at once by the same rule
  • solving linear systems and finding eigenvectors, the next two pages
on this page
  1. the idea
  2. explore
  3. try it
  4. the rules
  5. worked examples
  6. the key idea up close
  7. pitfalls
  8. practice
  9. sources

the idea

a matrix is a rule for moving every point of the plane at once. a 2 × 2 matrix is four numbers in a grid, and the picture to keep is this: its two columns are where the two unit arrows land. i=(1,0)i = (1, 0) goes to the first column and j=(0,1)j = (0, 1) to the second. every other point is some amount of ii plus some amount of jj, and it goes where that recipe says.

A=(abcd)A(xy)=x(ac)+y(bd)=(ax+bycx+dy)\begin{gathered} A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \\[8pt] A \begin{pmatrix} x \\ y \end{pmatrix} = x \begin{pmatrix} a \\ c \end{pmatrix} + y \begin{pmatrix} b \\ d \end{pmatrix} \\[8pt] = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix} \end{gathered}

so a matrix moves the whole grid in one piece: grid lines stay straight, parallel lines stay parallel and evenly spaced, and the origin never moves. what changes is where ii and jj point. the movie moves the plane one matrix at a time and follows the point (2,1)(2, 1), which is 2i+j2i + j.

−3−2−10123−3−2−10123ji(2, 1)
the shear A=(1101)A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}. its first column is (1,0)(1, 0), so ii stays. its second is (1,1)(1, 1), so jj leans over, and the grid leans with it. the unit square becomes a parallelogram with the same base and height: area 1, and det⁡A=1⋅1−1⋅0=1\det A = 1 \cdot 1 - 1 \cdot 0 = 1. the point (2,1)=2i+j(2, 1) = 2i + j lands on 2⋅(1,0)+(1,1)=(3,1)2 \cdot (1, 0) + (1, 1) = (3, 1).

an animation in five chapters on a grid from −3 to 3, with the unit square filled in, an arrow to where i lands in cyan and one to where j lands in amber, the matrix in brackets with its determinant, and the point (2, 1) followed. first the shear [1 1; 0 1]: i stays at (1, 0), j leans to (1, 1), the grid leans with it, the square becomes a parallelogram of area 1, and (2, 1) lands on (3, 1). second, a quarter turn on top of it: everything turns 90 degrees counter-clockwise, (3, 1) goes to (−1, 3), and the one matrix for both moves is [0 −1; 1 1]. third, both are undone in the reverse order: the turn back first, then the lean, and the grid is at rest again. fourth, the mirror [1 0; 0 −1]: j slides down to (0, −1), the square flips over, the determinant goes from 1 through 0 to −1, and (2, 1) lands on (2, −1). fifth, the squash [1 0; 0 0]: j slides onto the origin, the whole plane lands on the x axis, the determinant is 0, and (2, 1) and (2, −1) both land on (2, 0).

explore

set the matrix by hand. the tip of the cyan arrow is the first column and the tip of the amber one is the second, so dragging them is writing the matrix.

−3−2−10123−3−2−10123ji

drag the tip of i or j, or tab to one and use the arrow keys: 0.5 a step

A =2101
i lands on
(2, 0)
j lands on
(1, 1)
A(x, y)
x·(2, 0) + y·(1, 1)
det = a·d − b·c
2·1 − 1·0 = 2
the square
area 2, the same way round

a grid from −3 to 3 with the unit square filled in, an arrow to where i lands in cyan and one to where j lands in amber, and the matrix beside it with its first column in cyan and its second in amber. drag either tip, or tab to it and use the arrow keys, half a unit a step, and the grid and the square follow. it opens with i at (2, 0) and j at (1, 1): the matrix [2 1; 0 1], a stretch and a lean at once, and the square is a parallelogram of area 2. the readout gives the two columns, the rule A(x, y) = x·(2, 0) + y·(1, 1), the determinant worked out, 2·1 − 1·0 = 2, and what it says about the square: its area, and whether it is flipped over or flat. buttons set a preset: rest, a stretch by 2 along x, a turn of 90 degrees, a shear, the mirror that swaps i and j with determinant −1, and a squash with columns (1, 0.5) and (2, 1) that sends every point onto one line, determinant 0.

the determinant is the square's area, with a sign. put the two tips on one line through the origin and it reads 0: the plane is flat and there is no way back.

try it

A is the matrix below. where does it send (2, 1)?

2113(2, 1)

pick one.

0 / 0 right

a practice exercise with a matrix in brackets and a small grid under it: where the matrix sends a point, which move the matrix is (a stretch, a turn, a shear, a mirror or a squash onto a line), its determinant, or whether it has an inverse. after an answer the grid shows where i and j land, the image of the unit square, and for a point question where the point went.

the rules

the columns

Ai=(ac),Aj=(bd)A(x,y)=x Ai+y Aj\begin{gathered} A i = \begin{pmatrix} a \\ c \end{pmatrix}, \qquad A j = \begin{pmatrix} b \\ d \end{pmatrix} \\[8pt] A(x, y) = x \, A i + y \, A j \end{gathered}

the first column is where ii lands and the second is where jj lands. that is the whole matrix: a point is xx of ii and yy of jj, and a matrix keeps sums and multiples, so its image is xx of the first column and yy of the second. the derivation is below, in the key idea up close. to read a matrix, read its columns. (2113)\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} sends ii to (2,1)(2, 1) and jj to (1,3)(1, 3), so it sends (2,1)(2, 1) to 2⋅(2,1)+1⋅(1,3)=(5,5)2 \cdot (2, 1) + 1 \cdot (1, 3) = (5, 5).

the moves to know

stretch: (sx00sy)turn by θ: (cos⁡θ−sin⁡θsin⁡θcos⁡θ)shear: (1k01)mirror: (100−1)squash: (1000)\begin{gathered} \text{stretch: } \begin{pmatrix} s_x & 0 \\ 0 & s_y \end{pmatrix} \\[8pt] \text{turn by } \theta \text{: } \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} \\[8pt] \text{shear: } \begin{pmatrix} 1 & k \\ 0 & 1 \end{pmatrix} \\[8pt] \text{mirror: } \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \\[8pt] \text{squash: } \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} \end{gathered}

each one is its columns. a stretch is diagonal: ii goes to (sx,0)(s_x, 0) and jj to (0,sy)(0, s_y), so each axis is scaled on its own, and the same number twice scales everything evenly. a turn by θ\theta sends ii to the point at angle θ\theta on the unit circle, (cos⁡θ,sin⁡θ)(\cos\theta, \sin\theta), and jj to the point a quarter turn further, (−sin⁡θ,cos⁡θ)(-\sin\theta, \cos\theta): the circle picture from the trig page, once for each column. with θ=90°\theta = 90° it’s (0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}, and θ=180°\theta = 180° is a stretch by −1-1 both ways. a shear leaves ii alone and leans jj to (k,1)(k, 1): every point slides sideways by kk times its height, so horizontal lines stay where they are and vertical ones tilt. a mirror flips the plane over: this one negates yy, across the xx axis. (−1001)\begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix} mirrors across the yy axis, and (0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} swaps ii and jj, a mirror across the line y=xy = x. a squash, a projection, drops a dimension: this one sends jj to the origin, so every point lands on the xx axis, at its own xx. any matrix whose two columns point along one line squashes the plane onto that line.

one move after another

(AB) p=A (B p)AB=( A (Bi)    A (Bj) )(abcd)(efgh)=(ae+bgaf+bhce+dgcf+dh)\begin{gathered} (AB)\,p = A\,(B\,p) \\[8pt] AB = \big(\, A\,(Bi) \;\; A\,(Bj) \,\big) \\[8pt] \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} e & f \\ g & h \end{pmatrix} \\[8pt] = \begin{pmatrix} ae + bg & af + bh \\ ce + dg & cf + dh \end{pmatrix} \end{gathered}

ABAB is the one matrix that does BB first and then AA, read from the right, the way f(g(x))f(g(x)) runs gg first. its columns come one at a time: the first column of ABAB is where ii ends up after both moves, which is AA applied to the first column of BB, and the second column is AA applied to the second column of BB. the formula is that, written out: each column of BB is fed through AA with the rule above. entry by entry, the number in row rr and column cc of ABAB is row rr of AA times column cc of BB, matching parts multiplied and added, which is the dot product of the vectors page.

the order matters. the shear AA and the quarter turn BB from the movie:

BA=(0−110)(1101)=(0−111)AB=(1101)(0−110)=(1−110)\begin{gathered} BA = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} \\[8pt] = \begin{pmatrix} 0 & -1 \\ 1 & 1 \end{pmatrix} \\[14pt] AB = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \\[8pt] = \begin{pmatrix} 1 & -1 \\ 1 & 0 \end{pmatrix} \end{gathered}

lean then turn sends ii to (0,1)(0, 1). turn then lean sends it to (1,1)(1, 1). two different pictures, so AB≠BAAB \ne BA in general. they agree for some pairs, like two turns, or two stretches, and the cg fundamentals page has a figure of the same thing with a turn and a move.

the determinant

det⁡A=det⁡(abcd)=ad−bc\det A = \det \begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc

the determinant is the factor every area is multiplied by. the unit square, with corners at 00, ii, i+ji + j and jj, lands on the parallelogram with sides (a,c)(a, c) and (b,d)(b, d), and that parallelogram has area ∣ad−bc∣|ad - bc|: the derivation is below. since the grid is moved evenly, every shape’s area is scaled by the same factor, not only the square’s. the sign tells you which way round the shape came out. positive, and the corners still run counter-clockwise. negative, and the plane has been flipped over, as by a mirror. zero, and the square has been squashed flat: the two columns point along one line, or one of them is 00, and all of the plane lands on a line or a point. a turn and a shear have determinant 1, a stretch has sxsys_x s_y, a mirror −1-1. doing two moves multiplies the factors: det⁡(AB)=det⁡A⋅det⁡B\det(AB) = \det A \cdot \det B.

the inverse and the identity

I=(1001),AI=IA=AA−1=1ad−bc(d−b−ca)AA−1=A−1A=I(AB)−1=B−1A−1\begin{gathered} I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \qquad A I = I A = A \\[8pt] A^{-1} = \frac{1}{ad - bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix} \\[8pt] A A^{-1} = A^{-1} A = I \\[8pt] (AB)^{-1} = B^{-1} A^{-1} \end{gathered}

the identity II moves nothing: ii lands on ii and jj on jj. the inverse of AA undoes it: whatever AA did to a point, A−1A^{-1} sends it back, so one after the other is II. for a 2×22 \times 2 the recipe is: swap aa and dd, change the signs of bb and cc, and divide by the determinant. multiply it out and the off-diagonal entries cancel to 00 while the diagonal ones come to ad−bcad - bc, which the division turns into 11. the division is why a determinant of 00 means there is no inverse, and the picture says the same: a squash sends two different points to one place, and no rule can send that one place back to both. undoing two moves goes in the reverse order, the last move first: (AB)−1=B−1A−1(AB)^{-1} = B^{-1} A^{-1}. a turn’s inverse is the turn back, θ\theta to −θ-\theta, which is the same matrix with its rows and columns swapped. a mirror is its own inverse.

worked examples

where a point goes. M=(2113)M = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} and the point (2,1)(2, 1). xx times the first column plus yy times the second: 2⋅(2,1)+1⋅(1,3)=(4,2)+(1,3)=(5,5)2 \cdot (2, 1) + 1 \cdot (1, 3) = (4, 2) + (1, 3) = (5, 5). the formula agrees: (2⋅2+1⋅1, 1⋅2+3⋅1)=(5,5)(2 \cdot 2 + 1 \cdot 1,\ 1 \cdot 2 + 3 \cdot 1) = (5, 5).

a quarter turn. the turn by 90°90° has cos⁡90°=0\cos 90° = 0 and sin⁡90°=1\sin 90° = 1, so it is (0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}: ii goes to (0,1)(0, 1), straight up, and jj to (−1,0)(-1, 0). the point (3,1)(3, 1) goes to 3⋅(0,1)+1⋅(−1,0)=(−1,3)3 \cdot (0, 1) + 1 \cdot (-1, 0) = (-1, 3). for 30°30° the entries are cos⁡30°=3/2≈0.866\cos 30° = \sqrt 3 / 2 \approx 0.866 and sin⁡30°=1/2\sin 30° = 1/2, so ii lands on (0.866,0.5)(0.866, 0.5), a point on the unit circle.

two moves as one. the shear AA and the quarter turn BB from the movie. BABA column by column: BB applied to AA‘s first column, (1,0)(1, 0), is (0,1)(0, 1). BB applied to the second, (1,1)(1, 1), is (−1,1)(-1, 1). so BA=(0−111)BA = \begin{pmatrix} 0 & -1 \\ 1 & 1 \end{pmatrix}. check with the point (2,1)(2, 1): the shear sends it to (3,1)(3, 1) and the turn sends that to (−1,3)(-1, 3), and BABA sends it to 2⋅(0,1)+1⋅(−1,1)=(−1,3)2 \cdot (0, 1) + 1 \cdot (-1, 1) = (-1, 3) in one step.

the determinant. det⁡(3112)=3⋅2−1⋅1=5\det \begin{pmatrix} 3 & 1 \\ 1 & 2 \end{pmatrix} = 3 \cdot 2 - 1 \cdot 1 = 5: a shape of area 1 comes out with area 5. for any turn, cos⁡2θ+sin⁡2θ=1\cos^2\theta + \sin^2\theta = 1, so a turn never changes an area. det⁡(2412)=4−4=0\det \begin{pmatrix} 2 & 4 \\ 1 & 2 \end{pmatrix} = 4 - 4 = 0: the columns (2,1)(2, 1) and (4,2)(4, 2) point the same way, and every point lands on that line.

the inverse. M=(2113)M = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} has det⁡M=6−1=5\det M = 6 - 1 = 5. swap the diagonal, negate the rest, divide by 5: M−1=15(3−1−12)=(0.6−0.2−0.20.4)M^{-1} = \frac{1}{5} \begin{pmatrix} 3 & -1 \\ -1 & 2 \end{pmatrix} = \begin{pmatrix} 0.6 & -0.2 \\ -0.2 & 0.4 \end{pmatrix}. check: MM−1M M^{-1} has first column M(0.6,−0.2)=0.6⋅(2,1)−0.2⋅(1,3)=(1,0)M (0.6, -0.2) = 0.6 \cdot (2, 1) - 0.2 \cdot (1, 3) = (1, 0) and second column M(−0.2,0.4)=(0,1)M(-0.2, 0.4) = (0, 1): the identity. and (2412)\begin{pmatrix} 2 & 4 \\ 1 & 2 \end{pmatrix}, with determinant 0, has none: the formula would divide by 0.

undoing two moves. BABA above has det⁡=0⋅1−(−1)⋅1=1\det = 0 \cdot 1 - (-1) \cdot 1 = 1, so (BA)−1=(11−10)(BA)^{-1} = \begin{pmatrix} 1 & 1 \\ -1 & 0 \end{pmatrix}. the other way to get it: B−1B^{-1} is the turn back, (01−10)\begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}, and A−1A^{-1} is the shear back, (1−101)\begin{pmatrix} 1 & -1 \\ 0 & 1 \end{pmatrix}. A−1B−1A^{-1} B^{-1}, turn back then unlean, is (11−10)\begin{pmatrix} 1 & 1 \\ -1 & 0 \end{pmatrix}: the same. it takes (−1,3)(-1, 3) back to (2,1)(2, 1).

the key idea up close

why the columns are where i and j land

a matrix is a rule with two properties: it keeps sums and it keeps multiples. move two arrows and add them, or add them and move the sum, and you land in the same place; stretch an arrow by kk and move it, or move it and stretch, the same.

A(p+q)=Ap+AqA(kp)=k Ap\begin{gathered} A(p + q) = Ap + Aq \\[6pt] A(kp) = k\,Ap \end{gathered}

that is what it means for the grid to move as one piece, with the lines kept straight and evenly spaced. now write any point as its recipe in ii and jj and move it:

(x,y)=x i+y jA(x,y)=A(x i)+A(y j)=x Ai+y Aj\begin{aligned} (x, y) &= x\,i + y\,j \\[6pt] A(x, y) &= A(x\,i) + A(y\,j) \\[6pt] &= x\,Ai + y\,Aj \end{aligned}

so the whole move is pinned down by two arrows, AiAi and AjAj: where ii lands and where jj lands. write those two arrows side by side as columns and you have the matrix. the formula (ax+by, cx+dy)(ax + by,\ cx + dy) is this sum with the columns filled in. the same reasoning in three dimensions gives three columns, where ii, jj and kk land, and the 3×33 \times 3 and 4×44 \times 4 matrices of the cg fundamentals page read the same way.

why the area factor is ad − bc

the unit square lands on the parallelogram with sides (a,c)(a, c) and (b,d)(b, d). take the case where both columns point into the first quadrant with the first one lower, as in the explore figure’s opening matrix. box the parallelogram in the rectangle from the origin to (a+b,c+d)(a + b, c + d), area (a+b)(c+d)(a + b)(c + d), and cut away what isn’t parallelogram: two a×ca \times c right triangles, two b×db \times d right triangles, and two b×cb \times c rectangles.

(a+b)(c+d)−ac−bd−2bc=ac+ad+bc+bd−ac−bd−2bc=ad−bc\begin{aligned} &(a + b)(c + d) - ac - bd - 2bc \\[6pt] &= ac + ad + bc + bd \\[2pt] &\qquad - ac - bd - 2bc \\[6pt] &= ad - bc \end{aligned}

in the other arrangements the same bookkeeping gives ad−bcad - bc or its negative, and the sign records which way round the corners run: negative when the second column sits clockwise of the first, which is the flip. every other shape is scaled by the same factor, because a shape is a sum of small squares of the grid and each one lands on a copy of the same parallelogram.

pitfalls

practice

  1. A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}. where does it send (1,−1)(1, -1), and where (0,2)(0, 2)?

    answer

    xx times the first column plus yy times the second. (1,−1)→1⋅(1,3)−1⋅(2,4)=(−1,−1)(1, -1) \to 1 \cdot (1, 3) - 1 \cdot (2, 4) = (-1, -1). (0,2)→0⋅(1,3)+2⋅(2,4)=(4,8)(0, 2) \to 0 \cdot (1, 3) + 2 \cdot (2, 4) = (4, 8): a point on the yy axis lands on a multiple of the second column.

  2. which move is (0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, and which is (3003)\begin{pmatrix} 3 & 0 \\ 0 & 3 \end{pmatrix}? give each determinant.

    answer

    the first sends ii to (0,1)(0, 1) and jj to (1,0)(1, 0): they trade places, which is the mirror across the line y=xy = x. det⁡=0⋅0−1⋅1=−1\det = 0 \cdot 0 - 1 \cdot 1 = -1, the flip. the second is diagonal with the same number twice: a stretch by 3 in every direction. det⁡=9\det = 9, since a square 3 times as wide and 3 times as tall has 9 times the area.

  3. S=(2001)S = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix} stretches xx by 2 and H=(1101)H = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} is the shear. find SHSH and HSHS, and say what each does to jj.

    answer

    SHSH is SS applied to the columns of HH: S(1,0)=(2,0)S(1, 0) = (2, 0) and S(1,1)=(2,1)S(1, 1) = (2, 1), so SH=(2201)SH = \begin{pmatrix} 2 & 2 \\ 0 & 1 \end{pmatrix}. HSHS is HH applied to the columns of SS: H(2,0)=(2,0)H(2, 0) = (2, 0) and H(0,1)=(1,1)H(0, 1) = (1, 1), so HS=(2101)HS = \begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix}. lean first and then stretch, and the lean is stretched too: jj lands on (2,1)(2, 1). stretch first and then lean, and jj lands on (1,1)(1, 1), as under the shear alone, since the stretch left jj where it was.

  4. find the determinant and the inverse of (4726)\begin{pmatrix} 4 & 7 \\ 2 & 6 \end{pmatrix}, and check the inverse on ii.

    answer

    det⁡=4⋅6−7⋅2=24−14=10\det = 4 \cdot 6 - 7 \cdot 2 = 24 - 14 = 10. swap the diagonal, negate the rest, divide by 10: 110(6−7−24)=(0.6−0.7−0.20.4)\frac{1}{10} \begin{pmatrix} 6 & -7 \\ -2 & 4 \end{pmatrix} = \begin{pmatrix} 0.6 & -0.7 \\ -0.2 & 0.4 \end{pmatrix}. check: the matrix sends ii to (4,2)(4, 2), and the inverse sends (4,2)(4, 2) to 4⋅(0.6,−0.2)+2⋅(−0.7,0.4)=(2.4−1.4, −0.8+0.8)=(1,0)4 \cdot (0.6, -0.2) + 2 \cdot (-0.7, 0.4) = (2.4 - 1.4,\ -0.8 + 0.8) = (1, 0), which is ii again.

  5. for which kk does (2k36)\begin{pmatrix} 2 & k \\ 3 & 6 \end{pmatrix} have no inverse? what does the matrix do to the plane then?

    answer

    no inverse means det⁡=0\det = 0: 2⋅6−3k=02 \cdot 6 - 3k = 0, so k=4k = 4. then the columns are (2,3)(2, 3) and (4,6)(4, 6), and the second is twice the first: both point along the same line, and every point lands on it. the plane is squashed onto the line through (2,3)(2, 3), and two different points land in one place, so there is nothing to invert.

  6. a triangle has area 5. what is the area of its image under M=(2113)M = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}, and under the quarter turn (0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}? is either image flipped over?

    answer

    every area is multiplied by the determinant’s size. det⁡M=6−1=5\det M = 6 - 1 = 5, so the image has area 5⋅5=255 \cdot 5 = 25. the quarter turn has det⁡=0⋅0−(−1)⋅1=1\det = 0 \cdot 0 - (-1) \cdot 1 = 1, so its image still has area 5. both determinants are positive, so neither image is flipped: the corners run the same way round as before. a mirror would give −1-1 and a flipped triangle of the same size.

sources

  1. mdn’s CanvasRenderingContext2D.transform() (opens in a new tab) page: transform(a, b, c, d, e, f) sends a point (x,y)(x, y) to (ax+cy+e, bx+dy+f)(ax + cy + e,\ bx + dy + f). with bb and cc at 0, aa and dd scale; with aa and dd at 1, bb and cc skew; ee and ff translate. ↩

  2. css transforms module level 1 (opens in a new tab), section 3, the transform rendering model: the yy axis increases vertically downwards. section 9.1, on rotate(): rotate(90deg) makes an element appear turned a quarter turn clockwise. ↩

  3. mdn’s rotate() (opens in a new tab) page: in a left-to-right page a positive angle is a clockwise turn, and the function’s matrix is written out with cos⁡a\cos a and sin⁡a\sin a in the same places as the turn above. ↩