# The Algorithm for The Jacobi Iteration Method

We will now look at the algorithm for the Jacobi Iteration method in solving the system $Ax = b$.

Obtain an $n \times n$ matrix $A$ and an $n \times 1$ matrix $b$. Let $x^{(0)} = \begin{bmatrix} x_1^{(0)}\\ x_2^{(0)}\\ \vdots \\ x_n^{(0)}\\ \end{bmatrix}$ be an initial approximation to the solution to the system $Ax = b$. Obtain a maximum number of iterations and a prescribed accuracy value $\epsilon$ ensuring that the maximum difference between corresponding components is less than $\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.