Solve a linear system by forward elimination with partial
(maximum absolute value) pivoting, then back substitution.
Example: [[1,2|4],[2,1|5]] → x1=2, x2=1.
Forward elimination produces an upper triangular system;
back substitution then solves for the unknowns.
Example
Use a pivot swap and row operations to solve the system.
highlighted = computed this step
Step 1 — Set up
Start with the augmented matrix.
[122145]
Step 2 — Pivot swap
Swap rows 1 and 2 so the largest pivot is on top.
[211254]
Step 3 — Eliminate below
Eliminate below the pivot: R2 gets R2 minus R1 over 2.
[20123523]
Step 4 — Normalize row 2
Scale row 2 by 2 over 3.
[201151]
Step 5 — Back substitute
Use row 2 to eliminate x2 from row 1.
[200141]
Step 6 — Normalize row 1
Scale row 1 by 1 over 2.
[100121]
Step 7 — Solution
Read the solution x1 = 2 and x2 = 1.
[100121]x1=2x2=1
gaussian-elimination-partial-pivoting
Partial pivoting selects the row with the largest absolute value in the current column as the pivot, improving numerical stability.