1 Introduction

Inverse problems for partial differential equations are frequently encountered in various branches of science (see [13] and the bibliography therein).

In recent years, theory and methods of solutions of inverse problems of determining the parameter of partial differential equations have been extensively studied by several researchers (see [125] and the references therein).

We will denote the set of natural numbers from 1 to n by \(\mathbb{N}_{n}=\{1,2,\ldots ,n\}\), and closure of set Ω by \(\overline{\Omega}=\Omega \cup S\).

Let \(n\in\mathbb{N}\), \(\delta ,T,L>0\), \(\lambda \in (0,T) \) be given numbers and \(\Omega =(0,L)\times \cdots \times (0,L)\) be the open cube in the n-dimensional Euclidean space with boundary \(S=\partial \Omega =S_{1}\cup S_{2}\), where

$$\begin{aligned}& S = \bigcup^{n}_{i=1}\bigl\{ x=(x_{1},x_{2},\ldots x_{n})\mid x_{i}=0 \text{ or } x_{i}=L, x_{k}\in [ 0,L], k \in \mathbb{N}_{n}\backslash \{i\}\bigr\} , \\& S_{1} = \bigcup^{n}_{i=1}\bigl\{ x=(x_{1},x_{2},\ldots x_{n})\mid x_{i}=0, x_{k}\in [ 0,L], k\in\mathbb{N} _{n} \backslash \{i\}\bigr\} , \\& S_{2} = \bigcup^{n}_{i=1}\bigl\{ x=(x_{1},x_{2},\ldots x_{n})\mid x_{i}=L, x_{k}\in (0,L], k\in \mathbb{N}_{n} \backslash \{i\}\bigr\} , \end{aligned}$$

and let \(a_{r},\varphi ,\xi ,\psi :\overline{\Omega }\rightarrow \mathbb{R}\), \(f:(0,T)\times \Omega \rightarrow \mathbb{R}\) be given smooth functions such that \(a_{r}(x)\geq a>0\) for \(x\in \overline{\Omega }\), \(r\in\mathbb{N}_{n}\). Consider the multidimensional elliptic equation

$$\begin{aligned}& -u_{tt}(t,x)-\sum_{r=1}^{n} \bigl(a_{r}(x)u_{x_{r}}(t,x)\bigr)_{x_{r}}+\delta u(t,x)=f(t,x)+p(x), \\ & \quad x=(x_{1},\ldots ,x_{n})\in \Omega ,0< t<T. \end{aligned}$$
(1.1)

Here \(u(t,x)\) and \(p(x)\) are unknown functions.

In \([0,T]\times \Omega \), consider the inverse problem of finding functions \(u(t,x)\) and \(p(x)\) for the multidimensional elliptic equation (1.1) with overdetermined boundary conditions

$$ u(0,x)=\varphi (x),\qquad u(\lambda ,x)=\xi (x),\qquad u(T,x)=\psi (x), \quad x \in \overline{\Omega } $$
(1.2)

and one of the following usual boundary conditions on \([ 0,T ] \times S\):

$$\begin{aligned}& u(t,x)=0, \quad 0\leq t\leq T,x\in S, \end{aligned}$$
(1.3)
$$\begin{aligned}& \frac{\partial u(t,x)}{\partial \vec {n}}=0,\quad 0\leq t\leq T,x\in S, \end{aligned}$$
(1.4)
$$\begin{aligned}& \frac{\partial u(t,x)}{\partial \vec {n}}=0,\quad x\in S_{1}, \qquad u(t,x)=0,\quad x\in S_{2},0\leq t\leq T, \end{aligned}$$
(1.5)
$$\begin{aligned}& u(t,x)=0,\quad x\in S_{1}, \qquad \frac{\partial u(t,x)}{\partial \vec {n}} =0,\quad x\in S_{2},0\leq t\leq T. \end{aligned}$$
(1.6)

For the problem of determining the parameter of an elliptic equation in a Banach space, the exact estimates of solution in Hölder norms are established in [21]. Well-posedness of inverse problem (1.1), (1.2), (1.3) and its approximations were investigated in [18]. In [21], the third and fourth order stable difference schemes for approximate solution of this problem were presented. Stability and coercive stability estimates for the solution of the first and second order difference schemes for inverse problem (1.1), (1.2), (1.4) were established in [19]. In [23], the authors studied inverse problem (1.1), (1.2), (1.5).

Our aim in this work is to construct the first and second orders of accuracy difference schemes for an approximate solution of inverse problem (1.1), (1.2), (1.6) and to establish stability, coercive stability, almost coercive stability estimates for the solution of these difference schemes.

This paper is planned as follows. In Section 2, we give theorems on well-posedness of inverse problems with mixed boundary conditions and overdetermination. Section 3 is devoted to the construction of the first and second order difference schemes for approximate solution of problem (1.1), (1.2), (1.6). In this section, we establish stability, almost coercive, and coercive stability inequalities for the solution of difference schemes. In Section 4, we present numerical results for a two-dimensional elliptic equation. The conclusion is given in the final Section 5.

2 Well-posedness of inverse problems with mixed boundary conditions and overdetermination

Let \(\mathcal{C}_{0T}^{\alpha ,\alpha }(L_{2}(\overline{\Omega }))\) be the space obtained by completion of the space of all smooth \(L_{2}(\overline{ \Omega })\)-valued functions g on \([0,T]\) with the norm

$$ \Vert g\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }(L_{2}(\overline{\Omega }))} =\Vert g\Vert _{\mathcal{C}(L_{2}(\overline{\Omega }))}+ \sup _{0\leq t< t+\tau \leq T}\frac{(t+\tau )^{\alpha }(T-t)^{\alpha }\Vert g(t+\tau )-g(t)\Vert _{L_{2}(\overline{\Omega })}}{\tau ^{\alpha }}. $$

Denote the differential expression generated by (1.1) [26]

$$ A\rho (x)=-\sum_{r=1}^{n} \bigl(a_{r}(x)\rho _{x_{r}}(x)\bigr)_{x_{r}}+\delta \rho (x), $$
(2.1)

where \(\rho \in W_{2}^{2} ( \overline{\Omega } ) \).

The differential expression (1.1) defines a self-adjoint positive definite operator A acting on \(L_{2} ( \overline{\Omega } ) \) with the domain

$$ D(A)= \biggl\{ \rho \in W_{2}^{2} ( \overline{\Omega } ) , \frac{\partial \rho }{\partial \vec {n}}=0\text{ on } S_{1},\rho =0 \text{ on } S_{2} \biggr\} . $$

Therefore, by using abstract Theorems 2.1 and 2.2 of paper [19] for \(H=L_{2} ( \overline{\Omega } ) \), we get the following theorems on well-posedness of inverse problem (1.1), (1.2), (1.5).

Theorem 2.1

