Skip to main content

Subsection 7.3.1 Jacobi iteration

Let's review what we saw in Subsection 7.1.1. The linear system \(A u = f \)

\begin{equation*} \begin{array}{r r r r r r r r r r r c} 4 \upsilon_0 \amp - \upsilon_1 \amp \amp \amp - \upsilon_4 \amp \amp \amp \amp \amp \amp \amp = h^2 \phi_0 \\ - \upsilon_0 \amp + 4 \upsilon_1 \amp - \upsilon_2 \amp \amp \amp - \upsilon_5 \amp \amp \amp \amp \amp \amp = h^2 \phi_1 \\ \amp - \upsilon_1 \amp + 4 \upsilon_2 \amp - \upsilon_3 \amp \amp \amp - \upsilon_6 \amp \amp \amp \amp \amp = h^2 \phi_2 \\ \amp \amp - \upsilon_2 \amp + 4 \upsilon_3 \amp \amp \amp \amp - \upsilon_7 \amp \amp \amp \amp = h^2 \phi_3 \\ - \upsilon_0 \amp \amp \amp \amp + 4 \upsilon_4 \amp - \upsilon_5 \amp \amp \amp - \upsilon_8 \amp \amp \amp = h^2 \phi_4 \\ \amp \ddots \amp \amp \amp \ddots \amp \ddots \amp \ddots \amp \amp \amp\ddots \amp \amp \vdots \end{array} \end{equation*}

which can be written in matrix form as

\begin{equation*} \left( \begin{array} {r r r r | r r r r | r r } 4 \amp -1 \amp \amp \amp -1 \amp \amp \amp \amp \amp \\ -1 \amp 4 \amp -1 \amp \amp \amp -1 \amp \amp \amp \amp \\ \amp -1 \amp 4 \amp -1 \amp \amp \amp -1 \amp \amp \amp \\ \amp \amp -1 \amp 4 \amp \amp \amp \amp -1 \amp \amp \\ \hline -1 \amp \amp \amp \amp 4 \amp -1 \amp \amp \amp -1 \amp \\ \amp -1 \amp \amp \amp -1 \amp 4 \amp -1 \amp \amp \amp \ddots \\ \amp \amp -1 \amp \amp \amp -1 \amp 4 \amp -1 \amp \amp \\ \amp \amp \amp -1 \amp \amp \amp -1 \amp 4 \amp \amp \\ \hline \amp \amp \amp \amp -1 \amp \amp \amp \amp 4 \amp \ddots \\ \amp \amp \amp \amp \amp \amp \ddots \amp \amp \ddots \amp \ddots \end{array} \right) \left( \begin{array}{c} \upsilon_0 \\ \upsilon_1\\ \upsilon_2\\ \upsilon_3\\ \hline \upsilon_4\\ \upsilon_5\\ \upsilon_6\\ \upsilon_7\\ \hline \upsilon_8 \\ \vdots \end{array} \right) = \left( \begin{array}{c} h^2 \phi_0 \\ h^2 \phi_1 \\ h^2 \phi_2 \\ h^2 \phi_3 \\ \hline h^2 \phi_4 \\ h^2 \phi_5 \\ h^2 \phi_6\\ h^2 \phi_7 \\ \hline h^2 \phi_8 \\ \vdots \end{array} \right). \end{equation*}

was solved by repeatedly updating

\begin{equation*} \upsilon_{i} = \frac{h^2 \phi_{i} +\upsilon_{i-N} + \upsilon_{i-1} + \upsilon_{i+1} + \upsilon_{i+N}}{4} \end{equation*}

modified appropriately for points adjacent to the boundary. Let's label the value of \(\upsilon_{i} \) during the \(k\)th iteration with \(\upsilon_{i}^{(k)} \) and state the algorithm more explicitly as

\begin{equation*} \begin{array}{l} {\bf for~} k = 0, \ldots, \mbox{ convergence} \\ ~~~ {\bf for~} i = 0, \ldots, N \times N-1 \\ ~~~ ~~~ \upsilon_{i}^{(k+1)} = {(h^2 \phi_{i} +\upsilon_{i-N}^{(k)} + \upsilon_{i-1}^{(k)} + \upsilon_{i+1}^{(k)} + \upsilon_{i+N}^{(k)})}/{4} \\ ~~~ {\bf endfor} \\ {\bf endfor} \end{array} \end{equation*}

again, modified appropriately for points adjacent to the boundary. The superscripts are there to emphasize the iteration during which a value is updated. In practice, only the values for iteration \(k \) and \(k+1 \) need to be stored. We can also capture the algorithm with a vector and matrix as

\begin{equation*} \begin{array}{c c r r r r r r r r r r r c} 4 \upsilon_0^{(k+1)} \amp = \amp \amp \upsilon_1^{(k)} \amp \amp \amp + \upsilon_4^{(k)} \amp \amp \amp \amp \amp \amp \amp + h^2 \phi_0 \\ 4 \upsilon_1^{(k+1)} \amp = \amp \upsilon_0^{(k)} \amp \amp + \upsilon_2^{(k)} \amp \amp \amp + \upsilon_5^{(k)} \amp \amp \amp \amp \amp \amp + h^2 \phi_1 \\ 4 \upsilon_2^{(k+1)} \amp = \amp \amp \upsilon_1^{(k)} \amp \amp + \upsilon_3^{(k)} \amp \amp \amp + \upsilon_6^{(k)} \amp \amp \amp \amp \amp + h^2 \phi_2 \\ 4 \upsilon_3^{(k+1)} \amp = \amp \amp \amp \upsilon_2^{(k)} \amp \amp \amp \amp \amp + \upsilon_7^{(k)} \amp \amp \amp \amp + h^2 \phi_3 \\ 4 \upsilon_4^{(k+1)} \amp = \amp \upsilon_0^{(k)} \amp \amp \amp \amp \amp + \upsilon_5^{(k)} \amp \amp \amp - \upsilon_8^{(k)} \amp \amp \amp + h^2 \phi_4 \\ \vdots \amp \amp \amp \ddots \amp \amp \amp \ddots \amp \ddots \amp \ddots \amp \amp \amp\ddots \amp \amp \vdots \end{array} \end{equation*}

