Matrices and determinants — exam-style exercises with the coding game, a parameter, the determinant behind diagonalisation and a 20-question quiz (and the row I multiplied by 2)

In a practice exam in class I computed a 4×44 \times 4 determinant with elementary operations, got 2, and the answer key said 1: I had multiplied a row by 2 to clear a half and never compensated for it. The method was right and so was the arithmetic; I was missing one line. That kind of slip costs more marks than any other in this topic, which is why it is the first fragment of “What’s wrong here?”.

How to use this article

First, how this counts in the AG exam. The exam mark is EX=(T+P)/2EX = (T + P)/2: T is a 20-question quiz drawn from the Campus quizzes and P is written exercises on paper. If EX≥4.5EX \ge 4.5, the final mark is 0.7⋅EX+C+TP0.7 \cdot EX + C + TP (the quizzes and the MATLAB assignments, up to 1.5 points each); if not, the final mark is EXEX. You have the arithmetic done for you in the AG grade calculator.

In recent years’ exams there is no exercise only about matrices: rank, determinants and elementary operations appear inside the exercises on subspaces, diagonalisation and geometry. So this article has two parts: exercises in the format of an exam question (with points and marking criteria), the last one exactly as it later appears in diagonalisation, and a 20-question quiz like the Campus one for part T.

  1. Do each exercise on paper, without a calculator, with the operations written above every arrow.
  2. Compare with the expected result and, if it does not match, open the hint before looking at the solution.
  3. Read “What’s wrong here?” trying to find the mistake yourself before reading the explanation.
  4. Take the quiz at the end and check everything in MATLAB or in the Gauss-Jordan step-by-step simulator, which row reduces with exact fractions.

If you get stuck on the method, go back to the guided practice, which has the same kinds of problem solved step by step.

Exercise 1 (basic level): products and transposes

Exercise 1. [3 points] Let A=(120−113)A = \begin{pmatrix} 1 & 2 & 0 \\ -1 & 1 & 3 \end{pmatrix} and B=(210−111)B = \begin{pmatrix} 2 & 1 \\ 0 & -1 \\ 1 & 1 \end{pmatrix}. a) (1 point) Compute ABAB and BABA. b) (1 point) Check that tr(AB)=tr(BA)tr(AB) = tr(BA) even though ABAB and BABA are not even the same size. c) (1 point) Compute AAtA A^t and justify why it is symmetric.

Expected result: AB=(2−111)AB = \begin{pmatrix} 2 & -1 \\ 1 & 1 \end{pmatrix}, BABA is 3×33 \times 3, both traces are 3 and AAt=(51111)A A^t = \begin{pmatrix} 5 & 1 \\ 1 & 11 \end{pmatrix}.

Before multiplying, write down the sizes: (2×3)(3×2)(2 \times 3)(3 \times 2) gives 2×22 \times 2 and (3×2)(2×3)(3 \times 2)(2 \times 3) gives 3×33 \times 3. For the symmetry in c), use (XY)t=YtXt(XY)^t = Y^t X^t.

Exercise 2 (intermediate level): a key with a parameter

Exercise 2. [4 points] For the coding game, the proposed key is A=(11k1k1k11)A = \begin{pmatrix} 1 & 1 & k \\ 1 & k & 1 \\ k & 1 & 1 \end{pmatrix}, with k∈Rk \in \mathbb{R}. a) (1.5 points) Compute ∣A∣|A| and the rank of AA for each value of kk. b) (1.5 points) For k=0k = 0, compute A−1A^{-1} with elementary operations. c) (1 point) With k=0k = 0, the received code is C=(424025242726)C = \begin{pmatrix} 42 & 40 \\ 25 & 24 \\ 27 & 26 \end{pmatrix}. Find the message matrix XX knowing that AX=CA X = C and turn it into letters.

Expected result: ∣A∣=−(k−1)2(k+2)|A| = -(k – 1)^2 (k + 2); rank 3 if k≠1k \neq 1 and k≠−2k \neq -2, rank 1 if k=1k = 1 and rank 2 if k=−2k = -2. For k=0k = 0, every entry of the inverse is ±12\pm\frac12, and the message is a six-letter Spanish word you say to someone before an exam.

By Sarrus, ∣A∣=3k−k3−2|A| = 3k – k^3 – 2. To factorise it, try k=1k = 1: if it vanishes, (k−1)(k – 1) is a factor and you can divide with synthetic division. In c), solve for XX by multiplying by A−1A^{-1} on the left.

Exercise 3 (challenge): how it appears in the exam

In the diagonalisation exercise of the exam you always have to compute a determinant with a letter in it, ∣A−λI∣|A – \lambda I|, and then the rank of A−λIA – \lambda I for each special value. You do not know what diagonalising is yet (that is topic 5), but the computation is pure topic 1.

Exercise 3. [3 points] Let A=(211121112)A = \begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}. a) (1.5 points) Compute the polynomial p(λ)=∣A−λI∣p(\lambda) = |A – \lambda I| and factorise it. b) (0.5 points) For which values of λ\lambda does A−λIA – \lambda I have no inverse? c) (1 point) For each of those values, find the rank of A−λIA – \lambda I.

Expected result: p(λ)=(1−λ)2(4−λ)p(\lambda) = (1 – \lambda)^2 (4 – \lambda); the values are λ=1\lambda = 1 (double) and λ=4\lambda = 4; rg(A−I)=1rg(A – I) = 1 and rg(A−4I)=2rg(A – 4I) = 2.

Call t=2−λt = 2 – \lambda what sits on the diagonal. You get the same shape as in exercise 2, and you already know how to factorise t3−3t+2t^3 – 3t + 2.