Suppose that A is defined by formula (2.1), \(\varphi ,\xi ,\psi \in D(A)\). Then, for the solutions \((u,p)\) of inverse problem (1.1), (1.2), (1.5), the stability inequalities

$$\begin{aligned}& \Vert u\Vert _{C(L_{2}(\overline{\Omega }))} \leq M_{1}\bigl[\Vert \varphi \Vert _{L_{2}(\overline{\Omega })}+\Vert \psi \Vert _{L_{2}(\overline{\Omega })}+\Vert \xi \Vert _{L_{2}(\overline{\Omega })}+\Vert f\Vert _{C(L_{2}(\overline{\Omega }))}\bigr], \end{aligned}$$
(2.2)
$$\begin{aligned}& \bigl\Vert A^{-1}p\bigr\Vert _{L_{2}(\overline{\Omega })} \leq M_{1} \bigl[ \Vert \varphi \Vert _{L_{2}(\overline{\Omega })}+\Vert \psi \Vert _{L_{2}(\overline{\Omega })}+\Vert \xi \Vert _{L_{2}(\overline{\Omega })}+\Vert f\Vert _{C(L_{2}(\overline{\Omega }))} \bigr] , \end{aligned}$$
(2.3)
$$\begin{aligned}& \Vert p\Vert _{L_{2}(\overline{\Omega })} \leq M_{1}\biggl[\Vert A\varphi \Vert _{L_{2}(\overline{\Omega })}+\Vert A\psi \Vert _{L_{2}(\overline{\Omega })}+\Vert A\xi \Vert _{L_{2}(\overline{\Omega })} \\& \hphantom{\Vert p\Vert _{L_{2}(\overline{\Omega })} \leq}{}+\frac{1}{\alpha (1-\alpha )}\Vert f\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }(L_{2}(\overline{\Omega }))}\biggr], \end{aligned}$$
(2.4)

are satisfied, where \(M_{1}\) is independent of α, \(\varphi (x)\), \(\xi (x)\), \(\psi (x)\), and \(f(t,x)\).

Theorem 2.2

Assume that A is defined by formula (2.1), \(\varphi ,\psi ,\xi \in D(A)\). Then, for the solution of inverse problem (1.1), (1.2), (1.5), the coercive stability estimate

$$\begin{aligned}& \bigl\Vert u^{\prime \prime }\bigr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }(L_{2}(\overline{\Omega }))}+\Vert u\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }(W_{2}^{2}(\overline{\Omega }))}+\Vert p\Vert _{L_{2}(\overline{\Omega })} \\& \quad \leq M_{2}\biggl[\frac{1}{\alpha (1-\alpha )}\Vert f\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }(L_{2}(\overline{\Omega }))}+\Vert \varphi \Vert _{W_{2}^{2}(\overline{\Omega })}+\Vert \psi \Vert _{W_{2}^{2}(\overline{\Omega })}+\Vert \xi \Vert _{W_{2}^{2}(\overline{\Omega })}\biggr] \end{aligned}$$
(2.5)

holds, where \(M_{2}\) does not depend on α, \(\varphi (x)\), \(\xi (x)\), \(\psi (x)\), and \(f(t,x)\).

Now, consider inverse problem (1.1), (1.2), (1.6).

The differential expression (1.1) defines a self-adjoint positive definite operator A acting on \(L_{2} ( \overline{\Omega } ) \) with the domain

$$ D(A)= \biggl\{ \rho \in W_{2}^{2} ( \overline{\Omega } ) , \rho =0\text{ on } S_{1},\frac{\partial \rho }{\partial \vec {n}}=0 \text{ on } S_{2} \biggr\} . $$

So, in a similar manner, applying abstract Theorems 2.1 and 2.2 of paper [19] for \(H=L_{2} ( \overline{\Omega } ) \), we can get the theorems on well-posedness of inverse problem (1.1), (1.2), (1.6).

Theorem 2.3

Suppose that A is defined by formula (2.1), \(\varphi ,\xi ,\psi \in D(A)\). Then, for the solution \((u,p)\) of inverse problem (1.1), (1.2), (1.6), the stability inequalities (2.2), (2.3), (2.4) hold.

Theorem 2.4

Assume that A is defined by formula (2.1), \(\varphi ,\psi ,\xi \in D(A)\). Then, for the solution \((u,p)\) of inverse problem (1.1), (1.2), (1.6), coercive stability estimate (2.5) is valid.

3 Difference schemes and their well-posedness

We discretize inverse problem (1.1), (1.2), (1.6) in two steps. In the first step, define the set of grid points in space variables,

$$ \begin{cases} \widetilde{\Omega }_{h}=\{x=(h_{1}m_{1},\ldots ,h_{n}m_{n})\mid m_{i}=0,\ldots ,M_{i}, h_{i}M_{i}=L, i=1,\ldots ,n\}, \\ \Omega _{h}=\widetilde{\Omega }_{h}\cap \Omega ,\qquad S_{h}^{1}=\widetilde{\Omega }_{h}\cap S^{1},\qquad S_{h}^{2}=\widetilde{\Omega }_{h}\cap S^{2}.\end{cases}$$

Introduce the Hilbert spaces \(L_{2h}=L_{2}(\widetilde{\Omega }_{h})\) and \(W_{2h}^{2}=W_{2}^{2}(\widetilde{\Omega }_{h})\) of grid functions \(g^{h}(x)=\{g(h_{1}m_{1},\ldots ,h_{n}m_{n})\mid m_{i}=0,\ldots ,M_{i}, i=1,\ldots ,n\}\) defined on \(\widetilde{\Omega }_{h}\) equipped with the norms

$$\begin{aligned}& \bigl\Vert g^{h}\bigr\Vert _{L_{2h}}= \biggl( \sum _{x\in \widetilde{\Omega }_{h}}\bigl\vert g^{h}(x)\bigr\vert ^{2}h_{1}\cdots h_{n} \biggr) ^{1/2}, \\& \bigl\Vert g^{h}\bigr\Vert _{W_{2h}^{2}}=\bigl\Vert g^{h}\bigr\Vert _{L_{2h}}+ \Biggl( \sum _{x\in \widetilde{\Omega }_{h}}\sum_{i=1}^{n}\bigl\vert \bigl(g^{h}(x)\bigr)_{x_{i},m_{i}}\bigr\vert ^{2}h_{1}\cdots h_{n} \Biggr) ^{1/2} \\& \hphantom{\bigl\Vert g^{h}\bigr\Vert _{W_{2h}^{2}}={}}{}+ \Biggl( \sum_{x\in \widetilde{\Omega }_{h}}\sum _{i=1}^{n}\bigl\vert \bigl(g^{h}(x) \bigr)_{x_{i}\overline{x_{i}}, m_{i}}\bigr\vert ^{2}h_{1}\cdots h_{n} \Biggr) ^{1/2}, \end{aligned}$$

