# The Algorithm for The Gauss-Seidel Iteration Method

We will now look at the algorithm for the Gauss-Seidel Iteration method for solving the system of equations $Ax = b$.

Let $A$ be an $n \times n$ matrix and let $b$ be an $n \times 1$ matrix. Suppose that a solution exists to the linear system $Ax = b$. Obtain an initial approximation $x^{(0)} = \begin{bmatrix} x_1^{(0)}\\ x_2^{(0)}\\ \vdots \\ x_n^{(0)}\\ \end{bmatrix}$ of the solution to this system, as well as a maximum number of iterations for the Gauss-Seidel method and a desired level of accuracy $\epsilon$.

For each $k = 1, 2, ...$ up to the maximum number of iterations prescribed:

**Step 1:** Obtain the approximations $x^{(k)}$ component wise by:

**Step 2:** Check the accuracy of the approximations. Check to see if:

If the above is true, then stop the iteration process. $x^{(n)}$ is an approximation of the solution with the desired accuracy. If no, then continue the iterations to obtain successive approximations of the solution. If after the maximum number of iterations, the accuracy $\epsilon$ is not achieved, then stop the iteration process and print out a failure message.