Jacobi method

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In numerical linear algebra, the Jacobi method is an algorithm for determining the solutions of a diagonally dominant system of linear equations. Each diagonal element is solved for, and an approximate value is plugged in. The process is then iterated until it converges. This algorithm is a stripped-down version of the Jacobi transformation method of matrix diagonalization. The method is named after Carl Gustav Jakob Jacobi.

Description[edit]

Given a square system of n linear equations:

A\mathbf x = \mathbf b

where:

A=\begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\a_{n1} & a_{n2} & \cdots & a_{nn} \end{bmatrix}, \qquad  \mathbf{x} = \begin{bmatrix} x_{1} \\ x_2 \\ \vdots \\ x_n \end{bmatrix} , \qquad  \mathbf{b} = \begin{bmatrix} b_{1} \\ b_2 \\ \vdots \\ b_n \end{bmatrix}.

Then A can be decomposed into a diagonal component D, and the remainder R:

A=D+R \qquad \text{where} \qquad D = \begin{bmatrix} a_{11} & 0 & \cdots & 0 \\ 0 & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\0 & 0 & \cdots & a_{nn} \end{bmatrix} \text{ and } R = \begin{bmatrix} 0 & a_{12} & \cdots & a_{1n} \\ a_{21} & 0 & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & 0 \end{bmatrix}.

The solution is then obtained iteratively via

 \mathbf{x}^{(k+1)} = D^{-1} (\mathbf{b} - R \mathbf{x}^{(k)}).

The element-based formula is thus:

 x^{(k+1)}_i  = \frac{1}{a_{ii}} \left(b_i -\sum_{j\ne i}a_{ij}x^{(k)}_j\right),\quad i=1,2,\ldots,n.

Note that the computation of xi(k+1) requires each element in x(k) except itself. Unlike the Gauss–Seidel method, we can't overwrite xi(k) with xi(k+1), as that value will be needed by the rest of the computation. The minimum amount of storage is two vectors of size n.

Algorithm[edit]

Choose an initial guess x^{0} to the solution
 k = 0
while convergence not reached do
for i := 1 step until n do
 \sigma = 0
for j := 1 step until n do
if j ≠ i then
 \sigma  = \sigma  + a_{ij} x_j^{(k)}
end if
end (j-loop)
  x_i^{(k+1)}  = {{\left( {b_i  - \sigma } \right)} \over {a_{ii} }}
end (i-loop)
check if convergence is reached
k = k + 1
loop (while convergence condition not reached)

Convergence[edit]

The standard convergence condition (for any iterative method) is when the spectral radius of the iteration matrix is less than 1:

\rho(D^{-1}R) < 1.

The method is guaranteed to converge if the matrix A is strictly or irreducibly diagonally dominant. Strict row diagonal dominance means that for each row, the absolute value of the diagonal term is greater than the sum of absolute values of other terms:

\left | a_{ii} \right | > \sum_{j \ne i} {\left | a_{ij} \right |}.

The Jacobi method sometimes converges even if these conditions are not satisfied.

Example[edit]

A linear system of the form Ax=b with initial estimate x^{(0)} is given by

 A=
      \begin{bmatrix}
           2 & 1 \\
           5 & 7 \\
           \end{bmatrix},
 \ b=
      \begin{bmatrix}
           11 \\
           13 \\
           \end{bmatrix}
\quad \text{and} \quad x^{(0)} =
        \begin{bmatrix}
           1 \\
           1 \\
        \end{bmatrix} .

We use the equation  x^{(k+1)}=D^{-1}(b - Rx^{(k)}), described above, to estimate x. First, we rewrite the equation in a more convenient form D^{-1}(b - Rx^{(k)}) = Tx^{(k)} + C, where T=-D^{-1}R and C = D^{-1}b. Note that R=L+U where L and U are the strictly lower and upper parts of A. From the known values

 D^{-1}=
      \begin{bmatrix}
           1/2 & 0 \\
           0 & 1/7 \\
           \end{bmatrix}, 
 \ L=
      \begin{bmatrix}
           0 & 0 \\
           5 & 0 \\
           \end{bmatrix}
\quad \text{and}  \quad U =
        \begin{bmatrix}
           0 & 1 \\
           0 & 0 \\
        \end{bmatrix} .

we determine  T=-D^{-1}(L+U) as

 T=
      \begin{bmatrix}
           1/2 & 0 \\
           0 & 1/7 \\
           \end{bmatrix}
\left\{
      \begin{bmatrix}
           0 & 0 \\
           -5 & 0 \\
           \end{bmatrix}
 +
        \begin{bmatrix}
           0 & -1 \\
           0 & 0 \\
        \end{bmatrix}\right\}  
 =
        \begin{bmatrix}
           0 & -1/2 \\
           -5/7 & 0 \\
        \end{bmatrix}  .

Further, C is found as

 C =
      \begin{bmatrix}
           1/2 & 0 \\
           0 & 1/7 \\
           \end{bmatrix}
      \begin{bmatrix}
           11 \\
           13 \\
           \end{bmatrix}
 =
        \begin{bmatrix}
           11/2 \\
           13/7 \\
        \end{bmatrix}.

With T and C calculated, we estimate x as  x^{(1)}= Tx^{(0)}+C :

 x^{(1)}= 
      \begin{bmatrix}
           0 & -1/2 \\
           -5/7 & 0 \\
           \end{bmatrix}
      \begin{bmatrix}
           1 \\
           1 \\
           \end{bmatrix}
 +
        \begin{bmatrix}
           11/2 \\
           13/7 \\
        \end{bmatrix}  
 =
        \begin{bmatrix}
           5.0 \\
           8/7 \\
        \end{bmatrix}  
\approx
        \begin{bmatrix}
           5 \\
           1.143 \\
        \end{bmatrix} .

The next iteration yields

 x^{(2)}= 
      \begin{bmatrix}
           0 & -1/2 \\
           -5/7 & 0 \\
           \end{bmatrix}

      \begin{bmatrix}
           5.0 \\
           8/7 \\
           \end{bmatrix}
 +
        \begin{bmatrix}
           11/2 \\
           13/7 \\
        \end{bmatrix} 
= 
        \begin{bmatrix}
           69/14 \\
           -12/7 \\
        \end{bmatrix} 
 \approx
        \begin{bmatrix}
           4.929 \\
           -1.713 \\
        \end{bmatrix} .

This process is repeated until convergence (i.e., until \|Ax^{(n)} - b\| is small). The solution after 25 iterations is

 x=\begin{bmatrix}
7.111\\
-3.222
\end{bmatrix}
.

Weighted Jacobi method[edit]

The weighted Jacobi iteration uses a parameter \omega to compute the iteration as

 \mathbf{x}^{(k+1)} = \omega D^{-1} (\mathbf{b} - R \mathbf{x}^{(k)}) + \left(1-\omega\right)\mathbf{x}^{(k)}

with \omega = 2/3 being the usual choice.[1]

See also[edit]

References[edit]

  1. ^ Saad, Yousef (2003). Iterative Methods for Sparse Linear Systems (2 ed.). SIAM. p. 414. ISBN 0898715342. 

External links[edit]