1 Introduction

Let I be the interval \((-1,1)\) and the function \(J:L_2(I)\times L_2(I)\longrightarrow {\mathbb {R}}\) be defined by

$$\begin{aligned} J(y,u)=\frac{1}{2} \big [\Vert y-y_d\Vert _{L_2(I)}^2+\beta \Vert u\Vert _{L_2(I)}^2\big ], \end{aligned}$$
(1.1)

where \(y_d\in L_2(I)\) and \(\beta\) is a positive constant.

The optimal control problem is to

$$\begin{aligned} \text {find}\quad ({\bar{y}},{\bar{u}})={\mathop {\mathrm{argmin}}\limits _{(y,u)\in {\mathbb {K}}}}\,J(y,u), \end{aligned}$$
(1.2)

where \((y,u)\in H^2(I)\times L_2(I)\) belongs to \({\mathbb {K}}\) if and only if

$$\begin{aligned} -y''= & {} u+f \qquad \text {on }I, \end{aligned}$$
(1.3)
$$\begin{aligned} y'\le & {} \psi \qquad \qquad \text {on }I, \end{aligned}$$
(1.4)

together with the following boundary conditions for y:

$$\begin{aligned} y(-1)=y(1)&=0, \end{aligned}$$
(1.5a)

or

$$\begin{aligned} y(-1)=y'(1)&=0. \end{aligned}$$
(1.5b)

Remark 1.1

Throughout this paper we will follow standard notation for function spaces and norms that can be found, for example, in Ciarlet (1978), Brenner and Scott (2008) and Adams and Fournier (2003).

For the problem with the Dirichlet boundary conditions (1.5a), we assume that

$$\begin{aligned} f\in H^{\frac{1}{2}-\epsilon }(I), \;\psi \in H^{\frac{3}{2}-\epsilon }(I) \quad \forall \,\epsilon>0 \quad \text {and} \quad \int _I \psi \,dx>0. \end{aligned}$$
(1.6)

For the problem with the mixed boundary conditions (1.5b), we assume that

$$\begin{aligned} f\in H^1(I),\;\psi \in H^2(I) \quad \text {and} \quad \psi (1)\ge 0. \end{aligned}$$
(1.7)

Remark 1.2

