Partial pivoting in Gaussian elimination
5 min read
Short answer
Before eliminating a column, swap rows so the largest-magnitude entry in that column becomes the pivot. This keeps all multipliers at most in size, so rounding errors are not amplified. Without it, a tiny pivot can produce a completely wrong answer even for a well-conditioned system.
What goes wrong
Eliminating with pivot needs a multiplier . The next row then contains numbers like , in which the original is lost to rounding.
Cost and variants
Partial pivoting costs only comparisons in total. Complete pivoting searches the whole remaining submatrix and is slightly more stable but rarely needed. Production codes use partial pivoting.
Worked example
Solve keeping 3 significant digits. The exact solution is about .
Without pivoting: multiplier ; row 2 becomes and rhs , so and . Wrong. With a swap: multiplier ; row 2 becomes and rhs , so and . Correct.
Try it yourself
Which row should you swap to the top for the first column ?
Show the answer
The row with (largest absolute value), so all multipliers are at most in magnitude.
Keep going with practice
Vidi's linear algebra lessons practise row operations; here you see why their order matters on a computer.