Matrix operations and inverses
Sums and scalar multiples, the matrix product as composition of linear maps, transpose and identity, elementary matrices, and the inverse by formula and by Gauss-Jordan on [A | I].
Course notes: Syllabus ch. 4 (Computing Linear Maps, Matrix Operations) · Exercise sessions: Sheet 7 (Matrix Operations) · About 45 minutes
Sum, scalar multiple and productImportant
Matrices of the same size are added entry by entry, and a scalar multiplies every entry. These match the sum and scalar multiple of linear maps: (h + g)(v) = h(v) + g(v).
The product of an m × r matrix A and an r × n matrix B is the m × n matrix AB whose (i, j) entry multiplies row i of A entry by entry with column j of B and adds the products. The inner sizes must agree. The product represents the composition of maps: if B represents g and A represents h, then AB represents h ∘ g (first g, then h).
Products in both orders
A = 120−131 (3 × 2) and B = 2011−14 (2 × 3).
AB is 3 × 3
All rows
BA is 2 × 2
AB and BA do not even have the same size here. Even for square matrices AB ≠ BA in general: the order of composition matters.
| Rule | Holds? |
|---|---|
| A(BC) = (AB)C | yes (composition is associative) |
| A(B + C) = AB + AC | yes |
| AB = BA | not in general |
| AB = 0 implies A = 0 or B = 0 | no: two non-zero matrices can multiply to 0 |
| (AB)T = BTAT | yes, note the reversed order |
Transpose, identity and elementary matricesNeutral
The transpose AT swaps rows and columns. The identity In has ones on the diagonal and zeros elsewhere; I A = A I = A. A diagonal matrix has zeros off the diagonal; its powers are found entry by entry.
An elementary matrix is the identity after one row operation. Multiplying A on the left by it performs that row operation on A. There are three kinds: swap two rows, multiply a row by a non-zero scalar, add a multiple of one row to another. Each is invertible, and Gauss-Jordan reduction of an invertible A to I writes A−1 as a product of elementary matrices.
A row operation as a product
E = 10−31 is I with R2 → R2 − 3R1.
Apply to A
Inverse of E
Row reduction is matrix multiplication in disguise.
The inverse matrixImportant
A square matrix A is invertible when there is a matrix A−1 with A A−1 = A−1 A = I. It exists exactly when the map x ↦ A x is an isomorphism, that is when det A ≠ 0, rank A = n, or A x = 0 has only the solution 0. Then A x = b has the unique solution x = A−1 b.
For larger matrices use Gauss-Jordan on [A | I]: row reduce the left block to I; the right block then becomes A−1. If a zero row appears on the left, A is not invertible.
Inverting a 3 × 3 matrix
A = 102213011.
Start
R2 → R2 − 2R1, then R3 → R3 − R2
R3 → R3 / 2, then R2 → R2 + R3 and R1 → R1 − 2R3
A−1 = −11−1−11/21/21−1/21/2. Check one entry of A A−1: row 2 of A times column 2 gives 2 + 1/2 − 3/2 = 1.
Useful rules: (AB)−1 = B−1A−1, (AT)−1 = (A−1)T, (A−1)−1 = A.
Application: an input-output modelBackground
In a Leontief model, sector j needs aij units of good i to make one unit of good j. With final demand d, total production x must satisfy x = A x + d, so x = (I − A)−1 d.
Two sectors
A = 0.20.30.40.1 and d = (10, 20).
I − A
Inverse
Production
Sector 1 produces 25 and sector 2 about 33.3 units; check: 25 − (0.2·25 + 0.3·100/3) = 10.
Key takeaways
- Product AB: rows of A times columns of B; (m × r)(r × n) = m × n.
- AB represents the composition: first B, then A. In general AB ≠ BA.
- (AB)T = BTAT and (AB)−1 = B−1A−1.
- A row operation equals multiplication on the left by an elementary matrix.
- Invertible exactly when det A ≠ 0 (rank n, kernel {0}).
- Gauss-Jordan on [A | I] gives [I | A−1].
True or false (5)
If A is 3 × 2 and B is 3 × 2, then AB is defined.
(A + B)2 = A2 + 2AB + B2 for all square A and B.
The product of two invertible n × n matrices is invertible.
Every elementary matrix is invertible.
A square matrix with two equal rows is invertible.
Multiple choice (7)
(1, 2) times the column (3, 4) (a 1 × 2 times a 2 × 1 product) gives...
The inverse of [[2, 1], [3, 2]] is...
If A is 4 × 3, then ATA is...
Which matrix performs R1 ↔ R2 on a 2-row matrix?
For invertible A, B, the solution of A X B = C is...
[[1, 1], [0, 1]]3 equals...
For which k is [[k, 2], [2, 1]] not invertible?
Exam-style open questions (3)
Gauss-Jordan inverse
Invert A = [[2, 1, 0], [1, 1, 0], [0, 0, 3]] with Gauss-Jordan and check the result.
Show a model answer outline
- The 2 × 2 block [[2, 1], [1, 1]] has determinant 1 and inverse [[1, −1], [−1, 2]]; the 3 stays separate.
- Row operations on [A | I]: R1 ↔ R2, R2 → R2 − 2R1, R2 → −R2, R1 → R1 − R2, R3 → R3 / 3.
- A−1 = [[1, −1, 0], [−1, 2, 0], [0, 0, 1/3]]; A A−1 = I.
Composition
g(x, y) = (x + y, 2y) and h(x, y) = (y, x). Give the matrices and the matrix of h ∘ g and of g ∘ h.
Show a model answer outline
- G = [[1, 1], [0, 2]], H = [[0, 1], [1, 0]].
- h ∘ g has matrix HG = [[0, 2], [1, 1]]: (x, y) ↦ (2y, x + y).
- g ∘ h has matrix GH = [[1, 1], [2, 0]]: (x, y) ↦ (x + y, 2x). Different, as expected.
Matrix equation
Solve X from X [[1, 2], [1, 3]] = [[4, 7], [2, 1]].
Show a model answer outline
- Multiply on the right by the inverse [[3, −2], [−1, 1]] (determinant 1).
- X = [[4·3 − 7, −8 + 7], [6 − 1, −4 + 1]] = [[5, −1], [5, −3]].
- Check: [[5, −1], [5, −3]] [[1, 2], [1, 3]] = [[4, 7], [2, 1]].
LabMatrix calculator
Try the product of the worked example in both orders.
LabGauss-Jordan inverse lab
Change one entry of the default so that the determinant becomes 0 and watch the zero row appear.