respectively.

To the differential operator A (2.1) assign the difference operator \(A_{h}^{x}\), defined by the formula

$$ A_{h}^{x}u^{h}=-\sum _{i=1}^{n} \bigl( a_{i}(x)u_{\overline{x}_{i}}^{h} \bigr) _{x_{i},m_{i}}+\delta u^{h} $$
(3.1)

acting in the space of grid functions \(u^{h}(x)\) satisfying the conditions \(u^{h}(x)=0\) for all \(x\in S_{h}^{1}\) and \(D^{h}u^{h}(x)=0 \) for all \(x\in S_{h}^{2}\). Here, \(D^{h}u^{h}(x)\) is an approximation of \(\frac{ \partial u}{\partial \vec {n}}\). Note that [26, 27] \(A_{h}^{x}\) is a self-adjoint positive definite operator in \(L_{2} ( \widetilde{\Omega }_{h} ) \).

In this step, by using \(A_{h}^{x}\), for obtaining \(u^{h}(t,x)\) functions, we arrive at the problem

$$ \begin{cases} -\frac{d^{2}u^{h}(t,x)}{dt^{2}}+A_{h}^{x}u^{h}(t,x)=f^{h}(t,x)+p^{h}(x),\quad 0< t<T,x\in \Omega _{h}, \\ u^{h}(0,x)=\varphi ^{h}(x),\qquad u^{h}(\lambda ,x)=\xi ^{h}(x),\qquad u^{h}(T,x)=\psi ^{h}(x),\quad x\in \widetilde{\Omega }_{h}.\end{cases} $$
(3.2)

In the second step, applying the approximate formula

$$ u^{h}(\lambda ,x)=u^{h}\biggl(\biggl[\frac{\lambda }{\tau } \biggr]\tau ,x\biggr)+o(\tau ) $$

for \(u^{h}(\lambda ,x)=\xi ^{h}(x)\), we replace inverse problem (1.1), (1.2), (1.6) with the first order of accuracy difference scheme

$$ \begin{cases} -\frac{u_{k+1}^{h}(x)-2u_{k}^{h}(x)+u_{k-1}^{h}(x)}{\tau ^{2}}+A_{h}^{x}u_{k}^{h}(x)=\theta _{k}^{h}(x)+p^{h}(x), \\ \quad \theta _{k}^{h}(x)=f^{h}(t_{k},x),t_{k}=k\tau ,1\leq k\leq N-1,x\in \Omega _{h}, \\ u_{0}^{h}(x)=\varphi ^{h}(x),\qquad u_{N}^{h}(x)=\psi ^{h}(x),\qquad u_{l}^{h}(x)=\xi ^{h}(x),\quad x\in \widetilde{\Omega }_{h},N\tau =T.\end{cases} $$
(3.3)

Here, \(l= [ \frac{\lambda }{\tau } ] \), \([\cdot ]\) is a notation for the greatest integer function.

In this step, by using the approximate formula

$$ u^{h}(\lambda ,x)=u^{h}(l\tau ,x)+\biggl( \frac{\lambda }{\tau }-l\biggr) \bigl(u^{h}(l\tau +\tau ,x)-u^{h}(l \tau ,x)\bigr)+o\bigl(\tau ^{2}\bigr) $$

for \(u^{h}(\lambda ,x)=\xi ^{h}(x)\), we construct the second order of accuracy difference scheme for inverse problem (1.1), (1.2), (1.6)

$$ \begin{cases} -\frac{u_{k+1}^{h}(x)-2u_{k}^{h}(x)+u_{k-1}^{h}(x)}{\tau ^{2}}+A_{h}^{x}u_{k}^{h}(x)=\theta _{k}^{h}(x)+p^{h}(x), \\ \quad \theta _{k}^{h}(x)=f^{h}(t_{k},x),t_{k}=k\tau ,1\leq k\leq N-1,x\in \widetilde{\Omega }_{h}, \\ u_{0}^{h}(x)=\varphi ^{h}(x),\qquad u_{N}^{h}(x)=\psi ^{h}(x), \\ u_{l}^{h}(x)+ ( \frac{\lambda }{\tau }-l ) ( u_{l+1}^{h}(x)-u_{l}^{h}(x) ) =\xi ^{h}(x),\quad x\in \widetilde{\Omega }_{h},N\tau =T.\end{cases} $$
(3.4)

Applying

$$ u_{k}^{h}(x)=v_{k}^{h}(x)- \bigl( A_{h}^{x} \bigr) ^{-1}p^{h}(x),\quad 1 \leq k\leq N-1, $$
(3.5)

we can reduce difference problems (3.3) and (3.4) to the auxiliary nonlocal difference problems

$$ \begin{cases} -\frac{v_{k+1}^{h}(x)-2v_{k}^{h}(x)+v_{k-1}^{h}(x)}{\tau ^{2}}+A_{h}^{x}v_{k}^{h}(x)=\theta _{k}^{h}(x), \\ \quad \theta _{k}^{h}(x)=f^{h}(t_{k},x),t_{k}=k\tau , 1\leq k\leq N-1, x\in \Omega _{h}, \\ v_{0}^{h}(x)-v_{l}^{h}(x)=\varphi ^{h}(x)-\xi ^{h}(x), \\ v_{N}^{h}(x)-v_{l}^{h}(x)=\psi ^{h}(x)-\xi ^{h}(x),\quad x\in \widetilde{\Omega }_{h},N\tau =T\end{cases} $$
(3.6)

and

$$ \begin{cases} -\frac{v_{k+1}^{h}(x)-2v_{k}^{h}(x)+v_{k-1}^{h}(x)}{\tau ^{2}}+A_{h}^{x}v_{k}^{h}(x)=\theta _{k}^{h}(x), \\ \quad \theta _{k}^{h}(x)=f^{h}(t_{k},x),t_{k}=k\tau ,1\leq k\leq N-1,x\in \widetilde{\Omega }_{h}, \\ v_{0}^{h}(x)-v_{l}^{h}(x)- ( \frac{\lambda }{\tau }-l ) ( v_{l+1}^{h}(x)-v_{l}^{h}(x) ) =\varphi ^{h}(x)-\xi ^{h}(x), \\ v_{N}^{h}(x)-v_{l}^{h}(x)- ( \frac{\lambda }{\tau }-l ) ( v_{l+1}^{h}(x)-v_{l}^{h}(x) ) =\psi ^{h}(x)-\xi ^{h}(x), \\ \quad x\in \widetilde{\Omega }_{h},N\tau =T,\end{cases} $$
(3.7)

respectively.

The difference schemes for nonlocal boundary value problems for the multidimensional elliptic equation were studied in [28, 29].

Denote

