4.8.20Numerical Methods

Iterative methods — Jacobi, Gauss-Seidel, convergence

1,973 words9 min readdifficulty · medium1 backlinks

1. Splitting: the single idea behind everything

Derivation of the error recurrence (from scratch). Let x\mathbf{x}^* be the true solution, so Mx=Nx+bM\mathbf{x}^* = N\mathbf{x}^* + \mathbf{b}. Subtract this from Mx(k+1)=Nx(k)+bM\mathbf{x}^{(k+1)} = N\mathbf{x}^{(k)} + \mathbf{b}: M(x(k+1)x)=N(x(k)x).M(\mathbf{x}^{(k+1)} - \mathbf{x}^*) = N(\mathbf{x}^{(k)} - \mathbf{x}^*). Define error e(k)=x(k)x\mathbf{e}^{(k)} = \mathbf{x}^{(k)} - \mathbf{x}^*. Then   e(k+1)=M1Ne(k)=Te(k)    e(k)=Tke(0).  \boxed{\;\mathbf{e}^{(k+1)} = M^{-1}N\,\mathbf{e}^{(k)} = T\,\mathbf{e}^{(k)} \;\Rightarrow\; \mathbf{e}^{(k)} = T^{k}\mathbf{e}^{(0)}.\;} So the error gets multiplied by TT every step. Why this matters: convergence (e(k)0\mathbf{e}^{(k)}\to 0) for any starting guess happens iff Tk0T^k\to 0.


2. The standard split: A=DLUA = D - L - U

Jacobi

Choose M=DM = D, N=L+UN = L+U. Then Mx(k+1)=Nx(k)+bM\mathbf{x}^{(k+1)} = N\mathbf{x}^{(k)}+\mathbf{b} gives, component-wise: xi(k+1)=1aii(bijiaijxj(k)).x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j\neq i} a_{ij}\,x_j^{(k)}\Big).

Gauss-Seidel

Choose M=DLM = D - L (lower triangular, easy to forward-solve), N=UN = U: xi(k+1)=1aii(bij<iaijxj(k+1)j>iaijxj(k)).x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j<i} a_{ij}\,x_j^{(k+1)} - \sum_{j>i} a_{ij}\,x_j^{(k)}\Big).

Figure — Iterative methods — Jacobi, Gauss-Seidel, convergence

3. Convergence — WHY and WHEN

WHY ρ<1\rho<1? Diagonalize T=PΛP1T = P\Lambda P^{-1} (eigenvalues λi\lambda_i). Then Tk=PΛkP1T^k = P\Lambda^k P^{-1} and Λk=diag(λik)\Lambda^k = \operatorname{diag}(\lambda_i^k). As kk\to\infty, λik0\lambda_i^k \to 0 for all ii iff every λi<1|\lambda_i|<1, i.e. ρ(T)<1\rho(T)<1. Since e(k)=Tke(0)\mathbf{e}^{(k)}=T^k\mathbf{e}^{(0)}, the error dies out exactly under this condition.


4. Common mistakes (Steel-manned)


5. Stopping & cost


Flashcards

What is the iteration matrix TT for a splitting A=MNA=M-N?
T=M1NT = M^{-1}N; the iteration is x(k+1)=Tx(k)+M1b\mathbf{x}^{(k+1)}=T\mathbf{x}^{(k)}+M^{-1}\mathbf{b}.
Error recurrence of a stationary iteration?
e(k+1)=Te(k)\mathbf{e}^{(k+1)}=T\mathbf{e}^{(k)}, so e(k)=Tke(0)\mathbf{e}^{(k)}=T^k\mathbf{e}^{(0)}.
Exact necessary-and-sufficient condition for convergence from any start?
Spectral radius ρ(T)<1\rho(T)<1.
Splitting M,NM,N for Jacobi?
M=D, N=L+UM=D,\ N=L+U, giving TJ=D1(L+U)T_J=D^{-1}(L+U).
Splitting M,NM,N for Gauss-Seidel?
M=DL, N=UM=D-L,\ N=U, giving TGS=(DL)1UT_{GS}=(D-L)^{-1}U.
Component formula for Jacobi?
xi(k+1)=1aii(bijiaijxj(k))x_i^{(k+1)}=\frac{1}{a_{ii}}\big(b_i-\sum_{j\neq i}a_{ij}x_j^{(k)}\big).
Component formula for Gauss-Seidel?
xi(k+1)=1aii(bij<iaijxj(k+1)j>iaijxj(k))x_i^{(k+1)}=\frac{1}{a_{ii}}\big(b_i-\sum_{j<i}a_{ij}x_j^{(k+1)}-\sum_{j>i}a_{ij}x_j^{(k)}\big).
Key practical difference Jacobi vs Gauss-Seidel?
GS uses freshly updated components within the same sweep (in-place); Jacobi uses only the old vector (parallelisable).
A simple sufficient condition guaranteeing both converge?
Strict diagonal dominance: aii>jiaij|a_{ii}|>\sum_{j\neq i}|a_{ij}| for all ii.
Is diagonal dominance necessary for convergence?
No — it is sufficient only; the true criterion is ρ(T)<1\rho(T)<1.
Asymptotic error reduction factor per step?
Approximately ρ(T)\rho(T).
Why iterative over direct methods for large sparse AA?
Each sweep costs O(nnz)O(n)O(\text{nnz})\approx O(n) vs O(n3)O(n^3) for elimination, and memory stays sparse.

