Example 1: Solving a system of equations by the Gauss-Seidel method
Use the Gauss-Seidel method to solve the system
 4x1 + x2 - x3 = 3 2x1 + 7 x2 + x3 = 19 x1 - 3 x2 +12 x3 = 31
 <=> x1 = -1/4 x2 + 1/4 x3 + 3/4 x2 = -2/7 x1 - 1/7 x3 + 19/7 x3 = -1/12 x1 + 1/4 x2 + 31/12

Solution:

We have

 = 0 -1/4 1/4 -2/7 0 -1/7 -1/12 1/4 0
 x1 x2 x3
 + 3/4 = G + 19/7 31/12
The iteration formulas are
 <=> x1(k+1) = -1/4 x2(k) + 1/4 x3(k) + 3/4 x2(k+1) = -2/7 x1(k+1) - 1/7 x3(k) + 19/7 x3(k+1) = -1/12 x1(k+1) + 1/4 x2(k+1) + 31/12
The difference between the Gauss-Seidel method and the Jacobi method is that here we use the coordinates x1(k),...,xi-1(k) of x(k) already known to compute its ith coordinate xi(k).

If we start from x1(0) = x2(0) = x3(0) = 0 and apply the iteration formulas, we obtain
 k x1(k) x2(k) x3(k) 0 0 0 0 1 0,75 2,50 3,15 2 0,91 2,00 3,01 3 1,00 2,00 3,00 4 1,00 2,00 3,00
The exact solution is: x1 = 1, x2 = 2, x3 = 3.

For instance, when k=2, we have x2(2)= 2,00:
x2(2) = -2/7 x1(2) - 1/7 x3(1) + 19/7 = -2/7 · 0,72 - 1/7 · 3,15 + 19/7 = 2,00

Go back to theory