$$ C=\frac{1}{2}\Bigl(\tau A_{h}^{x}+\sqrt {4A_{h}^{x}+\tau ^{2}\bigl(A_{h}^{x} \bigr)^{2}}\Bigr),\qquad R=(I+\tau C)^{-1}. $$

Let H be the Hilbert space \(L_{2}(\overline{\Omega })\).

Lemma 3.1

The following estimates are satisfied [27]:

$$\begin{aligned}& \bigl\Vert R^{k}\bigr\Vert _{H\rightarrow H}\leq M_{3} \bigl(1+\delta ^{\frac{1}{2}}\tau \bigr)^{-k},\quad \delta >0, \\& \bigl\Vert CR^{k}\bigr\Vert _{H\rightarrow H}\leq \frac{M_{3}}{k\tau },\quad k\geq 1, \\& \bigl\Vert \bigl(I-R^{2N}\bigr)^{-1}\bigr\Vert _{H\rightarrow H}\leq M_{3}, \end{aligned}$$

where \(M_{3}\) is independent of τ.

Lemma 3.2

([19])

For \(1\leq l\leq N-1\) and for the operator \(S=R^{2N}+R^{l}-R^{2N-l}+R^{N-l}-R^{N+l}\), the operator \(I-S\) has an inverse \(G=(I-S)^{-1}\) and the estimate

$$ \| G\| _{H\rightarrow H}\leq M_{4} $$
(3.8)

is satisfied, where \(M_{4}\) does not depend on τ.

Lemma 3.3

([19])

For \(1\leq l\leq N-1\) and for the operator

$$\begin{aligned} S_{1} =&R^{2N}- \biggl( \frac{\lambda }{\tau }-l-1 \biggr) \bigl(R^{l}-R^{2N-l}+R^{N-l}-R^{N+l}\bigr) \\ &{}+ \biggl( \frac{\lambda }{\tau }-l \biggr) \bigl(R^{l+1}-R^{2N-l-1}+R^{N-l-1}-R^{N+l+1} \bigr), \end{aligned}$$

the operator \(I-S_{1}\) has an inverse

$$\begin{aligned} G_{1} =&\biggl(I-R^{2N}+ \biggl( \frac{\lambda }{\tau }-l-1 \biggr) \bigl(R^{l}-R^{2N-l}+R^{N-l}-R^{N+l} \bigr) \\ &\biggl.\biggl.{}- \biggl( \frac{\lambda }{\tau }-l \biggr) \bigl(R^{l+1}-R^{2N-l-1}+R^{N-l-1}-R^{N+l+1} \bigr)\biggr)\biggr.^{-1}, \end{aligned}$$

and the estimate

$$ \| G_{1}\| _{H\rightarrow H}\leq M_{5} $$
(3.9)

is valid, where \(M_{5}\) does not depend on τ.

In a similar manner as [19], we can obtain the following representation formula

$$\begin{aligned}& u_{k}^{h}(x)=\bigl(I-R^{2N} \bigr)^{-1}\Biggl[\bigl( \bigl( R^{k}-R^{2N-k} \bigr) v_{0}^{h}(x)+ \bigl( R^{N-k}-R^{N+k} \bigr) v_{N}^{h}(x)\bigr) \\& \hphantom{u_{k}^{h}(x)=}{}- \bigl( R^{N-k}-R^{N+k} \bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1}\sum_{i=1}^{N-1} \bigl( R^{N-i}-R^{N+i} \bigr) f_{i}^{h}(x) \tau \Biggr] \\& \hphantom{u_{k}^{h}(x)=}{}+(I+\tau C) (2I+\tau C)^{-1}C^{-1}\sum _{i=1}^{N-1} \bigl( R^{\vert k-i\vert }-R^{k+i} \bigr) f_{i}^{h}(x)\tau +\varphi ^{h}(x)-v_{0}^{h}(x), \\& p^{h}(x)=A_{h}^{x}\varphi ^{h}(x)-A_{h}^{x}v_{0}^{h}(x), \\& v_{N}^{h}(x)=v_{0}^{h}(x)+\psi ^{h}(x)-\varphi ^{h}(x), \end{aligned}$$
(3.10)

with

$$\begin{aligned} v_{0}^{h}(x) =&-G \bigl( R^{N-l}-R^{N+l} \bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1} \\ &{}\times \sum_{i=1}^{N-1} \bigl( R^{N-i}-R^{N+i} \bigr) f_{i}^{h}(x)\tau +G \bigl(I-R^{2N}\bigr) (I+\tau C) \\ &{}\times (2I+\tau C)^{-1}C^{-1}\sum _{i=1}^{N-1} \bigl( R^{\vert l-i\vert }-R^{l+i} \bigr) f_{i}^{h}(x)\tau \\ &{}+G\bigl(I-R^{2N}\bigr) \bigl( \varphi ^{h}(x)-\xi ^{h}(x) \bigr) +G \bigl( R^{N-l}-R^{N+l} \bigr) \bigl(\psi ^{h}(x)-\varphi ^{h}(x)\bigr) \end{aligned}$$
(3.11)

for the solution of difference scheme (3.3) and

$$\begin{aligned} v_{0}^{h}(x) =&\biggl(\frac{\lambda }{\tau }-l-1 \biggr)G_{1}\bigl(R^{N-l}-R^{N+l}\bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1} \\ &{}\times \sum_{i=1}^{N-1} \bigl(R^{N-i}-R^{N+i}\bigr)f_{i}^{h}(x)\tau \\ &{}-\biggl(\frac{\lambda }{\tau }-l-1\biggr)G_{1}\bigl(I-R^{2N} \bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1} \\ &{}\times \sum_{i=1}^{N-1} \bigl(R^{\vert l-i\vert }-R^{l+i}\bigr)f_{i}^{h}(x)\tau \\ &{}-\biggl(\frac{\lambda }{\tau }-l\biggr)G_{1}\bigl(R^{N-l-1}-R^{N+l+1} \bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1} \\ &{}\times \sum_{i=1}^{N-1} \bigl(R^{N-i}-R^{N+i}\bigr)f_{i}^{h}(x)\tau \\ &{}+\biggl(\frac{\lambda }{\tau }-l\biggr)G_{1}\bigl(I-R^{2N} \bigr) (I+\tau C) (2I+\tau C)^{-1}C^{-1} \\ &{}\times \sum_{i=1}^{N-1} \bigl(R^{\vert l+1-i\vert }-R^{l+1+i}\bigr)f_{i}^{h}(x)\tau \\ &{}+G_{1}\bigl(I-R^{2N}\bigr) \bigl(\varphi ^{h}(x)-\xi ^{h}(x)\bigr)+\biggl(\biggl(\frac{\lambda }{\tau }-l-1 \biggr)G_{1}\bigl(R^{N-l}-R^{N+l}\bigr) \\ &{}+ \biggl( \frac{\lambda }{\tau }-l \biggr) G_{1} \bigl( R^{N-l-1}-R^{N+l+1} \bigr) \biggr) \bigl(\psi ^{h}(x)- \varphi ^{h}(x)\bigr) \end{aligned}$$
(3.12)