What’s wrong here?

Three classmates’ solutions, each with one mistake. Read the solution, try to spot the error, then read the explanation.

Fragment 1: the determinant that came out double

|  2  1  3 |                 |  2  1  3 |                 | 2  1    3  |
|  1  1  1 |  f2 -> 2f2 - f1 |  0  1 -1 |  f3 -> f3 - 2f2 | 0  1   -1  |
|  0  2  1 |  ============>  |  0  2  1 |  ============>  | 0  0    3  |

Determinant = 2 · 1 · 3 = 6

Predict: what is the real value of the determinant?

The operation f2→2f2−f1f_2 \to 2f_2 – f_1 mixes two things: it multiplies row 2 by 2 (which multiplies the determinant by 2) and then subtracts f1f_1 (which changes nothing). The 6 is twice the real determinant: ∣A∣=6/2=3|A| = 6 / 2 = 3. Check it with Sarrus: 2+0+6−0−4−1=32 + 0 + 6 – 0 – 4 – 1 = 3.

The operation that doubled the determinantLeft: the matrix with determinant 3; after the operation f2 → 2f2 − f1, the new matrix has determinant 6, because multiplying the row by 2 doubles the determinant and subtracting f1 does not change it.213111021|A| = 3f₂ → 2f₂ − f₁= ×2 and then −f₁21301-1021|A′| = 6×2 multiplies |A|−f₁ changes nothing|A| = 6 / 2 = 3
One arrow hides two operations, and only one of them is harmless.

Using fi→αfi+βfjf_i \to \alpha f_i + \beta f_j with α≠1\alpha \neq 1 without dividing by α\alpha at the end. For the rank or for row reducing it does not matter, but in a determinant it changes the result.

If you want to avoid fractions, multiply the row and note it outside: ∣A∣=12⋅(whatever comes out)|A| = \frac12 \cdot (\text{whatever comes out}). Or use row 2 as the pivot (it has a 1) by swapping it with row 1, noting the sign change.

Fragment 2: the inverse of a product

Given: A^-1 = | 1  2 |    B^-1 = | 0  1 |
              | 0  1 |           | 1  3 |

(AB)^-1 = A^-1 · B^-1 = | 1·0+2·1  1·1+2·3 | = | 2  7 |
                        | 0·0+1·1  0·1+1·3 |   | 1  3 |

Predict: is the order right?

No: (AB)−1=B−1A−1(AB)^{-1} = B^{-1} A^{-1}. The arithmetic of the product is fine, but it is the wrong product. The correct one is

B−1A−1=(0113)(1201)=(0115) B^{-1} A^{-1} = \begin{pmatrix} 0 & 1 \\ 1 & 3 \end{pmatrix} \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 1 & 5 \end{pmatrix}

Carrying the rules for numbers over to matrices. With numbers, (ab)−1=a−1b−1(ab)^{-1} = a^{-1} b^{-1} because order does not matter; with matrices, it does.

Fragment 3: the rank that counted the wrong things

Echelon form:  | 1  -2  0  3 |
               | 0   0  1  5 |
               | 0   0  0  0 |
               | 0   0  0  0 |

There are two zero rows, so rg = 2 ... and since there are 4 rows, rg(A) = 4 - 2 = 2.
Since column 2 has no pivot, the rank drops to 1.

Predict: what is the rank?

The rank is 2: two non-zero rows, full stop. The first conclusion gets it right by luck (4−2=24 – 2 = 2), but the second line invents a rule: a column without a pivot subtracts nothing; it only says that column “depends” on the earlier ones. The rank counts pivots, and there are two.

Mixing up rows and columns when counting. The number of pivots is both the number of non-zero rows and the number of columns with a pivot; columns without a pivot are not subtracted from anything.

Solutions

Exercise 1

Approach: before touching a single number, look at the sizes. AB AB comes out 2×2 2 \times 2 , four entries, and BA BA comes out 3×3 3 \times 3 , nine. Then look at what you are asked: in b) only the diagonal, and in c) a justification as well as the calculation.

For the trace you do not need the whole product, only its diagonal. Entry (i,i) (i, i) of BA BA is row i i of B B times column i i of A A : 2⋅1+1⋅(−1)=1 2 \cdot 1 + 1 \cdot (-1) = 1 , 0⋅2+(−1)⋅1=−1 0 \cdot 2 + (-1) \cdot 1 = -1 and 1⋅0+1⋅3=3 1 \cdot 0 + 1 \cdot 3 = 3 . Three calculations instead of nine.

a) With the sizes clear, row by column:

AB=(1⋅2+2⋅0+0⋅11⋅1+2⋅(−1)+0⋅1−1⋅2+1⋅0+3⋅1−1⋅1+1⋅(−1)+3⋅1)=(2−111) AB = \begin{pmatrix} 1 \cdot 2 + 2 \cdot 0 + 0 \cdot 1 & 1 \cdot 1 + 2 \cdot (-1) + 0 \cdot 1 \\ -1 \cdot 2 + 1 \cdot 0 + 3 \cdot 1 & -1 \cdot 1 + 1 \cdot (-1) + 3 \cdot 1 \end{pmatrix} = \begin{pmatrix} 2 & -1 \\ 1 & 1 \end{pmatrix}
BA=(2⋅1+1⋅(−1)2⋅2+1⋅12⋅0+1⋅30⋅1+(−1)(−1)0⋅2+(−1)⋅10⋅0+(−1)⋅31⋅1+1⋅(−1)1⋅2+1⋅11⋅0+1⋅3)=(1531−1−3033) BA = \begin{pmatrix} 2 \cdot 1 + 1 \cdot (-1) & 2 \cdot 2 + 1 \cdot 1 & 2 \cdot 0 + 1 \cdot 3 \\ 0 \cdot 1 + (-1)(-1) & 0 \cdot 2 + (-1) \cdot 1 & 0 \cdot 0 + (-1) \cdot 3 \\ 1 \cdot 1 + 1 \cdot (-1) & 1 \cdot 2 + 1 \cdot 1 & 1 \cdot 0 + 1 \cdot 3 \end{pmatrix} = \begin{pmatrix} 1 & 5 & 3 \\ 1 & -1 & -3 \\ 0 & 3 & 3 \end{pmatrix}

