- Foundation
- About 14 min
- 5 practice questions
Matrices as tables: totals, trace, and scalar, diagonal and triangular matrices
Use a matrix product to turn a table of quantities and a column of prices into totals, find the trace of a square matrix and use tr(AB) = tr(BA), and recognise scalar, diagonal and triangular matrices.
If something looks wrong, please tell us.
Matrices began as a way of organising tables. Whenever a table of quantities meets a list of prices, rates or weights, the answer is a matrix product. This lesson shows that use, and adds the trace and three special kinds of square matrix that are named in many questions.
A table times a column
A matrix with rows as shops and columns as items can store the number of units sold. A column matrix of prices then gives each shop's total through multiplication: row by column means (quantity of item 1) × (price of item 1) + (quantity of item 2) × (price of item 2) + …
Worked example 1: shop totals
Two shops sell three items. Shop 1 sold 10, 5 and 8 units; shop 2 sold 6, 12 and 4 units. The prices (illustrative) are ₹20, ₹15 and ₹30 per unit. Write S = [10 5 8; 6 12 4] and the price column p = (20, 15, 30). The product S p has two entries. Shop 1: 10·20 + 5·15 + 8·30 = 200 + 75 + 240 = 515. Shop 2: 6·20 + 12·15 + 4·30 = 120 + 180 + 120 = 420. So the takings are ₹515 and ₹420. The order is 2 × 3 times 3 × 1, which gives 2 × 1: one total per shop. If the prices were laid out in a row, the product could not be formed, because the orders would not match.
The trace
The trace of a square matrix is the sum of the entries on its main diagonal, written tr(A). For [1 2 3; 4 5 6; 7 8 9] it is 1 + 5 + 9 = 15. The trace has simple rules: tr(A + B) = tr A + tr B, tr(kA) = k tr A, tr(Aᵀ) = tr A, and tr(AB) = tr(BA) even when AB ≠ BA.
tr(AB) = tr(BA), although AB and BA are usually different matrices.
Worked example 2: the same trace for AB and BA
Let P = [1 2; 3 4] and Q = [0 5; 6 7]. Then PQ = [1·0 + 2·6, 1·5 + 2·7; 3·0 + 4·6, 3·5 + 4·7] = [12 19; 24 43], with trace 12 + 43 = 55. And QP = [0·1 + 5·3, 0·2 + 5·4; 6·1 + 7·3, 6·2 + 7·4] = [15 20; 27 40], with trace 15 + 40 = 55. The matrices differ, but the traces are equal, as the rule says.
Scalar, diagonal and triangular matrices
| Type | Description | Example |
|---|---|---|
| Diagonal | all entries off the main diagonal are 0 | [2 0 0; 0 3 0; 0 0 5] |
| Scalar | diagonal with all diagonal entries equal | [4 0; 0 4] |
| Identity | scalar with diagonal entries 1 | [1 0; 0 1] |
| Upper triangular | all entries below the diagonal are 0 | [1 2 3; 0 4 5; 0 0 6] |
| Lower triangular | all entries above the diagonal are 0 | [1 0 0; 2 3 0; 4 5 6] |
Every scalar matrix is diagonal, and every diagonal matrix is both upper and lower triangular. The determinant of a triangular (or diagonal) matrix is the product of its diagonal entries. For the upper triangular example, the determinant is 1 × 4 × 6 = 24.
Worked example 3: use of the types
A scalar matrix kI of order 3 with k = 4 is [4 0 0; 0 4 0; 0 0 4]. Its trace is 12 and its determinant is 4³ = 64. Multiplying any 3 × 3 matrix A by this matrix gives 4A, since (kI)A = k(IA) = kA. This explains why a scalar matrix commutes with every square matrix of its order.
Key takeaways: a table times a column of rates gives totals, provided the orders match; the trace is the sum of the diagonal entries and tr(AB) = tr(BA); diagonal, scalar and triangular matrices are named by where the zeros are; the determinant of a triangular matrix is the product of the diagonal.
Check your understanding
-
1. What is the trace of [1 2 3; 4 5 6; 7 8 9]?
- 15
- 45
- 12
- 18
Show answer
Answer: A. The diagonal entries are 1, 5 and 9, and 1 + 5 + 9 = 15.
-
2. A 2 × 3 matrix of sales times a 3 × 1 column of prices gives a matrix of order:
- 3 × 3
- 1 × 3
- 2 × 1
- 2 × 3
Show answer
Answer: C. The inner orders (3 and 3) match, and the outer orders 2 and 1 give the result: one total for each of the two rows.
-
3. If P and Q are 2 × 2 and tr(PQ) = 55, what is tr(QP)?
- 0
- 55
- 110
- cannot be found
Show answer
Answer: B. tr(PQ) = tr(QP) for square matrices of the same order.
-
4. What is the determinant of [2 7 1; 0 3 9; 0 0 5]?
- 10
- 17
- 0
- 30
Show answer
Answer: D. The matrix is upper triangular, so the determinant is the product of the diagonal entries: 2 × 3 × 5 = 30.
-
5. Which of these is a scalar matrix?
- [4 0; 0 5]
- [4 0; 0 4]
- [0 4; 4 0]
- [4 1; 0 4]
Show answer
Answer: B. A scalar matrix is a diagonal matrix with equal diagonal entries.
Sign in to keep track of the lessons you finish.