Femtobytes
Problem type

Inverse of a matrix by row reduction

What it solves
Find the inverse of a 2 by 2 or 3 by 3 matrix by reducing the matrix beside the identity, with every row operation worked entry by entry, then prove the answer by multiplying back. If the matrix has no inverse, see exactly where and why the method stops.
Subject
Linear Algebra
Topic
Determinants and inverses
Also called
invert a matrix, matrix inverse, Gauss Jordan
Your problem

Find the inverse of this matrix, or show that it has none.

A=[211132100]A = \left[ \begin{array}{rrr} 2 & 1 & 1 \\ 1 & 3 & 2 \\ 1 & 0 & 0 \end{array} \right]
The square matrix
Size3
Whole numbers or fractions. 2 by 2 or 3 by 3.
Invent a new one:
The problem

Find the inverse of this matrix, or show that it has none.

A=[211132100]A = \left[ \begin{array}{rrr} 2 & 1 & 1 \\ 1 & 3 & 2 \\ 1 & 0 & 0 \end{array} \right]
The result
A−1=[001−2133−1−5]A^{-1} = \left[ \begin{array}{rrr} 0 & 0 & 1 \\ -2 & 1 & 3 \\ 3 & -1 & -5 \end{array} \right]

Checked: multiplying AA by this matrix gives the identity.

checked 67 lines of this solution were evaluated with exact arithmetic before it was shown to you. A solution with a false line is never served.
Picture 1 of 6Step 1: Say what an inverse is, and set up the method
A written beside the identity, which is the whole method
221111110000113322001100110000000011
On the left the matrix A, on the right the identity, the matrix that changes nothing. Every move made to the left half is made to the right half too. When the left half has become the identity, the right half has become the inverse, because it has had exactly the moves done to it that undo A.
1

Say what an inverse is, and set up the method

Why this step

The inverse of AA is the matrix that UNDOES AA. We could hunt for its entries as unknowns, which for a 3×33 \times 3 matrix means nine unknowns in nine equations. There is a far better idea: every row operation is itself a multiplication by some matrix, so the whole sequence of operations that turns AA into the identity IS, multiplied together, the inverse. We do not need to find those matrices. We only need to apply the same operations to the identity and watch what it turns into.

[211100132010100001]\left[ \begin{array}{rrr|rrr} 2 & 1 & 1 & 1 & 0 & 0 \\ 1 & 3 & 2 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 & 0 & 1 \end{array} \right]
Write AA and II side by side. We will row reduce the whole block. When the left half becomes II, the right half will have become A−1A^{-1}.
2

Pivot 1: column 1, row 1

Why this step

We work one column at a time, left to right. The goal for a column is a single 11 (the pivot) with zeros everywhere else in it. A column in that state says something very plain: its variable appears in exactly one equation, with nothing in front of it. Each cleared column is one variable pinned down.

Swap row 1 and row 2, to bring the entry 11 up to the pivot position. Swapping two equations changes nothing about what they say together.

