2.5 Matrices as maps, multiplication, change of basis
A matrix is the list of where a linear map sends the basis vectors. Multiplying matrices is composing maps, and changing basis changes the matrix but not the map.
Taught in 375/376Apostol, not taughtBeyond the courseApostol 2.10 to 2.16 and 4.9Spagnolie, Lectures 10, 11 and 17MATH 375 HW6 and HW7
Chapter 2.3 showed that a linear map is decided by what it does to a basis, and 2.4 showed that you may choose those values freely. This chapter writes that information down as a rectangular table of numbers, a matrix, so it can be computed with. Then it asks three questions. How do you read what a matrix does? Why does multiplying two matrices use that strange row-times-column rule? And what happens to the table when you describe the same map using a different basis?
Quick checkA linear map T of the plane has T(1,0)=(2,3) and T(0,1)=(0,1). What is T(1,1)?
(1,1)=(1,0)+(0,1), and a linear map respects addition, so T(1,1)=(2,3)+(0,1)=(2,4). A linear map is decided by its values on a basis.Review: linear maps
Quick checkS and T are invertible maps. Which is the inverse of ST?
ST applies T first, so the inverse must undo S first and then T: socks and shoes.Review: socks and shoes
Quick checkWhat are the coordinates of (3,1) in the basis b1=(1,1), b2=(1,−1)?
Solve c1(1,1)+c2(1,−1)=(3,1): c1+c2=3 and c1−c2=1 give c1=2, c2=1. The coordinates depend on the basis; (3,1) is only the answer for the standard basis.Review: coordinates
The picture
This is the visualizer from 2.3 with one new reading. The two arrows ^ and ^ are the standard basis vectors. Drag their tips anywhere. The numbers in the corner, the matrix A, are the coordinates of where the two arrows landed: first column where ^ went, second column where ^ went. Look at the purple vector v. It is v1^+v2^, so it lands at v1 times the first column plus v2 times the second column. That sentence is the whole of matrix-times-vector.
Try the following. Pick “Rotate 90°” and read off the matrix: ^ goes to (0,1) and ^ goes to (−1,0), so the columns are (0,1) and (−1,0). Then pick “Reflect” and “Stretch” and do the same. In every case you can write the matrix down by looking at two arrows.
The idea, in words
A linear map T from an n-dimensional space to an m-dimensional space is decided by the n vectors T(e1),…,T(en) (2.3). Each is a vector in the target, so each is a list of m coordinates. Stand those n lists side by side as columns, and you have a table with m rows and n columns: the matrix of T. Two things then happen.
Reading the table. The image of any vector is a combination of the columns, with the vector’s own coordinates as the weights. That is the 3Blue1Brown way to see a matrix, and Spagnolie’s ‘triple-starred’ picture in Lecture 10.
Chaining. If you chain two maps, the columns of the chain are the second matrix applied to the columns of the first. Writing that out gives the row-times-column rule. It looks arbitrary only if you forget that it came from composition.
Why· Why the table depends on the basis, and why that is fine
The columns are coordinates, and coordinates depend on the basis (2.2). The same map has different tables in different bases. That is no problem: the map is the real object, and a matrix is a description of it in a chosen language. The last section of the chapter shows how to translate between two descriptions, and why a good choice of basis can make a table far simpler.
Definitions and theorems
Matrices as arrays
Definition T
Matrix
An m×nmatrix is a rectangular array of numbers with m rows and n columns, written A=(aij) where aij is the entry in row i and column j. The first subscript is the row. A matrix with one column is a column vector. A matrix with m=n is square. The set of all real m×n matrices is Rm×n (Apostol: Mm,n).
In one lineA rectangular array of numbers with m rows and n columns; aij is the entry in row i and column j.
Why it existsIt is the compact table that records a linear map once bases are chosen, and also an object you can add and multiply in its own right.
Matrices of the same size are added, and scaled, entry by entry. This is the vector space Rm×n of 2.1.
Theorem AApostol 2.13
Matrix space has dimension mn
Let Eij be the m×n matrix with a 1 in row i, column j, and 0 everywhere else. The mn matrices Eij form a basis of Rm×n, so dimRm×n=mn.
In one lineThe space of m×n matrices has dimension mn.
Why it is trueA matrix is mn free numbers, and the matrices with a single 1 record each number separately.
ProofApostol 2.13
The idea: Spanning: any matrix is the sum of its entries times the E's. Independence: a combination of the E's has the coefficients as its entries.
Spanning: for any A=(aij), A=∑i,jaijEij.
The (i,j) entry of ∑p,qapqEpq is aij, because only Eij has a nonzero entry there.
Independence: suppose ∑cijEij is the zero matrix.
Same computation: the combination has entry cij at position (i,j).
Then each cij=0. So the Eij are independent and span: they are a basis, and there are mn of them.
Every entry of the zero matrix is 0.
The matrix of a linear map
Definition T
Matrix of a linear map
Let T:V→W be linear. Choose ordered bases (e1,…,en) of V and (w1,…,wm) of W. Write each image in the basis of W:
T(ek)=i=1∑mtikwi,k=1,…,n.
The matrix of T relative to these bases is the m×n matrix m(T)=(tik). Its kth column is the coordinates of T(ek). Call the two bases E=(e1,…,en) and W=(w1,…,wm). When the bases need naming we write mE→W(T) (Spagnolie’s Ae→w). For a vector x we write [x]E for the column of its coordinates in the basis E.
In one lineWith bases chosen, the matrix whose column k is the coordinates of T(ek).
Why it existsIt stores everything about T in a table, because T is decided by its values on a basis.
A warning about notation. The letter m now has two jobs: it is the number of rows, and (following Apostol) it is the name of the function T↦m(T) that produces the matrix. When m is followed by a map in brackets, as in m(T), it is the matrix of that map.
A tip on shape: the shape is (dimension of the target) by (dimension of the source). A map from R3 to R2 has a 2×3 matrix: it takes in columns of height 3, so it must have 3 columns, and it puts out columns of height 2.
Quick checkA linear map of the plane has T(e1)=(1,2) and T(e2)=(3,4). What is its matrix in the standard basis?
Each image is a COLUMN: column 1 is T(e1)=(1,2) and column 2 is T(e2)=(3,4). The first option writes them as rows, which is the transpose and a different map.
Worked example Apostol 2.10 Ex. 2; Spagnolie Lecture 10
Find the matrix of differentiation D from P3 to P2 in the standard bases, and again in the bases (x,21x2,31x3,1) and (1,x,x2)
Solution.
Fix the bases. For the source P3 (cubics, dimension 4) take e=(1,x,x2,x3). For the target P2 (dimension 3) take w=(1,x,x2). The matrix needs an ordered basis on each side. The matrix will be 3×4: target dimension by source dimension.
Differentiate each source basis vector and write the answer in w.D(1)=0=(0,0,0), D(x)=1=(1,0,0), D(x2)=2x=(0,2,0), D(x3)=3x2=(0,0,3). Column k is the coordinates of T(ek) in the target basis.
Place the four columns side by side.
m(D)=000100020003.
Columns, not rows: each image becomes a column.
4. Now change the bases. Take e′=(x,21x2,31x3,1) and keep w. Then D(x)=1=(1,0,0), D(21x2)=x=(0,1,0), D(31x3)=x2=(0,0,1), D(1)=0. We chose source vectors that D sends exactly onto the target basis vectors, and the last one from the null space.
5. Write the new matrix.
m(D)=100010001000.Same map, much simpler table. The ones form an identity block of size 3, the rank of D, and the zero column is the null space.
Answer. The two matrices above. Same map, different bases, different tables.
Step 4 is a special case of a general fact, stated later in the chapter as the ‘diagonal form’ theorem. First, the central result: how to compute with a matrix.
Theorem TApostol Thm 2.13; Spagnolie Lecture 10
Matrix times vector
Let m(T)=(tik) be the matrix of T relative to bases E=(ek) and W=(wi). If x=∑kxkek then T(x)=∑iyiwi with
where the matrix-times-column on the right is defined by the displayed formula. Equivalently, [T(x)]W=x1F1+⋯+xnFn, where Fk is column k of m(T).
In one lineIf x has coordinates xk, then T(x) has coordinates yi=∑ktikxk, which is x1⋅(column 1)+⋯+xn⋅(column n).
Why it is trueExpand x in the basis, push T through, and read the coefficient of each wi.
ProofApostol 2.10; Spagnolie Lecture 10
The idea: Write x in the basis, apply T term by term, expand each T(e_k), and collect the coefficient of each w_i.
Let x=∑k=1nxkek.
Coordinates of x in the basis (ek).
T(x)=∑kxkT(ek).
Linearity: T passes through sums and multiples (2.3).
T(x)=∑kxk∑itikwi.
Definition of the matrix: T(ek)=∑itikwi.
T(x)=∑i(∑ktikxk)wi.
Swap the order of the two finite sums, and collect the coefficient of each wi.
So yi=∑ktikxk.
Coordinates in a basis are unique (2.2), so the coefficient of wi is the ith coordinate.
This is the column form y=x1F1+⋯+xnFn.
Read the same formula column by column: the ith entry of x1F1+⋯+xnFn is ∑kxktik.
In the picture. In the visualizer above, the purple vector v has coordinates (v1,v2). The caption says it lands at ‘column 1 times v1 plus column 2 times v2’. That is the last step of this proof, in two dimensions. Dragging ^ and ^ changes the columns, and Av moves with them.
Quick checkFor a 3×2 matrix A, which statement is right?
The number of columns is the number of basis vectors of the source, so the source is R2. The number of rows is the target dimension, 3. The shape reads (target) by (source).
Your answerLet A=[21−1304] and x=(1,2,−1). Compute Ax as 1⋅(column 1)+2⋅(column 2)−1⋅(column 3). What is the SECOND entry of Ax?
Second entry: 1⋅1+3⋅2+4⋅(−1).
Ax=1[21]+2[−13]−1[04]=[2−2−01+6−4]=[03]. The second entry is 3. Row by row: 1⋅1+3⋅2+4⋅(−1)=3.
Worked example
Find the matrix of T(x,y,z)=(x+2y,3z−y) and of S(u,v)=(u+v,u−v). Then find the matrix of ST and check it on (2,1,4)
Solution.
Read off the shapes.T takes 3 numbers in and gives 2 out, so its matrix is 2×3. S is R2→R2, so its matrix is 2×2. Shape is (target dimension) by (source dimension).
Find the columns of T.T(1,0,0)=(1,0), T(0,1,0)=(2,−1), T(0,0,1)=(0,3). So m(T)=[102−103]. Column k is T(ek). Equivalently the coefficients of x,y,z in each output formula, one output per row.
Find the columns of S.S(1,0)=(1,1) and S(0,1)=(1,−1), so m(S)=[111−1]. Same rule.
Multiply, with T acting first.m(ST)=m(S)m(T)=[111−1][102−103]=[11133−3]. The product of matrices is the matrix of the composition, with the first map on the right. Shapes: (2×2)(2×3)=2×3.
Check on (2,1,4). Directly: T(2,1,4)=(4,11) and S(4,11)=(15,−7). By the matrix: (2+1+12,2+3−12)=(15,−7). Both routes must agree, since the matrix describes the composition.
Answer.m(ST)=[11133−3], and both routes give (15,−7).
Worked example Apostol 2.12 #5; MATH 375 HW6
A linear map T of R3 has T(k)=(2,3,5), T(j+k)=(1,0,0) and T(i+j+k)=(0,1,−1). Find its matrix in the standard bases, and compute T(i+2j+3k)
Solution. Here i=(1,0,0), j=(0,1,0) and k=(0,0,1) are the standard basis vectors of R3 (Apostol’s names for e1,e2,e3).
Find T(j).T(j)=T(j+k)−T(k)=(1,0,0)−(2,3,5)=(−1,−3,−5). Linearity lets us subtract values: j=(j+k)−k.
Find T(i).T(i)=T(i+j+k)−T(j)−T(k)=(0,1,−1)−(−1,−3,−5)−(2,3,5)=(−1,1,−1). Same idea: i=(i+j+k)−j−k.
Write the images as columns. The columns are T(i),T(j),T(k):
m(T)=−11−1−1−3−5235.
The matrix in the standard bases has columns T(ek), with coordinates read off as the entries themselves.
4. Check against the data. The matrix times (0,0,1) is column 3, (2,3,5). Times (0,1,1) it gives column 2 plus column 3, (1,0,0). Times (1,1,1) it gives (−1−1+2,1−3+3,−1−5+5)=(0,1,−1). The matrix must reproduce all three given values.
5. Compute T(i+2j+3k).1⋅(−1,1,−1)+2⋅(−1,−3,−5)+3⋅(2,3,5)=(−1−2+6,1−6+9,−1−10+15)=(3,4,4). Matrix times vector is a combination of columns, with the coordinates 1,2,3 as weights.
Answer. The matrix above, and T(i+2j+3k)=(3,4,4). (The posted answer key made an elimination slip when finding the null space of this map; the correct null space is {O}, since the three columns are independent.)
Matrices are the maps
Fix the bases and write m(T) for the matrix of each map T∈L(V,W). This gives a function Φ:L(V,W)→Rm×n, Φ(T)=m(T). It turns out to be an isomorphism, which is the idea behind Spagnolie’s remark in Lecture 11.
Theorem TApostol Thm 2.15 (the isomorphism theorem); Spagnolie Lecture 11
Maps and matrices are the same thing
Let dimV=n and dimW=m, with fixed bases. Then the function Φ:L(V,W)→Rm×n defined by Φ(T)=m(T) is linear, one-to-one and onto. In particular dimL(V,W)=mn.
In one lineFor fixed bases, the function T↦m(T) is an isomorphism from L(V,W) onto Rm×n.
Why it is trueAdding maps adds their columns, a map is decided by its columns, and any table of columns is the table of some map.
ProofApostol 2.14
The idea: Linear because images add and scale; one-to-one because a map is decided by its values on a basis; onto by prescribing the columns.
Linear: column k of m(S+T) is column k of m(S) plus column k of m(T), so m(S+T)=m(S)+m(T). In the same way m(cT)=cm(T).
(S+T)(ek)=S(ek)+T(ek), and coordinates of a sum are the sums of coordinates.
One-to-one: suppose m(S)=m(T). Then S(ek)=T(ek) for every k.
If m(S)=m(T), both maps send each ek to the same vector.
So S=T. Hence Φ is one-to-one.
Two linear maps that agree on a basis are equal (2.3).
Onto: given any matrix (tik), there is a linear map T with T(ek)=∑itikwi.
'Prescribed values on a basis' from 2.4: you may choose the images of the ek freely.
Then m(T)=(tik). So m is an isomorphism, and dimL(V,W)=dimRm×n=mn.
By construction its columns are the given ones.
Your answerWhat is dimL(R3,R4), the dimension of the space of all linear maps from R3 to R4?
Use the isomorphism with matrices: how many entries does the matrix have?
Each such map has a 4×3 matrix, and the space of 4×3 matrices has dimension 4⋅3=12. The map T↦m(T) is an isomorphism, so the dimensions agree.
Matrix multiplication is composition
Let T:U→V and S:V→W be linear, with dimU=n, dimV=p, dimW=m, and bases (uj), (vk), (wi). Then m(T) is p×n and m(S) is m×p, and ST:U→W has an m×n matrix. What is it in terms of m(S) and m(T)? Do not guess a rule. Compute it, one column at a time.
Theorem TApostol Thm 2.16; Spagnolie Lecture 11
Matrix of a composition
With m(S)=(sik) and m(T)=(tkj) as above, m(ST) is the m×n matrix with
(m(ST))ij=k=1∑psiktkj.
In words: column j of m(ST) is m(S) applied to column j of m(T).
In one lineThe (i,j) entry of m(ST) is ∑ksiktkj: row i of m(S) times column j of m(T).
Why it is trueColumn j of m(ST) is the coordinates of S(T(uj)). Those are m(S) times the coordinates of T(uj), which is column j of m(T).
ProofApostol 2.15; Spagnolie Lecture 11 page 2
The idea: Take the j-th basis vector of U. Send it through T, then through S, and record coordinates at each stage. The first stage gives column j of m(T); the second stage is 'Matrix times vector'.
Column j of m(ST) is the coordinates, in (wi), of ST(uj)=S(T(uj)).
Column j of any matrix is the coordinates of the image of the jth basis vector.
T(uj)=∑ktkjvk. So the coordinate column of T(uj) in the basis (vk) is column j of m(T).
Definition of m(T): its jth column lists the coordinates of T(uj) in the basis (vk).
The coordinate column of S(T(uj)) in the basis (wi) is m(S) times the coordinate column of T(uj) in the basis (vk). This is the second claim: column j of m(ST) is m(S) times column j of m(T).
'Matrix times vector', applied to the map S and the vector x=T(uj) of V.
The ith entry of that column is ∑k=1psiktkj. That is the (i,j) entry of m(ST).
The formula for matrix times vector: the ith entry of m(S)y is ∑ksikyk, with yk=tkj.
Proof workshopRebuild the proof that the matrix of a composition is the product
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
Definition of the matrix of a map: column j records the image of the jth basis vector.
Definition of m(T), applied to the same basis vector uj.
First say what column j of m(ST) means. This line then looks at the inner map T alone.
'Matrix times vector', for the map S and the vector T(uj) of V.
You need the coordinate column of T(uj) before you can feed it to m(S).
Combine the first and third lines, using the second to name the column of m(T).
This joins the earlier lines, so they must all be written first.
The formula for matrix times vector: the ith entry of m(S)y is ∑ksikyk, with yk=tkj.
Work out the whole column first. Then read off one entry of it.
So the row-times-column rule is not a definition somebody invented. It is forced: it is the only table that describes ‘do T, then S’. We therefore use the formula to define the product of two matrices.
Definition T
Matrix multiplication
Let A=(aik) be m×p and B=(bkj) be p×n. The productAB is the m×n matrix whose (i,j) entry is
(AB)ij=k=1∑paikbkj=(row i of A)⋅(column j of B).
It is defined only when the number of columns of A equals the number of rows of B. Equivalently, column j of AB is A times column j of B. With this definition, the theorem reads m(ST)=m(S)m(T).
In one lineFor A of size m×p and B of size p×n, AB is the m×n matrix with (AB)ij=∑kaikbkj.
Why it existsIt makes the matrix of a composition equal to the product of the matrices: m(ST)=m(S)m(T).
Shapes: (m by p) times (p by n) is (m by n). The two inside numbers must match and then vanish. Read the product right to left as maps, exactly like ST: AB means ‘apply B, then A’.
Where this came from· Cayley and the matrix
In 1850 James Joseph Sylvester introduced the word ‘matrix’ (Latin for womb) for a rectangular array from which determinants can be taken. People had long written coefficients of linear substitutions in arrays, and by the 1840s Gauss and Eisenstein had noticed that substitutions can be multiplied like numbers, except that the order matters. Arthur Cayley’s 1858 ‘Memoir on the Theory of Matrices’ gave the array itself an abstract definition and an algebra: sum, product and inverse. Both men worked on invariant theory, where one constantly performs a linear substitution of variables and then another, which is exactly the situation of the rule derived above. In the same memoir Cayley stated that a matrix satisfies its own characteristic equation. He proved it for 2×2 matrices and said he had checked 3×3; Frobenius gave the first proof for every size in 1878. Spagnolie’s Lecture 17 proves a special case of this Cayley–Hamilton theorem.
Worked example Spagnolie Lecture 11 page 2
Compute AB for A=[101112] and B=010111001, column by column, and check it on a vector
Solution.
Answer.AB=[113312].
Quick checkA is 2×3 and B is 3×4. Which products exist?
AB pairs the 3 columns of A with the 3 rows of B. For BA you would pair the 4 columns of B with the 2 rows of A, and 4=2. Even when both products exist they are generally different.
Your answerLet A=[1324] and B=[5768]. What is the entry in row 2, column 1 of AB?
Dot product of row 2 of A with column 1 of B.
Row 2 of A is (3,4) and column 1 of B is (5,7). The dot product is 3⋅5+4⋅7=15+28=43. (The full product is [19432250].)
Matrix multiplication does not commute
Spagnolie’s 2D example (Lecture 11). Let A=[01−10], which sends (x,y) to (−y,x), a quarter turn counterclockwise, and B=[−1001], which sends (x,y) to (−x,y), a mirror in the y-axis. Then
AB=[0−1−10],BA=[0110].
AB means ‘mirror, then turn’: (1,0) goes to (−1,0), then to (0,−1), which is column 1 of AB. BA means ‘turn, then mirror’: (1,0) goes to (0,1) and stays, which is column 1 of BA. The matrix BA=[0110] is exactly the “Reflect” preset of the visualizer: turning then mirroring in the y-axis is the same as mirroring in the line y=x. Spagnolie’s note labelled A as ‘clockwise’. It is counterclockwise, since ^=(1,0) goes to (0,1); the formula is right and the label is not.
Two more ways products fail to commute. The sizes can differ: for A of size 2×3 and B of size 3×2, AB is 2×2 and BA is 3×3. And a product can be zero while neither factor is.
Worked example Apostol 2.16 #1; MATH 375 HW7
For A=[1−1−442−2], B=1−1523−2 and C=2112−1−3, compute AB, BA, AC and CA
Solution.
Check the shapes first.A is 2×3, B and C are 3×2. So AB, AC are 2×2, while BA, CA are 3×3. The inside numbers must match; here they do in both orders, and the results differ in size, so AB=BA before we compute anything.
Compute AB entry by entry.(AB)11=1⋅1+(−4)(−1)+2⋅5=15. (AB)12=1⋅2+(−4)⋅3+2⋅(−2)=−14. Row 2 of A is the negative of row 1, so row 2 of AB is (−15,14). Row i of A against column j of B. The shortcut for row 2 saves two dot products.
Compute BA row by row. Row i of BA is bi1(row 1 of A)+bi2(row 2 of A). Row 1: 1(1,−4,2)+2(−1,4,−2)=(−1,4,−2). Row 2: −1(1,−4,2)+3(−1,4,−2)=(−4,16,−8). Row 3: 5(1,−4,2)−2(−1,4,−2)=(7,−28,14). A row of a product is a combination of the rows of the right factor, with the left factor’s row as weights. This is the mirror image of ‘combination of columns’.
Compute AC.(AC)11=2−4+2=0, (AC)12=2+4−6=0, and row 2 is the negative of row 1. So AC=O (2×2 zero matrix). Every column of C is sent to O by A: the columns of C lie in the null space of A.
Compute CA. Row 1: 2(1,−4,2)+2(−1,4,−2)=(0,0,0). Row 2: 1(1,−4,2)−1(−1,4,−2)=(2,−8,4). Row 3: 1(1,−4,2)−3(−1,4,−2)=(4,−16,8). Same row rule as step 3.
What does hold is the pair of laws that matter for algebra.
Theorem TApostol Thm 2.17
Matrix multiplication is associative and distributive
For matrices of compatible sizes: A(BC)=(AB)C, (A+B)C=AC+BC, and C(A+B)=CA+CB.
In one lineA(BC)=(AB)C, (A+B)C=AC+BC and C(A+B)=CA+CB whenever the products are defined.
Why it is trueMatrices are maps, and composition of maps is associative and distributive. Nobody needs to expand a sum.
ProofApostol 2.15 (Apostol's own proof)
The idea: Turn the matrices into maps using the isomorphism theorem, use the matching law for maps, and turn back.
Let A,B,C be m×p, p×q, q×n. Choose linear maps R,S,T with m(R)=A, m(S)=B, m(T)=C in the standard bases.
'Maps and matrices are the same thing' is onto: with standard bases, every matrix is m of some linear map.
(AB)C=m(RS)m(T)=m((RS)T).
'Matrix of a composition', used twice: m(RS)=AB, and then m((RS)T)=m(RS)m(T).
(RS)T=R(ST), so m((RS)T)=m(R(ST)).
Composition is associative (2.4).
m(R(ST))=m(R)m(ST)=A(BC). So (AB)C=A(BC).
'Matrix of a composition' once more, in the other grouping.
The distributive laws follow in the same way.
The same argument with the distributive laws of 2.4: m((R+S)T)=m(RT+ST)=m(RT)+m(ST), and m is linear.
(An alternative proof expands ∑kaik(∑lbklclj) and swaps the finite sums. It checks the same thing with more index bookkeeping.) Associativity is why An makes sense: A0=I and An=AAn−1.
Definition T
Identity matrix
The identity matrixIn is the matrix of the identity map I:V→V with the same basis on both sides. Since I(ek)=ek, column k is (0,…,1,…,0) with the 1 in place k, so In has 1s on the diagonal and 0s elsewhere. For A of size m×n: ImA=A=AIn.
In one lineThe square matrix In with 1 on the diagonal and 0 elsewhere; it is the matrix of the identity map and satisfies IA=A and AI=A.
Why it existsIt is the matrix that does nothing, the unit for matrix multiplication.
The last equation holds because IT=T=TI for maps and m turns products into products.
Inverse matrices
A square matrix A is invertible when the map x↦Ax is one-to-one and onto (2.4; for a map from a space to itself, one-to-one already forces onto, by 2.3). Its inverse is written A−1.
Theorem TApostol 2.15 and 2.16; Spagnolie Lecture 11
The matrix of an inverse is the inverse of the matrix
Let T:V→V be one-to-one and onto, with the same basis on both sides, and A=m(T). Then m(T−1) is the unique matrix A−1 with AA−1=I=A−1A. Also (AB)−1=B−1A−1 when both are invertible.
In one lineIf T:V→V is invertible and A=m(T) in one basis, then A−1=m(T−1) in the same basis, and AA−1=A−1A=I.
Why it is truem turns products into products and the identity map into I.
ProofApostol 2.15 and 2.16
The idea: Apply m to TT⁻¹ = I and T⁻¹T = I. Uniqueness and the product rule come from the same facts about maps.
m(T)m(T−1)=m(TT−1)=m(I)=I.
'Matrix of a composition': m(ST)=m(S)m(T).
m(T−1)m(T)=m(T−1T)=m(I)=I.
The same, in the other order.
So m(T−1) is a two-sided inverse of A, and any other two-sided inverse equals it.
If AB′=I and B′A=I and also AB′′=I, then B′′=(B′A)B′′=B′(AB′′)=B′ by associativity.
For (AB)−1: (ST)−1=T−1S−1 for maps, so (AB)−1=B−1A−1.
'Inverse of a composition reverses the order' from 2.4, then apply m.
There is a formula for the 2×2 case that is worth knowing (it will reappear as a determinant in chapter 2.7).
Proposition AApostol 2.20 #11
Inverse of a 2 by 2 matrix
Let A=[acbd] and Δ=ad−bc. If Δ=0, then A is invertible with A−1=Δ1[d−c−ba]. If Δ=0, then A is not invertible.
In one line[acbd] is invertible exactly when ad−bc=0, and then its inverse is ad−bc1[d−c−ba].
Why it is trueMultiplying the matrix by the swapped-and-negated matrix gives (ad−bc)I. If ad−bc=0, a nonzero vector is sent to O.
ProofApostol 2.20 #11; MATH 375 HW7
The idea: If Δ is not zero, multiply and see I. If Δ is zero, exhibit a nonzero vector that A sends to O, so A is not one-to-one.
[acbd][d−c−ba]=[ad−bccd−dc−ab+ba−cb+da]=ΔI.
Row times column, entry by entry.
If Δ=0, then A−1=Δ1[d−c−ba] works on both sides.
Divide by Δ, which is allowed when Δ=0. The same multiplication in the other order gives ΔI too, so the result is a two-sided inverse.
If Δ=0: A[d−c]=[ad−bccd−dc]=O and A[−ba]=[−ab+ba−cb+da]=O.
Compute A times the column (d,−c) and times (−b,a).
So A is not one-to-one, hence not invertible (2.4).
If A is not the zero matrix, one of a,b,c,d is nonzero, so one of the two columns above is not O. The zero matrix is not invertible either. A nonzero vector in N(A) means A is not one-to-one.
Quick checkWhich of these matrices is NOT invertible?
Check Δ=ad−bc. The first has 4−6=−2. The third has 0−1=−1. The second has 2⋅2−4⋅1=0: its second column is twice its first, so it squashes the plane onto a line and cannot be undone.
Worked example
Find the inverse of A=[5723] and use it to solve Ax=[4−1]
Solution.
Compute Δ.Δ=5⋅3−2⋅7=15−14=1. The inverse exists exactly when Δ=0.
Swap the diagonal and negate the off-diagonal.[3−7−25], then divide by Δ=1. So A−1=[3−7−25]. The formula Δ1[d−c−ba].
Check.AA−1=[15−1421−21−10+10−14+15]=I. A claimed inverse must multiply back to I.
Solve by multiplying by the inverse.x=A−1[4−1]=[12+2−28−5]=[14−33]. From Ax=b, multiply both sides on the left by A−1: A−1Ax=x.
Check the solution.A[14−33]=[70−6698−99]=[4−1]. Plug back into the original equation.
Answer.A−1=[3−7−25] and x=(14,−33).
Your answerFind the inverse of [3412]. What is the entry in row 1, column 2 of the inverse?
The inverse is Δ1[d−c−ba] with Δ=ad−bc.
Δ=3⋅2−1⋅4=2. The inverse is 21[2−4−13]=[1−2−2123]. Row 1, column 2 is −21: the old b=1, negated, then divided by Δ=2.
Worked example used in graphics
Find the 3×3 homogeneous matrix that scales the plane by 2 about the origin and then shifts it by (1,3); apply it to (1,1) and find its inverse
Solution.
Explain homogeneous coordinates. Shifting is not a linear map, so a matrix cannot do it directly. The trick is to write the point (x,y) as the column (x,y,1). A shift adds a constant, and the constant can be produced as the third coordinate times a column.
Write the matrix. Scaling by 2 is [2002] on (x,y). The shift adds 1 to x and 3 to y. Together: H=200020131. The last row (0,0,1) keeps the third coordinate equal to 1. The last column carries the shift.
Apply it.H111=2+0+10+2+31=351, the point (3,5). Check by hand: scale (1,1) to (2,2), then shift to (3,5).
Invert in two stages. Undo the shift first (subtract (1,3)), then undo the scaling (halve): H−1=21000210001100010−1−31=21000210−21−231. H=(shift)(scale), so H−1=(scale)−1(shift)−1, socks and shoes.
Check.H−1(3,5,1)=(23−21,25−23,1)=(1,1,1). It must return the starting point.
Answer.H=200020131, H(1,1,1)=(3,5,1), and H−1 as above.
Powers of a matrix
Worked example Apostol 2.16 #6; MATH 375 HW7
For A=[1011], find A2 and An, and prove the formula by induction
Solution.
Compute small powers.A2=[1011][1011]=[1021] and A3=AA2=[1031]. Compute until a pattern appears; here the top-right entry counts the powers.
State the guess.An=[10n1] for every n≥1. It fits n=1,2,3. A guess is not a proof, so we prove it by induction.
Base case. For n=1 the formula says A1=[1011], which is A. Induction starts from one true case.
Inductive step. Assume An−1=[10n−11]. Then An=AAn−1=[1011][10n−11]=[10(n−1)+11]=[10n1]. The definition An=AAn−1, the hypothesis, then one row-times-column multiplication.
Answer.An=[10n1]. Geometrically, n shears in a row slide the point (0,1) to (n,1).
The transpose
Definition T
Transpose
The transpose of an m×n matrix A=(aij) is the n×m matrix AT with (AT)ij=aji: rows become columns. For example, [142536]T=123456.
In one lineThe matrix AT whose rows are the columns of A: (AT)ij=aji.
Why it existsIt swaps the roles of input and output. Later it is the matrix that moves across an inner product.
Directly from the definition, (AT)T=A, (A+B)T=AT+BT and (cA)T=cAT. The one that needs a proof reverses the order, like inverses.
Theorem TApostol 3.6 #7(d); MATH 375 HW7 (2.21 #7)
Transpose of a product
For A of size m×p and B of size p×n, (AB)T=BTAT.
In one line(AB)T=BTAT.
Why it is trueEntries of AB come from a row of A and a column of B, and the transposes swap which is which.
ProofApostol 3.6 #7
The idea: Compare the (i, j) entries of both sides, one definition at a time.
((AB)T)ij=(AB)ji.
Definition of transpose: swap the indices of AB.
=∑kajkbki.
Definition of the product, entry (j,i).
=∑k(BT)ik(AT)kj.
Definition of transpose, backwards: ajk=(AT)kj and bki=(BT)ik. The numbers commute, so we can write b first.
=(BTAT)ij. All entries agree.
Definition of the product of BT (n×p) and AT (p×m), entry (i,j).
Your answerLet A=[1324] and B=[0110]. Compute (AB)T. What is its entry in row 1, column 2?
Multiply AB first, then swap rows and columns.
AB=[2413] (swapping the columns of A), so (AB)T=[2143] and the entry is 4. Check with the theorem: BTAT=[0110][1234]=[2143].
(Chapter 2.9 gives the transpose its geometric meaning, once we have inner products.)
Changing the basis
Now fix one space V of dimension n and one map T:V→V. Take two ordered bases: the old basis E=(e1,…,en) and the new basis F=(f1,…,fn). Let A=mE→E(T) be the matrix of T in the old basis and B=mF→F(T) the matrix in the new basis. How are A and B related?
Definition T
Change of basis
Write each new basis vector in the old basis, fj=∑kckjek. The change-of-basis matrix is C=(ckj). Its jth column is the old coordinates of fj. In the language of the previous sections, C=mF→E(I), the matrix of the identity map with the new basis on the input side and the old basis on the output side.
In one lineThe matrix C whose column j is the new basis vector fj written in old coordinates; it converts new coordinates into old ones.
Why it existsIt is the dictionary between two descriptions of the same space.
Theorem TApostol 4.9; Spagnolie Lecture 17
Coordinates change by C
For every x∈V: [x]E=C[x]F. The matrix C is invertible, and its inverse C−1=mE→F(I) turns old coordinates into new: [x]F=C−1[x]E.
In one line[x]E=C[x]F, and C is invertible with C−1=mE→F(I).
Why it is trueC is the matrix of the identity map, so it turns new coordinates into old coordinates, and the matrix of the reverse trip is its inverse.
ProofApostol 4.9; Spagnolie Lecture 17
The idea: x is the identity map applied to x. 'Matrix times vector' for the identity map says exactly this. For the inverse, compose the two identity matrices.
By ‘Matrix times vector’, [I(x)]E=mF→E(I)[x]F. Since I(x)=x, [x]E=C[x]F.
I(x)=x, and C=mF→E(I) takes F-coordinates of the input to E-coordinates of the output.
mE→F(I)mF→E(I)=mF→F(I)=In.
'Matrix of a composition' for II=I with three bases: first F→E, then E→F.
mF→E(I)mE→F(I)=In.
The same in the other order: E→F→E.
So C is invertible and C−1=mE→F(I).
Definition of an inverse matrix.
Remember the direction.C takes NEW coordinates to OLD coordinates. It is the matrix whose columns are the new basis written in old language.
Theorem TApostol Thm 4.6 and 4.7; Spagnolie Lecture 17
Change of basis rewrites the matrix of a map
Let T:V→V be linear, A=mE→E(T), B=mF→F(T), and C the change-of-basis matrix. Then B=C−1AC. Conversely, if A is the matrix of T in the basis E and C is any invertible matrix, then C−1AC is the matrix of T in the basis F whose columns, in E-coordinates, are the columns of C.
In one lineIf A and B are the matrices of T in the old and new bases, then B=C−1AC. Conversely every C−1AC is the matrix of the same map in some basis.
Why it is trueTo describe T in new coordinates: convert new to old, apply the old matrix, convert back. The three conversions are C, A, C−1, read right to left.
ProofApostol 4.9 proves this with matrices of vectors; this is the same idea phrased with maps
The idea: T does not care about bases: T = I∘T∘I. Give each factor a matrix with the right bases, and multiply (matrix of a composition).
Write T=I∘T∘I as a chain of maps (V,F)I(V,E)T(V,E)I(V,F).
The identity map changes nothing, so T=ITI. We give the three factors different bases so that each has a matrix we know.
The first map has matrix C, the middle map has matrix A, and the last map has matrix mE→F(I)=C−1.
Matrices of the three pieces: C, then A, then C−1 from the previous theorem.
B=mF→F(T)=C−1AC.
'Matrix of a composition': the matrix of a chain is the product, with the first map on the right.
The vectors f1,…,fn form a basis F, and C is its change-of-basis matrix.
Converse. Let C be invertible and define fj=∑kckjek. Let U be the linear map with U(ej)=fj ('Prescribed values on a basis'), so m(U)=C. Let U′ be the linear map whose matrix is C−1. Then m(UU′)=CC−1=I=m(I) and m(U′U)=I too. Since m is one-to-one ('Maps and matrices are the same thing'), UU′=U′U=I. So U is one-to-one and onto, and it sends the basis E to a basis ('One-to-one in finite dimension' from 2.4).
So the matrix of T in F is C−1AC.
Apply the first half of this theorem to this F.
Proof workshopGive the reason for each line: B=C−1AC
Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.
Write T=I∘T∘I as the chain (V,F)→(V,E)→(V,E)→(V,F).
The first map has matrix C.
The middle map has matrix A.
The last map has matrix C−1.
B=C−1AC.
Definition T
Similar matrices
Two n×n matrices A and B are similar if there is an invertible C with B=C−1AC.
In one lineMatrices A and B with B=C−1AC for some invertible C; equivalently, two descriptions of the same map in different bases.
Why it existsIt is the right notion of 'the same linear map', since any quantity of the map itself must be the same for similar matrices.
By the theorem and its converse (Apostol Thm 4.8), A and B are similar exactly when they are matrices of the same linear map in two bases. Spagnolie’s slogan: similar matrices are the same transformation in different coordinates. Everything about the map that does not depend on the basis must come out the same for similar matrices. Chapters 2.7 and 2.8 show that the determinant, the trace and the eigenvalues are such quantities. A remark you will need: similarity is an equivalence relation (the prove problem on similarity below proves it).
In the picture. Pick “Eigen example” in the visualizer below and tick ‘eigenlines’. The matrix is [3012]. The two dashed lines are special directions that the map only stretches, by 3 and by 2. Use those two directions as the new basis and the matrix of the SAME picture becomes [3002]: a table with only a diagonal. That is a change of basis doing its job, and it is why B=C−1AC is worth the effort. Chapter 2.8 shows how to find such a basis.
Worked example Spagnolie Lecture 17; Apostol 4.9
Let T(x)=Ax with A=[4213]. Find its matrix B in the basis f1=(1,1), f2=(1,−2), check it on x=(2,5), and use it to compute A5
Solution.
Answer.B=[5002] and A5=[2094206210311063].
Quick checkB=C−1AC where the columns of C are the new basis vectors in old coordinates. To find B's action on new coordinates y, which happens FIRST?
Product order is right to left. C acts first and converts new coordinates y into old coordinates. Then A acts in old coordinates, and C−1 converts the result back to new coordinates.
Your answerIn the example above the new basis is f1=(1,1), f2=(1,−2). Write x=(4,1) as c1f1+c2f2. What is c1, the first new coordinate?
Two equations from the two entries of c1(1,1)+c2(1,−2)=(4,1).
Solve c1+c2=4 and c1−2c2=1. Subtracting gives 3c2=3, so c2=1 and c1=3. Check: 3(1,1)+1(1,−2)=(4,1). (This is C−1(4,1)=(3,1).)
Worked example Spagnolie Lecture 17 (powers); the general n is a prove problem below
Prove: if B=C−1AC, then B2=C−1A2C
Solution.
Write B2 as a product.B2=BB=(C−1AC)(C−1AC). That is the definition of the square.
Regroup.=C−1A(CC−1)AC. Matrix multiplication is associative, so brackets can move.
Cancel.CC−1=I and AI=A, so this is C−1AAC. The middle CC−1 cancels because C−1 is the inverse of C.
Name the result.=C−1A2C. Definition of A2.
Answer.B2=C−1A2C. Every power cancels the middle pairs in the same way.
The simplest matrix a map can have
If you may choose different bases for the input and output, you can make the matrix almost empty.
Let dimV=n, dimW=m, and r=rankT. There are bases (e1,…,en) of V and (w1,…,wm) of W with T(ei)=wi for i=1,…,r and T(ei)=O for i=r+1,…,n. The matrix of T is then the m×n matrix with 1 in positions (1,1),…,(r,r) and 0 elsewhere.
In one lineFor T:V→W of rank r there are bases of V and W in which the matrix has 1s in the first r diagonal places and 0 everywhere else.
Why it is trueChoose a basis of the range and lift it to V; fill out with a basis of the null space.
ProofApostol 2.11; Spagnolie Lecture 10 page 5
The idea: Start in W: a basis of the range, extended to a basis of W. Lift the range basis back to V. Then add a basis of the null space. Rank–nullity says the count is right.
Let w1,…,wr be a basis of T(V).
The range T(V) is a subspace of W of dimension r, so it has a basis (2.2).
Extend to a basis w1,…,wr,wr+1,…,wm of W.
'Extending to a basis' (2.2): an independent set extends to a basis of W.
For i≤r choose ei∈V with T(ei)=wi.
Each wi with i≤r is in the range, so it has a source.
Let er+1,…,en be a basis of N(T), so T(ei)=O for i>r.
The null space has dimension k=n−r by rank–nullity (2.3).
It remains to show e1,…,en are independent. Applying T gives ∑i=1rciwi=O.
Since there are n=r+k vectors, it is enough to show independence ('Extending to a basis' (b)). Suppose ∑i=1nciei=O and apply T.
So c1=⋯=cr=0.
The wi with i≤r are independent.
Then ∑i>rciei=O forces cr+1=⋯=cn=0. So the ei are a basis of V, and the matrix has the claimed form.
What remains is a combination of a basis of the null space equal to O.
(Spagnolie’s page has a typo in the index range. The second condition is for i=r+1,…,n because there are n basis vectors of V.) This is what the differentiation example above did with D: the basis (x,21x2,31x3,1) maps the first three vectors onto 1,x,x2 and the last one into the null space.
A preview· Preview: the case V = W with one shared basis
The theorem above allows different bases on the two sides. When the input and output spaces are the same space and the bases must agree, as in the change-of-basis section, you cannot always reach a diagonal matrix. When you can, the diagonal entries are the eigenvalues of chapter 2.8, and A=CBC−1 is the factorisation that makes A500 easy. The shear [1011] is the standard example that cannot be diagonalised.
Where it is used
Used inside maths· Inside maths: the chain rule is a matrix product
In multivariable calculus the derivative of a map g:R2→R2 at a point is a linear map, and its matrix is the Jacobian Dg of partial derivatives. The chain rule from Lectures 22 and 23 says D(F∘g)=DF(g)Dg, a product of matrices, because the derivative of a composition is the composition of derivatives. Take polar coordinates g(r,θ)=(rcosθ,rsinθ) and F(x,y)=x2+y2. Then DF=[2x2y] and Dg=[cosθsinθ−rsinθrcosθ], so
Direct check: F(g(r,θ))=r2, whose partial derivative in r is 2r and in θ is 0.
Used inside maths· Inside maths: angle-addition formulas from multiplying rotations
Let R(α)=[cosαsinα−sinαcosα] be rotation by α. Turning by β and then by α is turning by α+β, so R(α)R(β)=R(α+β). Multiply the left side out. Its first column is [cosαcosβ−sinαsinβsinαcosβ+cosαsinβ]. The first column of R(α+β) is (cos(α+β),sin(α+β)). Comparing entries gives cos(α+β)=cosαcosβ−sinαsinβ and sin(α+β)=sinαcosβ+cosαsinβ, the two formulas you memorised in JEE. They are matrix multiplication, and the memorising was never needed. Also R(α)R(β)=R(β)R(α): rotations of the plane about one point commute, unlike the 3D rotations of 2.4.
Used in the real world· Graphics: model, view and projection matrices, chained
To draw a 3D scene, a game engine takes each vertex p (a point of a model) and applies three maps in a row: the model matrix M1 places the object in the world, the view matrix M2 moves the world so the camera sits at the origin looking down the −z axis, and the projection matrix P squeezes the 3D view into a flat image. Shifts are not linear, so the points are written in homogeneous coordinates(x,y,z,1), which lets a shift be a 4×4 matrix. In 2D, rotating 90∘ and shifting by (5,2) is H=010−100521, and H(1,0,1)=(5,3,1); its inverse, the matrix a mouse-click needs, is H−1=0−10100−251.
The vertex shader on the GPU computes PM2M1p. Read it right to left: model first, projection last. A perspective matrix with near plane 1 and far plane 100 (field of view 90∘, square image) is
P=1000010000−99101−100−992000.
A point (2,1,−4) in front of the camera is (2,1,−4,1), and P sends it to (2,1,99204,4). The last coordinate 4 is the distance in front of the camera. Dividing by it gives the screen position (0.5,0.25) and a depth of about 0.515. That final division is the only non-linear step. Everything before it is matrix multiplication, so the three matrices can be multiplied together once, into PM2M1. For a model of 100,000 vertices, multiplying each vertex by three separate 4×4 matrices costs 3×16×100,000=4,800,000 multiplications. Multiplying the matrices first costs 2×64=128 for the two matrix products, plus 16×100,000 for the vertices: about 1,600,000, three times fewer. Associativity is what makes this legal.
Used in the real world· Robotics: forward kinematics of a two-link arm
A planar robot arm has a first link of length 2 at angle θ1 from the x-axis and a second link of length 1 at angle θ2 relative to the first. The end of the second link, measured from the elbow, is R(θ2)(1,0) in the first link’s frame. Add the first link and rotate everything by θ1: the hand is at
p=R(θ1)[(2,0)+R(θ2)(1,0)].
For θ1=90∘ and θ2=−90∘: R(−90∘)(1,0)=(0,−1), then (2,0)+(0,−1)=(2,−1), then R(90∘)(2,−1)=(1,2). Check by drawing: link 1 points straight up to (0,2); link 2 turns 90∘ clockwise from it, so it points right and ends at (1,2). Inverse kinematics, going from the hand position back to the angles, asks for the inverse of this chain of rotations, applied in reverse order.
Used in the real world· AI: why a neural network needs nonlinearities between layers
A dense layer is a matrix. For handwritten digits (MNIST, 28×28=784 pixels), a network with a 128×784 matrix W1 and then a 10×128 matrix W2 computes W2(W1x), which has 784×128+128×10=101,632 weights. By associativity W2(W1x)=(W2W1)x, and W2W1 is a single 10×784 matrix with only 7,840 entries. Without a nonlinear function between the layers, the two layers collapse into one, and the second layer has added nothing. The matrix W2W1 also has rank at most 10 (the second stretch problem), however large the middle layer is. That is why every deep network inserts a function such as ReLU between matrix products. CS 532 builds on exactly these shape-and-rank facts. A batch of 64 images is a 64×784 matrix X, and the whole batch passes through the first layer in one product XW1T, a 64×128 matrix. That one product is what GPUs are built to do fast.
Traps
Watch out· Columns, not rows
The matrix of T has the images T(ek) as its COLUMNS. Writing them as rows gives the transpose, which is a different map. On HW6 the answer key had a wrong first column in exactly this kind of problem (2.12 #6; the correct matrix is worked out in the Apostol 2.12 #6 problem below).
Watch out· AB is not BA
Even for square matrices of the same size. Spagnolie’s rotate-and-mirror example gives two different answers. And AB=O does not force A=O or B=O (the HW7 example AC=O above). So you cannot cancel a matrix from both sides of an equation the way you cancel a number, unless it is invertible.
Watch out· Shapes: the inside numbers must match
(m×p)(p×n) gives m×n. If AB exists, BA may not exist, and if both exist they can have different sizes (2×2 and 3×3 in HW7 #1).
Watch out· Reversed order: inverses and transposes
(AB)−1=B−1A−1 and (AB)T=BTAT. Both reverse the order. And B=C−1AC is not the same as B=CAC−1: which one you need depends on whether C‘s columns are the NEW basis in OLD coordinates (then C−1AC) or the other way round. Check which way the coordinates go.
Watch out· Same eigenvalues does not mean similar
Similar matrices share many numbers, but sharing them does not make two matrices similar. (Eigenvalues are defined in chapter 2.8; for now, they are the numbers by which a map stretches the directions it only stretches, like 3 and 2 in the picture above.) [1011] and I have the same characteristic polynomial (λ−1)2, so the same eigenvalues, yet they are not similar (HW10 4.10 #1): C−1IC=I for every C, so I is similar only to itself (see the prove problem on I below).
Problems
checkApostol 2.12 #11; MATH 375 HW6
Let D be differentiation on the span of sinx and cosx, with basis (sinx,cosx). Find the matrix of D and of D2.
Solution
D(sinx)=cosx has coordinates (0,1), and D(cosx)=−sinx has coordinates (−1,0). So m(D)=[01−10]. Then m(D)2=[01−10][01−10]=[−100−1]=−I, which says D2=−id, i.e. f′′=−f for these functions.
check
A is 2×3 and B is 3×4. What are the sizes of AB and of BA?
Solution
AB is 2×4. BA does not exist: B has 4 columns and A has 2 rows.
check
Compute [1324][0110] and [0110][1324]. What does each do to the first matrix?
Solution
The first product is [2413]: multiplying on the right by the swap matrix swaps the COLUMNS. The second is [3142]: multiplying on the left swaps the ROWS. (Right factor: columns of the product are combinations of columns of the left factor. Left factor: rows of the product are combinations of rows of the right factor.)
checkApostol 2.12 #2(b)
Find the matrix of the projection T:R3→R2, T(x1,x2,x3)=(x2,x3) in the standard bases.
Solution
T(e1)=(0,0), T(e2)=(1,0), T(e3)=(0,1), so m(T)=[001001] (2×3). Check: it times (x1,x2,x3) gives (x2,x3).
useApostol 2.16 #1; MATH 375 HW7
For the matrices A,B,C of the worked example above, compute A(2B−3C) in two ways.
Solution
First, 2B−3C=2−21046−4−6336−3−9=−4−57−295. Then A(2B−3C) has first row (1,−4,2)⋅ columns: 1(−4)−4(−5)+2(7)=30 and 1(−2)−4(9)+2(5)=−28. Row 2 is the negative: (−30,28). Second way, using distributivity: A(2B−3C)=2AB−3AC=2[15−15−1414]−3O=[30−30−2828]. Both agree.
use
Let A=[2112] and let T(x)=Ax. Find the matrix of T in the basis f1=(1,1), f2=(1,−1).
Solution
C=[111−1] and C−1=21[111−1] (check: CC−1=I). AC=[331−1]. B=C−1AC=21[111−1][331−1]=21[6002]=[3001]. Direct check: A(1,1)=(3,3)=3f1 and A(1,−1)=(1,−1)=1⋅f2.
useApostol 2.12 #6; MATH 375 HW6 (corrected)
For the map of the worked example with matrix A=−11−1−1−3−5235, find its matrix in the basis e1=(2,3,5), e2=(1,0,0), e3=(0,1,−1) (same basis on both sides).
Solution
Compute each T(ek) with A, then write it in the basis. T(e1)=A(2,3,5)=(−2−3+10,2−9+15,−2−15+25)=(5,8,8). Solve ae1+be2+ce3=(5,8,8): the second and third entries give 3a+c=8 and 5a−c=8, so a=2, c=2, and the first gives 2a+b=5, b=1. Column 1 is (2,1,2). T(e2)=A(1,0,0)=(−1,1,−1): 3a+c=1, 5a−c=−1 give a=0, c=1, then b=−1. Column 2 is (0,−1,1). T(e3)=A(0,1,−1)=(−3,−6,−10): 3a+c=−6, 5a−c=−10 give a=−2, c=0, then 2a+b=−3 gives b=1. Column 3 is (−2,1,0). So
B=2120−11−210.
This agrees with C−1AC for C=23510001−1 (one can verify that AC=CB). The published key had T(i) wrong in an intermediate step and a wrong first column.
use
A game draws a sprite by rotating it 90∘ counterclockwise about the origin and then shifting it by (2,−1). Write the 3×3 homogeneous matrix, apply it to the corner (3,1), and find the matrix that undoes it.
Solution
Rotation by 90∘ is [01−10], so H=010−1002−11. Then H(3,1,1)=(0−1+2,3+0−1,1)=(1,2,1), the point (1,2). To undo: subtract (2,−1), then rotate by −90∘, which is [0−110]. As matrices, H−1=0−10100001100010−211=0−10100121. Check: H−1(1,2,1)=(2+1,−1+2,1)=(3,1,1), the corner we started with.
proveApostol 3.6 #7(e); MATH 375 HW7 (2.21 #7)
Prove that if A is invertible then AT is invertible and (AT)−1=(A−1)T.
Solution
Let B=A−1, so AB=I. Take transposes: (AB)T=IT=I. By ‘Transpose of a product’, (AB)T=BTAT, so BTAT=I. Likewise BA=I gives ATBT=I. So BT is a two-sided inverse of AT, and by uniqueness of the inverse (AT)−1=BT=(A−1)T.
proveApostol 4.9
Prove that similarity is an equivalence relation: (i) A is similar to A; (ii) if A is similar to B then B is similar to A; (iii) if A is similar to B and B to D then A is similar to D.
Solution
(i) A=I−1AI. (ii) If B=C−1AC, then multiplying by C on the left and C−1 on the right gives CBC−1=A. Write this as A=(C−1)−1B(C−1), so A is similar to B via the invertible matrix C−1. (iii) If B=C−1AC and D=E−1BE, then D=E−1C−1ACE=(CE)−1A(CE), using (CE)−1=E−1C−1. And CE is invertible as a product of invertible matrices.
proveSpagnolie Lecture 17
Let B=C−1AC. Prove by induction that Bn=C−1AnC for every n≥1. Deduce An=CBnC−1.
Solution
For n=1 the claim is the hypothesis. Assume Bn−1=C−1An−1C. Then Bn=BBn−1=(C−1AC)(C−1An−1C)=C−1A(CC−1)An−1C=C−1AnC, using associativity and CC−1=I. For the second claim, multiply Bn=C−1AnC on the left by C and on the right by C−1: CBnC−1=(CC−1)An(CC−1)=An.
proveApostol 2.16 #9; MATH 375 HW7
Let A=[1−101]. Prove A2=2A−I, then prove An=nA−(n−1)I for all n≥1, and compute A100.
Solution
A2=[1−201] and 2A−I=[2−202]−[1001]=[1−201]. Equal. For the induction: n=1 gives A=1A−0I. Assume An−1=(n−1)A−(n−2)I. Then An=AAn−1=(n−1)A2−(n−2)A=(n−1)(2A−I)−(n−2)A=nA−(n−1)I. For n=100: A100=100A−99I=[100−1000100]−[990099]=[1−10001]. (Matches the pattern An=[1−n01].)
proveStrang
Prove that similar matrices have the same trace, where the trace of a square matrix is the sum of its diagonal entries. (Hint: first prove tr(PQ)=tr(QP).)
Solution
tr(PQ)=∑i(PQ)ii=∑i∑kpikqki, and tr(QP)=∑k∑iqkipik. These are the same finite double sum with the order of summation swapped and the numbers pikqki multiplied in the other order, so they are equal. Now if B=C−1AC, put P=C−1 and Q=AC: tr(B)=tr(C−1⋅AC)=tr(AC⋅C−1)=tr(A).
proveMATH 375 HW10 4.10 #1
Prove that I is similar only to itself. Deduce that [1011] is not similar to I.
Solution
If B=C−1IC, then B=C−1C=I. So the only matrix similar to I is I. The shear [1011] is not I, so it is not similar to I, although both have the eigenvalue 1 only.
stretchAxler 3.D
Let A be an n×n matrix with AB=BA for every n×n matrix B. Prove A=cI for some number c.
Solution
Use B=Eij (the matrix with a single 1 in row i, column j). Computing entries, (AEij)kl=∑makm(Eij)ml=aki if l=j and 0 otherwise. Likewise (EijA)kl=ajl if k=i and 0 otherwise. Since AEij=EijA, compare entries. Take l=j and k=i: aki=0. So every off-diagonal entry of A is 0 (any off-diagonal pair (k,i) with k=i arises). Take k=i, l=j: aii=ajj. So all diagonal entries are equal, to some c, and A=cI.
stretch
Prove that rank(ST)≤min(rankS,rankT) for linear maps T:U→V and S:V→W with finite-dimensional domains. Why does this bound the rank of W2W1 in the neural-network example?
Solution
The range of ST is S(T(U)), which lies inside S(V), the range of S. A subspace of S(V) has dimension at most dimS(V) (a problem in 2.2), so rank(ST)≤rankS. For the other bound, restrict S to the subspace X=T(U) of V. The restricted map S∣X:X→W is linear, and by rank–nullity its range has dimension dimX−dimN(S∣X)≤dimX. Its range is S(T(U)), so rank(ST)≤dimT(U)=rankT. In the network, W1 is 128×784 and W2 is 10×128, so rank(W2W1)≤rankW2≤10, because the range of W2 sits inside R10.
Summary
The matrix of a linear map relative to bases has T(ek), written in the target basis, as its kth column. Its shape is (target dimension) by (source dimension).
Matrix times vector is a combination of the columns, with the vector’s coordinates as the weights. The map T↦m(T) is an isomorphism from L(V,W) to Rm×n, so dimL(V,W)=mn.
Matrix multiplication is composition. Column j of AB is A times column j of B, which gives the row-times-column rule. It is associative and distributive, and generally not commutative, and the inside sizes must match.
The identity matrix does nothing. (AB)−1=B−1A−1 and (AB)T=BTAT both reverse the order. A 2×2 matrix is invertible exactly when ad−bc=0.
The change-of-basis matrixC has the new basis, in old coordinates, as its columns. It converts new coordinates to old ones: [x]E=C[x]F.
The matrix of the same map in the new basis is B=C−1AC: similar matrices are one map in two languages. Powers become easy when B is diagonal: An=CBnC−1.
With separate bases on input and output, a map of rank r has a matrix with r ones on the diagonal and zeros elsewhere. With one shared basis you often cannot reach that, and finding the best basis is the subject of chapter 2.8.
Watch and read
The same ideas explained by someone else. Use these when an explanation here does not land.
CS 532: CS 532 (matrix methods in machine learning) treats every data set as a matrix and every model layer as a matrix product. The rules here (shapes, order, columns as images of basis vectors, low rank) are what it assumes from the first week.
MATH 340: MATH 340 begins with matrix arithmetic and row reduction. Here the arithmetic is derived from composing maps, so the rules (associative, not commutative, reversed order for inverses and transposes) come with reasons.
MATH 376: The solution of a linear system of differential equations y' = Ay is written with the matrix exponential of A. Computing it is easy only after a change of basis to a diagonal matrix, as previewed at the end of this chapter.