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 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?”.
Table of Contents
How to use this article
First, how this counts in the AG exam. The exam mark is : T is a 20-question quiz drawn from the Campus quizzes and P is written exercises on paper. If , the final mark is (the quizzes and the MATLAB assignments, up to 1.5 points each); if not, the final mark is . 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.
- Do each exercise on paper, without a calculator, with the operations written above every arrow.
- Compare with the expected result and, if it does not match, open the hint before looking at the solution.
- Read “What’s wrong here?” trying to find the mistake yourself before reading the explanation.
- 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 and . a) (1 point) Compute and . b) (1 point) Check that even though and are not even the same size. c) (1 point) Compute and justify why it is symmetric.
Expected result: , is , both traces are 3 and .
Before multiplying, write down the sizes: gives and gives . For the symmetry in c), use .
Exercise 2 (intermediate level): a key with a parameter
Exercise 2. [4 points] For the coding game, the proposed key is , with . a) (1.5 points) Compute and the rank of for each value of . b) (1.5 points) For , compute with elementary operations. c) (1 point) With , the received code is . Find the message matrix knowing that and turn it into letters.
Expected result: ; rank 3 if and , rank 1 if and rank 2 if . For , every entry of the inverse is , and the message is a six-letter Spanish word you say to someone before an exam.
By Sarrus, . To factorise it, try : if it vanishes, is a factor and you can divide with synthetic division. In c), solve for by multiplying by 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, , and then the rank of 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) (1.5 points) Compute the polynomial and factorise it. b) (0.5 points) For which values of does have no inverse? c) (1 point) For each of those values, find the rank of .
Expected result: ; the values are (double) and ; and .
Call what sits on the diagonal. You get the same shape as in exercise 2, and you already know how to factorise .
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 mixes two things: it multiplies row 2 by 2 (which multiplies the determinant by 2) and then subtracts (which changes nothing). The 6 is twice the real determinant: . Check it with Sarrus: .
Using with without dividing by 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: . 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: . The arithmetic of the product is fine, but it is the wrong product. The correct one is
Carrying the rules for numbers over to matrices. With numbers, 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 (), 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. comes out , four entries, and comes out , 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 of is row of times column of : , and . Three calculations instead of nine.
a) With the sizes clear, row by column:
b) and . It is a general property: whenever both products exist. It comes in handy for checking products.
c) is :
It is symmetric because : it equals its transpose. Saying “you can see that ” 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 as a . 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):
| Part | What earns the marks | Points |
|---|---|---|
| a) | correct | 0.5 |
| a) | with its correct size | 0.5 |
| b) | Both traces | 1 |
| c) | The product | 0.5 |
| c) | The justification with | 0.5 |
Exercise 2
Approach: the obvious route to the rank is to row reduce with the inside, and it is the one that gets most complicated: every time you divide by something with 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:
- Compute and factorise it: the factors give you the values of that make it vanish.
- For all the others, rank 3.
- Each value that makes it vanish, separately and substituted into : the rank is 1 if all the rows are proportional and 2 if there is a nonzero 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 , so there is no need to touch the matrix: , 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:
To factorise, makes it vanish (). Dividing by with synthetic division leaves , so
- If and : and .
- If : all three rows are ; after row reducing, two rows of zeros remain and .
- If : and the minor , so .
b) With , and . With :
Check one row: row 1 of times column 1 of gives , and times column 2, .
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.
| Step | Operation | Resulting row | Why |
|---|---|---|---|
| 1 | Below the pivot 1 there is another 1: subtract row 1 once | ||
| 2 | The pivot of column 2 is and below it there is a 1: add them. That ends the way down | ||
| 3 | It only flips the sign so that the pivot is 1 | ||
| 4 | Pivot to 1. The halves appear here and not earlier, because dividing is left until the end | ||
| 5 | The way up begins: the pivot of row 3 clears the in column 3 | ||
| 6 | What is left is the 1 in column 2 of row 1 |
c) :
The first entry, slowly: . 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 is a three-letter piece of the message, and the key encrypts it by multiplying it by . Column 1 of is times column 1 of , and nothing else: the columns do not mix. That is why, to decrypt, you undo the multiplication with 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 comes out. With the first column, :
| Row of | Calculation | Result | Why it has to be that |
|---|---|---|---|
| 42 | It is entry of | ||
| 25 | It is entry of | ||
| 27 | It is entry of |
The second, , 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 that can be 0. In b), the operation only flips the sign of the row to get a pivot of 1. In c), order matters: cannot even be computed ( times ), so the sizes themselves warn you.
How it is marked (indicative):
| Part | What earns the marks | Points |
|---|---|---|
| a) | Determinant correctly computed and factorised | 0.75 |
| a) | The three rank cases, each justified | 0.75 |
| b) | Elementary operations on the whole row | 1 |
| b) | Correct (or checked) inverse | 0.5 |
| c) | Solving on the left | 0.5 |
| c) | Product and message | 0.5 |
Exercise 3
Approach: the obvious route is to apply Sarrus to as it stands. It works, but you have to expand with all its signs, and you get , 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 , 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 minor decides it without row reducing anything.
Writing . The determinant does not split over the subtraction. Here you would get , of degree 1, and the one for a matrix has to be of degree 3: that warning is enough to catch it.
a) Subtracting only changes the diagonal:
With , it is the matrix of exercise 2 with the roles swapped ( on the diagonal and ones off it), and by Sarrus:
makes it vanish () and synthetic division gives the rest. Undoing the change, and :
b) has no inverse when its determinant is 0: (double root) and .
c) With , all three rows of equal : . With :
and since , . The diagram places both values on a line with the rank of at each one.
Why it is done this way: the substitution avoids expanding by brute force, which is where signs get lost. In topic 5 you will see that is exactly what you compare with the multiplicity of each root to know whether the matrix diagonalises: here for the double root and 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 and 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.
If is and is , what size is ?
- 3 × 5
- 2 × 2
- 5 × 3
- They cannot be multiplied
Solution
Answer: 3 × 5
To multiply, the columns of (2) must equal the rows of (2). The result has the rows of and the columns of : .
Say whether each statement is true or false (all matrices are square and of the same size):
- always holds.
- always holds.
- always holds.
- always holds.
Solution
- F — always holds.
- T — always holds.
- T — always holds.
- F — 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 , and .
Which of these matrices are upper triangular?
Solution
Answer: ·
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.
The trace of is:
- 5
- 27
- -36
- It has no trace because it is not symmetric
Solution
Answer: 5
The trace is the sum of the main diagonal: . Every square matrix has one, symmetric or not.
About row echelon matrices, following the definition in the course notes:
- In an echelon matrix, zero rows go at the bottom.
- In a row echelon matrix, the pivot of each non-zero row can be any non-zero number.
- The reduced row echelon form of a matrix is unique.
- 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.
A matrix has rank at most:
- 4
- 6
- 10
- 24
Solution
Answer: 4
: there cannot be more pivots than rows.
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 leaves the determinant unchanged. That is why it is the one used to triangulate.
Compute the determinant of . Write only the number.
Solution
Answer: 11
. The typical slip is subtracting instead of adding 8.
Which of these matrices have determinant 0 without needing to compute it?
Solution
Answer: · ·
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 .
The cofactor of a matrix is:
- , the minor of row 2 and column 3 with its sign changed
- , the minor without changing its sign
- The entry
- The determinant of the matrix without row 3 and column 2
Solution
Answer: , the minor of row 2 and column 3 with its sign changed
. On the sign chessboard, position carries a minus.
About the inverse of a square matrix of size :
- If it exists, it is unique.
- It exists if and only if .
- holds.
- holds.
Solution
- T — If it exists, it is unique.
- T — It exists if and only if .
- F — holds.
- T — holds.
The inverse of a product reverses the order: , because .
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.
To compute the determinant of a matrix, which method does NOT work?
- The rule of Sarrus
- Cofactor expansion along a row or a column
- Reducing it to triangular form with elementary operations
- 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).
If and is , what is ?
- 32
- 8
- 16
- 6
Solution
Answer: 32
multiplies all three rows by 2, and each multiplied row pulls a 2 out of the determinant: .
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 rankrref(A)→ The reduced row echelon forminv(A)→ The inverseA'→ The transpose
The determinant is det(A). And A' (with an apostrophe) is the transpose; to raise entry by entry you use .^.
The adjugate matrix has, in position :
- The cofactor
- The minor without its sign
- The entry
- The entry of in that position
Solution
Answer: The cofactor
The adjugate is the matrix of cofactors. The inverse is : the transposed adjugate divided by the determinant.
Find the rank of . Write only the number.
Solution
Answer: 1
Row 2 is twice row 1 and row 3 is times row 1: after row reducing, only one non-zero row is left.
About the matrix , with of size :
- It always exists.
- It is square of size .
- It is symmetric.
- It equals .
Solution
- T — It always exists.
- T — It is square of size .
- T — It is symmetric.
- F — It equals .
is and is : if they are not even the same size. Both are symmetric because .
For which value of does have no inverse?
Solution
Answer:
, which is 0 when . With , row 2 is three times row 1.
Let be a matrix with . What can you be sure of?
- has no inverse
- Some row can be obtained by combining the others
- has a row of zeros
Solution
Answer: · 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: 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.
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); exists.
| I want to… | By hand | MATLAB |
|---|---|---|
| Multiply | = row of times column of | A*B |
| Transpose | Rows become columns | A' |
| Find the rank | Row reduce and count non-zero rows, or the largest non-zero minor | rank(A) |
| Get the reduced row echelon form | EROs: zeros below and above pivots equal to 1 | rref(A) |
| Compute a determinant | det(A) | |
| Compute a determinant | Sarrus: three products added and three subtracted | det(A) |
| Compute a large determinant | Triangulate with or cofactors along the row with most zeros | det(A) |
| Find the inverse | or | inv(A) |
| Solve | (on the left) | inv(A)*C |
| A determinant with a parameter | Sarrus or cofactors, without dividing by the parameter | syms 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 → requested method → check one row of .
- : subtract on the diagonal → Sarrus or cofactors → factorise → rank of at each root.
| Symptom | Likely cause |
|---|---|
| The determinant comes out doubled or halved | A multiplied row not compensated |
| The determinant comes out with the wrong sign | A row swap not noted |
| is not the identity | An ERO applied to half a row, or the adjugate not transposed |
rref does not match your reduced form | An arithmetic slip (the reduced form is unique) |
| A rank larger than the number of rows | You counted columns or invented a pivot |
Before handing in, ask yourself:
- Have I written the elementary operation above every arrow?
- Have I noted every swap and every multiplied row if I am computing a determinant?
- Have I justified every rank with the echelon form or a minor?
- Have I checked the inverse by multiplying at least one row?
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)