for difference scheme (3.4).

Now, we consider the linear spaces of mesh functions \(\theta ^{\tau }= \{ \theta _{k} \} _{1}^{N-1}\) with values in the Hilbert space H. We denote by \(C([0,T]_{\tau },H)\) a normed space with the norm

$$ \bigl\Vert \{ \theta _{k} \} _{1}^{N-1}\bigr\Vert _{C([0,T]_{\tau },H)}=\max_{1\leq k\leq N-1}\Vert \theta _{k} \Vert _{H}, $$

and by \(\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },H)\) a normed space with the norm

$$\begin{aligned} \bigl\Vert \{ \theta _{k} \} _{1}^{N-1}\bigr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },H)} =&\bigl\Vert \{ \theta _{k} \} _{1}^{N-1}\bigr\Vert _{C([0,T]_{\tau },H)} \\ &{}+\sup _{1\leq k< k+n\leq N-1}\frac{(k\tau +n\tau )^{\alpha }(T-k\tau )^{\alpha }\Vert \theta _{k+n}-\theta _{k}\Vert _{H}}{ ( n\tau ) ^{\alpha }}. \end{aligned}$$

Let τ and \(|h|=\sqrt{h_{1}^{2}+\cdots +h_{n}^{2}}\) be sufficiently small positive numbers.

Theorem 3.1

The solutions \(( \{ u_{k}^{h} \} _{1}^{N-1},p^{h} ) \) of difference schemes (3.3) and (3.4) obey the following stability estimates:

$$\begin{aligned}& \bigl\Vert \bigl\{ u_{k}^{h} \bigr\} _{1}^{N-1} \bigr\Vert _{C([0,T]_{\tau },L_{2h})}\leq M_{6} \bigl[ \bigl\Vert \varphi ^{h}\bigr\Vert _{L_{2h}}+\bigl\Vert \psi ^{h}\bigr\Vert _{L_{2h}}+\bigl\Vert \xi ^{h}\bigr\Vert _{L_{2h}} +\bigl\Vert \bigl\{ f_{k}^{h} \bigr\} _{1}^{N-1}\bigr\Vert _{C([0,T]_{\tau },L_{2h})} \bigr] , \\& \bigl\Vert p^{h}\bigr\Vert _{L_{2h}}\leq M_{6} \biggl[ \bigl\Vert \varphi ^{h}\bigr\Vert _{W_{2h}^{2}}+\bigl\Vert \psi ^{h}\bigr\Vert _{W_{2h}^{2}}+\bigl\Vert \xi ^{h}\bigr\Vert _{W_{2h}^{2}}+\frac{1}{\alpha (1-\alpha )}\bigl\Vert \bigl\{ f_{k}^{h} \bigr\} _{1}^{N-1}\bigr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },L_{2h})} \biggr] , \end{aligned}$$

where \(M_{6}\) is independent of τ, α, h, \(\varphi ^{h}\), \(\psi ^{h}\), \(\xi ^{h}\), and \(\{ f_{k}^{h} \} _{1}^{N-1}\).

Theorem 3.2

The solutions of difference schemes (3.3) and (3.4) obey the following almost coercive stability estimate:

$$\begin{aligned}& \biggl\Vert \biggl\{ \frac{u_{k+1}^{h}-2u_{k}^{h}+u_{k-1}^{h}}{\tau ^{2}} \biggr\} _{1}^{N-1}\biggr\Vert _{C([0,T]_{\tau },L_{2h})}+\bigl\Vert p^{h}\bigr\Vert _{L_{2h}} \\& \quad \leq M_{7} \biggl( \bigl\Vert \varphi ^{h}\bigr\Vert _{W_{2h}^{2}}+\bigl\Vert \psi ^{h}\bigr\Vert _{W_{2h}^{2}}+\bigl\Vert \xi ^{h}\bigr\Vert _{W_{2h}^{2}}+\ln \biggl( \frac{1}{\tau +h} \biggr) \bigl\Vert \bigl\{ f_{k}^{h} \bigr\} _{1}^{N-1}\bigr\Vert _{C([0,T]_{\tau },L_{2h})} \biggr) , \end{aligned}$$

where \(M_{7}\) does not depend on τ, α, h, \(\varphi ^{h}\), \(\psi ^{h}\), \(\xi ^{h}\), and \(\{ f_{k}^{h} \} _{1}^{N-1}\).

Theorem 3.3

The solutions of difference schemes (3.3) and (3.4) obey the following coercive stability estimate:

$$\begin{aligned}& \biggl\Vert \biggl\{ \frac{u_{k+1}^{h}-2u_{k}^{h}+u_{k-1}^{h}}{\tau ^{2}} \biggr\} _{1}^{N-1}\biggr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },L_{2h})}+\bigl\Vert \bigl\{ u_{k}^{h} \bigr\} _{1}^{N-1}\bigr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },W_{2h}^{2})}+\bigl\Vert p^{h}\bigr\Vert _{L_{2h}} \\& \quad \leq M_{8} \biggl[ \frac{1}{\alpha (1-\alpha )}\bigl\Vert \bigl\{ f_{k}^{h} \bigr\} _{1}^{N-1}\bigr\Vert _{\mathcal{C}_{0T}^{\alpha ,\alpha }([0,T]_{\tau },L_{2h})}+\bigl\Vert \varphi ^{h}\bigr\Vert _{W_{2h}^{2}}+ \bigl\Vert \psi ^{h}\bigr\Vert _{W_{2h}^{2}}+\bigl\Vert \xi ^{h}\bigr\Vert _{W_{2h}^{2}} \biggr] , \end{aligned}$$

where \(M_{8}\) is independent of τ, α, h, \(\varphi ^{h}\), \(\psi ^{h}\), \(\xi ^{h}\), and \(\{ f_{k}^{h} \} _{1}^{N-1}\).

The proofs of Theorems 3.1-3.3 are based on the symmetry property of operator \(A_{h}^{x}\) in \(L_{2h}\), representation formulas (3.10), (3.11), (3.12), Lemmas 3.1-3.3 and the following theorem on the coercivity estimate for the solution of the elliptic difference problem in \(L_{2h}\).

Theorem 3.4

([30])

For the solution of the elliptic difference problem

$$ \begin{cases} A_{h}^{x}u^{h}(x)=\omega ^{h}(x),\quad x\in \widetilde{\Omega }_{h}, \\ u^{h}(x)=0, \quad x\in S_{1}^{h},\qquad D^{h}u^{h}(x)=0, \quad x\in S_{2}^{h},\end{cases}$$

