Skip to content

Why Gaussian elimination works

7 min read

Short answer

Gaussian elimination works because each row operation is reversible, so the new system has exactly the same solutions as the old one. We use that freedom to reach a triangular system that can be solved from the bottom up. Recording the multipliers gives the factorization A=LUA=LU.

Steps1Use a pivot to clear the entries below it2Repeat on the smaller system that remains3Back-substitute from the last equation upward4Multipliers used are stored in L (A = LU)Reversible steps → same solution set
Elimination turns a full system into a triangular one without changing its solutions, then solves it from the last equation upward.

Why the solutions never change

Three operations are allowed: swap two equations, scale an equation by a nonzero number, add a multiple of one equation to another. Each has an inverse of the same kind (swap again, divide, subtract). So if x\mathbf{x} solves the system before an operation, it solves it after, and if it solves it after, undoing the operation shows it solved it before.

In matrix language each operation is multiplication by an invertible elementary matrix EE. The system Ax=bA\mathbf{x}=\mathbf{b} becomes EAx=EbEA\mathbf{x}=E\mathbf{b}, which has the same solutions because EE can be cancelled.

What elimination achieves

Choose a pivot in column 1 and subtract multiples of row 1 to zero out everything below it. Move to column 2 and repeat. After about 23n3\tfrac23n^3 arithmetic operations for an n×nn\times n system, you hold an upper triangular UU.

The last equation involves one unknown, which you solve; substitute upward. The number of pivots is the rank, the columns without pivots give the free variables, and a row of zeros with a nonzero right side exposes an inconsistent system.

LU factorization and pivoting

Each elimination step subtracts a multiplier times a row. Storing those multipliers below the diagonal in a matrix LL (with ones on the diagonal) gives A=LUA=LU. Then solving Ax=bA\mathbf{x}=\mathbf{b} means solving two easy triangular systems, Ly=bL\mathbf{y}=\mathbf{b} and Ux=yU\mathbf{x}=\mathbf{y}, and the expensive factorization can be reused for many right-hand sides.

If a pivot is zero you swap in a lower row. Even a tiny pivot is dangerous in floating point, so software picks the largest available entry (partial pivoting) and factors PA=LUPA=LU.

Worked example

Solve x+2y+z=8x+2y+z=8, 2x+y−z=12x+y-z=1, 3x−y+2z=73x-y+2z=7 by elimination and record the multipliers.

R2←R2−2R1R_2\leftarrow R_2-2R_1 gives −3y−3z=−15-3y-3z=-15. R3←R3−3R1R_3\leftarrow R_3-3R_1 gives −7y−z=−17-7y-z=-17.

R3←R3−73R2R_3\leftarrow R_3-\tfrac73R_2 gives (−1+7)z=−17+35(-1+7)z=-17+35, that is 6z=186z=18, so z=3z=3.

Back-substitute: −3y−9=−15⇒y=2-3y-9=-15\Rightarrow y=2; then x+4+3=8⇒x=1x+4+3=8\Rightarrow x=1. The solution is (1,2,3)(1,2,3).

Multipliers 2,3,732,3,\tfrac73 fill L=(1002103731)L=\begin{pmatrix}1&0&0\\2&1&0\\3&\tfrac73&1\end{pmatrix}, with U=(1210−3−3006)U=\begin{pmatrix}1&2&1\\0&-3&-3\\0&0&6\end{pmatrix}. Check row 3 of LULU: 3(1,2,1)+73(0,−3,−3)+(0,0,6)=(3,−1,2)3(1,2,1)+\tfrac73(0,-3,-3)+(0,0,6)=(3,-1,2). ✓

Try it yourself

Why does adding 5×5\times(row 1) to row 2 not change the solutions of a system?

Show the answer

Because it can be undone by subtracting 5×5\times(row 1) again. Any solution of the old system satisfies the new equation (a sum of valid equations), and any solution of the new system satisfies the old one by undoing the step.

Keep going with practice

Vidi's elimination lessons let you practice the row operations whose logic this article explains.