b) tr(AB)=2+1=3tr(AB) = 2 + 1 = 3 and tr(BA)=1+(−1)+3=3tr(BA) = 1 + (-1) + 3 = 3. It is a general property: tr(AB)=tr(BA)tr(AB) = tr(BA) whenever both products exist. It comes in handy for checking products.

c) AAtA A^t is (2×3)(3×2)=2×2(2 \times 3)(3 \times 2) = 2 \times 2:

AAt=(120−113)(1−12103)=(1+4+0−1+2+0−1+2+01+1+9)=(51111) A A^t = \begin{pmatrix} 1 & 2 & 0 \\ -1 & 1 & 3 \end{pmatrix} \begin{pmatrix} 1 & -1 \\ 2 & 1 \\ 0 & 3 \end{pmatrix} = \begin{pmatrix} 1 + 4 + 0 & -1 + 2 + 0 \\ -1 + 2 + 0 & 1 + 1 + 9 \end{pmatrix} = \begin{pmatrix} 5 & 1 \\ 1 & 11 \end{pmatrix}

It is symmetric because (AAt)t=(At)tAt=AAt(A A^t)^t = (A^t)^t A^t = A A^t: it equals its transpose. Saying “you can see that a12=a21a_{12} = a_{21}” is not enough: that checks it for this matrix, the property proves it for all of them.

Why it is done this way: in a) the key is writing the sizes first; otherwise it is easy to attempt BABA as a 2×22 \times 2. In c) two things are asked, the calculation and the justification, and each carries part of the marks.

How it is marked (indicative split, my own, not the official one):

PartWhat earns the marksPoints
a)ABAB correct0.5
a)BABA with its correct 3×33 \times 3 size0.5
b)Both traces1
c)The product AAtA A^t0.5
c)The justification with (XY)t=YtXt(XY)^t = Y^t X^t0.5

Exercise 2

Approach: the obvious route to the rank is to row reduce A A with the k k inside, and it is the one that gets most complicated: every time you divide by something with k k in it, you have to split off the case where it is 0. The determinant settles it in one go, because wherever it does not vanish the rank is 3 with no more work. The plan:

  1. Compute ∣A∣ |A| and factorise it: the factors give you the values of k k that make it vanish.
  2. For all the others, rank 3.
  3. Each value that makes it vanish, separately and substituted into A A : the rank is 1 if all the rows are proportional and 2 if there is a nonzero 2×2 2 \times 2 minor. Now with numbers, no letters.
Check you’ve got it: what is the rank of the key if k is 2?

Rank 3. Step by step: 2 is neither 1 nor −2 -2 , so there is no need to touch the matrix: ∣A∣=−(2−1)2(2+2)=−4≠0 |A| = -(2 – 1)^2 (2 + 2) = -4 \neq 0 , and the rank is maximal. That is what the plan saves you: except for two values, the answer comes out without row reducing anything.

a) By Sarrus:

∣A∣=1⋅k⋅1+1⋅1⋅k+k⋅1⋅1−k⋅k⋅k−1⋅1⋅1−1⋅1⋅1=3k−k3−2 |A| = 1 \cdot k \cdot 1 + 1 \cdot 1 \cdot k + k \cdot 1 \cdot 1 – k \cdot k \cdot k – 1 \cdot 1 \cdot 1 – 1 \cdot 1 \cdot 1 = 3k – k^3 – 2

To factorise, k=1k = 1 makes it vanish (3−1−2=03 – 1 – 2 = 0). Dividing −k3+3k−2-k^3 + 3k – 2 by (k−1)(k – 1) with synthetic division leaves −k2−k+2=−(k−1)(k+2)-k^2 – k + 2 = -(k – 1)(k + 2), so

∣A∣=−(k−1)2(k+2) |A| = -(k – 1)^2 (k + 2)
  • If k≠1k \neq 1 and k≠−2k \neq -2: ∣A∣≠0|A| \neq 0 and rg(A)=3rg(A) = 3.
  • If k=1k = 1: all three rows are (1,1,1)(1, 1, 1); after row reducing, two rows of zeros remain and rg(A)=1rg(A) = 1.
  • If k=−2k = -2: ∣A∣=0|A| = 0 and the minor ∣111−2∣=−2−1=−3≠0\begin{vmatrix} 1 & 1 \\ 1 & -2 \end{vmatrix} = -2 – 1 = -3 \neq 0, so rg(A)=2rg(A) = 2.

b) With k=0k = 0, A=(110101011)A = \begin{pmatrix} 1 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 1 \end{pmatrix} and ∣A∣=−(0−1)2(0+2)=−2≠0|A| = -(0 – 1)^2 (0 + 2) = -2 \neq 0. With (A∣I)(A \mid I):

