hanegreefs.com/Math II
Chapter 4 · unit 4 of 12

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).

Formula
(AB)ij = ai1b1j + ai2b2j + ... + airbrj
Worked example

Products in both orders

A = 120−131 (3 × 2) and B = 2011−14 (2 × 3).

1

AB is 3 × 3

row 1 of A with the columns of B: (1·2 + 2·1, 1·0 + 2·(−1), 1·1 + 2·4) = (4, −2, 9)
2

All rows

AB = 4−29−11−47−17
3

BA is 2 × 2

BA = 55137
Answer

AB and BA do not even have the same size here. Even for square matrices AB ≠ BA in general: the order of composition matters.

RuleHolds?
A(BC) = (AB)Cyes (composition is associative)
A(B + C) = AB + ACyes
AB = BAnot in general
AB = 0 implies A = 0 or B = 0no: two non-zero matrices can multiply to 0
(AB)T = BTATyes, 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.

Worked example

A row operation as a product

E = 10−31 is I with R2 → R2 − 3R1.

1

Apply to A

E 1238 = 1202
2

Inverse of E

undo the operation: R2 → R2 + 3R1, so E−1 = 1031
Answer

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.

Formula
pqrs−1 = 1ps − qr s−q−rp   when ps − qr ≠ 0

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.

Worked example

Inverting a 3 × 3 matrix

A = 102213011.

1

Start

102100213010011001
2

R2 → R2 − 2R1, then R3 → R3 − R2

10210001−1−2100022−11
3

R3 → R3 / 2, then R2 → R2 + R3 and R1 → R1 − 2R3

100−11−1010−11/21/20011−1/21/2
Answer

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.

Common trapNever divide by a matrix. To solve AX = B multiply by A−1 on the left (X = A−1B); to solve XA = B multiply on the right (X = BA−1).

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.

Worked example

Two sectors

A = 0.20.30.40.1 and d = (10, 20).

1

I − A

0.8−0.3−0.40.9 with determinant 0.72 − 0.12 = 0.6
2

Inverse

10.6 0.90.30.40.8 = 1.50.52/34/3
3

Production

x = (1.5·10 + 0.5·20, (2/3)·10 + (4/3)·20) = (25, 100/3)
Answer

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].

Loading cards
Question
Click, tap or press space to flip
Answer

True or false (5)

Statement 1 · Chapter 4 · true or false

If A is 3 × 2 and B is 3 × 2, then AB is defined.

Why: The inner sizes 2 and 3 do not match; ATB and ABT are defined.
Statement 2 · Chapter 4 · true or false

(A + B)2 = A2 + 2AB + B2 for all square A and B.

Why: The middle term is AB + BA, which differs from 2AB unless AB = BA.
Statement 3 · Chapter 4 · true or false

The product of two invertible n × n matrices is invertible.

Why: Its inverse is B−1A−1.
Statement 4 · Chapter 4 · true or false

Every elementary matrix is invertible.

Why: Each row operation can be undone by another row operation.
Statement 5 · Chapter 4 · true or false

A square matrix with two equal rows is invertible.

Why: Subtracting one row from the other gives a zero row.

Multiple choice (7)

Question 1 · Chapter 4

(1, 2) times the column (3, 4) (a 1 × 2 times a 2 × 1 product) gives...

Why: 1·3 + 2·4 = 11, a 1 × 1 matrix.
Question 2 · Chapter 4

The inverse of [[2, 1], [3, 2]] is...

Why: The determinant is 4 − 3 = 1.
Question 3 · Chapter 4

If A is 4 × 3, then ATA is...

Why: (3 × 4)(4 × 3).
Question 4 · Chapter 4

Which matrix performs R1 ↔ R2 on a 2-row matrix?

Why: Swap the rows of the identity.
Question 5 · Chapter 4

For invertible A, B, the solution of A X B = C is...

Why: Multiply by A−1 on the left and B−1 on the right.
Question 6 · Chapter 4

[[1, 1], [0, 1]]3 equals...

Why: Each multiplication adds 1 to the top right entry.
Question 7 · Chapter 4

For which k is [[k, 2], [2, 1]] not invertible?

Why: k − 4 = 0.

Exam-style open questions (3)

Open question · Chapter 4

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.
Open question · Chapter 4

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.
Open question · Chapter 4

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.