the following coercivity inequality holds:

$$ \sum_{q=1}^{n}\bigl\Vert \bigl(u_{k}^{h}\bigr)_{x_{q}\overline{x}_{q},m_{q}}\bigr\Vert _{L_{2h}}\leq M\bigl\Vert \omega ^{h}\bigr\Vert _{L_{2h}}, $$

where M does not depend on h and \(\omega ^{h}\).

4 Numerical example

We consider the inverse problem

$$ \begin{cases} -\frac{\partial ^{2}u(t,x)}{\partial t^{2}}-\frac{\partial }{\partial x} ( (2+\cos x)\frac{\partial u(t,x)}{\partial x} ) +u(t,x)=f(t,x)+p(x), \\ \quad 0< x<\pi ,0<t<T, \\ f(t,x)=-\exp ( -t ) (\cos (x)-1)+ ( \exp ( -t ) +t ) ( 3\cos ( x ) +\cos ( 2x ) -1 ) , \\ u(0,x)=2(\cos (x)-1),\quad 0\leq x\leq \pi , \\ u(T,x)= ( \exp ( -T ) +T+1 ) (\cos (x)-1),\quad 0\leq x\leq \pi, \\ u(\lambda ,x)= ( \exp ( -\lambda ) +\lambda +1 ) (\cos (x)-1),\quad 0\leq x\leq \pi , \\ u(t,0)=u_{x}(t,\pi )=0,\quad 0\leq t\leq T, \lambda =\frac{4T}{7}\end{cases} $$
(4.1)

for the elliptic equation. It is easy to see that \(u(t,x)= ( \exp ( -t ) +t+1 ) (\cos (x)-1)\) and \(p(x)=3\cos ( x ) +\cos ( 2x ) -1\) are the exact solutions of (4.1).

For this example, we have the following auxiliary nonlocal boundary value problem for an unknown function \(v(t,x)\):

$$ \begin{cases} -\frac{d^{2}v(t,x)}{dt^{2}}-\frac{\partial }{\partial x} ( (2+\cos x)\frac{\partial v(t,x)}{\partial x} ) +v(t,x)=f(t,x), \quad 0< x<\pi , 0<t<T, \\ v(t,0)=v_{x}(t,\pi )=0,\quad 0\leq t\leq T, \\ v(0,x)-v(\lambda ,x)= ( 1-\exp ( -\lambda ) -\lambda ) (\cos (x)-1),\quad 0\leq x\leq \pi , \\ v(T,x)-v(\lambda ,x)= ( \exp ( -T ) -\exp ( -\lambda ) +T-\lambda ) (\cos (x)-1),\quad 0\leq x\leq \pi .\end{cases} $$
(4.2)

Consider the set \([ 0,T ] _{\tau }\times [ 0,\pi ] _{h}\) of grid points depending on the small parameters τ and h,

$$\begin{aligned}{} [0,T]_{\tau }\times [ 0,\pi ]_{h} =&\bigl\{ (t_{k},x_{n}):t_{k}=k \tau , k=1,\ldots ,N-1, N\tau =T, \\ &x_{n}=nh, n=1,\ldots ,M-1, Mh=\pi \bigr\} . \end{aligned}$$

We get difference schemes of the first order of accuracy in t and the second order of accuracy in x,

$$ \begin{cases} \frac{v_{n}^{k+1}-2v_{n}^{k}+v_{n}^{k-1}}{\tau ^{2}}+(2+\cos (x_{n}))\frac{v_{n+1}^{k}-2v_{n}^{k}+v_{n-1}^{k}}{h^{2}} -\sin (x_{n})\frac{v_{n+1}^{k}-v_{n-1}^{k}}{2h}-v_{n}^{k}=\theta _{n}^{k}, \\ \quad \theta _{n}^{k}=-f(t_{k},x_{n}),k=1,\ldots ,N-1, n=1,\ldots ,M-1, \\ v_{0}^{k}=0,\qquad v_{M}^{k}-v_{M-1}^{k}=0,\quad k=0,\ldots ,N, \\ v_{n}^{0}-v_{n}^{l}= ( 1-\exp ( -\lambda ) -\lambda ) (\cos (x_{n})-1),\quad n=0,\ldots ,M, \\ v_{n}^{N}-v_{n}^{l}= ( \exp ( -t_{N} ) -\exp ( -\lambda ) +t_{N}-\lambda ) (\cos (x_{n})-1), \\ \quad n=0,\ldots ,M,l= [ \frac{\lambda }{\tau } ]\end{cases} $$
(4.3)

for the approximate solutions of the nonlocal boundary value problem (4.2).

Now, it is easy to rewrite difference scheme (4.3) in the following matrix form:

$$ \begin{aligned} &A_{n}v_{n+1}+B_{n}v_{n}+C_{n}v_{n-1} =I_{N+1}\theta _{n},\quad n=1,\ldots ,M-1, \\ &v_{0} =\vec {0},\qquad v_{M}=v_{M-1}. \end{aligned} $$
(4.4)

Here, \(\theta _{n}\) is an \((N+1)\times 1\) column matrix, \(I_{N+1}\) is the \((N+1)\times (N+1)\) identity matrix, \(A_{n}\), \(B_{n}\), \(C_{n}\) are \((N+1)\times (N+1)\) square matrices