(110100101010011001)→f2→f2−f1(1101000−11−110011001)→f3→f3+f2(1101000−11−110002−111) \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 & 0 & 1 \end{array}\right) \xrightarrow{f_2 \to f_2 – f_1} \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & -1 & 1 & -1 & 1 & 0 \\ 0 & 1 & 1 & 0 & 0 & 1 \end{array}\right) \xrightarrow{f_3 \to f_3 + f_2} \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & -1 & 1 & -1 & 1 & 0 \\ 0 & 0 & 2 & -1 & 1 & 1 \end{array}\right)
→f2→−f2f3→12f3(11010001−11−10001−121212)→f2→f2+f3(11010001012−1212001−121212) \xrightarrow[f_2 \to -f_2]{f_3 \to \frac12 f_3} \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & 1 & -1 & 1 & -1 & 0 \\ 0 & 0 & 1 & -\frac12 & \frac12 & \frac12 \end{array}\right) \xrightarrow{f_2 \to f_2 + f_3} \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & \frac12 & -\frac12 & \frac12 \\ 0 & 0 & 1 & -\frac12 & \frac12 & \frac12 \end{array}\right)
→f1→f1−f2(1001212−1201012−1212001−121212)⇒A−1=12(11−11−11−111) \xrightarrow{f_1 \to f_1 – f_2} \left(\begin{array}{ccc|ccc} 1 & 0 & 0 & \frac12 & \frac12 & -\frac12 \\ 0 & 1 & 0 & \frac12 & -\frac12 & \frac12 \\ 0 & 0 & 1 & -\frac12 & \frac12 & \frac12 \end{array}\right) \quad\Rightarrow\quad A^{-1} = \frac12 \begin{pmatrix} 1 & 1 & -1 \\ 1 & -1 & 1 \\ -1 & 1 & 1 \end{pmatrix}

Check one row: row 1 of AA times column 1 of A−1A^{-1} gives 12+12+0=1\tfrac12 + \tfrac12 + 0 = 1, and times column 2, 12−12+0=0\tfrac12 – \tfrac12 + 0 = 0.

The operations in b), with the reason for each one. The order is always the same: first zeros below the diagonal, column by column; then the pivots to 1; and finally zeros above, from the bottom up.

StepOperationResulting rowWhy
1f2→f2−f1 f_2 \to f_2 – f_1 (0  −1  1∣−1  1  0) (0 \; {-1} \; 1 \mid {-1} \; 1 \; 0) Below the pivot 1 there is another 1: subtract row 1 once
2f3→f3+f2 f_3 \to f_3 + f_2 (0  0  2∣−1  1  1) (0 \; 0 \; 2 \mid {-1} \; 1 \; 1) The pivot of column 2 is −1 -1 and below it there is a 1: add them. That ends the way down
3f2→−f2 f_2 \to -f_2 (0  1  −1∣1  −1  0) (0 \; 1 \; {-1} \mid 1 \; {-1} \; 0) It only flips the sign so that the pivot is 1
4f3→12f3 f_3 \to \frac12 f_3 (0  0  1∣−12  12  12) (0 \; 0 \; 1 \mid {-\tfrac12} \; \tfrac12 \; \tfrac12) Pivot to 1. The halves appear here and not earlier, because dividing is left until the end
5f2→f2+f3 f_2 \to f_2 + f_3 (0  1  0∣12  −12  12) (0 \; 1 \; 0 \mid \tfrac12 \; {-\tfrac12} \; \tfrac12) The way up begins: the pivot of row 3 clears the −1 -1 in column 3
6f1→f1−f2 f_1 \to f_1 – f_2 (1  0  0∣12  12  −12) (1 \; 0 \; 0 \mid \tfrac12 \; \tfrac12 \; {-\tfrac12}) What is left is the 1 in column 2 of row 1

c) AX=C⇒A−1AX=A−1C⇒X=A−1CA X = C \Rightarrow A^{-1} A X = A^{-1} C \Rightarrow X = A^{-1} C:

X=12(11−11−11−111)(424025242726)=12(403844421010)=(2019222155) X = \frac12 \begin{pmatrix} 1 & 1 & -1 \\ 1 & -1 & 1 \\ -1 & 1 & 1 \end{pmatrix} \begin{pmatrix} 42 & 40 \\ 25 & 24 \\ 27 & 26 \end{pmatrix} = \frac12 \begin{pmatrix} 40 & 38 \\ 44 & 42 \\ 10 & 10 \end{pmatrix} = \begin{pmatrix} 20 & 19 \\ 22 & 21 \\ 5 & 5 \end{pmatrix}

The first entry, slowly: 12(42+25−27)=12⋅40=20\tfrac12(42 + 25 – 27) = \tfrac12 \cdot 40 = 20. By columns, 20, 22, 5 (S, U, E) and 19, 21, 5 (R, T, E): the message is “SUERTE”, Spanish for “good luck”. Notice that, although the inverse has halves, the message comes out in whole numbers: if it did not, that would be a sign of an arithmetic slip.

Why is it read by columns? Because of how the Hill cipher works: each column of X X is a three-letter piece of the message, and the key encrypts it by multiplying it by A A . Column 1 of C C is A A times column 1 of X X , and nothing else: the columns do not mix. That is why, to decrypt, you undo the multiplication with A−1 A^{-1} on the left, which is the side that acts on the columns.

That gives you the quickest check: instead of going over the inverse again, encrypt the message yourself and see whether C C comes out. With the first column, (20,22,5) (20, 22, 5) :

Row of A A CalculationResultWhy it has to be that
(1,1,0) (1, 1, 0) 20+22+0 20 + 22 + 0 42It is entry (1,1) (1, 1) of C C
(1,0,1) (1, 0, 1) 20+0+5 20 + 0 + 5 25It is entry (2,1) (2, 1) of C C
(0,1,1) (0, 1, 1) 0+22+5 0 + 22 + 5 27It is entry (3,1) (3, 1) of C C

