Scheme for solving Laplace's (Poisson's) equation, final rewrite
We can rewrite the equations in a more compact form in terms of the matrices \( \mathbf{D} \), \( \mathbf{L} \) and \( \mathbf{U} \) as,
after \( r+1 \) iterations,
$$
\begin{equation} \tag{20}
\mathbf{x}^{(r+1)}= \mathbf{D}^{-1}\left(\mathbf{b} - (\mathbf{L}+\mathbf{U})\mathbf{x}^{(r)}\right),
\end{equation}
$$
where the unknown functions are now defined in terms of
$$
\begin{equation*}
\mathbf{x}= \begin{bmatrix} u_{11}\\
u_{12}\\
u_{21}\\
u_{22}\\
\end{bmatrix}.
\end{equation*}
$$
If we wish to implement Gauss-Seidel's algorithm,
the set of equations to solve are then given by
$$
\begin{equation} \tag{21}
\mathbf{x}^{(r+1)}= -(\mathbf{D}+\mathbf{L})^{-1}\left(\mathbf{b} -\mathbf{U}\mathbf{x}^{(r)}\right),
\end{equation}
$$
or alternatively as
$$
\begin{equation*}
\mathbf{x}^{(r+1)}= \mathbf{D}^{-1}\left(\mathbf{b} -\mathbf{L}\mathbf{x}^{(r+1)}-\mathbf{U}\mathbf{x}^{(r)}\right).
\end{equation*}
$$