In the case of Dirichlet boundary conditions, clearly we need \(\int _I\psi \,dx\ge 0\) since \(\int _I y' dx=0\) and \(y'\le \psi\). However \(\int _I \psi \,dx=0\) implies \(\int _I(y'-\psi )dx=0\), which together with \(y'\le \psi\) leads to \(y'=\psi\). Hence in this case \({\mathbb {K}}\) is a singleton and the optimal control problem becomes trivial.

The optimal control problem with the Dirichlet boundary conditions (1.5a) is a one dimensional analog of the optimal control problems considered in Casas and Bonnans (1988), Casas and Fernández (1993), Deckelnick et al. (2009), Ortner and Wollner (2011) and Wollner (2012) on smooth or convex domains. In Casas and Bonnans (1988) and Casas and Fernández (1993), first order optimality conditions were derived for a semilinear elliptic optimization problem with pointwise gradient constraints on smooth domains, where the solution of the state equation is in \(W^{1,\infty }\) for any feasible control. These results were extended to non-smooth domains in Wollner (2012). On the other hand higher dimensional analogs of the optimal control problem with the mixed boundary conditions (1.5b) are absent from the literature.

Finite element error analysis for the problem with the Dirichlet boundary conditions was first carried out in Deckelnick et al. (2009) by a mixed formulation of the elliptic equation and a variational discretization of the control, and in Ortner and Wollner (2011) by a standard \(H^1\)-conforming discretization with a possible non-variational control discretization.

The goal of this paper is to show that it is also possible to solve the one dimensional optimal control problem with either boundary conditions as a fourth order variational inequality for the state variable by a \(C^1\) finite element method. We note that such an approach has been carried out for elliptic distributed optimal control problems with pointwise state constraints in, for example, the papers (Liu et al. 2009; Brenner et al. 2013, 2014, 2016, 2018, 2018, 2019). The analysis in this paper extends the general framework in Brenner and Sung (2017) to the one dimensional problem defined by (1.1)–(1.5).

The rest of the paper is organized as follows. We collect information on the optimal control problem in Sect. 2. The construction and analysis of the discrete problem are treated in Sect. 3, followed by numerical results in Sect. 4. We end with some concluding remarks in Sect. 5. The appendices contain derivations of the Karush–Kuhn–Tucker conditions that appear in Sect. 2.

Throughout the paper we will use C (with or without subscript) to denote a generic positive constant independent of the mesh sizes.

2 The continuous problem

Let the space V be defined by

$$\begin{aligned} V=\{v\in H^2(I):\, v(-1)=v(1)=0\}\quad \text {for the boundary conditions }(1.5\hbox {a}), \end{aligned}$$
(2.1a)

and

$$\begin{aligned} V=\{v\in H^2(I):\,v(-1)=v'(1)=0\}\quad \text {for the boundary conditions }(1.5\hbox {b}). \end{aligned}$$
(2.1b)

The minimization problem defined by (1.1)–(1.5) can be reformulated as the following problem that only involves y:

$$\begin{aligned} \text {Find}\quad {\bar{y}}={\mathop {\mathrm{argmin}}\limits _{y\in K}}\frac{1}{2}\big [\Vert y-y_d\Vert _{L_2(I)}^2+\beta \Vert y''+f\Vert _{L_2(I)}^2\big ], \end{aligned}$$
(2.2)

where

$$\begin{aligned} K=\{y\in V:\,y'\le \psi \;\text {on}\;I\}. \end{aligned}$$
(2.3)

Note that the closed convex subset K of the Hilbert space V is nonempty for either boundary conditions. In the case of the Dirichlet boundary conditions, the function \(y(x)=\int _{-1}^ x (\psi (t)-\delta )dt\) belongs to K if we take \(\delta\) to be \(\frac{1}{2}\int _I\psi \,dx \,(>0)\). Similarly, in the case of the mixed boundary conditions, the function \(y(x)=\int _{-1}^x[\psi (t)-\delta \sin [(\pi /4)(1+t)]dt\) belongs to K if we take \(\delta\) to be \(\psi (1)\,(\ge 0)\).

According to the standard theory in Ekeland and Témam (1999), there is a unique solution \({\bar{y}}\) of (2.2)–(2.3) characterized by the fourth order variational inequality

$$\begin{aligned} \int _I ({\bar{y}}-y_d)(y-{\bar{y}})dx+ \beta \int _I ({\bar{y}}''+f)(y''-{\bar{y}}'')dx\ge 0 \quad \forall \,y\in K. \end{aligned}$$
(2.4)

We can express (2.4) in the form of

$$\begin{aligned} a({\bar{y}},y-{\bar{y}})\ge \int _I y_d(y-{\bar{y}})dx-\beta \int _I f(y''-{\bar{y}}'')dx \quad \forall \,y\in K, \end{aligned}$$
(2.5)

where

$$\begin{aligned} a(y,z)=\beta \int _I y''z''dx+\int _I yz\,dx. \end{aligned}$$
(2.6)

2.1 The Karush–Kuhn–Tucker conditions

The solution of (2.4) is characterized by the following conditions:

$$\begin{aligned} \int _I ({\bar{y}}-y_d)z\,dx+\beta \int _I ({\bar{y}}''+f)z''\,dx+\int _{[-1,1]} z'd\mu= & {} 0 \quad \forall \,z\in V, \end{aligned}$$
(2.7)
$$\begin{aligned} \int _{[-1,1]} ({\bar{y}}'-\psi )d\mu= & {} 0, \end{aligned}$$
(2.8)

where

$$\begin{aligned} \mu \text { is a nonnegative finite Borel measure on }[-1,1]. \end{aligned}$$
(2.9)

Note that (2.8) is equivalent to the statement that \(\mu\) is supported on the active set

$$\begin{aligned} {\mathscr {A}}=\{x\in [-1,1]:\,{\bar{y}}'(x)=\psi (x)\} \end{aligned}$$
(2.10)

for the derivative constraint (1.4).

We can also express (2.7) as

$$\begin{aligned} a({\bar{y}},z)-\int _I y_d z\,dx+\beta \int _I fz''dx=-\int _{[-1,1]}z'd\mu \quad \forall \,z\in V. \end{aligned}$$
(2.11)

The Karush–Kuhn–Tucker (KKT) conditions (2.7)–(2.9) can be derived from the general theory on Lagrange multipliers that can be found, for example, in Luenberger (1969) and Ito and Kunisch (2008). For the simple one dimensional problem here, they can also be derived directly (cf. “Appendix A” for the Dirichlet boundary conditions and “Appendix B” for the mixed boundary conditions).

Remark 2.1

In the case of the mixed boundary conditions, additional information on the structure of \(\mu\) [cf. (2.27)] is obtained in “Appendix B”.

2.2 Dirichlet boundary conditions

We will use (2.7) to obtain additional regularity for \({\bar{y}}\) that matches the regularity result in Ortner and Wollner (2011). The following lemmas are useful for this purpose.

Lemma 2.2

We have

$$\begin{aligned} \int _I fv'\,dx\le C_\epsilon |f|_{H^{\frac{1}{2}-\epsilon }(I)} |v|_{H^{\frac{1}{2}+\epsilon }(I)}\quad \forall \,v\in H^1(I) \ \text {and}\ \epsilon \in (0,1/2). \end{aligned}$$
(2.12)

Proof

Observe that

$$\begin{aligned} \int _I gv'dx\le & {} \Vert g\Vert _{L_2(I)}|v|_{H^1(I)}\quad \forall \,v\in H^1(I) \end{aligned}$$
(2.13)

if \(g\in L_2(I)\), and

$$\begin{aligned} \int _I gv'dx\le & {} |g|_{H^1(I)}\Vert v\Vert _{L_2(I)}\quad \forall \,v\in H^1(I) \end{aligned}$$
(2.14)

if \(g\in H^1_0(I)\).

Recall that \(f\in H^{\frac{1}{2}-\epsilon }(I)\) by the assumption in (1.6). The estimate (2.12) follows from (2.13), (2.14) and bilinear interpolation (cf. Bergh and Löfström 1976, Theorem 4.4.1), together with the following interpolations of Sobolev spaces (cf. Lions and Magenes 1972, Sections 1.9 and 1.11):

$$\begin{aligned} {[}L_2(I),H^1_0(I)]_{\frac{1}{2}-\epsilon }&=H^{\frac{1}{2}-\epsilon }_0(I)=H^{\frac{1}{2}-\epsilon }(I) \quad \text {and}\\ {[}H^1(I),L_2(I)]_{\frac{1}{2}-\epsilon }&=H^{\frac{1}{2}+\epsilon }(I). \end{aligned}$$

\(\square\)

Note that the map \(z\rightarrow z''\) is an isomorphism between V [given by (2.1a)] and \(L_2(I)\). Therefore, by the Riesz representation theorem, for any \(\ell \in V'\) we can define \(p\in L_2(I)\) by

$$\begin{aligned} \int _I pz''\,dx=\ell (z) \quad \forall \,z\in V. \end{aligned}$$
(2.15)

Lemma 2.3

Given any \(s\in [0,1]\), the function p defined by (2.15) belongs to \(H^{1-s}(I)\) provided that

$$\begin{aligned} \ell (z)\le C|z|_{H^{1+s}(I)} \quad \forall \,z\in H^{1+s}(I). \end{aligned}$$
(2.16)

Proof

On one hand, if \(\ell \in (H^2(I))'\), we have

$$\begin{aligned} \Vert p\Vert _{L_2(I)}\le \Vert \ell \Vert _{(H^2(I))'}. \end{aligned}$$
(2.17)

On the other hand, if \(\ell \in (H^1(I))'\), then the solution p of (2.15) can also be defined by the conditions that \(p\in H^1_0(I)\) and

$$\begin{aligned} \int _I p'q'dx=-\ell (q)\quad \forall \,q\in H^1_0(I). \end{aligned}$$

Hence in this case we have

$$\begin{aligned} |p|_{H^1(I)}\le \Vert \ell \Vert _{(H^1(I))'}. \end{aligned}$$
(2.18)

The estimate (2.16) follows from (2.17), (2.18) and the following interpolations of Sobolev spaces (cf. Lions and Magenes 1972, Sections 1.6 and 1.9):

$$\begin{aligned}{}[L_2(I),H^1(I)]_{1-s}&=H^{1-s}(I) \end{aligned}$$

and

$$\begin{aligned}{}[(H^2(I))',(H^1(I))']_{1-s}&=([H^1(I),H^2(I)]_s)' =(H^{1+s}(I))'. \end{aligned}$$

\(\square\)

Theorem 2.4

The solution \({\bar{y}}\) of (2.4) belongs to \(H^{\frac{5}{2}-\epsilon }(I)\) for all \(\epsilon \in (0,1/2)\).

Proof

Note that, by the Sobolev inequality (Adams and Fournier 2003),

$$\begin{aligned} \int _I v\,d\mu \le C_\epsilon |v|_{H^{\frac{1}{2}+\epsilon }(I)}\quad \forall \,v\in H^1(I) \ \text {and}\ \epsilon \in (0,1/2). \end{aligned}$$
(2.19)

Let \(p\in L_2(I)\) be defined by

$$\begin{aligned} \beta \int _I pz''\,dx=\int _I (y_d-{\bar{y}})z\,dx-\beta \int _I fz''\,dx-\int _{[-1,1]} z'd\mu \quad \forall \,z\in V, \end{aligned}$$
(2.20)

where V is given by (2.1a). It follows from (2.12), (2.19), (2.20) and Lemma 2.3 (with \(s=\frac{1}{2}+\epsilon\)) that

$$\begin{aligned} p\text { belongs to }H^{\frac{1}{2}-\epsilon }(I)\text { for all } \epsilon \in (0,1/2). \end{aligned}$$
(2.21)

Comparing (2.7) and (2.20), we see that

$$\begin{aligned} \int _I {\bar{y}}'' z''dx=\int _I pz''\,dx\quad \forall \,z\in V \end{aligned}$$

and hence \({\bar{y}}''=p\), which together with (2.21) concludes the proof. \(\square\)

Corollary 2.5

We have \({\bar{u}}=-{\bar{y}}''-f\in H^{\frac{1}{2}-\epsilon }(I)\) for all \(\epsilon \in (0,1/2)\).

Example 2.6

We take \(\beta =\psi =1\) and the exact solution

$$\begin{aligned} {\bar{y}}(x)={\left\{ \begin{array}{ll} -\frac{1}{2}(x+1)+\frac{1}{2}(x+1)^3+\frac{1}{12}(1-x^2)^3&{}\quad -1< x\le 0\\ -\frac{1}{2}(x-1)+\frac{1}{2}(x-1)^3+\frac{1}{12}(1-x^2)^3&{}\quad 0\le x<1 \end{array}\right. }. \end{aligned}$$
(2.22)

It follows from a direct calculation that

$$\begin{aligned} {\bar{y}}'(x)={\left\{ \begin{array}{ll} -\frac{1}{2}+\frac{3}{2}(x+1)^2-\frac{1}{2}x(1-x^2)^2&{}\quad -1< x\le 0\\ -\frac{1}{2}+\frac{3}{2}(x-1)^2-\frac{1}{2}x(1-x^2)^2&{}\quad 0\le x<1 \end{array}\right. }, \end{aligned}$$

and

$$\begin{aligned} {\bar{y}}''(x)={\left\{ \begin{array}{ll} 3(x+1)-\frac{1}{2}(1-6x^2+5x^4)&{}\qquad -1< x< 0\\ 3(x-1)-\frac{1}{2}(1-6x^2+5x^4)&{}\qquad 0< x<1 \end{array}\right. }. \end{aligned}$$

It is straightforward to check that \({\bar{y}}\) belongs to K, \({\mathscr {A}}=\{0\}\), and for \(z\in V\),

$$\begin{aligned} \int _I {\bar{y}}''z''dx&=\int _{-1}^0 3(x+1)z''dx+\int _0^1 3(x-1)z''dx -\frac{1}{2}\int _I(1-6x^2+5x^4)z''dx\\&=6z'(0)+\int _I gz\,dx,\nonumber \end{aligned}$$
(2.23)

where

$$\begin{aligned} g(x)=6(1-5x^2). \end{aligned}$$

Now we take

$$\begin{aligned} f(x)={\left\{ \begin{array}{ll} 7(x^2-1) &{}\quad -1<x<0\\ 0&{}\hspace{22pt} 0<x<1 \end{array}\right. } \end{aligned}$$

so that \(f\in H^{\frac{1}{2}-\epsilon }(I)\) for all \(\epsilon >0\) and

$$\begin{aligned} \int _I fz''dx=7\int _{-1}^0 (x^2-1)z''dx =-7z'(0)+14\int _{-1}^0 z\,dx\quad \forall \,z\in V. \end{aligned}$$
(2.24)

Putting (2.23) and (2.24) together we have

$$\begin{aligned} -\int _I (14\chi _{(-1,0)}+g)z\,dx+ \int _I ({\bar{y}}''+f)z''dx+z'(0)=0 \quad \forall \,z\in V, \end{aligned}$$
(2.25)

where

$$\begin{aligned} \chi _S(x)={\left\{ \begin{array}{ll} 1&{}\quad \text {if }x\in S\\ 0&{}\quad \text {if }x\notin S \end{array}\right. } \end{aligned}$$

is the characteristic function of the set S, and the KKT conditions (2.7)–(2.9) are satisfied (with \(\mu\) being the Dirac point measure at the origin) if we choose

$$\begin{aligned} y_d={\bar{y}}+14\chi _{(-1,0)}+g, \end{aligned}$$
(2.26)

Remark 2.7

It follows from Example 2.6 that the regularities of \({\bar{y}}\) and \({\bar{u}}\) stated in Theorem 2.4 and Corollary 2.5 are sharp under the assumptions on the data in (1.6).

2.3 Mixed boundary conditions

In this case the nonnegative Borel measure \(\mu\) on \([-1,1]\) satisfies [cf. (B.8)–(B.10)]

$$\begin{aligned} d\mu = \beta [\rho \,dx+\gamma d\delta _{-1}], \end{aligned}$$
(2.27)

where \(\rho \in L_2(I)\) is nonnegative, \(\gamma\) is a nonnegative number and \(\delta _{-1}\) is the Dirac point measure at \(-1\).

Theorem 2.8

The solution \({\bar{y}}\) of (2.4) belongs to \(H^3(I)\).

Proof

Recall that \(f\in H^1(I)\) by the assumption in (1.7). After substituting (2.27) into (2.7) and carrying out integration by parts, we have

$$\begin{aligned} \beta \int _I {\bar{y}}''z''\,dx= & {} \int _I (y_d-{\bar{y}}) z\,dx+\beta \int _I (f'-\rho )z'dx\nonumber \\&+\,\beta [f(-1)-\gamma ]z'(-1)\quad \forall \,z\in V, \end{aligned}$$
(2.28)

where V is given by (2.1b).

Let \(H^1(I;1)=\{v\in H^1(I):\,v(1)=0\}\) and \(p\in H^1(I;1)\) be defined by

$$\begin{aligned} \int _I p'q'dx= & {} -\int _I \Phi q\,dx+\int _I (f'-\rho )qdx\nonumber \\&+\,[f(-1)-\gamma ]q(-1) \quad \forall \,q\in H^1(I;1), \end{aligned}$$
(2.29)

where \(\Phi \in H^1(I;1)\) is defined by

$$\begin{aligned} \beta \Phi '=y_d-{\bar{y}}. \end{aligned}$$
(2.30)

Note that (2.29) is the weak form of the two-point boundary value problem

$$\begin{aligned} -p''=-\Phi +f'-\rho \quad \text {in }I\quad \text {and}\quad p'(-1)=\gamma -f(-1),\;p(1)=0, \end{aligned}$$

and hence we can conclude from elliptic regularity that

$$\begin{aligned} p\in H^2(I). \end{aligned}$$
(2.31)

Finally (2.28)–(2.30) imply

$$\begin{aligned} \int _I {\bar{y}}''z''dx=\int _I p'z''\,dx\quad \forall \,z\in V \end{aligned}$$

and hence \({\bar{y}}''=p'\) because the map \(z\rightarrow z''\) is also an isomorphism between V (defined by (1.5b)) and \(L_2(I)\). The theorem then follows from (2.31). \(\square\)

Corollary 2.9

We have \({\bar{u}}=-{\bar{y}}''-f\in H^1(I)\).

Example 2.10

We take \(\beta =\psi =1\), \(f=0\) and the exact solution is given by

$$\begin{aligned} {\bar{y}}(x)=\int _{-1}^x p(t)dt, \end{aligned}$$
(2.32)

where

$$\begin{aligned} p(x)={\left\{ \begin{array}{ll} 1&{}\quad -1< x\le \frac{1}{3}\\ \sin \big [\frac{\pi }{4}(9x-1)\big ]&{} \hspace{20pt}\frac{1}{3}\le x< 1 \end{array}\right. }. \end{aligned}$$
(2.33)

We have \({\mathscr {A}}=[-1,1/3]\), \(p\in H^2(I)\),

$$\begin{aligned} p_+''(1/3)=-({9\pi }/4)^2 \quad \text {and}\quad p(1)=p''(1)=0. \end{aligned}$$
(2.34)

If we choose the function \(\Phi\) by

$$\begin{aligned} \Phi (x)={\left\{ \begin{array}{ll} -({9\pi }/4)^2 &{}\quad -1\le x\le \frac{1}{3}\\ p''(x)&{} \hspace{20pt}\frac{1}{3}\le x\le 1 \end{array}\right. }, \end{aligned}$$
(2.35)

then \(\Phi \in H^1(I;1)\) by (2.34) and (2.35), and

$$\begin{aligned} \int _I p'q'dx= -\int _I \Phi q\,dx-\int _{-1}^\frac{1}{3} ({9\pi }/4)^2q\,dx \quad \forall \,q\in H^1(I;1). \end{aligned}$$
(2.36)

Therefore (2.29) is valid if we take

$$\begin{aligned} \rho = ({9\pi }/4)^2\chi _{[-1,1/3]} \quad \text {and} \quad \gamma =0. \end{aligned}$$
(2.37)

Finally we define \(y_d\) according to (2.30) so that

$$\begin{aligned} y_d(x)={\left\{ \begin{array}{ll} {\bar{y}}(x)&{}\quad -1<x<\frac{1}{3}\\ {\bar{y}}(x)+p'''(x)&{}\hspace{20pt} \frac{1}{3}< x< 1 \end{array}\right. }. \end{aligned}$$
(2.38)

Putting (2.32) and (2.36)–(2.38) together, we see that the KKT conditions (2.7)–(2.9) are valid provided we define the Borel measure \(\mu\) by

$$\begin{aligned} d\mu =({9\pi }/4)^2\chi _{[-1,1/3]}dx. \end{aligned}$$

3 The discrete problem

Let \({\mathcal {T}}_h\) be a quasi-uniform partition of I and \(V_h\subset V\) be the cubic Hermite finite element space (Ciarlet 1978) associated with \({\mathcal {T}}_h\). The discrete problem is to

$$\begin{aligned} \text {find}\quad {\bar{y}}_h={\mathop {\mathrm{argmin}}\limits _{y_h\in K_h}}\frac{1}{2} \big [\Vert y_h-y_d\Vert _{L_2(I)}^2+\beta \Vert y_h''+f\Vert _{L_2(I)}^2\big ], \end{aligned}$$
(3.1)

where

$$\begin{aligned} K_h=\{y\in V_h:\; P_hy'\le P_h\psi \ \text {on }[-1,1]\}, \end{aligned}$$
(3.2)

and \(P_h\) is the nodal interpolation operator for the \(P_1\) finite element space (Ciarlet 1978; Brenner and Scott 2008) associated with \({\mathcal {T}}_h\). In other words the derivative constraint (1.4) is only imposed at the grid points.

The nodal interpolation operator from \(C^1({\bar{I}})\) onto \(V_h\) will be denoted by \(\Pi _h\). Note that

$$\begin{aligned} \Pi _h y\in K_h \quad \forall \,y\in K. \end{aligned}$$
(3.3)

In particular, the closed convex set \(K_h\) is nonempty.

The minimization problem (3.1)–(3.2) has a unique solution characterized by the discrete variational inequality

$$\begin{aligned} \int _I ({\bar{y}}_h-y_d)(y_h-{\bar{y}}_h)dx+ \beta \int _I ({\bar{y}}_h''+f)(y_h''-{\bar{y}}_h'')dx\ge 0 \quad \forall \,y_h\in K_h, \end{aligned}$$

which can also be written as

$$\begin{aligned} a({\bar{y}}_h,y_h-{\bar{y}}_h)\ge \int _I y_d(y_h-{\bar{y}}_h)dx- \beta \int _I f(y_h''-{\bar{y}}_h'')dx \quad \forall \,y_h\in K_h. \end{aligned}$$
(3.4)

We begin the error analysis by recalling some properties of \(P_h\) and \(\Pi _h\).

For \(0\le s\le 1\le t\le 2\), we have an error estimate

$$\begin{aligned} \Vert \zeta -P_h\zeta \Vert _{H^s(I)}\le Ch^{t-s}|\zeta |_{H^t(I)} \quad \forall \,\zeta \in H^t(I) \end{aligned}$$
(3.5)

that follows from standard error estimates for \(P_h\) (cf. Ciarlet 1978; Brenner and Scott 2008) and interpolation between Sobolev spaces (Adams and Fournier 2003).

For \(0\le s\le 1\) and \(2\le t\le 4\), we also have the estimates

$$\begin{aligned} \Vert \zeta -\Pi _h\zeta \Vert _{L_2(I)}+h^2|\zeta -\Pi _h\zeta |_{H^2(I)}\le & {} C h^t|\zeta |_{H^t(I)} \quad \forall \,\zeta \in H^s(I), \end{aligned}$$
(3.6)
$$\begin{aligned} |\zeta -\Pi _h\zeta |_{H^{1+s}(I)}\le & {} C h^{t-s-1} |\zeta |_{H^t(I)} \quad \forall \,\zeta \in H^s(I), \end{aligned}$$
(3.7)

that follow from standard error estimates for \(\Pi _h\) (cf. Ciarlet 1978; Brenner and Scott 2008) and interpolation between Sobolev spaces.

3.1 An intermediate error estimate

Let the energy norm \(\Vert \cdot \Vert _a\) be defined by

$$\begin{aligned} \Vert v\Vert _a^2=a(v,v)=\Vert v\Vert _{L_2(I)}^2+\beta |v|_{H^2(I)}^2. \end{aligned}$$
(3.8)

We have, by a Poincaré−Friedrichs inequality (Nečas 2012),

$$\begin{aligned} C_1\Vert v\Vert _a\le \Vert v\Vert _{H^2(I)}\le C_2\Vert v\Vert _a \quad \forall \,v\in V. \end{aligned}$$
(3.9)

Observe that (3.4), (3.8) and the Cauchy–Schwarz inequality imply

$$\begin{aligned} \Vert {\bar{y}}-{\bar{y}}_h\Vert _a^2&=a({\bar{y}}-{\bar{y}}_h,{\bar{y}}-y_h)+ a({\bar{y}}-{\bar{y}}_h,y_h-{\bar{y}}_h)\nonumber \\&\le \frac{1}{2}\Vert {\bar{y}}-{\bar{y}}_h\Vert _a^2+\frac{1}{2}\Vert {\bar{y}}-y_h\Vert _a^2+a({\bar{y}},y_h-{\bar{y}}_h)\\&\quad -\int _I y_d(y_h-{\bar{y}}_h)dx+ \beta \int _I f(y_h''-{\bar{y}}_h'')dx\quad \forall \,y_h\in K_h,\nonumber \end{aligned}$$
(3.10)

and we have, by (2.8)–(2.11) and (3.2),

$$\begin{aligned}&a({\bar{y}},y_h-{\bar{y}}_h)-\int _I y_d(y_h-{\bar{y}}_h)dx+ \beta \int _I f(y_h''-{\bar{y}}_h'')dx\nonumber \\&\quad =\int _{[-1,1]} ({\bar{y}}_h'-y_h')d\mu \nonumber \\&\quad =\int _{[-1,1]} ({\bar{y}}_h'-P_h{\bar{y}}_h')d\mu + \int _{[-1,1]} (P_h{\bar{y}}_h'-P_h\psi )d\mu +\int _{[-1,1]} (P_h\psi -\psi )d\mu \\&\qquad +\int _{[-1,1]} (\psi -{\bar{y}}')d\mu + \int _{[-1,1]} ({\bar{y}}'-y_h')d\mu ,\nonumber \\&\quad \le \int _{[-1,1]} ({\bar{y}}_h'-P_h{\bar{y}}_h')d\mu +\int _{[-1,1]} (P_h\psi -\psi )d\mu +\int _{[-1,1]} ({\bar{y}}'-y_h')d\mu \nonumber \end{aligned}$$
(3.11)

for all \(y_h\in K_h\).

It follows from (3.10) and (3.11) that

$$\begin{aligned} \Vert {\bar{y}}-{\bar{y}}_h\Vert _a^2&\le 2\left[ \int _{[-1,1]} ({\bar{y}}_h'-P_h{\bar{y}}_h')d\mu +\int _{[-1,1]}(P_h\psi -\psi )d\mu \right] \nonumber \\&\quad +\inf _{y_h\in K_h}\left( \Vert {\bar{y}}-y_h\Vert _a^2+ 2\int _{[-1,1]} ({\bar{y}}'-y_h')d\mu \right) . \end{aligned}$$
(3.12)

3.2 Dirichlet boundary conditions

The following estimates will allow us to produce concrete error estimates from (3.12). First of all, we have

$$\begin{aligned} \int _{[-1,1]} ({\bar{y}}_h'-P_h{\bar{y}}_h')d\mu&=\int _{[-1,1]} \big [({\bar{y}}_h'-{\bar{y}}')-P_h({\bar{y}}_h'-{\bar{y}}')\big ]d\mu + \int _{[-1,1]} ({\bar{y}}'-P_h{\bar{y}}')d\mu \nonumber \\&\le C_\epsilon \Big ( h^{\frac{1}{2}-\epsilon }\Vert {\bar{y}}-{\bar{y}}_h\Vert _a +h^{1-\epsilon }|y|_{H^{\frac{5}{2}-\epsilon }(I)}\Big )\quad \forall \,\epsilon >0 \end{aligned}$$
(3.13)

by (2.19), Theorem 2.4, (3.5) and (3.9); secondly

$$\begin{aligned} \int _{[-1,1]} (P_h\psi -\psi )d\mu \le C_\epsilon h^{1-\epsilon } |\psi |_{H^{\frac{3}{2}-\epsilon }(I)} \quad \forall \epsilon >0 \end{aligned}$$
(3.14)

by the assumption on \(\psi\) in (1.6) and (3.5). Finally, in view of Theorem 2.4, (2.19), (3.6)–(3.7) and (3.9), we also have

$$\begin{aligned} \Vert {\bar{y}}-\Pi _h {\bar{y}}\Vert _a^2+2\int _{[-1,1]} \big [{\bar{y}}'-(\Pi _h{\bar{y}})'\big ]d\mu \le C_\epsilon h^{1-\epsilon } \quad \forall \,\epsilon >0. \end{aligned}$$
(3.15)

Putting (3.3), (3.12)–(3.15) and Young’s inequality together, we arrive at the estimate

$$\begin{aligned} \Vert {\bar{y}}-{\bar{y}}_h\Vert _a\le C_\epsilon h^{\frac{1}{2}-\epsilon } \end{aligned}$$
(3.16)

that is valid for any \(\epsilon >0\), which in turn implies the following result, where \({\bar{u}}_h=-{\bar{y}}_h''-f\) is the approximation for \({\bar{u}}=-{\bar{y}}''-f\).

Theorem 3.1

Under the assumptions on the data in (1.6), we have

$$\begin{aligned} |{\bar{y}}-{\bar{y}}_h|_{H^1(I)}+\Vert {\bar{u}}-{\bar{u}}_h\Vert _{L_2(I)}\le C_\epsilon h^{\frac{1}{2}-\epsilon } \quad \forall \,\epsilon >0. \end{aligned}$$

Remark 3.2

Numerical results in Sect. 4 indicate that \(|{\bar{y}}-{\bar{y}}_h|_{H^1(I)}\) is of higher order.

3.3 Mixed boundary conditions

In this case we have

$$\begin{aligned} \int _{[-1,1]} ({\bar{y}}_h'-P_h{\bar{y}}_h')d\mu&=\beta \left[ \int _I ({\bar{y}}_h'-P_h{\bar{y}}_h')\rho \,dx+ \gamma ({\bar{y}}_h'-P_h{\bar{y}}_h')(-1)\right] \nonumber \\&=\beta \left[ \int _I \big [({\bar{y}}_h'-{\bar{y}}')-P_h({\bar{y}}_h'-{\bar{y}}')\right] \rho \,dx+ \int _I ({\bar{y}}'-P_h{\bar{y}}')\rho \,dx\Big ]\nonumber \\&\le C \Big ( h\Vert {\bar{y}}-{\bar{y}}_h\Vert _a +h^2|{\bar{y}}|_{H^3(I)}\Big ) \end{aligned}$$
(3.17)

by (2.27), Theorem 2.8, (3.5) and (3.9);

$$\begin{aligned} \int _{[-1,1]} (P_h\psi -\psi )d\mu&=\beta \int _I (P_h\psi -\psi )\rho dx\le Ch^2 \end{aligned}$$
(3.18)

by the assumption on \(\psi\) in (1.7), (2.27) and (3.5); and

$$\begin{aligned} \Vert {\bar{y}}-\Pi _h {\bar{y}}\Vert _a^2+2\int _{[-1,1]} \big [{\bar{y}}'-(\Pi _h{\bar{y}})'\big ]d\mu \le Ch^2 \end{aligned}$$
(3.19)

by (2.27), Theorem 2.8, (3.6), (3.7) and (3.9).

Combining (3.12) and (3.17)–(3.19) with Young’s inequality, we find

$$\begin{aligned} \Vert {\bar{y}}-{\bar{y}}_h\Vert _a\le Ch, \end{aligned}$$
(3.20)

which immediately implies the following result, where \({\bar{u}}_h=-{\bar{y}}_h''-f\) is the approximation for \({\bar{u}}=-{\bar{y}}''-f\).

Theorem 3.3

Under the assumptions on the data in (1.7), we have

$$\begin{aligned} |{\bar{y}}-{\bar{y}}_h|_{H^1(I)}+\Vert {\bar{u}}-{\bar{u}}_h\Vert _{L_2(I)}\le Ch. \end{aligned}$$

Remark 3.4

Numerical results in Sect. 4 again indicate that \(|{\bar{y}}-{\bar{y}}_h|_{H^1(I)}\) is of higher order.

4 Numerical results

In the first experiment, we solved the problem in Example 2.6 on a uniform mesh with dyadic grid points. The errors of \({\bar{y}}_h\) in various norms are reported in Table 1. We observed \(O(h^2)\) convergence in \(|\cdot |_{H^2(I)}\) and higher convergence in the lower order norms. This phenomenon can be justified as follows.

Note that for this example the first term on the right-hand side of (3.12) vanishes because \(\mu\) is supported at the origin which is one of the grid points where \({\bar{y}}_h\) (resp. \(\psi\)) and \(P_h{\bar{y}}_h\) (resp., \(P_h\psi\)) assume identical values. The remaining term on the right-hand side of (3.12) is bounded by

$$\begin{aligned} \Vert {\bar{y}}-(\Pi _h{\bar{y}})\Vert _a^2+2\int _I\big [{\bar{y}}'-(\Pi _h{\bar{y}})'\big ]d\mu = \Vert {\bar{y}}-(\Pi _h{\bar{y}})\Vert _a^2\le Ch^4, \end{aligned}$$

where we have used the estimate (3.6), with I replaced by the intervals \((-1,0)\) and (0, 1), the norm equivalence (3.9), and the fact that \({\bar{y}}\) defined by (2.22) is a sextic polynomial on each of these intervals.

Table 1 Numerical results for Example 2.6 on meshes with dyadic grid points

In the second experiment we solved the problem in Example 2.6 on slightly perturbed meshes where the origin is no longer a grid point. The errors are reported in Table 2. We observed \(O(h^{0.5})\) convergence in the \(|\cdot |_{H^2(I)}\) (which agrees with Theorem 3.1) and O(h) convergence in the lower order norms.

Table 2 Numerical results for Example 2.6 on meshes where 0 is not a grid point

In the third experiment, we solved the problem in Example 2.10 on a uniform mesh with dyadic grid points. We observed O(h) convergence in \(|\cdot |_{H^2(I)}\) from the results in Table 3 (which agrees with Theorem 3.3) and \(O(h^2)\) convergence in the lower order norms.

Table 3 Numerical results for Example 2.10 on meshes with dyadic grid points

In the final experiment, we solved the problem in Example 2.10 by a uniform mesh that includes 1/3 as a grid point. The errors are reported in Table 4. We observed similar convergence behavior as the dyadic case, but the magnitude of the errors is smaller. This can be justified by the observation that the term [cf. (3.17)]

$$\begin{aligned} \int _I ({\bar{y}}-P_h{\bar{y}}')\rho \,dx=\int _0^\frac{1}{3} ({\bar{y}}-P_h{\bar{y}}')\rho \,dx=0 \end{aligned}$$

because \({\bar{y}}(x)=1+x\) on the active set \({\mathscr {A}}=[-1,1/3]\) and 1/3 is a grid point. On the other hand the corresponding integral is nonzero for dyadic meshes.

Table 4 Numerical results for Example 2.10 on uniform meshes where 1/3 is a grid point

5 Concluding remarks

We have demonstrated in this paper that the convergence analysis developed in Brenner and Sung (2017) can be adopted to elliptic distributed optimal control problems with pointwise constraints on the derivatives of the state, at least in a simple one dimensional setting.

The results in this paper can be extended to two-sided constraints of the form \(\psi _1\le y'\le \psi _2,\) where \(\psi _i\) and \(\psi _2\) are sufficiently regular and \(\psi _1<0<\psi _2\) on I. In particular, they are valid for the constraints defined by \(|y'|\le 1\).

It would be interesting to find out if the results in this paper can be extended to higher dimensions. We note that the higher dimensional analogs of the variational inequality for the derivative [cf. (B.5)] lead to obstacle problems for the vector Laplacian. Such obstacle problems are of independent interest and appear to be open.