The second, (19,21,5) (19, 21, 5) , gives 40, 24 and 26: it matches too. Six additions and no fractions.

Why it is done this way: in a), Sarrus with the parameter and not EROs, because with EROs you would have to divide by expressions in kk that can be 0. In b), the operation f2→−f2f_2 \to -f_2 only flips the sign of the row to get a pivot of 1. In c), order matters: CA−1C A^{-1} cannot even be computed (3×23 \times 2 times 3×33 \times 3), so the sizes themselves warn you.

How it is marked (indicative):

PartWhat earns the marksPoints
a)Determinant correctly computed and factorised0.75
a)The three rank cases, each justified0.75
b)Elementary operations on the whole row1
b)Correct (or checked) inverse0.5
c)Solving X=A−1CX = A^{-1} C on the left0.5
c)Product and message0.5

Exercise 3

Approach: the obvious route is to apply Sarrus to A−λI A – \lambda I as it stands. It works, but you have to expand (2−λ)3 (2 – \lambda)^3 with all its signs, and you get −λ3+6λ2−9λ+4 -\lambda^3 + 6\lambda^2 – 9\lambda + 4 , whose roots you would have to hunt for without any clue. The solution looks at the shape of the matrix first: everything off the diagonal is 1, and the diagonal repeats. That is why it pays to call what repeats t t , do a short Sarrus with a single letter and undo the substitution at the end.

For c), the same as in exercise 2: at those values the determinant is 0, so the rank can only be 1 or 2, and a 2×2 2 \times 2 minor decides it without row reducing anything.

Writing ∣A−λI∣=∣A∣−λ |A – \lambda I| = |A| – \lambda . The determinant does not split over the subtraction. Here you would get 4−λ 4 – \lambda , of degree 1, and the one for a 3×3 3 \times 3 matrix has to be of degree 3: that warning is enough to catch it.

a) Subtracting λI\lambda I only changes the diagonal:

A−λI=(2−λ1112−λ1112−λ) A – \lambda I = \begin{pmatrix} 2 – \lambda & 1 & 1 \\ 1 & 2 – \lambda & 1 \\ 1 & 1 & 2 – \lambda \end{pmatrix}

With t=2−λt = 2 – \lambda, it is the matrix of exercise 2 with the roles swapped (tt on the diagonal and ones off it), and by Sarrus:

∣A−λI∣=t3+1+1−t−t−t=t3−3t+2=(t−1)2(t+2) |A – \lambda I| = t^3 + 1 + 1 – t – t – t = t^3 – 3t + 2 = (t – 1)^2 (t + 2)

t=1t = 1 makes it vanish (1−3+2=01 – 3 + 2 = 0) and synthetic division gives the rest. Undoing the change, t−1=1−λt – 1 = 1 – \lambda and t+2=4−λt + 2 = 4 – \lambda:

p(λ)=(1−λ)2(4−λ) p(\lambda) = (1 – \lambda)^2 (4 – \lambda)

b) A−λIA – \lambda I has no inverse when its determinant is 0: λ=1\lambda = 1 (double root) and λ=4\lambda = 4.

c) With λ=1\lambda = 1, all three rows of A−IA – I equal (1,1,1)(1, 1, 1): rg(A−I)=1rg(A – I) = 1. With λ=4\lambda = 4:

A−4I=(−2111−2111−2),∣−211−2∣=4−1=3≠0 A – 4I = \begin{pmatrix} -2 & 1 & 1 \\ 1 & -2 & 1 \\ 1 & 1 & -2 \end{pmatrix}, \qquad \begin{vmatrix} -2 & 1 \\ 1 & -2 \end{vmatrix} = 4 – 1 = 3 \neq 0

and since ∣A−4I∣=p(4)=0|A – 4I| = p(4) = 0, rg(A−4I)=2rg(A – 4I) = 2. The diagram places both values on a line with the rank of A−λIA – \lambda I at each one.

Where |A − λI| vanishesNumber line of lambda values with two marked points: lambda equals 1, a double root, where the rank of A minus lambda I is 1, and lambda equals 4, a simple root, where the rank is 2. Everywhere else the rank is 3.-10123456λλ = 1rg(A − I) = 1double rootλ = 4rg(A − 4I) = 2simple rootp(λ) = (1 − λ)²(4 − λ)everywhere else, rg(A − λI) = 3
The rank only drops at the roots of the polynomial; how much it drops is what you will look at in diagonalisation.

Why it is done this way: the substitution t=2−λt = 2 – \lambda avoids expanding (2−λ)3(2 – \lambda)^3 by brute force, which is where signs get lost. In topic 5 you will see that 3−rg(A−λI)3 – rg(A – \lambda I) is exactly what you compare with the multiplicity of each root to know whether the matrix diagonalises: here 3−1=23 – 1 = 2 for the double root and 3−2=13 – 2 = 1 for the simple one.

How it is marked (indicative): a) 1 point for the polynomial and 0.5 for factorising it; b) 0.5; c) 0.5 for each rank, justified.

Check it in MATLAB

This script checks the three exercises. Run it after doing them on paper:

format rat
%% Exercise 1
A = [1 2 0; -1 1 3];  B = [2 1; 0 -1; 1 1];
A*B, B*A
trace(A*B), trace(B*A)     % the two traces
A*A'                       % symmetric
%% Exercise 2
syms k
Ak = [1 1 k; 1 k 1; k 1 1];
d = det(Ak)                % 3k - k^3 - 2 expanded
rank(subs(Ak, k, 1)), rank(subs(Ak, k, -2))
A0 = [1 1 0; 1 0 1; 0 1 1];
inv(A0)
X = inv(A0)*[42 40; 25 24; 27 26]
%% Exercise 3
A3 = [2 1 1; 1 2 1; 1 1 2];
syms lambda
p = det(A3 - lambda*eye(3))
rank(A3 - eye(3)), rank(A3 - 4*eye(3))

