MTH 492 · Numerical Methods
Our notes
2 min readThe problem
A linear two-point boundary value problem (BVP):
y″ + p(x)y′ + q(x)y = r(x), a ≤ x ≤ b, with y(a) = α, y(b) = β.
Examples: deflection of a beam, steady temperature in a rod, the shape of a cable.
Difference formulas
On a grid xᵢ = a + ih, i = 0, ..., N, h = (b − a)/N:
- y″(xᵢ) ≈ (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h²
- y′(xᵢ) ≈ (yᵢ₊₁ − yᵢ₋₁)/(2h)
Both are second order: error O(h²).
The system
Substituting at each interior node gives one linear equation per node, linking yᵢ₋₁, yᵢ, yᵢ₊₁: a tridiagonal system. The boundary values move to the right-hand side.
Worked example
y″ = 4(y − x), y(0) = 0, y(1) = 2, h = 0.25 (exact y = x + sinh 2x / sinh 2).
At node i: (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/0.0625 = 4(yᵢ − xᵢ), so
yᵢ₋₁ − 2.25yᵢ + yᵢ₊₁ = −0.25xᵢ
- i = 1 (x = 0.25): 0 − 2.25y₁ + y₂ = −0.0625
- i = 2 (x = 0.5): y₁ − 2.25y₂ + y₃ = −0.125
- i = 3 (x = 0.75): y₂ − 2.25y₃ + 2 = −0.1875, so y₂ − 2.25y₃ = −2.1875
Solving:
| x | Finite difference | Exact |
|---|---|---|
| 0.25 | 0.39512 | 0.39368 |
| 0.5 | 0.82653 | 0.82403 |
| 0.75 | 1.33957 | 1.33709 |
The error (about 0.0025) falls by about 4 when h is halved, as O(h²) predicts.
Check by substitution at i = 2: 0.39512 − 2.25(0.82653) + 1.33957 = −0.12500. ✓
The Thomas algorithm
A tridiagonal system aᵢyᵢ₋₁ + bᵢyᵢ + cᵢyᵢ₊₁ = dᵢ is solved in O(N) operations:
- Forward sweep: c′₁ = c₁/b₁, d′₁ = d₁/b₁; then for i = 2...N: m = bᵢ − aᵢc′ᵢ₋₁, c′ᵢ = cᵢ/m, d′ᵢ = (dᵢ − aᵢd′ᵢ₋₁)/m.
- Back substitution: y_N = d′_N, then yᵢ = d′ᵢ − c′ᵢyᵢ₊₁.
It is Gaussian elimination that skips all the zeros. It is stable when the matrix is diagonally dominant (|bᵢ| ≥ |aᵢ| + |cᵢ|), as here.
Derivative boundary conditions
For y′(b) = γ, add a "ghost" node y_{N+1} and use (y_{N+1} − y_{N−1})/(2h) = γ to eliminate it.
Exams usually ask
- Set up and solve the finite difference equations for a BVP with h = 0.25 or 0.2.
- Describe the Thomas algorithm.
Common mistake
Forgetting to move the known boundary values to the right-hand side of the first and last equations.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Finite difference method
(opens en.wikipedia.org in a new tab)
Wikipedia, Finite difference method, CC BY-SA 4.0 · licence
-
Boundary value problem
(opens en.wikipedia.org in a new tab)
Wikipedia, Boundary value problem, CC BY-SA 4.0 · licence
Watch
-
Finite Difference Numerical Method | Boundary Value Problems Numerical Method
14 min · ≈ 63 MB · about ₦35
(opens youtube.com in a new tab)
-
Finite Difference Method of solving (Second Order ODE) Boundary Value Problem(BVP).
23 min · ≈ 104 MB · about ₦58
(opens youtube.com in a new tab)
-
Finite Difference Equations and Second Order Linear Boundary Value Problems
9 min · ≈ 41 MB · about ₦23
(opens youtube.com in a new tab)
-
Finite Difference Method (Problem Solving), MAT306, Lec#20, Md.Akteruzzaman, Dhaka College, Dhaka
21 min · ≈ 95 MB · about ₦53
(opens youtube.com in a new tab)
-
Introduction to Numerical Methods to Solve Boundary Value Problems
1 h 43 min · ≈ 464 MB · about ₦261
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.