- Start with A and I written side by side: [A | I].
- Eliminate below the pivots, then above them, then divide each row by its pivot.
- When the left half becomes I, the right half is A⁻¹.
- If a zero row appears on the left, A has no inverse.
- To solve Ax = b, use elimination (A = LU), not A⁻¹: it is faster and more accurate.
Why the right half becomes A⁻¹
Each row step is a matrix E₁, E₂, and so on (lesson 2). Dividing a row by its pivot is a step matrix too: ½001 halves row 1 and keeps row 2. Multiply all the steps, last step on the left: E = ⋯E₃E₂E₁. The steps turn A into I, so EA = I, and that says E = A⁻¹. On the right, the same steps turn I into EI = E, which is A⁻¹. The right half is the friend's notebook.
The three stages
- Forward: clear the entries below each pivot, as in lesson 2.
- Backward: clear the entries above each pivot, from the bottom row up.
- Scale: divide each row by its pivot, so the diagonal is all 1s.
Scaling doesn't disturb the zeros, so you can do it any time. Doing it last keeps the fractions away until the end. The finished left half, with pivots of 1 and zeros above and below them, is called the reduced row echelon form, rref for short. Lesson 4 uses it a lot. The lab's rref does all three stages.
A 2 by 2, step by step
Take slide 2's A = 2153. The pivot is 2 and the multiplier is ℓ = 5 ÷ 2 = 2.5. Each step below changes one row, and only the changed row is shown.
A bigger example: 3 × 3
Here every pivot is 1, so no fractions appear and the scale stage has nothing to do.
Check by multiplying: A times A⁻¹ must be I.
A computer does exactly these steps for a 1000 by 1000 matrix. It just has many more rows to clear.
The lab's matrix: a chain of springs
rref.When Gauss-Jordan gets stuck
Try slide 1's A = 1224, the matrix with no inverse:
The second pivot is 0 and no lower row can help. The left half can never become I, so there is no A⁻¹. This is the same test as slide 1: a zero pivot means no inverse.
Think with the inverse, compute without it
Finding A⁻¹ takes about three times the work of factoring A = LU, and it adds more rounding error: tiny mistakes that creep in because a computer keeps only about 16 digits of each number. So to solve Ax = b, use elimination. The inverse is great for reasoning, as in x = A⁻¹b. It is rarely the best way to compute.
Next: Gauss-Jordan reads A row by row. Slide 5 turns the rows of a matrix into its columns, the transpose, and meets the matrices that stay the same when you do that.
Examples
Example 1 · A 2 by 2 by hand
Invert A = 2111.
Show solutionHide solution
Example 2 · A triangular matrix
Invert A = 120013001. Only upward steps are needed.
Show solutionHide solution
Where does the 6 come from? Follow the right half, which starts as I. Step 1 puts −3 in row 2, column 3, so row 2 becomes [0 1 −3]. Step 2 subtracts 2 times this new row 2 from row 1. Row 1 had 0 in column 3, so it gets 0 − 2·(−3) = 6. The second step uses the result of the first.
Example 3 · When Gauss-Jordan stops
Try A = 1224.
Show solutionHide solution
The left side has a zero row, so it can never become I. No inverse.
Example 4
Invert 3121.
Show solutionHide solution
det = 3 − 2 = 1. Inverse 1−1−23. Check: 3·1 + 1·(−2) = 1 ✓
Example 5
Invert the diagonal matrix with entries 1, 2, 4.
Show solutionHide solution
Divide each row by its pivot: the inverse is diagonal with entries 1, ½, ¼.

Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.