Lab 12 · Lecture 12 · Gaussian and Gauss–Jordan Elimination
Elimination Lab
Step through Gaussian and Gauss–Jordan elimination on your own systems, see what pivoting and limited precision do, and write the solver in Python and C.
Type any system as [A | b], one row per line. Choose the method, then step through the row operations. Use it to check every line of a hand calculation.
Set the arithmetic to 3 or 4 significant digits to imitate a calculator. Compare the answers with and without partial pivoting. The textbook 2×2 (exact answer x = 10, y = 1) gives x = −10 without pivoting in 4-digit arithmetic.
Operation counts: elimination against Gauss–Jordan, the inverse and Cramer.
Gaussian elimination with partial pivoting
Try this
A tiny pivot in double precision
Try this
Q1 Solve , , by Gaussian elimination.
, : rows , . : . So , , .
Q2 Find the inverse of by Gauss–Jordan.
(det ). Check .
Q3 What is partial pivoting and why is it needed?
Before eliminating column , swap rows so that the entry of largest absolute value in column (rows to ) becomes the pivot. Then all multipliers satisfy , so rounding errors are not magnified; a tiny pivot (like 0.0001) would otherwise give multipliers like 10 000 and destroy the answer.
Q4 Show that Gaussian elimination needs about operations.
Column : rows, each needs about operations, so about . Back substitution adds only .
Q5 Compare Gaussian elimination and Gauss–Jordan elimination.
Gauss: zeros below the pivots, then back substitution; about . Gauss–Jordan: zeros above and below, pivots scaled to 1, no back substitution; about . Gauss–Jordan is convenient for inverses and RREF; Gauss is cheaper for solving.