Jacobi Method and Gauss-Seidel Method¶
Context¶
Let
be a square system of \(n\) linear equations, where
We want to find an approximate solution of \(\mathbf{x}\).
Problem¶
How do we find a good approximate solution of \(\mathbf{x}\)?
Solution¶
Re-write the \(n\) linear equations as follows:
Define:
* \(\mathbf {x}^{(k)} \in \mathbb{C}^n\): The kth iteration of the approximation of \(\mathbf {x}\).
Then \(\mathbf {x}^{(k+1)}\) can be derived by \(\mathbf {x}^{(k)}\) using the above equations.
The initial approximation, \(\mathbf {x}^{(0)}\), can be empirically assigned. If there is no other prior knowledge about the system, \(\mathbf {x}^{(0)}\) can be set to all zeros.
Jacobi Method¶
To compute the (k+1)th iteration, use the following equations:
A different way to understand the equations is to decompose \(A\) into a diagonal component \(D\) and the remainder \(R\):
where
$$
D={\begin{bmatrix}a_{11}&0&\cdots &0\0&a_{22}&\cdots &0\\vdots &\vdots &\ddots &\vdots \0&0&\cdots &a_{nn}\end{bmatrix}}, \qquad
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}}.
$$
And the system can be written as
And the solution of \(\mathbf{x}\) is iteratively approximated by
Gauss-Seidel Method¶
When computing the new approximation \(x_1^{(k+1)}, x_2^{(k+1)}, \cdots, x_n^{(k+1)}\), the new estimation \(x_j^{(k+1)}\) instead of the old one (\(x_j^{(k)}\)) will be used, if available.
In other words, the equations are
A different way to understand the equation is to decompose \(A\) into a lower triangular component \(L_*\) and a strictly upper triangular component \(U\):
where
$$
L_*={\begin{bmatrix}a_{11}&0&\cdots &0\a_{21}&a_{22}&\cdots &0\\vdots &\vdots &\ddots &\vdots \a_{n1}&a_{n2}&\cdots &a_{nn}\end{bmatrix}},\quad
U={\begin{bmatrix}0&a_{12}&\cdots &a_{1n}\0&0&\cdots &a_{2n}\\vdots &\vdots &\ddots &\vdots \0&0&\cdots &0\end{bmatrix}}.
$$
And the system can be written as
And the solution of \(\mathbf{x}\) is iteratively approximated by