$$ A_{n}=\left [ \begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{}} 0 & 0 & 0 & \cdots & 0 & 0 & 0 \\ 0 & a_{n} & 0 & \cdots & 0 & 0 & 0 \\ 0 & 0 & a_{n} & \cdots & 0 & 0 & 0 \\ \vdots & \vdots & \vdots & \cdots & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & \cdots & a_{n} & 0 & 0 \\ 0 & 0 & 0 & \cdots & 0 & a_{n} & 0 \\ 0 & 0 & 0 & \cdots & 0 & 0 & 0\end{array} \right ] , $$
(4.5)
$$ B_{n}=\left [ \begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{}} 1 & 0 & 0 & 0 & \cdots & -1 & \cdots & 0 & 0 & 0 & 0 \\ d & b_{n} & d & 0 & \cdots & 0 & \cdots & 0 & 0 & 0 & 0 \\ 0 & d & b_{n} & d & \cdots & 0 & \cdots & 0 & 0 & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \cdots & \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & 0 & \cdots & 0 & \cdots & d & b_{n} & d & 0 \\ 0 & 0 & 0 & 0 & \cdots & 0 & \cdots & 0 & d & b_{n} & d \\ 0 & 0 & 0 & 0 & \cdots & -1 & \cdots & 0 & 0 & 0 & 1\end{array} \right ] , $$
$$ C_{n}=\left [ \begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{}} 0 & 0 & 0 & \cdots & 0 & 0 & 0 \\ 0 & c_{n} & 0 & \cdots & 0 & 0 & 0 \\ 0 & 0 & c_{n} & \cdots & 0 & 0 & 0 \\ \vdots & \vdots & \vdots & \cdots & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & \cdots & c_{n} & 0 & 0 \\ 0 & 0 & 0 & \cdots & 0 & c_{n} & 0 \\ 0 & 0 & 0 & \cdots & 0 & 0 & 0\end{array} \right ] , $$
(4.6)
$$ \begin{aligned} &a_{n} =\frac{2+\cos (x_{n})}{h^{2}}-\frac{\sin (x_{n})}{2h},\qquad b_{n}=- \frac{2}{\tau ^{2}}-\frac{2(2+\cos (x_{n}))}{h^{2}}-1, \\ &c_{n} =\frac{2+\cos (x_{n})}{h^{2}}+\frac{\sin (x_{n})}{2h},\qquad d= \frac{1}{\tau ^{2}}, \end{aligned} $$
(4.7)
$$ \begin{aligned} &\theta _{n} =\left [ \begin{array}{@{}c@{}} \theta _{n}^{0} \\ \vdots \\ \theta _{n}^{N}\end{array} \right ] , \\ &\theta _{n}^{k} =-f(t_{k},x_{n}),\quad k=1,\ldots ,N-1, n=1,\ldots ,M-1, \\ &\theta _{n}^{0} = \bigl( 1-\exp ( -\lambda ) -\lambda \bigr) \bigl(\cos (x_{n})-1\bigr), \\ &\theta _{n}^{N} = \bigl( \exp ( -t_{N} ) -\exp ( -\lambda ) +t_{N}-\lambda \bigr) \bigl(\cos (x_{n})-1\bigr), \quad n=1,\ldots ,M-1, \\ &v_{n-1}=\left [ \begin{array}{@{}c@{}} v_{n-1}^{0} \\ \vdots \\ v_{n-1}^{N}\end{array} \right ] ,\qquad v_{n}=\left [ \begin{array}{@{}c@{}} v_{n}^{0} \\ \vdots \\ v_{n}^{N}\end{array} \right ] ,\qquad v_{n+1}= \left [ \begin{array}{@{}c@{}} v_{n+1}^{0} \\ \vdots \\ v_{n+1}^{N}\end{array} \right ]. \end{aligned} $$

For numerical solving of this system equation, we use the modified Gauss elimination method [31]. Solution of (4.4) is presented by the formula

$$ v_{n}=\alpha _{n+1}v_{n+1}+\beta _{n+1}, \quad n=M-1, \ldots , 1, $$

where \(\alpha _{n}\) (\(n=1,\ldots ,M-1\)) are \((N+1)\times (N+1)\) square matrices and \(\beta _{n}\) (\(n=1,\ldots ,M-1\)) are \((N+1)\times 1\) column matrices. For \(\alpha _{n+1}\), \(\beta _{n+1}\), we have the following formulas:

$$\begin{aligned}& \alpha _{n+1} = -(B_{n}+C_{n}\alpha _{n})^{-1} A_{n}, \\& \beta _{n+1} = (B_{n}+C_{n}\alpha _{n})^{-1} (I_{N+1}\theta _{n}-C_{n} \beta _{n}), \quad n=1,\ldots ,M-1, \end{aligned}$$

where

$$\begin{aligned}& \alpha _{1} = 0_{(N+1)\times (N+1)},\qquad \beta _{1}=0_{(N+1)\times 1} \quad (v_{0}=\vec {0}), \\& \alpha _{M} = I_{N+1},\qquad \beta _{M}=0_{(N+1)\times 1} \quad (v_{M-1}=v_{M}). \end{aligned}$$

By using the second order of accuracy in x approximation of A, we get the following values of p in grid points:

$$\begin{aligned} p_{n} =&-\frac{(2+\cos (x_{n}))}{h^{2}}\bigl[\bigl(\varphi _{n+1}-v_{n+1}^{0}\bigr)-2\bigl(\varphi _{n}-v_{n}^{0}\bigr)+\bigl(\varphi _{n-1}-v_{n-1}^{0}\bigr)\bigr] \\ &{}+\frac{\sin (x_{n})}{2h}\bigl(\bigl(\varphi _{n+1}-v_{n+1}^{0} \bigr)-\bigl(\varphi _{n-1}-v_{n-1}^{0}\bigr) \bigr)+\bigl(\varphi _{n}-v_{n}^{0}\bigr), \\ &n =1,\ldots ,M-1. \end{aligned}$$
(4.8)

For the approximate solution of problem (4.1), we use the formula

$$ u_{n}^{k}=v_{n}^{k}+\varphi _{n}-v_{n}^{0},\quad n=0,\ldots ,M, k=0,\ldots ,N. $$

Now, we consider again nonlocal boundary value problem (4.2).

Applying (3.7), we get the second order of accuracy in t and xdifference scheme

$$ \begin{cases} \frac{v_{n}^{k+1}-2v_{n}^{k}+v_{n}^{k-1}}{\tau ^{2}}+(2+\cos (x_{n}))\frac{v_{n+1}^{k}-2v_{n}^{k}+v_{n-1}^{k}}{h^{2}} \\ \quad {}-\sin (x_{n})\frac{v_{n+1}^{k}-v_{n-1}^{k}}{2h}-v_{n}^{k}=\theta _{n}^{k}, \\ \quad \theta _{n}^{k}=-f(t_{k},x_{n}),k=1,\ldots ,N-1, n=1,\ldots ,M-1, \\ v_{0}^{k}=0, \qquad -3v_{M}^{k}+4v_{M-1}^{k}-v_{M-2}^{k}=0,\quad k=0,\ldots ,N, \\ 10v_{M}^{k}-15v_{M-1}^{k}+6v_{M-2}^{k}-v_{M-3}^{k}=0, \\ v_{n}^{0}+ ( \frac{\lambda }{\tau }-l-1 ) v_{n}^{l}- ( \frac{\lambda }{\tau }-l ) v_{n}^{l+1}= ( 1-\exp ( -\lambda ) -\lambda ) \cos (x_{n}), \\ \quad n=0,\ldots ,M, \\ v_{n}^{N}+ ( \frac{\lambda }{\tau }-l-1 ) v_{n}^{l}- ( \frac{\lambda }{\tau }-l ) v_{n}^{l+1} \\ \quad = ( \exp ( -t_{N} ) -\exp ( -\lambda ) +t_{N}-\lambda ) \cos (x_{n}), \quad n=0,\ldots ,M\end{cases} $$
(4.9)

for the approximate solution of nonlocal boundary value problem (4.2).

Therefore, we can rewrite difference scheme (4.9) in the matrix form

