notesonly.in

One notebook for every subject — open it anywhere.

Log in

Gaussian Elimination: Solve Linear Equations Step by Step

Gaussian elimination solves linear systems like 2x + y − z = 8 by using multiples of one equation to wipe out a variable from the equations below it, then moving to the next variable. The forward sweep leaves the system in upper triangular form, where the last equation has one unknown — solve it and walk backwards, which is back substitution.

Linear systems are everywhere — circuits, structural forces, economic models, machine-learning algebra — all reducing to Ax = b. Gaussian elimination is the algorithm every computer uses for this, and its row-operation ideas (pivoting, triangular forms) underpin almost all of numerical linear algebra.

Key Concepts

  • Pivot: the diagonal element a_ii used to clear entries below it; a zero pivot needs a row swap.
  • Partial pivoting: swapping in the row with the largest entry in the current column before eliminating, keeping multipliers small and round-off under control.
  • Row echelon form: the triangular shape reached after forward elimination, with zeros below the diagonal.
  • Singular system: a zero pivot even after swapping means no unique solution — inconsistent or infinitely many solutions.

Formulas

  • Elimination step: for each row i below row k, replace row i with (row i) − m_ik × (row k), where the multiplier is m_ik = a_ik / a_kk.
  • Back substitution: x_i = (b_i − Σ_j=i+1..n a_ij x_j) / a_ii, computed from i = n down to 1.
  • Cost: about n³/3 multiplications and divisions for n equations — this cubic growth is why large systems need smarter approaches.
  • Determinant bonus: det(A) equals the product of the pivots (times −1 for each row swap), so elimination also computes determinants.

Worked Example

Solve: 2x + y − z = 8; −3x − y + 2z = −11; −2x + y + 2z = −3. Eliminate x with multipliers m₂₁ = −3/2 = −1.5 and m₃₁ = −2/2 = −1. New eq 2 = (eq 2) + 1.5 × (eq 1): 0.5y + 0.5z = 1. New eq 3 = (eq 3) + (eq 1): 2y + z = 5. Eliminate y with multiplier 2/0.5 = 4: (eq 3) − 4 × (eq 2) gives −2y − 3z = −3. Back substitution: y + z = 2, so 2(2 − z) + 3z = 3 gives z = −1, then y = 3. From 2x + 3 − (−1) = 8: x = 2. Check eq 2: −6 − 3 + 2(−1) = −11. Correct.

Common Misconceptions

  • "Elimination works for every system." A zero pivot that cannot be fixed by row swaps means the system is singular — no unique solution exists, and the algorithm must stop.
  • "Swapping rows changes the answer." Row swaps only reorder the equations; the solution set is identical. Pivoting is purely for numerical safety.
  • "The computed answer is exact." Floating-point round-off accumulates, especially without pivoting — for sensitive systems the computed x may only approximately satisfy the equations.

Real-World Applications

  • Circuit analysis: node voltages in a resistor network satisfy linear equations solved by elimination.
  • Computer graphics: transforming 3D coordinates and solving for camera positions uses small linear systems.
  • Least-squares fitting: the normal equations behind every trend line are solved this way.
  • Structural engineering: forces in trusses and frames come from large sparse linear systems.

Gaussian elimination clears variables column by column with row operations, then reads the solution by back substitution. With partial pivoting it is the reliable default linear solver, and its multipliers are exactly what LU decomposition stores for reuse.