Recall Feynman: explain it to a 12-year-old

Imagine guessing everyone's height in a class, then fixing each guess using a rule that ties heights together. Jacobi: everybody updates their guess at the same time using last round's numbers. Gauss-Seidel: you go one by one, and each person uses the just-corrected numbers of the people before them — so corrections spread faster. If the rule "pulls" guesses gently toward the truth (numbers don't blow up — that's ρ<1\rho<1), then after a few rounds everyone's guess is basically right. If the rule over-reacts (ρ>1\rho>1), guesses explode and you never finish.

Connections

  • Gaussian Elimination — the direct O(n3)O(n^3) alternative these methods replace for sparse systems.
  • Eigenvalues and Eigenvectors — convergence rests entirely on ρ(T)\rho(T).
  • Spectral Radius — the master quantity here.
  • Fixed-Point Iteration — these are the matrix version of x=g(x)x=g(x) iteration.
  • SOR — Successive Over-Relaxation — accelerates Gauss-Seidel with a relaxation factor ω\omega.
  • Sparse Matrices — why per-sweep cost is cheap.
  • Finite Difference Methods for PDEs — main source of the huge sparse systems.

Concept Map

direct too costly for large sparse

refine guess each step

rearrange to fixed point

solve for new iterate

error recurrence

converges iff T^k to zero

standard split

M = D, N = L+U

M = D-L, N = U

uses all old values, parallel

uses fresh components immediately

Solve Ax = b

Iterative methods

Matrix splitting A = M - N

M x_new = N x_old + b

Iteration matrix T = inv M times N

e_k = T^k e_0

Convergence condition

A = D - L - U

Jacobi

Gauss-Seidel

T_J = inv D times L+U

faster convergence

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, jab humein bahut bada system Ax=bA\mathbf{x}=\mathbf{b} solve karna ho — jaise lakhs of equations jo PDE grids se aate hain — tab seedha Gaussian elimination (O(n3)O(n^3)) bahut mehenga pad jaata hai. Iska smart solution hai iterative methods: ek guess se start karo, aur baar-baar thoda-thoda sudhaarte jao jab tak answer paas na aa jaaye. Har step sasta hota hai, aur agar matrix "achhi" hai to guess slowly sahi answer ki taraf march karta hai.

Core trick hai splitting: A=MNA = M - N likho jahan MM ko invert karna easy ho. Phir formula banta hai x(k+1)=Tx(k)+M1b\mathbf{x}^{(k+1)} = T\mathbf{x}^{(k)} + M^{-1}\mathbf{b} jahan T=M1NT=M^{-1}N iteration matrix hai. Jacobi mein M=DM=D (sirf diagonal) — har xix_i purane vector se compute hota hai, sab parallel. Gauss-Seidel mein M=DLM=D-L — yahan jaise hi koi xix_i update hota hai, usi sweep mein agle equations us fresh value ko use karte hain, isliye GS aam taur par fast converge karta hai.

Sabse important baat — convergence. Error har step pe TT se multiply hota hai: e(k)=Tke(0)\mathbf{e}^{(k)}=T^k\mathbf{e}^{(0)}. Yeh tabhi zero ki taraf jaayega jab spectral radius ρ(T)<1\rho(T)<1 ho (sabse bada λ|\lambda| one se kam). Practical shortcut: agar matrix strictly diagonally dominant hai (aii>jiaij|a_{ii}|>\sum_{j\neq i}|a_{ij}|), to dono methods pakka converge karenge. Par yaad rakho — yeh sirf sufficient condition hai, necessary nahi. Asli rule hamesha ρ(T)<1\rho(T)<1 hi hai. Aur agar diagonal pe zero aa jaaye, pehle rows swap karke nonzero diagonal banao.

Go deeper — visual, from zero

Test yourself — Numerical Methods

Connections