$$ \begin{aligned} &A_{n}v_{n+1}+B_{n}v_{n}+C_{n}v_{n-1} =I_{N+1}\theta _{n},\quad n=1,\ldots ,M-1, \\ &v_{0} =0, \qquad -3v_{M}+4v_{M-1}-v_{M-2}=0, \end{aligned} $$
(4.10)

where \(A_{n}\), \(C_{n}\) are defined by (4.5), (4.6), (4.7) and \(B_{n}\) is an \((N+1)\times (N+1)\) square matrix

$$\begin{aligned}& B_{n}=\left [ \begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{}} 1 & 0 & 0 & 0 & \cdots & 0 & y & z & 0 & \cdots & 0 & 0 & 0 & 0 \\ d & b_{n} & d & 0 & \cdots & 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 \\ 0 & d & b_{n} & d & \cdots & 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 \\ 0 & 0 & d & b_{n} & \cdots & 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 & \cdots & b_{n} & d & 0 & 0 \\ 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 & \cdots & d & b_{n} & d & 0 \\ 0 & 0 & 0 & 0 & \cdots & 0 & 0 & 0 & 0 & \cdots & 0 & d & b_{n} & d \\ 0 & 0 & 0 & 0 & \cdots & 0 & y & z & 0 & \cdots & 0 & 0 & 0 & 1\end{array} \right ] , \\& b_{n}=-\frac{2}{\tau ^{2}}-\frac{2(2+\cos (x_{n}))}{h^{2}}-1,\qquad d= \frac{1}{\tau ^{2}},\qquad y=\biggl(\frac{\lambda }{\tau }-l-1\biggr),\qquad z=-\biggl( \frac{\lambda }{\tau }-l\biggr). \end{aligned}$$

For solution of (4.10), we use the formula

$$ v_{n}=\alpha _{n}v_{n+1}+\beta _{n}v_{n+2}+ \gamma _{n},\quad n=M-2,\ldots ,0, $$

where \(\alpha _{n}\), \(\beta _{n}\) (\(n=0,\ldots ,M-2\)) are \((N+1)\times (N+1)\) square matrices and \(\gamma _{n}\) (\(n=0,\ldots ,M-2\)) are \((N+1)\times 1\) column matrices. For the coefficients \(\alpha _{n}\), \(\beta _{n}\), \(\gamma _{n}\), we get formulas

$$\begin{aligned}& \alpha _{n} = -(B_{n}+C_{n}\alpha _{n-1})^{-1}(A_{n}+C_{n}\beta _{n-1}), \\& \beta _{n} = 0, \\& \gamma _{n} = (B_{n}+C_{n}\alpha _{n-1})^{-1}(I_{N+1}\theta _{n}-C_{n} \gamma _{n-1}),\quad n=1,\ldots ,M-1. \end{aligned}$$

Here

$$\begin{aligned}& \alpha _{0} = 0,\qquad \beta _{0}=0,\qquad \gamma _{0}=0 \qquad (v_{0}=0), \\& \alpha _{1} = \frac{8}{5}I_{N+1},\qquad \beta _{1}=-\frac{3}{5}I_{N+1}, \\& \alpha _{M-2} = 4I_{N+1},\qquad \beta _{M-2}=-3I_{N+1}, \\& \alpha _{M-3} = \frac{8}{3}I_{N+1},\qquad \beta _{M-3}=-\frac{5}{3}I_{N+1}, \end{aligned}$$

and \(\gamma _{0}\), \(\gamma _{1}\), \(\gamma _{M-2}\), \(\gamma _{M-3} \) are the \((N+1)\times 1\) zero column vector. For \(v_{M}\) and \(v_{M-1}\), we have the following formulas:

$$\begin{aligned}& v_{M} = \bigl(Q_{11}-Q_{12}Q_{22}^{-1}Q_{21} \bigr)^{-1}\bigl(G_{1}-Q_{12}Q_{22}^{-1}G_{2} \bigr), \\& v_{M-1} = Q_{22}^{-1}(G_{2}-Q_{21}v_{M}), \end{aligned}$$

where

$$\begin{aligned}& Q_{11} = -3A_{M-2}-8B_{M-2}-8C_{M-2} \alpha _{M-3}-3C_{M-2}\beta _{M-3}, \\& Q_{12} = 4A_{M-2}+9B_{M-2}+9C_{M-2} \alpha _{M-3}+4C_{M-2}\beta _{M-3}, \\& Q_{21} = -3B_{M-1}-8C_{M-1}, \\& Q_{22} = A_{M-1}+4B_{M-1}+9C_{M-1}, \\& G_{1} = I_{N+1}\theta _{M-2}-C_{M-2} \gamma _{M-3}, \\& G_{2}=I_{N+1}\theta _{M-1}. \end{aligned}$$

Now, by using MATLAB programs, we present numerical results for this example (4.1). The numerical solutions are recorded for different values of N and M.

The numerical solutions are recorded for different values of \(N=M\) for \(T=2\). The grid function \(u_{n}^{k}\) represents the numerical solution of difference schemes for inverse problem at \((t_{k},x_{n})\), respectively. Grid function \(p_{n}\) represents the numerical solutions at \(x_{n}\) for unknown function p. For their comparison, the errors are computed by

$$\begin{aligned}& \mathrm{E}u_{M}^{N}=\max_{1\leq k\leq N-1}\Biggl( \sum_{n=1}^{M-1}\bigl\vert u(t_{k},x_{n})-u_{n}^{k}\bigr\vert ^{2}h\Biggr)^{\frac{1}{2}}, \\& \mathrm{E}p_{M}=\Biggl(\sum_{n=1}^{M-1} \bigl\vert p(x_{n})-p_{n}\bigr\vert ^{2}h \Biggr)^{\frac{1}{2}}. \end{aligned}$$

Tables 1 and 2 give the error analysis between the exact solution and solutions derived by difference schemes. Tables 1 and 2 are constructed for \(N=M=20, 40, 80, \mbox{and } 160\). Hence, the second order of accuracy difference scheme is more accurate comparing with the first order of accuracy difference scheme.

Table 1 Error analysis for p
Table 2 Error analysis for u

Table 1 is the error analysis between the exact solution p and solutions derived by difference schemes in the second stage of algorithm.

Table 2 presents the error analysis between the exact solution u and solutions derived by first order and second order accuracy of difference schemes.

5 Conclusion

In this paper, the inverse problem for a multidimensional elliptic equation with Dirichlet-Neumann conditions and overdetermination is considered. The first and second orders of accuracy difference schemes for approximate solution of this problem are presented. Theorems on the stability, almost coercive stability, and coercive stability inequalities for the solutions of difference schemes for inverse problem are proved. Numerical example in a two-dimensional case is given. As it can be seen from Tables 1 and 2, the second order of accuracy difference scheme is more accurate comparing with the first order of accuracy difference scheme.