MATH 133 Linear Algebra and Geometry • McGill University, Montreal
Corrected exercises: matrix algebra, transpose and the matrix product (MATH 133)
This is the corrected exercise set for the matrix algebra chapter of MATH 133, Linear Algebra and Geometry, the first-year course at McGill University, sections 2.1 and 2.3 of Nicholson. It covers equality, addition and scalar multiples of matrices, the transpose and its rules, symmetric and skew-symmetric matrices, the matrix product under its three readings, powers of a matrix and the trace. Every number is chosen to be handled by hand, since the exam allows no calculator, and every solution names the reading of the product it uses.
The thread running through the whole set: a matrix product remembers the ORDER of its factors. A row of the LEFT factor meets a column of the RIGHT factor, so the sizes decide first whether the product exists at all, and every rule of ordinary algebra that quietly swaps two factors, ab=ba, (ab)T=aTbT, ab=0 so a=0 or b=0, a2=1 so a=±1, has to be re-proved before it is used. Most of them turn out to be false, and the few that survive, like the binomial expansion of two commuting matrices or tr(AB)=tr(BA), survive for a reason you can name.
The traps named explicitly in the solutions: multiplying entry by entry, computing a product whose inner sizes disagree, reading the indices of an entry backwards, writing XA as 'the same computation' as AX, transposing a product without reversing it, squaring the entries of a matrix to get its square, concluding A=0 from A2=0 or AB=0, believing a product of symmetric matrices is symmetric, and treating diagonal matrices as if they commuted with everything.
Self-checking setType your answers and check them question by question: the page tells you right or wrong before you open the solution. With an account, every answer right on the first try earns points, and your right answers stay filled in when you come back.
•An m×n matrix times an n×p matrix is an m×p matrix: the INNER sizes must agree, the OUTER sizes give the shape. A sum needs identical sizes.
•Entry (i,j) of AB is row i of A against column j of B: (AB)ij=ai1b1j+ai2b2j+⋯+ainbnj.
•Column j of AB is A times column j of B, a combination of the columns of A. Row i of AB is row i of A times B, a combination of the rows of B.
•(AB)C=A(BC) and A(B+C)=AB+AC, but in general AB=BA, and AB=0 does not force A=0 or B=0.
•(AT)T=A, (A+B)T=AT+BT, (kA)T=kAT and (AB)T=BTAT. Symmetric: AT=A. Skew-symmetric: AT=−A. Every square A=21(A+AT)+21(A−AT).
•Nilpotent: Ak=0 for some k. Idempotent: A2=A. The binomial theorem holds for (A+B)n only when AB=BA.
•trA is the sum of the diagonal entries; tr(AB)=tr(BA) whenever both products exist.
Part A: the basics (/50)
Exercise 1: Sizes first: when a product exists, and what shape it has
Before a single entry is computed, a product has to pass a size test. An m×n matrix can multiply an n×p matrix, because each row of the first has exactly as many entries as each column of the second, and the result is m×p. The figure shows the rule on a pair that is not in the questions: the INNER sizes must agree, the OUTER sizes give the shape.
Throughout, A=(1−12301) and B=2011−14.
a) Sizes only. A is 2×3, B is 3×2, C is some 3×3 matrix and u is a column of R3, that is 3×1. For each of AB, BA, AC, CA, BC, A+BT, uTC and uC, say whether it exists and give its size.
b) Compute AB and BA. What is the first thing you notice, before comparing a single entry?
c) With u=(1,2,−1)T, compute uTu and uuT.
d) A is m×n. What size must a matrix X have for both AX and XA to exist? For which m, n can the question whether AX=XA even be asked?
e) Give the (3,1) entry of the triple product BAB, choosing the bracketing that costs the fewest multiplications.
b)AB=(2−1−10), BA=11−37−3141−14: not even the same size
c)uTu=(6), a 1×1; uuT=12−124−2−1−21, a 3×3
d)X must be n×m; AX=XA can only be asked when m=n
e)(BAB)31=−2, computed as row 3 of B times column 1 of AB
a)
The test is always the same: write the two sizes side by side and look at the two numbers in the MIDDLE. AB is (2×3)(3×2), inner 3=3, so it exists and is 2×2. BA is (3×2)(2×3), inner 2=2, so it exists and is 3×3. AC is (2×3)(3×3), which is 2×3. CA is (3×3)(2×3), inner 3=2: it does not exist, even though AC does. BC is (3×2)(3×3), inner 2=3: undefined. A+BT is a sum, and a sum needs IDENTICAL sizes, not matching inner ones: BT is 2×3 like A, so the sum exists and is 2×3, while A+B would not. uTC is (1×3)(3×3)=1×3, and uC is (3×1)(3×3), inner 1=3, undefined. Writing out the two sizes costs three seconds and it is the only line that catches a product that does not exist before you have spent a page computing it.
b)
Row i of A against column j of B. Row 1 of A is (1,2,0): against column 1 of B, (2,0,1), it gives 2+0+0=2; against column 2, (1,−1,4), it gives 1−2+0=−1. Row 2, (−1,3,1), gives −2+0+1=−1 and −1−3+4=0. So AB=(2−1−10). For BA, row 1 of B is (2,1) and the columns of A are (1,−1), (2,3), (0,1), giving 1, 7, 1; row 2, (0,−1), gives 1, −3, −1; row 3, (1,4), gives −3, 14, 4. So BA=11−37−3141−14. The first thing to notice needs no entry at all: AB is 2×2 and BA is 3×3. Non-commutativity starts here, in its crudest form. For non-square factors the two orders are not even comparable.
c)
uTu is (1×3)(3×1), a 1×1 matrix: 1+4+1=6. uuT is (3×1)(1×3), a 3×3 matrix whose (i,j) entry is uiuj, so uuT=12−124−2−1−21. The same two factors in the two orders give a number in one case and nine numbers in the other. A student who writes uuT=6 has computed the wrong product, and nothing in the arithmetic warns them: only the sizes do. Notice also that uuT is symmetric and that its diagonal adds up to 6, a first sighting of the trace identity of exercise 7.
d)
If A is m×n, then AX needs X to have n rows and XA needs X to have m columns, so X is n×m. Then AX is m×m and XA is n×n. The equation AX=XA compares two matrices, so it only makes sense when they have the same size, that is m=n: commuting is a question about SQUARE matrices, and exercise 6 only asks it there.
e)
BAB is (3×2)(2×3)(3×2), a 3×2 matrix, and associativity lets us bracket it either way. (BA)B first builds the 3×3 matrix BA, nine entries; B(AB) first builds the 2×2 matrix AB, four entries, already found in b). Take the cheaper one. The (3,1) entry of B(AB) is row 3 of B times column 1 of AB: (1,4)⋅(2,−1)=2−4=−2. The check through the other bracketing, row 3 of BA times column 1 of B, gives (−3)(2)+14(0)+4(1)=−2 as well. What you may NOT do is move a factor: B(AB)=(BA)B is associativity, allowed, while BAB=ABB would be commutativity, forbidden.
Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.
Exercise 2: One entry, one column, one row: three readings of the same product
The product AB can be read three ways, and an examiner who asks for one entry, one column or one row is testing whether you know which reading to use. Entry (i,j) is row i of A times column j of B. Column j of AB is A times column j of B. Row i of AB is row i of A times B.
Here A=1−12031210 and B=2011−12310. The figure computes one entry, the (3,1), and nothing else.
a) Compute the (2,3) entry of AB, and only that entry.
b) Compute the second column of AB as A times the second column of B, then write it as a combination of the columns of A.
c) Compute the third row of AB as the third row of A times B, then write it as a combination of the rows of B.
d) Check that the third column of B equals twice its first column minus its second. Without any new row-times-column product, deduce the third column of AB from its first two, computing the first column by the reading of b).
e) The second row of A is replaced by zeros. Which entries of AB change, and to what? Same question if instead the first column of B is replaced by zeros.
Show the solution
Answers
a)(AB)23=0
b)second column (5,−2,1)T=1a1−1a2+2a3
c)third row (4,1,7)=2r1+1r2+0r3
d)first column (4,−1,4)T, third column 2(4,−1,4)T−(5,−2,1)T=(3,0,7)T
e)only row 2 of AB becomes zero; in the second case only column 1 of AB becomes zero
a)
Row 2 of A is (−1,3,1) and column 3 of B is (3,1,0), so (AB)23=(−1)(3)+3(1)+1(0)=−3+3+0=0. Three multiplications and two additions, not twenty-seven multiplications. The classic slip is to take column 2 of A with row 3 of B, the indices read backwards: that gives 0(1)+3(2)+1(0)=6, a wrong answer that looks perfectly reasonable. Say it aloud once: the FIRST index picks a row of the LEFT factor, the SECOND index picks a column of the RIGHT factor.
b)
Column 2 of B is (1,−1,2)T. Then A(1,−1,2)T=(1−0+4,−1−3+2,2−1+0)T=(5,−2,1)T. Read the same computation column by column: A times a vector is the combination of the COLUMNS of A with the entries of that vector as weights, 1⋅(1,−1,2)T−1⋅(0,3,1)T+2⋅(2,1,0)T=(5,−2,1)T. This reading is the bridge to the previous chapter: every column of AB is a linear combination of the columns of A, so every column of AB lives wherever the columns of A live.
c)
Row 3 of A is (2,1,0), and a row times B is the combination of the ROWS of B with those weights: 2(2,1,3)+1(0,−1,1)+0(1,2,0)=(4,2,6)+(0,−1,1)=(4,1,7). Its first entry, 4, is the entry the figure computed, which is the free check. The two readings are mirror images: columns of AB are built from the columns of the LEFT factor, rows of AB from the rows of the RIGHT factor. Mixing them up, combining rows of A for instance, is the error that turns a correct method into a wrong matrix.
d)
Twice column 1 of B minus column 2 is 2(2,0,1)T−(1,−1,2)T=(3,1,0)T, which is column 3: checked. Column 1 of AB is A(2,0,1)T=(2+0+2,−2+0+1,4+0+0)T=(4,−1,4)T. Now A times a combination is the same combination of the products, because multiplying by A is linear: A(2b1−b2)=2Ab1−Ab2. So column 3 of AB is 2(4,−1,4)T−(5,−2,1)T=(3,0,7)T, with no new row-times-column product. It agrees with a), whose entry 0 sits in position 2, and with c), whose row ends in 7. A relation among the columns of B is inherited by the columns of AB: that is the column reading doing real work, not just giving a second route.
e)
By the row reading, row 2 of AB is row 2 of A times B. If that row of A is zero, row 2 of AB is zero, and the other two rows, which never used row 2 of A, do not move: AB becomes 404501307. By the column reading, column 1 of AB is A times column 1 of B; a zero column there gives a zero column in AB, and nothing else changes. So a product can acquire a zero row or a zero column without either factor being zero, and pushing the idea one step further, the whole product can vanish while both factors are non-zero. Exercise 3 builds exactly such a pair.
Exercise 3: The order is part of the product: AB is zero, BA is not
Two square matrices of the same size can always be multiplied in both orders, and the two products usually differ. This exercise pushes the difference to its extreme: one order gives the zero matrix, the other does not.
Let A=(1224) and B=(2−1−42).
a) Compute AB and BA.
b) Explain the result AB=0 with the column reading of the product, and say what it tells you about the columns of B.
c) Without multiplying any 2×2 matrices, show that (BA)2=0. Then check it by computing.
d) Find ALL 2×2 matrices X such that AX=0.
e) Compute (A+B)(A−B) and A2−B2. Show that their difference is BA−AB, and state when the identity (A+B)(A−B)=A2−B2 holds for matrices.
Show the solution
Answers
a)AB=(0000) and BA=(−63−126)
b)each column of B solves Ax=0: both are multiples of (2,−1)T
c)(BA)2=B(AB)A=B0A=0
d)X=(2s−s2t−t), s and t any real numbers
e)(A+B)(A−B)=(−9171418), A2−B2=(−3142612); the identity holds exactly when AB=BA
a)
Row 1 of A, (1,2), against the columns (2,−1) and (−4,2) of B gives 2−2=0 and −4+4=0; row 2, (2,4), gives 4−4=0 and −8+8=0. So AB=0. In the other order, row 1 of B, (2,−4), against the columns (1,2) and (2,4) of A gives 2−8=−6 and 4−16=−12; row 2, (−1,2), gives −1+4=3 and −2+8=6. So BA=(−63−126), which is not zero. Neither factor is zero, and the two orders do not even agree on whether the product is zero. Any argument that starts with 'since AB=0, also BA=0' is already lost.
b)
Column j of AB is A times column j of B. Both columns of AB are zero, so both columns of B are solutions of the homogeneous system Ax=0. That system is the single equation x1+2x2=0, since the second row of A is twice the first, and its solutions are the multiples of (2,−1)T. Indeed column 1 of B is (2,−1)T and column 2 is (−4,2)T=−2(2,−1)T. The product vanishes because B was built entirely out of directions that A kills. Nothing of the kind holds for BA: its columns are B times the columns of A, and (1,2)T is not killed by B.
c)
By associativity, (BA)2=(BA)(BA)=B(AB)A=B⋅0⋅A=0. The brackets move, the factors do not: the four letters stay in the order B,A,B,A, and the pair AB that sits in the middle is zero. Check: (BA)2=(−63−126)(−63−126), whose (1,1) entry is 36−36=0, (1,2) entry 72−72=0, (2,1) entry −18+18=0 and (2,2) entry −36+36=0. So BA is a non-zero matrix whose square is zero, a nilpotent matrix, obtained without a single guess.
d)
By b), AX=0 says exactly that each column of X solves x1+2x2=0, so each column is a multiple of (2,−1)T, with its own multiple. The answer is X=(2s−s2t−t) for all real s, t: a two-parameter family, and B is the member s=1, t=−2. The trap is to give one example and stop, or to force both columns to be the same multiple. The question says ALL, and the column reading turns a matrix equation into two independent vector equations.
e)
A+B=(31−26) and A−B=(−1362), so (A+B)(A−B)=(−9171418). Also A2=(5101020) and B2=(8−4−168), so A2−B2=(−3142612). Expanding while keeping every factor in its place, (A+B)(A−B)=A2−AB+BA−B2, so the difference with A2−B2 is BA−AB. Here AB=0, so the difference should be BA=(−63−126), and indeed (−9171418)−(−3142612)=(−63−126). The difference of squares survives for matrices exactly when AB=BA, never by default.
Exercise 4: Transpose: the reversal rule, and the symmetric and skew-symmetric parts
The transpose AT turns rows into columns: (AT)ij=aji. For a square matrix it is a reflection across the main diagonal, which the figure shows on M=107421−353: the diagonal stays put and each coloured pair of entries swaps places.
A square matrix is symmetric when AT=A and skew-symmetric when AT=−A. In parts a) to c), A=(13−2102) and B=21−1.
a) Compute (AB)T and BTAT. Then give the sizes of AT and BT and explain why ATBT cannot be the transpose of AB here.
b) Prove that (AB)T=BTAT for any A of size m×n and B of size n×p, by comparing the (i,j) entries of both sides.
c) Show that AAT and ATA are symmetric for every matrix A, give their sizes for the A above, and compute AAT.
d) Write M as S+K with S symmetric and K skew-symmetric.
e) Prove that the diagonal entries of a skew-symmetric matrix are all zero, and that the decomposition of d) is the only one possible.
Show the solution
Answers
a)(AB)T=BTAT=(05); ATBT would be (3×2)(1×3), which does not exist
c)(AAT)T=AAT, (ATA)T=ATA; sizes 2×2 and 3×3; AAT=(51114)
d)S=122223233, K=0−2520−2−520
e)kii=−kii forces kii=0; S and K are forced to be 21(M+MT) and 21(M−MT)
a)
AB is (2×3)(3×1)=2×1: row 1 of A gives 2−2+0=0 and row 2 gives 6+1−2=5, so AB=(0,5)T and (AB)T=(05), a 1×2 row. On the other side BT=(21−1) is 1×3 and AT is 3×2, so BTAT is 1×2: against the columns of AT, which are the rows of A, it gives 2−2+0=0 and 6+1−2=5. The two agree. Now try the order a student writes by reflex: ATBT is (3×2)(1×3), inner 2=1, so it does not exist at all. The size test settles the question before any entry is computed, and it is the fastest way to remember that the transpose REVERSES the order.
b)
Take 1≤i≤p and 1≤j≤m. On the left, ((AB)T)ij=(AB)ji=∑k=1najkbki. On the right, (BTAT)ij=∑k=1n(BT)ik(AT)kj=∑k=1nbkiajk. Each term is a product of two NUMBERS, bkiajk=ajkbki, so the two sums are equal term by term. Note where commutativity was used: between numbers, inside one term, never between the matrices. That is exactly why the matrices come out in the reverse order. A proof on one 2×2 example proves nothing; the marker wants the general (i,j) entry.
c)
By the rule of b) and (AT)T=A: (AAT)T=(AT)TAT=AAT, and (ATA)T=AT(AT)T=ATA. Both are symmetric, for every A, square or not. For our 2×3 matrix A, AAT is 2×2 and ATA is 3×3. Entry (i,j) of AAT is row i of A against row j of A: 1+4+0=5, 3−2+0=1, and 9+1+4=14, so AAT=(51114). The two off-diagonal entries come out equal, which is the built-in check: an AAT that is not symmetric contains an arithmetic error, found before the marker finds it.
d)
Put S=21(M+MT) and K=21(M−MT). Reading MT off the figure, each coloured pair swapped: MT=14−3025713. Then M+MT=244446466 and M−MT=0−41040−4−1040, which halve to S=122223233 and K=0−2520−2−520. Checks in five seconds: S is symmetric, K has a zero diagonal and opposite mirror pairs, and S+K gives back M, for instance 2+2=4 and 2−2=0 in the first coloured pair. S averages each pair, K takes half their difference.
e)
If KT=−K, the diagonal entries satisfy kii=(KT)ii=−kii, so 2kii=0 and kii=0: the diagonal is the mirror, and a number equal to its own opposite is zero. Uniqueness: suppose M=S+K with S symmetric and K skew-symmetric. Transposing, MT=ST+KT=S−K. Adding and subtracting the two equations gives M+MT=2S and M−MT=2K, so S and K have no choice: they are the matrices of d). The proof does not guess a formula, it DERIVES it from the two conditions, which is what makes it a proof of uniqueness rather than a verification of one example.
Exercise 5: Powers of a matrix: nilpotent, idempotent, and the pattern behind the n-th power
For a square matrix, A2=AA, A3=AAA, and so on; associativity makes the bracketing irrelevant, and A0=I. Powers of a matrix are NOT the powers of its entries, and the whole exercise is about spotting a structure that makes An computable without n multiplications.
Let N=000200130, P=(21−2−1), A=(2032) and E=(0010).
a) Compute N2 and N3. What is Nk for every k≥3?
b) Compute P2 and deduce P50. Show that (I−P)2=I−P and that P(I−P)=0.
c) Compute A2 and A3, conjecture a formula for An, and prove it by induction on n.
d) Write A=2I+3E. Explain why the binomial expansion of (2I+3E)n is legitimate here, and use it to recover the formula of c) in one line.
e) Give Dn for D=2000−10003. Then compare P2 with the matrix obtained by squaring each entry of P, and conclude.
Show the solution
Answers
a)N2=000000600, N3=0, so Nk=0 for all k≥3
b)P2=P, hence P50=P; (I−P)2=I−P and P(I−P)=0
c)A2=(40124), A3=(80368), An=(2n03n2n−12n)
d)2I and 3E commute and E2=0, so (2I+3E)n=2nI+n2n−13E
e)Dn=2n000(−1)n0003n; squaring the entries of P gives (4141)=P2
a)
Row 1 of N, (0,2,1), against the columns of N gives 0, 0 and 0+6+0=6; row 2, (0,0,3), meets columns whose third entry is always 0, so it gives zeros; row 3 is zero. So N2=000000600. Then N3=N2N: the only non-zero row of N2 is (0,0,6), and the third row of N is zero, so N3=0 and every higher power is N3Nk−3=0. The figure of the correction shows the mechanism: the non-zero entries sit above the diagonal, and each multiplication pushes them one diagonal further up until they fall off the corner. A strictly upper triangular n×n matrix always dies by the power n. So N3=0 although N=0 and N2=0: writing 'N3=0, so N=0' copies a rule of real numbers that matrices do not obey.
b)
P2: row 1, (2,−2), against the columns (2,1) and (−2,−1) gives 4−2=2 and −4+2=−2; row 2, (1,−1), gives 2−1=1 and −2+1=−1. So P2=P: P is idempotent. Then P3=P2P=PP=P, and by the same step P50=P, with no further multiplication. Next, (I−P)2=I−IP−PI+P2=I−2P+P=I−P: the expansion is legal because I commutes with everything, so the two middle terms really do combine. Directly, I−P=(−1−122) and its square has entries 1−2=−1, −2+4=2, 1−2=−1, −2+4=2. Finally P(I−P)=P−P2=0: two non-zero matrices with product zero once again, and this time they commute.
c)
A2=(2032)(2032)=(40124) and A3=A2A=(80368), since 4⋅3+12⋅2=36. The diagonal is 2n, and the corner reads 3=3⋅1⋅20, 12=3⋅2⋅21, 36=3⋅3⋅22, which suggests An=(2n03n2n−12n). Proof by induction. For n=1 the formula gives A. If it holds for n, then An+1=AnA has corner entry 2n⋅3+3n2n−1⋅2=3⋅2n+3n2n=3(n+1)2n, which is the formula at n+1, and diagonal entries 2n⋅2=2n+1. A pattern read off three powers is a conjecture; the marks are in the induction step.
d)
E2=0, and 2I commutes with 3E because a multiple of I commutes with every matrix. For two COMMUTING matrices the binomial theorem holds exactly as for numbers, since every product of factors can be reordered. So (2I+3E)n=(2I)n+n(2I)n−1(3E)+(terms with E2=0)=2nI+3n2n−1E, which is the formula of c). For a general sum X+Y the binomial theorem is false, because (X+Y)2 already contains XY+YX and not 2XY. The expansion is not a formula about sums, it is a formula about sums of commuting matrices.
e)
A diagonal matrix multiplies each coordinate separately, so Dn=2n000(−1)n0003n: for diagonal matrices, and only for them, powers are taken entry by entry. Try it on P: squaring each entry gives (4141), while P2=P=(21−2−1). The entries of An mix all the entries of A through sums of products; the diagonal case is the one case where no mixing happens because every off-diagonal term is zero. Before raising a matrix to a power, look for one of the four structures of this exercise: diagonal, nilpotent, idempotent, or scalar plus nilpotent. If none is there, compute A2 and A3 and look for a pattern to prove.
Part B: problems and reasoning (/50)
Exercise 6: Every matrix that commutes with a given one
Two square matrices commute when AX=XA. Since that is rare, a classic midterm question asks for ALL the matrices that commute with a given one. The method is always the same: write an unknown X=(acbd), compute BOTH products, AX and XA, as two separate computations, and equate them entry by entry. The result is a homogeneous linear system in a, b, c, d.
Throughout, A=(1023).
a) Find all 2×2 matrices X such that AX=XA.
b) Show that every matrix found in a) can be written αI+βA for some real α, β.
c) Find all X that commute with D=(2005). Use the answer to show that diagonal matrices do not commute with everything.
d) Prove that if X commutes with a square matrix A, then X commutes with A2 and with A+3I.
e) Find all 2×2 matrices X that commute with EVERY 2×2 matrix.
Show the solution
Answers
a)X=(a0ba+b), a and b any real numbers
b)X=(a−2b)I+2bA
c)exactly the diagonal matrices; E=(0010) gives DE=ED
d)XA2=(XA)A=(AX)A=A(XA)=A(AX)=A2X, and X(A+3I)=XA+3X=AX+3X=(A+3I)X
e)only the scalar matrices X=cI
a)
AX=(1023)(acbd)=(a+2c3cb+2d3d) and, as a SEPARATE computation, XA=(acbd)(1023)=(ac2a+3b2c+3d). Equating entry by entry: (1,1) gives a+2c=a, so c=0; (2,1) gives 3c=c, so c=0 again; (2,2) gives 3d=2c+3d, so c=0 a third time; (1,2) gives b+2d=2a+3b, that is d=a+b. Two free parameters remain, a and b, and X=(a0ba+b). The standard loss of marks is to compute AX once and then write XA as 'the same thing': the whole question is that it is not.
b)
Try αI+βA=(α+β02βα+3β). Matching the (1,2) entry gives 2β=b, so β=2b; matching the (1,1) entry gives α=a−2b; the (2,2) entry is then a−2b+23b=a+b, as required. So X=(a−2b)I+2bA. Check on a=1, b=2: X=(1023), which is A itself, and A certainly commutes with A. The commuting matrices are exactly the combinations of I and A here, which is why the answer to a) had two parameters and not four.
c)
DX=(2a5c2b5d), because multiplying by a diagonal matrix on the LEFT scales the ROWS, and XD=(2a2c5b5d), because on the RIGHT it scales the COLUMNS. Equality forces 2b=5b and 5c=2c, so b=c=0: the matrices commuting with D are exactly the diagonal ones. In particular E=(0010) does not commute with D: DE=(0020) while ED=(0050). Diagonal matrices commute with EACH OTHER, not with everything; the distinct diagonal entries 2=5 are what break it.
d)
Only associativity and the hypothesis are allowed, one swap at a time: XA2=(XA)A=(AX)A=A(XA)=A(AX)=A2X. Each equality either moves a bracket or uses XA=AX once. For the second, distributivity and the fact that I commutes with X: X(A+3I)=XA+3XI=AX+3IX=(A+3I)X. By the same steps X commutes with every polynomial in A, which explains b) from the other side: I and A are the simplest such polynomials.
e)
If X=(acbd) commutes with every matrix, it commutes in particular with F=(1000) and with E=(0010). XF=(ac00) and FX=(a0b0), so b=c=0. Then XE=(00a0) and EX=(00d0) with b=c=0, so a=d. Hence X=aI. Conversely every cI commutes with everything, so the answer is exactly the scalar matrices. Testing two well-chosen matrices is enough to find the candidates; the converse sentence is what makes the answer complete.
Exercise 7: The trace, and why AB minus BA can never be the identity
The trace of a square matrix is the sum of its diagonal entries, trA=a11+a22+⋯+ann. It is additive, tr(A+B)=trA+trB, but NOT multiplicative. Its one deep property is that it forgets the order of a product of two factors: tr(AB)=tr(BA) whenever both products exist, even when they are not the same size.
Let A=(1021−13) and B=1210−11.
a) Compute tr(AB) and tr(BA), computing only the entries you actually need.
b) Prove that tr(AB)=tr(BA) for any m×n matrix A and n×m matrix B.
c) Prove that there are no n×n matrices X, Y with XY−YX=I.
d) With F=(1000), G=(0010) and H=(0100), compute tr(FGH), tr(HFG) and tr(FHG). Which reorderings does the trace forgive?
e) Show that tr(ATA) is the sum of the squares of all the entries of A, check it on the A above, and deduce that ATA=0 forces A=0.
Show the solution
Answers
a)tr(AB)=4+2=6 and tr(BA)=1+3+2=6
b)both equal ∑i=1m∑k=1naikbki
c)tr(XY−YX)=0 while trI=n=0
d)tr(FGH)=tr(HFG)=1 but tr(FHG)=0: only cyclic reorderings
e)tr(ATA)=∑i,jaij2=16; a sum of squares is zero only if every entry is zero
a)
The trace only reads the diagonal, so only the diagonal entries of each product are needed. (AB)11 is row 1 of A against column 1 of B: 1+4−1=4; (AB)22 is row 2 against column 2: 0−1+3=2. So tr(AB)=6, from two entries out of four. BA is 3×3 and we need three of its nine entries: (BA)11=(1,0)⋅(1,0)=1, (BA)22=(2,−1)⋅(2,1)=4−1=3, (BA)33=(1,1)⋅(−1,3)=2. So tr(BA)=6. Same trace, although AB is 2×2 and BA is 3×3. Computing the whole of BA to read its diagonal is the time loss the question is designed to catch.
b)
tr(AB)=∑i=1m(AB)ii=∑i=1m∑k=1naikbki. Likewise tr(BA)=∑k=1n(BA)kk=∑k=1n∑i=1mbkiaik. The two double sums run over the same mn pairs (i,k), and each term is a product of two numbers, bkiaik=aikbki. A finite double sum can be summed in either order, so the two traces are equal. Note that the proof never claims AB=BA: the matrices differ, and only the sum of their diagonals coincides.
c)
Suppose XY−YX=I. Take the trace of both sides. The trace is additive, so the left side gives tr(XY)−tr(YX)=0 by b), while the right side gives trI=n. Since n≥1, 0=n is impossible, so no such X, Y exist. This is the model of a trace argument: an equation between matrices implies an equation between their traces, and a contradiction in the NUMBERS kills the matrix equation without solving anything. The same argument shows XY−YX can never equal cI with c=0.
d)
FG=G and GH=F, so FGH=(FG)H=GH=F, and tr(FGH)=1. HF=H, so HFG=HG, which has a single 1 in position (2,2): tr(HFG)=1. But FH=0, because the first row of H is zero, so FHG=0 and tr(FHG)=0. Moving the LAST factor to the FRONT, FGH→HFG, is a cyclic shift, and it is tr(XY)=tr(YX) applied with X=FG, Y=H. Swapping two factors in the middle is not a cyclic shift, and here it changes the trace from 1 to 0. The trace forgives rotations of the word, never arbitrary shuffles.
e)
(ATA)jj is column j of A against itself, ∑iaij2, so tr(ATA)=∑j∑iaij2, the sum of the squares of all the entries. Here the columns of A are (1,0), (2,1) and (−1,3), giving 1+5+10=16, and directly 1+4+1+0+1+9=16. If ATA=0, its trace is 0, so a sum of squares of real numbers is 0, which forces every aij=0. Compare with exercise 3: AB=0 is possible with A=0, but ATA=0 is not. The difference is that ATA pairs each column with ITSELF, and squares cannot cancel.
Exercise 8: Five statements to correct
Each statement below was written by a student revising for a MATH 133 midterm, and each is false as stated. Say what is wrong, give the smallest counterexample that settles it, and write the correct statement. Every counterexample here is a 2×2 matrix with small integer entries: a counterexample you can check in your head is worth more than a general discussion.
a) "The transpose of a product is the product of the transposes: (AB)T=ATBT."
b) "If A2=0, then A=0."
c) "To multiply two matrices of the same size, multiply the entries in the same position."
d) "If A and B are symmetric, then AB is symmetric."
e) "If A2=I, then A=I or A=−I."
Show the solution
Answers
a)false: A=(1010), B=(1100) give (AB)T=(2000)=ATBT=(1111); correct: (AB)T=BTAT
b)false: (21−4−2)2=0; correct: A2=0 is possible with A=0
c)false: (1111)2=(2222); correct: entry (i,j) is row i times column j
d)false: (1002)(0110)=(0210); correct: AB is symmetric exactly when AB=BA
e)false: (102−1)2=I; correct: (A−I)(A+I)=0, which does not force either factor to be zero
a)
FALSE, the order is backwards. With A=(1010) and B=(1100), AB=(2000), which is its own transpose, while ATBT=(1100)(1010)=(1111). The correct order gives BTAT=(1010)(1100)=(2000), as it should. Correct statement: (AB)T=BTAT. For non-square factors the wrong version usually does not even exist, as exercise 4 showed; for square ones it exists and is simply wrong, which is the more dangerous case.
b)
FALSE. N=(21−4−2) is not zero, and N2 has entries 4−4=0, −8+8=0, 2−2=0 and −4+4=0. The rule 'a2=0⇒a=0' is true for numbers because a product of two non-zero numbers is non-zero, and exercise 3 showed that this fails for matrices. Here the columns of N are both multiples of (2,1)T, and N(2,1)T=(0,0)T: N kills the very direction its columns point in. Correct statement: A2=0 is possible with A=0, and such a matrix is called nilpotent. What IS true, by exercise 7 e), is that a SYMMETRIC A with A2=ATA=0 must be zero.
c)
FALSE. The entry-by-entry product exists as an operation, but it is not the matrix product. With J=(1111), the entrywise square is J itself, while the matrix product gives J2=(2222): every entry is a row against a column, 1⋅1+1⋅1=2. Correct statement: (AB)ij=∑kaikbkj, row i of A against column j of B, and the sizes must satisfy the inner-size rule, not be equal. The entrywise rule only agrees with the product for diagonal matrices, which is why students who first met matrices through diagonal examples carry it for so long.
d)
FALSE. A=(1002) and B=(0110) are both symmetric, but AB=(0210) is not. The reason is one line: (AB)T=BTAT=BA, so AB is symmetric if and only if AB=BA. Here BA=(0120)=AB. Correct statement: the product of two symmetric matrices is symmetric exactly when they commute. The sum of two symmetric matrices, by contrast, is always symmetric, and so is A2 for symmetric A, since A commutes with itself.
e)
FALSE. R=(102−1) has R2 with entries 1+0=1, 2−2=0, 0+0=0 and 0+1=1, so R2=I, yet R=±I. Simpler examples are (100−1) and (0110). The student's argument is the factorisation A2−I=(A−I)(A+I)=0, and the factorisation itself is valid, because A commutes with I. The false step is the next one, concluding that one factor is zero: here R−I=(002−2) and R+I=(2020) are both non-zero with product zero. Correct statement: A2=I means (A−I)(A+I)=0, and there are infinitely many such 2×2 matrices besides ±I.
Exercise 9: Prices times quantities: a matrix product with units
A small company runs three campus kiosks, K1, K2 and K3, selling coffee, muffins, sandwiches and juice. The table gives the units sold on one day; it is the 3×4 matrix Q, one row per kiosk and one column per product.
The 4×2 matrix P=32741142 gives, for each product in the same order, its selling price (column 1) and its cost to the company (column 2), in dollars per unit.
kiosk
coffee
muffin
sandwich
juice
K1
120
80
40
30
K2
90
60
50
20
K3
150
100
30
40
a) Which of the products QP and PQ exists? Give its size, and say what its (i,j) entry means, with its unit.
b) Compute QP.
c) Using one more matrix product each time, find the profit of each kiosk, then the total revenue and total cost of the company.
d) The company raises the price of coffee and of sandwiches by 1 dollar each, costs unchanged. Find the new revenue of each kiosk by computing only the CHANGE.
e) The accountant wants the same figures as in b) but with one COLUMN per kiosk. Which product of the given matrices, or of their transposes, produces it directly? Justify with the transpose rule.
Show the solution
Answers
a)only QP exists, 3×2; entry (i,1) is the revenue and (i,2) the cost of kiosk i, in dollars
b)QP=9208201020420390450
c)profits QP(1,−1)T=(500,430,570)T dollars; (111)QP=(27601260), total revenue 2760 and cost 1260 dollars
d)change Q(1,0,1,0)T=(160,140,180)T; new revenues 1080, 960 and 1200 dollars
e)PTQT=(QP)T, a 2×3 matrix
a)
Q is 3×4 and P is 4×2. QP has inner sizes 4 and 4, so it exists and is 3×2. PQ would be (4×2)(3×4), inner 2=3: it does not exist. The sizes are not a formality here, they are the units speaking. Entry (i,1) of QP is row i of Q against column 1 of P: units of each product times dollars per unit of that product, summed over the four products, so it is the REVENUE of kiosk i in dollars. Entry (i,2) is, the same way, the COST of kiosk i. The inner index is the product being summed over, and that is why the inner sizes must agree: both matrices must list the same four products in the same order.
b)
Row 1: revenue 120(3)+80(2)+40(7)+30(4)=360+160+280+120=920, cost 120+80+160+60=420. Row 2: 270+120+350+80=820 and 90+60+200+40=390. Row 3: 450+200+210+160=1020 and 150+100+120+80=450. So QP=9208201020420390450. A quick plausibility check: kiosk 3 sells the most coffee and muffins, but fewer sandwiches, the most expensive item, and still comes out on top, which the row totals confirm.
c)
Profit is revenue minus cost, that is column 1 minus column 2, that is QP times the column (1,−1)T: (920−420,820−390,1020−450)T=(500,430,570)T dollars. Totals over the three kiosks add the ROWS, which is the row (111) times QP on the LEFT: (920+820+1020420+390+450)=(27601260). So the company takes in 2760 dollars, spends 1260 and keeps 1500. The side matters: multiplying on the right combines columns, on the left combines rows, which is the row and column reading of exercise 2 used as a tool.
d)
The new price column is p+Δp with Δp=(1,0,1,0)T. By distributivity Q(p+Δp)=Qp+QΔp, and Qp is the first column of QP, already known. So only QΔp is needed: it adds the coffee and sandwich columns of the table, (120+40,90+50,150+30)T=(160,140,180)T. The new revenues are 920+160=1080, 820+140=960 and 1020+180=1200 dollars. Recomputing the whole product with the new prices gives the same result with four times the arithmetic, and four times the chances of a slip.
e)
The wanted matrix is (QP)T, 2×3, revenue in row 1 and cost in row 2, one column per kiosk. By the reversal rule (QP)T=PTQT, a (2×4)(4×3) product, which exists and has the right size. The tempting QTPT is (4×3)(2×4), inner 3=2, and does not exist. So the transpose rule is not an abstract identity: it is what an accountant uses without knowing it when a spreadsheet is turned sideways, and the sizes check it in three seconds.
Exercise 10: Flight routes and paths of length two: the adjacency matrix
A regional airline serves four airports, numbered 1 to 4. Every arrow on the figure is a direct flight, and every flight is one-way: there is a flight from 1 to 3 and another from 3 to 1, but only from 4 to 2 and never back.
The adjacency matrix of the network is the 4×4 matrix M with mij=1 if there is a direct flight from airport i to airport j, and mij=0 otherwise.
a) Write M. Is it symmetric? What would it mean for it to be?
b) Compute M2. Explain why its (i,j) entry is the number of trips from i to j with exactly two flights, and list the trips counted by the entry (3,2).
c) Compute M+M2. Which airport cannot be reached from which other airport in at most two flights?
d) Compute tr(M2) and interpret it.
e) What network does MT describe? Show that (M2)T=(MT)2 and use it to give, without new computation, the number of two-flight trips from 2 to 3 in that network.
Show the solution
Answers
a)M=0010100111000010, not symmetric; symmetric would mean every route runs both ways
b)M2=1100002010111100; (M2)32=2: 3→1→2 and 3→4→2
c)M+M2=1110102121111110; airport 1 cannot be reached from airport 4 in at most two flights
d)tr(M2)=2: the round trips 1→3→1 and 3→1→3
e)MT is the network with every flight reversed; ((MT)2)23=(M2)32=2
a)
Row i lists the departures from airport i. From 1 there are flights to 2 and 3; from 2, to 3; from 3, to 1 and 4; from 4, to 2. So M=0010100111000010. It is not symmetric: m12=1 but m21=0, because the flight 1→2 has no return. The matrix would be symmetric exactly when every route is served in both directions, which is the case for the pair 1,3 and for no other pair. Row sums count departures and column sums count arrivals: airport 2 has one departure and two arrivals.
b)
Row by row, using the row reading: row i of M2 is row i of M times M, that is the sum of the rows of M for the airports reachable from i. Row 1 is row 2 plus row 3, (0,0,1,0)+(1,0,0,1)=(1,0,1,1); row 2 is row 3; row 3 is row 1 plus row 4, (0,2,1,0); row 4 is row 2. So M2=1100002010111100. Why it counts trips: (M2)ij=∑kmikmkj, and the term mikmkj equals 1 exactly when there is a flight i→k AND a flight k→j, that is a two-flight trip through k, and 0 otherwise. Summing over the stopover k counts every such trip once. For (3,2): k=1 gives 3→1→2 and k=4 gives 3→4→2, total 2. The row-times-column formula IS the counting argument.
c)
M+M2=1110102121111110 counts the trips with one OR two flights. Off the diagonal, the only zero is in position (4,1): from airport 4, airport 1 cannot be reached in at most two flights. Indeed from 4 the only flight goes to 2, and from 2 the only flight goes to 3. It takes three flights, 4→2→3→1, and M3 would detect it. The diagonal zeros at (2,2) and (4,4) say that no passenger can leave 2 or 4 and be back within two flights. Note the 2 in position (1,3): one direct flight plus the two-flight trip 1→2→3.
d)
tr(M2)=1+0+1+0=2. A diagonal entry (M2)ii counts the two-flight trips that start and end at i, that is the round trips out and back. There is one at airport 1, 1→3→1, and one at airport 3, 3→1→3: the same pair of routes seen from its two ends. In general tr(M2) is twice the number of pairs of airports connected in both directions, which is a quick way to read two-way service off the matrix with no picture.
e)
(MT)ij=mji, so MT has a flight i→j exactly when M has j→i: it is the same network with every arrow reversed. By the reversal rule, (M2)T=(MM)T=MTMT=(MT)2; here the two factors are equal, so the reversal of the order is invisible, which is the one case where (XY)T=XTYT happens to be true. In words: a two-flight trip 3→k→2 read backwards is a two-flight trip 2→k→3 in the reversed network. So the number of such trips from 2 to 3 is ((MT)2)23=(M2)32=2, namely 2→1→3 and 2→4→3 with every arrow reversed.
Something missing from this set?A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.
Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space.
Rather not create an account? Write to me directly.