Output:

ans =

       2             -1       
       1              1       

ans =

       1              5              3       
       1             -1             -3       
       0              3              3       

ans =

       3       

ans =

       3       

ans =

       5              1       
       1             11       

 
d =
 
3*k - k^3 - 2
 

ans =

       1       

ans =

       2       

ans =

       1/2            1/2           -1/2     
       1/2           -1/2            1/2     
      -1/2            1/2            1/2     

X =

      20             19       
      22             21       
       5              5       

 
p =
 
6*lambda^2 - lambda^3 - 9*lambda + 4
 

ans =

       1       

ans =

       2       

trace is the trace; det with syms expands the polynomial instead of factorising it, so to compare it with yours, substitute: with λ=1\lambda = 1 and λ=4\lambda = 4 it must give 0. And the two ranks at the end, 1 and 2, are those of part c).

Campus-style quiz

These 20 questions are like the ones in the Campus quiz on matrices and determinants: true or false, single answer, several correct answers, matching and fill in the gaps, almost all theoretical and a few with a short calculation. They are original and belong to the question bank of the AG mock exam. The rules are those of the exam quiz: no negative marking, except in the several correct answers questions, where each wrongly ticked option cancels a correctly ticked one. Allow about 15 minutes and repeat it as often as you like.

Question 1Single choice

If AA is 3×23 \times 2 and BB is 2×52 \times 5, what size is ABAB?

  1. 3 × 5
  2. 2 × 2
  3. 5 × 3
  4. They cannot be multiplied
Solution

Answer: 3 × 5

To multiply, the columns of AA (2) must equal the rows of BB (2). The result has the rows of AA and the columns of BB: 3×53 \times 5.

Question 2True or false

Say whether each statement is true or false (all matrices are square and of the same size):

  1. AB=BAAB = BA always holds.
  2. (AB)t=BtAt(AB)^t = B^t A^t always holds.
  3. ∣AB∣=∣A∣⋅∣B∣|AB| = |A| \cdot |B| always holds.
  4. ∣A+B∣=∣A∣+∣B∣|A + B| = |A| + |B| always holds.
Solution
  • F — AB=BAAB = BA always holds.
  • T — (AB)t=BtAt(AB)^t = B^t A^t always holds.
  • T — ∣AB∣=∣A∣⋅∣B∣|AB| = |A| \cdot |B| always holds.
  • F — ∣A+B∣=∣A∣+∣B∣|A + B| = |A| + |B| always holds.

The product does not commute and the transpose of a product reverses the order. The determinant respects the product, but not the sum: with A=B=I2A = B = I_2, ∣A+B∣=∣2I2∣=4|A + B| = |2I_2| = 4 and ∣A∣+∣B∣=2|A| + |B| = 2.

Question 3Multiple · wrong ticks subtract

Which of these matrices are upper triangular?

  1. (410−2)\begin{pmatrix} 4 & 1 \\ 0 & -2 \end{pmatrix}
  2. (3000)\begin{pmatrix} 3 & 0 \\ 0 & 0 \end{pmatrix}
  3. (1052)\begin{pmatrix} 1 & 0 \\ 5 & 2 \end{pmatrix}
  4. (0010)\begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}
Solution

Answer: (410−2)\begin{pmatrix} 4 & 1 \\ 0 & -2 \end{pmatrix} · (3000)\begin{pmatrix} 3 & 0 \\ 0 & 0 \end{pmatrix}

Upper triangular means zeros below the main diagonal; above it anything goes, zero included. The second one is diagonal and therefore both upper and lower triangular. The other two have a non-zero number below the diagonal.

Question 4Single choice

The trace of (2710−34516)\begin{pmatrix} 2 & 7 & 1 \\ 0 & -3 & 4 \\ 5 & 1 & 6 \end{pmatrix} is:

  1. 5
  2. 27
  3. -36
  4. It has no trace because it is not symmetric
Solution

Answer: 5

The trace is the sum of the main diagonal: 2+(−3)+6=52 + (-3) + 6 = 5. Every square matrix has one, symmetric or not.

Question 5True or false

About row echelon matrices, following the definition in the course notes:

  1. In an echelon matrix, zero rows go at the bottom.
  2. In a row echelon matrix, the pivot of each non-zero row can be any non-zero number.
  3. The reduced row echelon form of a matrix is unique.
  4. In a reduced row echelon matrix, pivots only have zeros below them.
Solution
  • T — In an echelon matrix, zero rows go at the bottom.
  • F — In a row echelon matrix, the pivot of each non-zero row can be any non-zero number.
  • T — The reduced row echelon form of a matrix is unique.
  • F — In a reduced row echelon matrix, pivots only have zeros below them.

In the course definition, the pivot of each non-zero row is a 1. The reduced form also requires zeros above each pivot, and it is unique: that is why rref always gives the same answer.

Question 6Single choice

A 4×64 \times 6 matrix has rank at most:

  1. 4
  2. 6
  3. 10
  4. 24
Solution

Answer: 4

rg(A)≤min⁡{m,n}=min⁡{4,6}=4rg(A) \le \min\{m, n\} = \min\{4, 6\} = 4: there cannot be more pivots than rows.

Question 7Match

Match each elementary operation with what it does to the determinant:

Swapping two rows
Multiplying a row by 3
Adding 5 times another row to a row

Definitions:

  • It does not change
  • It is multiplied by 5
  • It is multiplied by 3
  • It changes sign
