Skip to content

Jacobi and Gauss-Seidel iteration

5 min read

Short answer

Solve each equation for its diagonal unknown and iterate. Jacobi uses only the previous iterate: xi(k+1)=1aii(bi−∑j≠iaijxj(k))x_i^{(k+1)}=\dfrac1{a_{ii}}\Big(b_i-\sum_{j\ne i}a_{ij}x_j^{(k)}\Big). Gauss-Seidel uses new values as soon as they are computed and usually converges faster. Both converge when AA is strictly diagonally dominant.

Jacobi compared with Gauss-SeidelJacobiUses only old valuesEasy to parallelizeSlower convergenceGauss-SeidelUses newest values atonceSequential updatesOften about 2× faster
Both are cheap per step, which matters for huge sparse systems.

When to use iterative methods

For very large sparse systems (millions of unknowns from PDEs), elimination fills in zeros and is too costly. Each iteration only needs a sparse matrix-vector product, so iterative methods win in memory and time.

Convergence

If ∣aii∣>∑j≠i∣aij∣|a_{ii}|>\sum_{j\ne i}|a_{ij}| for every row, both methods converge from any starting vector. Convergence can occur without this condition, but it is not guaranteed.

Worked example

Apply Jacobi to 4x+y=64x+y=6, 2x+5y=122x+5y=12 from (0,0)(0,0) for three steps. The exact solution is (1,2)(1,2).

Updates: x=6−y4x=\dfrac{6-y}4, y=12−2x5y=\dfrac{12-2x}5. Step 1: (1.5, 2.4)(1.5,\,2.4). Step 2: x=6−2.44=0.9x=\tfrac{6-2.4}4=0.9, y=12−35=1.8y=\tfrac{12-3}5=1.8. Step 3: x=6−1.84=1.05x=\tfrac{6-1.8}4=1.05, y=12−1.85=2.04y=\tfrac{12-1.8}5=2.04. The iterates close in on (1,2)(1,2).

Try it yourself

Is (5123)\begin{pmatrix}5&1\\2&3\end{pmatrix} strictly diagonally dominant?

Show the answer

Row 1: 5>15>1 ✓. Row 2: 3>23>2 ✓. Yes, so both methods converge.

Keep going with practice

Vidi's linear algebra lessons solve small systems exactly; this is how the very large ones are solved.