Hint. We discretize the unit cube

\(\varOmega \) with

\({x_1}_i = i h_1, {x_2}_j = j h_2, {x_3}_k = k h_3\), where

$$ h_1 = \frac{1}{n_i -1},\quad h_2 = \frac{1}{n_j -1},\quad h_3 = \frac{1}{n_k -1} $$

are the steps of the discrete finite difference mesh and

\(n_i, n_j, n_k\) are the numbers of discretization points in the directions

\(x_1, x_2, x_3\), respectively. The indices (

*i*,

*j*,

*k*) are such that

\(0 \le i < n_i\),

\(0 \le j < n_j\),

\(0 \le j < n_k \). The global node numbers

\(n_{glob}\) in the three-dimensional case can be computed as

$$\begin{aligned} \begin{aligned} n_{glob}&= j + n_j \left( (i-1) + n_i (k-1) \right) . \end{aligned} \end{aligned}$$

(8.83)

We take

\(n_i = n_j = n_k = n = N+2\),

\(h_1 = h_2 = h_3 = 1/(n -1) = 1/(N+1)\) and obtain the following scheme for the solution of Poisson’s equation (

8.11) in three dimensions:

$$\begin{aligned} \begin{aligned} - \frac{u_{i+1,j, k} - 2 u_{i,j, k} + u_{i-1,j, k}}{ h_1^2 }&- \frac{u_{i, j+1,k} - 2 u_{i,j,k} + u_{i, j-1,k}}{ h_2^2} \\&- \frac{u_{i,j, k+1} - 2 u_{i,j,k} + u_{i,j, k-1}}{ h_3^2} = \frac{f_{i,j,k}}{ a_{i,j, k}}, \end{aligned} \end{aligned}$$

(8.84)

where

\(u_{i,j,k}, f_{i,j,k}, a_{i,j, k}\) are values of

*u*,

*f*,

*a*, respectively, at the discrete point

\(n_{glob}\) with indices (

*i*,

*j*,

*k*). We rewrite Eq. (

8.84) with

\(h= h_1=h_2 = h_3\) as

$$\begin{aligned} 6 u_{i,j, k} - u_{i+1,j, k} - u_{i-1,j,k}- u_{i, j+1,k} - u_{i, j-1,k} - u_{i,j, k+1} - u_{i,j, k-1} = h^2 \frac{f_{i,j,k}}{a_{i,j, k}}. \end{aligned}$$

(8.85)

Again, we recognize that the scheme (

8.85) is a system of linear equations

\(A u = b\). The matrix

*A* is of size

\((n_i-2)(n_j -2)(n_k-2)=N^3\), and on the unit cube it is given by the block matrix

$$ A =\left( \begin{array}{c|ccc|c} A_N &{} -I_N &{} O_N &{} -I_N &{} \ddots \\ \hline -I_N &{} A_N &{} -I_N &{} \ddots &{} \ddots \\ \ddots &{} \ddots &{} \ddots &{} \ddots &{} \ddots \\ -I_N &{} \ddots &{} -I_N &{} A_N &{} -I_N \\ \hline \ddots &{} -I_N &{} O_N &{} -I_N &{} A_N \end{array} \right) $$

with zero blocks

\(O_N\) of order

*N*. The blocks

\(A_N\) of size

\(N\times N\) on the main diagonal of this matrix are given by

$$ A_N =\left( \begin{array}{cccccc} 6 &{} -1 &{} 0 &{} \cdots &{} \cdots &{} 0 \\ -1 &{} 6 &{} -1 &{} 0 &{} \cdots &{} 0 \\ 0 &{} -1 &{} 6 &{} 0 &{} \cdots &{} 0 \\ \cdots &{} \cdots &{} \cdots &{} \cdots &{} \cdots &{} \cdots \\ 0 &{} \cdots &{} \cdots &{} 0 &{} -1 &{} 6 \end{array} \right) . $$