[132010211100100001]\left[ \begin{array}{rrr|rrr} \boxed{1} & 3 & 2 & 0 & 1 & 0 \\ 2 & 1 & 1 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 1 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Replace row 2 by R2−2R1R_{2} - 2 R_{1}. The multiplier is chosen so that the entry under attack, 22, is cancelled exactly by the pivot: 2−2⋅1=02 - 2 \cdot 1 = 0.

columnworkingnew entry
112−2⋅12 - 2 \cdot 100
221−2⋅31 - 2 \cdot 3−5-5
331−2⋅21 - 2 \cdot 2−3-3
441−2⋅01 - 2 \cdot 011
550−2⋅10 - 2 \cdot 1−2-2
660−2⋅00 - 2 \cdot 000
Row 2, entry by entry: old entry minus the multiple of row 1.
[1320100−5−31−20100001]\left[ \begin{array}{rrr|rrr} \boxed{1} & 3 & 2 & 0 & 1 & 0 \\ 0 & -5 & -3 & 1 & -2 & 0 \\ 1 & 0 & 0 & 0 & 0 & 1 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Replace row 3 by R3−R1R_{3} - R_{1}. The multiplier is chosen so that the entry under attack, 11, is cancelled exactly by the pivot: 1−1⋅1=01 - 1 \cdot 1 = 0.

columnworkingnew entry
111−1⋅11 - 1 \cdot 100
220−1⋅30 - 1 \cdot 3−3-3
330−1⋅20 - 1 \cdot 2−2-2
440−1⋅00 - 1 \cdot 000
550−1⋅10 - 1 \cdot 1−1-1
661−1⋅01 - 1 \cdot 011
Row 3, entry by entry: old entry minus the multiple of row 1.
[1320100−5−31−200−3−20−11]\left[ \begin{array}{rrr|rrr} \boxed{1} & 3 & 2 & 0 & 1 & 0 \\ 0 & -5 & -3 & 1 & -2 & 0 \\ 0 & -3 & -2 & 0 & -1 & 1 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked
3

Pivot 2: column 2, row 2

Why this step

The same job for the next column. Working left to right matters: the rows we use now already have zeros in the earlier pivot columns, so clearing this column cannot spoil the columns already finished. That is why the method never has to go back.

Swap row 2 and row 3, to bring the entry −3-3 up to the pivot position. Swapping two equations changes nothing about what they say together.

[1320100−3−20−110−5−31−20]\left[ \begin{array}{rrr|rrr} 1 & 3 & 2 & 0 & 1 & 0 \\ 0 & \boxed{-3} & -2 & 0 & -1 & 1 \\ 0 & -5 & -3 & 1 & -2 & 0 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Multiply row 2 by −13-\frac{1}{3}, which turns the pivot −3-3 into 11. Multiplying an equation through by a number that is not zero keeps it true for exactly the same values.

columnworkingnew entry
11−13⋅0-\frac{1}{3} \cdot 000
22−13⋅(−3)-\frac{1}{3} \cdot \left( -3 \right)11
33−13⋅(−2)-\frac{1}{3} \cdot \left( -2 \right)23\frac{2}{3}
44−13⋅0-\frac{1}{3} \cdot 000
55−13⋅(−1)-\frac{1}{3} \cdot \left( -1 \right)13\frac{1}{3}
66−13⋅1-\frac{1}{3} \cdot 1−13-\frac{1}{3}
Row 2, entry by entry.
[1320100123013−130−5−31−20]\left[ \begin{array}{rrr|rrr} 1 & 3 & 2 & 0 & 1 & 0 \\ 0 & \boxed{1} & \frac{2}{3} & 0 & \frac{1}{3} & -\frac{1}{3} \\ 0 & -5 & -3 & 1 & -2 & 0 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Replace row 1 by R1−3R2R_{1} - 3 R_{2}. The multiplier is chosen so that the entry under attack, 33, is cancelled exactly by the pivot: 3−3⋅1=03 - 3 \cdot 1 = 0.

columnworkingnew entry
111−3⋅01 - 3 \cdot 011
223−3⋅13 - 3 \cdot 100
332−3⋅232 - 3 \cdot \frac{2}{3}00
440−3⋅00 - 3 \cdot 000
551−3⋅131 - 3 \cdot \frac{1}{3}00
660−3⋅(−13)0 - 3 \cdot \left( -\frac{1}{3} \right)11
Row 1, entry by entry: old entry minus the multiple of row 2.
[1000010123013−130−5−31−20]\left[ \begin{array}{rrr|rrr} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & \boxed{1} & \frac{2}{3} & 0 & \frac{1}{3} & -\frac{1}{3} \\ 0 & -5 & -3 & 1 & -2 & 0 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Replace row 3 by R3+5R2R_{3} + 5 R_{2}. The multiplier is chosen so that the entry under attack, −5-5, is cancelled exactly by the pivot: −5+5⋅1=0-5 + 5 \cdot 1 = 0.

columnworkingnew entry
110+5⋅00 + 5 \cdot 000
22−5+5⋅1-5 + 5 \cdot 100
33−3+5⋅23-3 + 5 \cdot \frac{2}{3}13\frac{1}{3}
441+5⋅01 + 5 \cdot 011
55−2+5⋅13-2 + 5 \cdot \frac{1}{3}−13-\frac{1}{3}
660+5⋅(−13)0 + 5 \cdot \left( -\frac{1}{3} \right)−53-\frac{5}{3}
Row 3, entry by entry: old entry plus the multiple of row 2.
[1000010123013−1300131−13−53]\left[ \begin{array}{rrr|rrr} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & \boxed{1} & \frac{2}{3} & 0 & \frac{1}{3} & -\frac{1}{3} \\ 0 & 0 & \frac{1}{3} & 1 & -\frac{1}{3} & -\frac{5}{3} \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked
4

Pivot 3: column 3, row 3

Why this step

The same job for the next column. Working left to right matters: the rows we use now already have zeros in the earlier pivot columns, so clearing this column cannot spoil the columns already finished. That is why the method never has to go back.

Multiply row 3 by 33, which turns the pivot 13\frac{1}{3} into 11. Multiplying an equation through by a number that is not zero keeps it true for exactly the same values.

columnworkingnew entry
113⋅03 \cdot 000
223⋅03 \cdot 000
333⋅133 \cdot \frac{1}{3}11
443⋅13 \cdot 133
553⋅(−13)3 \cdot \left( -\frac{1}{3} \right)−1-1
663⋅(−53)3 \cdot \left( -\frac{5}{3} \right)−5-5
Row 3, entry by entry.
[1000010123013−130013−1−5]\left[ \begin{array}{rrr|rrr} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & \frac{2}{3} & 0 & \frac{1}{3} & -\frac{1}{3} \\ 0 & 0 & \boxed{1} & 3 & -1 & -5 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked

Replace row 2 by R2−23R3R_{2} - \frac{2}{3} R_{3}. The multiplier is chosen so that the entry under attack, 23\frac{2}{3}, is cancelled exactly by the pivot: 23−23⋅1=0\frac{2}{3} - \frac{2}{3} \cdot 1 = 0.

columnworkingnew entry
110−23⋅00 - \frac{2}{3} \cdot 000
221−23⋅01 - \frac{2}{3} \cdot 011
3323−23⋅1\frac{2}{3} - \frac{2}{3} \cdot 100
440−23⋅30 - \frac{2}{3} \cdot 3−2-2
5513−23⋅(−1)\frac{1}{3} - \frac{2}{3} \cdot \left( -1 \right)11
66−13−23⋅(−5)-\frac{1}{3} - \frac{2}{3} \cdot \left( -5 \right)33
Row 2, entry by entry: old entry minus the multiple of row 3.
[100001010−2130013−1−5]\left[ \begin{array}{rrr|rrr} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & -2 & 1 & 3 \\ 0 & 0 & \boxed{1} & 3 & -1 & -5 \end{array} \right]
The matrix now. The boxed entry is the pivot being worked on. checked
5

Read off the inverse

Why this step

The left half is now the identity, which means the operations we performed, taken together, amount to multiplying by A−1A^{-1}. The right half started as II and received exactly the same operations, so it is now A−1I=A−1A^{-1} I = A^{-1}.

[100001010−2130013−1−5]\left[ \begin{array}{rrr|rrr} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & -2 & 1 & 3 \\ 0 & 0 & 1 & 3 & -1 & -5 \end{array} \right]
The fully reduced block: identity on the left, the inverse on the right. checked
A−1=[001−2133−1−5]A^{-1} = \left[ \begin{array}{rrr} 0 & 0 & 1 \\ -2 & 1 & 3 \\ 3 & -1 & -5 \end{array} \right]
The right half, on its own.
6

Prove it by multiplying back

Why this step

The definition of the inverse is a multiplication, so the definition itself is the test. Each entry of AA−1A A^{-1} is a row of AA times a column of A−1A^{-1}: multiply matching entries and add. The diagonal entries must come to 11 and all the others to 00. One wrong entry anywhere in our answer would show up here.

entryworkingvalue
row 11, column 112⋅0+1⋅(−2)+1⋅32 \cdot 0 + 1 \cdot \left( -2 \right) + 1 \cdot 311
row 11, column 222⋅0+1⋅1+1⋅(−1)2 \cdot 0 + 1 \cdot 1 + 1 \cdot \left( -1 \right)00
row 11, column 332⋅1+1⋅3+1⋅(−5)2 \cdot 1 + 1 \cdot 3 + 1 \cdot \left( -5 \right)00
row 22, column 111⋅0+3⋅(−2)+2⋅31 \cdot 0 + 3 \cdot \left( -2 \right) + 2 \cdot 300
row 22, column 221⋅0+3⋅1+2⋅(−1)1 \cdot 0 + 3 \cdot 1 + 2 \cdot \left( -1 \right)11
row 22, column 331⋅1+3⋅3+2⋅(−5)1 \cdot 1 + 3 \cdot 3 + 2 \cdot \left( -5 \right)00
row 33, column 111⋅0+0⋅(−2)+0⋅31 \cdot 0 + 0 \cdot \left( -2 \right) + 0 \cdot 300
row 33, column 221⋅0+0⋅1+0⋅(−1)1 \cdot 0 + 0 \cdot 1 + 0 \cdot \left( -1 \right)00
row 33, column 331⋅1+0⋅3+0⋅(−5)1 \cdot 1 + 0 \cdot 3 + 0 \cdot \left( -5 \right)11
Every entry of A times its inverse: row of A times column of the inverse.
AA−1=[100010001]A A^{-1} = \left[ \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right]
The product is the identity matrix, so the answer is correct. checked