Numerical Methods · Module 4 of 10
Systems of Linear Equations
Linear systems appear everywhere a problem is discretised: trusses, circuits, finite elements. Gauss elimination reduces the system to a triangle you can back-substitute, and LU decomposition reuses that work for many right-hand sides.
Readiness check
This module solves linear systems. Tick only what you can do closed-notes.
- Write a system of equations in matrix form Ax = b.
- Add a multiple of one equation to another.
- Solve a triangular system by substitution.
- Multiply two small matrices.
- Recall that a zero pivot blocks elimination.
The core idea
Gauss elimination turns Ax = b into an upper-triangular system by row operations, then back substitution solves it from the bottom up. LU decomposition stores that elimination so many right-hand sides can be solved cheaply.
A x = beliminate → U x = b′, back-substituteA = L U, solve L y = b then U x = yA system of linear equations is written Ax = b, with the coefficients in the matrix A, the unknowns in x, and the right-hand sides in b. Gauss elimination is the direct method: using elementary row operations, it eliminates the unknowns below each pivot to leave an upper-triangular system, which back substitution then solves from the last equation upward. If a pivot is zero or small, partial pivoting swaps in the largest available coefficient to keep the arithmetic stable. LU decomposition factors A into a lower-triangular L and an upper-triangular U that record the same elimination; once factored, any new right-hand side is solved by a forward substitution Ly = b followed by a back substitution Ux = y, far cheaper than repeating the full elimination. This reuse is why LU underlies the solvers in structural and thermal analysis.
The skills, taught in order
Five skills build from the matrix form to Gauss elimination, pivoting, and LU decomposition.
4.1 The matrix form
A linear system is collected as Ax = b. Writing it this way separates the structure (A) from the loading (b) and exposes the system to matrix methods. Most discretised engineering problems arrive in exactly this form.
4.2 Gauss elimination
Forward elimination subtracts multiples of each pivot row from the rows below to zero out the coefficients beneath the pivot, reducing A to upper-triangular form U. The same operations are applied to b. The work scales as the cube of the system size.
4.3 Back substitution
With an upper-triangular system, the last equation gives the last unknown directly; substituting upward gives each remaining unknown in turn. Back substitution is the cheap second half of the solve.
| Step | Produces | Cost |
|---|---|---|
| Forward elimination | upper-triangular U | order n3 |
| Back substitution | the solution x | order n2 |
| LU then substitute | x for a new b | order n2 |
The factorisation costs the same as one elimination, but each later right-hand side then costs only the cheap substitution.
4.4 Partial pivoting
A zero pivot stops elimination, and a small one amplifies roundoff. Partial pivoting swaps the current row with the one below having the largest pivot magnitude, keeping the multipliers below one and the arithmetic stable. It is almost always used in practice.
4.5 LU decomposition
LU decomposition writes A = LU, with L holding the elimination multipliers and U the resulting triangle. Solving Ax = b becomes Ly = b (forward) then Ux = y (back). The factorisation is done once; every new right-hand side reuses it, the key economy for repeated solves.
Engineering connection: a finite-element stiffness matrix is factored once, then solved against many load cases, exactly the LU economy.
Worked example 1: Gauss elimination of a 3 by 3 system
Solve the system x + y + z = 6, 2x − y + z = 3, x + 2y − z = 2 by Gauss elimination and back substitution.
- ProblemSolve the 3 by 3 system in Figure 1 for x, y, z.
- Given / findx + y + z = 6; 2x − y + z = 3; x + 2y − z = 2. Find x, y, z.
- AssumptionsThe system is nonsingular; pivots are nonzero, so no row swaps are needed.
- ModelEliminate below the first pivot, then the second, to reach a triangle, then back-substitute.
- EquationsR2 ← R2 − 2R1, R3 ← R3 − R1then eliminate column 2, back-substitute
- SolveAfter R2 − 2R1: −3y − z = −9. After R3 − R1: y − 2z = −4. Eliminate y: R3 + (1/3)R2 gives −2z − z/3 = −4 − 3, so −(7/3)z = −7, z = 3. Then −3y − 3 = −9 gives y = 2, and x + 2 + 3 = 6 gives x = 1.
- CheckSubstitute into all three: 1 + 2 + 3 = 6 ✓; 2 − 2 + 3 = 3 ✓; 1 + 4 − 3 = 2 ✓.
- ConclusionElimination plus back substitution gives the exact solution (1, 2, 3). The method is direct: a fixed amount of work, no iteration.
Worked example 2: LU decomposition and solve
Factor A = [[3, 1], [1, 2]] into L and U, then use the factorisation to solve Ax = b for b = [9, 8].
- ProblemFactor A and solve Ax = b for b = [9, 8], as in Figure 2.
- Given / findA = [[3, 1], [1, 2]], b = [9, 8]. Find L, U, and x.
- AssumptionsThe pivot 3 is nonzero, so no pivoting is needed.
- ModelThe multiplier ℓ21 = a21/a11 fills L; U is the eliminated matrix; solve Ly = b then Ux = y.
- Equationsℓ21 = 1/3, u22 = 2 − (1/3)(1) = 5/3L y = b, U x = y
- SolveL = [[1, 0], [1/3, 1]], U = [[3, 1], [0, 5/3]]. Forward: y1 = 9, y2 = 8 − (1/3)(9) = 5. Back: x2 = 5/(5/3) = 3, x1 = (9 − 1·3)/3 = 2.
- CheckLU = [[3, 1], [1, 2]] reproduces A, and Ax = [3·2 + 3, 2 + 6] = [9, 8] = b.
- ConclusionThe factorisation solves the system, and a different b would reuse the same L and U, needing only the two cheap substitutions.
Misconceptions and diagnostics
| Mistake | Symptom | Diagnostic question | Correction |
|---|---|---|---|
| Small pivot kept | Roundoff swamps the solution | "Is the pivot the largest available?" | Use partial pivoting to bring up the biggest coefficient. |
| Back substitution direction | Unknowns solved top-down | "Did I start from the last equation?" | Back-substitute from the bottom row upward. |
| Refactoring for each b | Repeated full eliminations | "Did I reuse L and U?" | Factor once, then substitute for each new b. |
| Singular matrix unnoticed | A zero pivot with no swap available | "Does a unique solution exist?" | A zero column means the system is singular. |
Practice ladder
Solve 2x + y = 5, x − y = 1 by elimination.
Show answer
Add the two equations to eliminate y: 3x = 6, so x = 2. Then x − y = 1 gives y = 1. Check: 2(2) + 1 = 5 ✓.
For A = [[4, 3], [2, 3]], find the elimination multiplier and U.
Show answer
ℓ21 = 2/4 = 0.5. U = [[4, 3], [0, 3 − 0.5·3]] = [[4, 3], [0, 1.5]].
Using the L and U from Worked Example 2, solve Ax = b for a new b = [6, 7].
Show answer
Forward: y1 = 6, y2 = 7 − (1/3)(6) = 5. Back: x2 = 5/(5/3) = 3, x1 = (6 − 3)/3 = 1. So x = 1, y = 3.
A structure must be analysed under twenty load cases with the same stiffness matrix. Explain why LU decomposition is the right tool and what it saves.
What good work looks like
The matrix is factored once at order n3 cost, then each of the twenty loads is solved with cheap order-n2 substitutions, instead of twenty full eliminations, a large saving that grows with system size.
Working with AI, and proving it yourself
Use AI as an examiner, not a solver
Portfolio task
Solve a real linear system by Gauss elimination, verify the solution by substitution, then factor the matrix as LU and reuse it for a second right-hand side.
Retrieval and spaced review
Closed notes. Answer out loud, then reveal.
1. What does forward elimination produce?
An upper-triangular system U from the coefficient matrix A.
2. In what order does back substitution solve?
From the last equation upward, last unknown first.
3. Why use partial pivoting?
To avoid zero or small pivots that block elimination or amplify roundoff.
4. What does LU decomposition store?
The elimination: L holds the multipliers, U the resulting triangle.
5. How is a new right-hand side solved with LU?
Forward-substitute Ly = b, then back-substitute Ux = y.
Textbook mapping
This module follows Chapra and Canale, Numerical Methods for Engineers, 7th edition. Use these references to read further.
| Topic in this module | Where to read more |
|---|---|
| Gauss elimination and back substitution | Chapra & Canale, Chapter 9 |
| Partial pivoting | Chapra & Canale, Chapter 9 |
| LU decomposition | Chapra & Canale, Chapter 10 |
Chapter numbers refer to the 7th edition. The elimination methods are standard, so any recent edition will align closely.