Solution
  • Swapping two rows → It changes sign
  • Multiplying a row by 3 → It is multiplied by 3
  • Adding 5 times another row to a row → It does not change

Only the operation fi→fi+λfjf_i \to f_i + \lambda f_j leaves the determinant unchanged. That is why it is the one used to triangulate.

Question 8Short answer

Compute the determinant of (3−241)\begin{pmatrix} 3 & -2 \\ 4 & 1 \end{pmatrix}. Write only the number.

Solution

Answer: 11

3⋅1−(−2)⋅4=3+8=113 \cdot 1 – (-2) \cdot 4 = 3 + 8 = 11. The typical slip is subtracting −8-8 instead of adding 8.

Question 9Multiple · wrong ticks subtract

Which of these matrices have determinant 0 without needing to compute it?

  1. (123000456)\begin{pmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 4 & 5 & 6 \end{pmatrix}
  2. (246123011)\begin{pmatrix} 2 & 4 & 6 \\ 1 & 2 & 3 \\ 0 & 1 & 1 \end{pmatrix}
  3. (101213314)\begin{pmatrix} 1 & 0 & 1 \\ 2 & 1 & 3 \\ 3 & 1 & 4 \end{pmatrix}
  4. (100020003)\begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}
Solution

Answer: (123000456)\begin{pmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 4 & 5 & 6 \end{pmatrix} · (246123011)\begin{pmatrix} 2 & 4 & 6 \\ 1 & 2 & 3 \\ 0 & 1 & 1 \end{pmatrix} · (101213314)\begin{pmatrix} 1 & 0 & 1 \\ 2 & 1 & 3 \\ 3 & 1 & 4 \end{pmatrix}

The first has a row of zeros; in the second, row 1 is twice row 2; in the third, row 3 is the sum of the first two. The last one is diagonal: its determinant is 1⋅2⋅3=61 \cdot 2 \cdot 3 = 6.

Question 10Single choice

The cofactor δ23\delta_{23} of a 3×33 \times 3 matrix is:

  1. −M23-M_{23}, the minor of row 2 and column 3 with its sign changed
  2. M23M_{23}, the minor without changing its sign
  3. The entry a32a_{32}
  4. The determinant of the matrix without row 3 and column 2
Solution

Answer: −M23-M_{23}, the minor of row 2 and column 3 with its sign changed

δ23=(−1)2+3M23=−M23\delta_{23} = (-1)^{2+3} M_{23} = -M_{23}. On the sign chessboard, position (2,3)(2, 3) carries a minus.

Question 11True or false

About the inverse of a square matrix AA of size nn:

  1. If it exists, it is unique.
  2. It exists if and only if rg(A)=nrg(A) = n.
  3. (AB)−1=A−1B−1(AB)^{-1} = A^{-1} B^{-1} holds.
  4. (At)−1=(A−1)t(A^t)^{-1} = (A^{-1})^t holds.
Solution
  • T — If it exists, it is unique.
  • T — It exists if and only if rg(A)=nrg(A) = n.
  • F — (AB)−1=A−1B−1(AB)^{-1} = A^{-1} B^{-1} holds.
  • T — (At)−1=(A−1)t(A^t)^{-1} = (A^{-1})^t holds.

The inverse of a product reverses the order: (AB)−1=B−1A−1(AB)^{-1} = B^{-1} A^{-1}, because AB⋅B−1A−1=AIA−1=IAB \cdot B^{-1} A^{-1} = A I A^{-1} = I.

Question 12Fill in the gaps

Complete the sentence:

A square matrix with zero determinant is called ____ and has no inverse; if the determinant is non-zero it is called ____ and its rank is ____.

Words:

  • full
  • symmetric
  • regular
  • singular
  • diagonal
  • zero
Solution

A square matrix with zero determinant is called singular and has no inverse; if the determinant is non-zero it is called regular and its rank is full.

Singular = determinant 0 = no inverse. Regular (or non-singular) = non-zero determinant = rank equal to the size.

Question 13Single choice

To compute the determinant of a 5×55 \times 5 matrix, which method does NOT work?

  1. The rule of Sarrus
  2. Cofactor expansion along a row or a column
  3. Reducing it to triangular form with elementary operations
  4. Combining elementary operations and cofactors
Solution

Answer: The rule of Sarrus

Sarrus only works for size 3. For size 4 or more you triangulate with elementary operations or expand by cofactors (and you can combine them: first make zeros, then expand).

Question 14Single choice

If ∣A∣=4|A| = 4 and AA is 3×33 \times 3, what is ∣2A∣|2A|?

  1. 32
  2. 8
  3. 16
  4. 6
Solution

Answer: 32

2A2A multiplies all three rows by 2, and each multiplied row pulls a 2 out of the determinant: ∣2A∣=23∣A∣=8⋅4=32|2A| = 2^3 |A| = 8 \cdot 4 = 32.

Question 15Match

Match each MATLAB command with what it computes:

rank(A)
rref(A)
inv(A)
A'

Definitions:

  • The inverse
  • The reduced row echelon form
  • The rank
  • The determinant
  • The transpose
Solution
  • rank(A) → The rank
  • rref(A) → The reduced row echelon form
  • inv(A) → The inverse
  • A' → The transpose

The determinant is det(A). And A' (with an apostrophe) is the transpose; to raise entry by entry you use .^.

Question 16Single choice

The adjugate matrix Adj(A)Adj(A) has, in position (i,j)(i, j):

  1. The cofactor δij\delta_{ij}
  2. The minor MijM_{ij} without its sign
  3. The entry ajia_{ji}
  4. The entry of A−1A^{-1} in that position
Solution

Answer: The cofactor δij\delta_{ij}

The adjugate is the matrix of cofactors. The inverse is 1∣A∣Adj(A)t\frac{1}{|A|} Adj(A)^t: the transposed adjugate divided by the determinant.

Question 17Short answer

Find the rank of (12−124−2−3−63)\begin{pmatrix} 1 & 2 & -1 \\ 2 & 4 & -2 \\ -3 & -6 & 3 \end{pmatrix}. Write only the number.

Solution

Answer: 1

Row 2 is twice row 1 and row 3 is −3-3 times row 1: after row reducing, only one non-zero row is left.

Question 18True or false

About the matrix AAtA A^t, with AA of size m×nm \times n:

  1. It always exists.
  2. It is square of size mm.
  3. It is symmetric.
  4. It equals AtAA^t A.
Solution
  • T — It always exists.
  • T — It is square of size mm.
  • T — It is symmetric.
  • F — It equals AtAA^t A.

AAtA A^t is m×mm \times m and AtAA^t A is n×nn \times n: if m≠nm \neq n they are not even the same size. Both are symmetric because (AAt)t=(At)tAt=AAt(A A^t)^t = (A^t)^t A^t = A A^t.

Question 19Single choice

For which value of kk does (k236)\begin{pmatrix} k & 2 \\ 3 & 6 \end{pmatrix} have no inverse?

  1. k=1k = 1
  2. k=0k = 0
  3. k=2k = 2
  4. k=−1k = -1
Solution

Answer: k=1k = 1

∣A∣=6k−6|A| = 6k – 6, which is 0 when k=1k = 1. With k=1k = 1, row 2 is three times row 1.

Question 20Multiple · wrong ticks subtract

Let AA be a 3×33 \times 3 matrix with ∣A∣=0|A| = 0. What can you be sure of?

  1. rg(A)<3rg(A) < 3
  2. AA has no inverse
  3. Some row can be obtained by combining the others
  4. AA has a row of zeros
Solution

Answer: rg(A)<3rg(A) < 3 · AA has no inverse · Some row can be obtained by combining the others

Determinant 0, rank below the size and “no inverse” are the same thing. A row of zeros is one way to get there, but not the only one: (1122)\begin{pmatrix} 1 & 1 \\ 2 & 2 \end{pmatrix} has no zeros and its determinant is 0.

What next?

Everything from today gets used straight away. In topic 2, systems of linear equations, the rank of the coefficient matrix and that of the augmented matrix decide whether a system has a solution, and Gaussian elimination is today’s echelon form with one more column. If you want to see each elementary operation with exact fractions, the Gauss-Jordan step-by-step simulator does it with you, and in MATLAB, rref, rank, det and inv check any question.

AG exam coming up?The test and practical packs with new solved questions and exercises, their cheat sheets, a blank test and practical exam and MATLAB functions, for free.See the pack

Cheat sheet: matrices and determinants

The essentials in 30 seconds: the product is row by column and does not commute; the rank counts pivots; the determinant only changes with swaps (sign) and multiplied rows (factor); ∣A∣≠0  ⟺  rg(A)=n  ⟺  |A| \neq 0 \iff rg(A) = n \iff A−1A^{-1} exists.

I want to…By handMATLAB
Multiply Am×nBn×qA_{m \times n} B_{n \times q}cijc_{ij} = row ii of AA times column jj of BBA*B
TransposeRows become columnsA'
Find the rankRow reduce and count non-zero rows, or the largest non-zero minorrank(A)
Get the reduced row echelon formEROs: zeros below and above pivots equal to 1rref(A)
Compute a 2×22 \times 2 determinanta11a22−a12a21a_{11}a_{22} – a_{12}a_{21}det(A)
Compute a 3×33 \times 3 determinantSarrus: three products added and three subtracteddet(A)
Compute a large determinantTriangulate with fi→fi+λfjf_i \to f_i + \lambda f_j or cofactors along the row with most zerosdet(A)
Find the inverse(A∣I)→(I∣A−1)(A \mid I) \to (I \mid A^{-1}) or 1∣A∣Adj(A)t\frac{1}{\lvert A \rvert} Adj(A)^tinv(A)
Solve AX=CAX = CX=A−1CX = A^{-1} C (on the left)inv(A)*C
A determinant with a parameterSarrus or cofactors, without dividing by the parametersyms a, det(A)

Templates for the exercises:

  • Rank depending on a parameter: determinant → values that make it zero → full rank for the rest → for each special value, a non-zero minor of the right order.
  • Inverse: check ∣A∣≠0|A| \neq 0 → requested method → check one row of AA−1A A^{-1}.
  • ∣A−λI∣|A – \lambda I|: subtract λ\lambda on the diagonal → Sarrus or cofactors → factorise → rank of A−λIA – \lambda I at each root.
SymptomLikely cause
The determinant comes out doubled or halvedA multiplied row not compensated
The determinant comes out with the wrong signA row swap not noted
A⋅A−1A \cdot A^{-1} is not the identityAn ERO applied to half a row, or the adjugate not transposed
rref does not match your reduced formAn arithmetic slip (the reduced form is unique)
A rank larger than the number of rowsYou counted columns or invented a pivot

Before handing in, ask yourself:

  1. Have I written the elementary operation above every arrow?
  2. Have I noted every swap and every multiplied row if I am computing a determinant?
  3. Have I justified every rank with the echelon form or a minor?
  4. Have I checked the inverse by multiplying at least one row?
Keep goingAll Linear algebra articles

Did this article help you? Here is how you can support SergioLearns →

Ready for the exam?AG theory mock exam — the 20-question test with the Campus rules, no negative marking (and the catch in the several-correct ones)