which can be written in matrix form as

\begin{equation} \begin{array}{l} \left( \begin{array} {r r r r | r r r r | r r } 4 \amp \amp \amp \amp \amp \amp \amp \amp \amp \\ \amp 4 \amp \amp \amp \amp \amp \amp \amp \amp \\ \amp \amp 4 \amp \amp \amp \amp \amp \amp \amp \\ \amp \amp \amp 4 \amp \amp \amp \amp \amp \amp \\ \hline \amp \amp \amp \amp 4 \amp \amp \amp \amp \amp \\ \amp \amp \amp \amp \amp 4 \amp \amp \amp \amp \\ \amp \amp \amp \amp \amp \amp 4 \amp \amp \amp \\ \amp \amp \amp \amp \amp \amp \amp 4 \amp \amp \\ \hline \amp \amp \amp \amp \amp \amp \amp \amp 4 \amp \\ \amp \amp \amp \amp \amp \amp \amp \amp \amp \ddots \end{array} \right) \left( \begin{array}{c} \upsilon_0^{(k+1)} \\ \upsilon_1^{(k+1)}\\ \upsilon_2^{(k+1)}\\ \upsilon_3^{(k+1)}\\ \hline \upsilon_4^{(k+1)}\\ \upsilon_5^{(k+1)}\\ \upsilon_6^{(k+1)}\\ \upsilon_7^{(k+1)}\\ \hline \upsilon_8^{(k+1)} \\ \vdots \end{array} \right) \\ ~~~~= \left( \begin{array} {r r r r | r r r r | r r } 0 \amp 1 \amp \amp \amp 1 \amp \amp \amp \amp \amp \\ 1 \amp 0 \amp 1 \amp \amp \amp 1 \amp \amp \amp \amp \\ \amp 1 \amp 0 \amp 1 \amp \amp \amp 1 \amp \amp \amp \\ \amp \amp 1 \amp 0 \amp \amp \amp \amp 1 \amp \amp \\ \hline 1 \amp \amp \amp \amp 0 \amp 1 \amp \amp \amp 1 \amp \\ \amp 1 \amp \amp \amp 1 \amp 0 \amp 1 \amp \amp \amp \ddots \\ \amp \amp 1 \amp \amp \amp 1 \amp 0 \amp 1 \amp \amp \\ \amp \amp \amp 1 \amp \amp \amp 1 \amp 0 \amp \amp \\ \hline \amp \amp \amp \amp 1 \amp \amp \amp \amp 0 \amp \ddots \\ \amp \amp \amp \amp \amp \amp \ddots \amp \amp \ddots \amp \ddots \end{array} \right) \left( \begin{array}{c} \upsilon_0^{(k)} \\ \upsilon_1^{(k)}\\ \upsilon_2^{(k)}\\ \upsilon_3^{(k)}\\ \hline \upsilon_4^{(k)}\\ \upsilon_5^{(k)}\\ \upsilon_6^{(k)}\\ \upsilon_7^{(k)}\\ \hline \upsilon_8^{(k)} \\ \vdots \end{array} \right) + \left( \begin{array}{c} h^2 \phi_0 \\ h^2 \phi_1 \\ h^2 \phi_2 \\ h^2 \phi_3 \\ \hline h^2 \phi_4 \\ h^2 \phi_5 \\ h^2 \phi_6\\ h^2 \phi_7 \\ \hline h^2 \phi_8 \\ \vdots \end{array} \right). \end{array}\label{chapter07-Jacobi-matrix-form}\tag{7.3.1} \end{equation}

How can we capture this more generally?

  • We wish to solve \(A x = y \text{.}\)

    We write \(A \) as the difference of its diagonal, \(M = D \text{,}\) and the negative of its off-diagonal part, \(N = D - A \) so that

    \begin{equation*} A = D - ( D - A ) = M - N. \end{equation*}

    In our example, \(M = 4 I \) and \(N = 4 I - A \text{.}\)

  • We then notice that

    \begin{equation*} A x = y \end{equation*}

    can be rewritten as

    \begin{equation*} ( M - N )x = y \end{equation*}

    or, equivalently,

    \begin{equation*} M x = N x + y. \end{equation*}

    If you think about it carefully, this captures (7.3.1) for our example. Finally,

    \begin{equation*} x = M^{-1} ( N x + y ). \end{equation*}
  • If we now let \(x^{(k)} \) be the values of our vector \(x \) in the current step. Then the values after all elements have been updated are given by the vector

    \begin{equation*} x^{(k+1)} = M^{-1} ( N x^{(k)} + y ). \end{equation*}
  • All we now need is an initial guess for the solution, \(x^{(0)} \text{,}\) and we are ready to iteratively solve the linear system by computing \(x^{(1)} \text{,}\) \(x^{(2)} \text{,}\) etc., until we (approximately) reach a fixed point where \(x^{(k+1)} = M^{-1} ( N x^{(k)} + y ) \approx x^{(k)} \text{.}\)

The described method, where \(M \) equals the diagonal of \(A \) and \(N = D - A \text{,}\) is known as the Jacobi iteration.

Remark 7.3.1.1.

The important observation is that the computation involves a matrix-vector multiplication with a sparse matrix, \(N = D - A \text{,}\) and a solve with a diagonal matrix, \(M = D \text{.}\)