1 Introduction

Let \({\mathbb {K}}\) be the field \({\mathbb {R}}\) of real numbers or the field \({\mathbb {C}}\) of complex numbers and A a linear space over \({\mathbb {K}}.\)

Definition 1

A function \(\rho _{A}:A\rightarrow [0,\infty ]\) is called a gauge on A if:

  1. (i)

    \(\rho _A(x)=0\) if and only if \(x=0\);

  2. (ii)

    \(\rho _A(\lambda x)=|\lambda |\rho _A(x)\) for all \(x\in A,\)\(\lambda \in {\mathbb {K}},\)\(\lambda \ne 0.\)

Let AB be linear spaces over \({\mathbb {K}}\), \(\rho _A,\rho _B\) gauges on A and B and \(L:A\rightarrow B\) a linear operator. We denote by \({{\,\mathrm{\mathrm{ker}\,}\,}}{L}\) and R(L) the kernel and the range of L, respectively.

Definition 2

We say that L is Ulam stable if there exists \(K\ge 0\) such that for every \(\varepsilon >0\) with \(\rho _B(Lx)\le \varepsilon \) there exists \(z\in {{\,\mathrm{\mathrm{ker}\,}\,}}{L}\) with the property \(\rho _A(x-z)\le K\varepsilon .\)

The Ulam stability of the operator L is equivalent with the stability of the associated equation \(Lx=y,\)\(y\in R(L).\) In fact, the problem of Ulam stability of an equation answers the next question (cf, e.g., [17]): When is it true that the solution of an equation differing slightly from a given one, must of necessity be close to the solution of the given equation?

The number K from Definition 2 is called an Ulam constant of L. The infimum of all Ulam constants of L will be denoted in what follows by \(K_L\). In general \(K_L\) is not an Ulam constant of L, but if it is, it is called the best Ulam constant of L, or simply the Ulam constant of L. For more details on Ulam stability with respect to gauges and on the best Ulam constant of linear operators we refer the reader to [1, 2, 14]. A characterization of Ulam stable operators acting on normed spaces and a representation of their best Ulam constant was given in the papers [3, 15]. Popa and Rasa obtained some results on Ulam stability of some classical operators in approximation theory and their Ulam constants [11,12,13]. For more information on Ulam stability we refer the reader to [1, 4, 17].

Throughout this paper we denote by \((X,\Vert \cdot \Vert )\) a Banach space over the field \({\mathbb {C}}\). By \({\mathcal {C}}^{n}({\mathbb {R}}, X)\) we denote the linear space of all n times differentiable functions with continuous nth derivatives, defined on \({\mathbb {R}}\) with values in X. \({\mathcal {C}}^{0}({\mathbb {R}}, X)\) will be denoted as usual by \({\mathcal {C}}({\mathbb {R}}, X).\) For \(f\in {\mathcal {C}}^{n}({\mathbb {R}}, X)\) define

$$\begin{aligned} \Vert f\Vert _{\infty }=\sup \{\Vert f(t)\Vert :t\in {\mathbb {R}}\}. \end{aligned}$$
(1)

Then \(\Vert f\Vert _{\infty }\) is a gauge on \({\mathcal {C}}^{n}({\mathbb {R}}, X)\). We suppose that \({\mathcal {C}}^{n}({\mathbb {R}}, X)\) and \({\mathcal {C}}({\mathbb {R}}, X)\) are endowed with the same gauge \(\Vert \cdot \Vert _{\infty }.\)

Let \(a_1,\ldots ,a_n\in {\mathbb {C}}\) and consider the differential operator \(L:{\mathcal {C}}^{n}({\mathbb {R}}, X)\rightarrow {\mathcal {C}}({\mathbb {R}}, X)\) defined by

$$\begin{aligned} L(y)=y^{(n)}+a_1 y^{(n-1)}+\cdots +a_n y, y\in {\mathcal {C}}^{n}({\mathbb {R}}, X). \end{aligned}$$
(2)

Denote by \(P(z)=z^n+a_1 z^{n-1}+\cdots +a_n\) the characteristic polynomial of the operator L and let \(r_1,\ldots ,r_n\) be the complex roots of \(P(z)=0.\) Then the following result holds (see [7]).

Theorem 1

The operator L is Ulam stable if and only if \({{\,\mathrm{\mathrm{Re}\,}\,}}r_k\ne 0,\) for all \(k\in \{1,\ldots , n\}\). Moreover, in this case, for every \(\varepsilon >0\) and every \(y\in {\mathcal {C}}^{n}({\mathbb {R}}, X)\) with the property

$$\begin{aligned} \Vert L(y)\Vert _{\infty }\le \varepsilon \end{aligned}$$
(3)

there exists a unique \(y_0\in {\mathcal {C}}^{n}({\mathbb {R}}, X)\) such that \(L(y_0)=0\) and

$$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le \frac{\varepsilon }{\prod \nolimits _{k=1}^{n}|{{\,\mathrm{\mathrm{Re}\,}\,}}r_k|}. \end{aligned}$$
(4)

A result on Ulam stability of a first order system of linear differential equations is given in [5].

A generalization of the result given in Theorem 1 was obtained in [9, 10]. For the case \(n=1\) the operator L has the form \(L(y)=y'+\lambda y,\)\(\lambda \in {\mathbb {C}}\). Then it is Ulam stable if and only if \({{\,\mathrm{\mathrm{Re}\,}\,}}\lambda \ne 0\). Moreover, in [6, 8, 15] is proved that the best Ulam constant of it is \(\frac{1}{|{{\,\mathrm{\mathrm{Re}\,}\,}}\lambda |}\). As far as we know there is no result, until now, on the best Ulam constant of L for \(n\ge 2\). The goal of this paper is to obtain a result on Ulam stability of the operator L for \(n=2\) and to determine its best Ulam constant.

2 Main results

Let \(p,q\in {\mathbb {C}}\) and let \(L:{\mathcal {C}}^{2}({\mathbb {R}}, X)\rightarrow {\mathcal {C}}({\mathbb {R}}, X)\) be defined by

$$\begin{aligned} L(y)=y''+py'+qy, y\in {\mathcal {C}}^{2}({\mathbb {R}}, X). \end{aligned}$$
(5)

Then \(P(z)=z^2+pz+q\) is the characteristic polynomial of L and denote by \(a,b\in {\mathbb {C}}\) the roots of \(P(z)=0.\)

For \(a\ne b\)

$$\begin{aligned} {{\,\mathrm{\mathrm{ker}\,}\,}}L=\left\{ C_1e^{ax}+C_2e^{bx}|C_1, C_2\in X\right\} , \end{aligned}$$
(6)

and for \(a=b\)

$$\begin{aligned} {{\,\mathrm{\mathrm{ker}\,}\,}}L=\left\{ (C_1 x+C_2)e^{ax}|C_1, C_2\in X\right\} . \end{aligned}$$
(7)

The operator L is surjective, so for every \(f\in {\mathcal {C}}({\mathbb {R}}, X)\) a particular solution of the equation \(L(y)=f\) is given by

$$\begin{aligned} y_{P}(x)=\frac{e^{ax}}{a-b}\int _{0}^{x}f(t)e^{-at}dt-\frac{e^{bx}}{a-b}\int _{0}^{x}f(t)e^{-bt}dt, \quad \text{ if } a\ne b, \end{aligned}$$
(8)

respectively

$$\begin{aligned} y_{P}(x)=-e^{ax}\int _{0}^{x}tf(t)e^{-at}dt+xe^{ax}\int _{0}^{x}f(t)e^{-at}dt,\quad \text{ if } a= b, \end{aligned}$$
(9)

according to the variation of constants method.

The main result concerning the Ulam stability of the operator L is given in the next theorem.

Theorem 2

Suppose that \({{\,\mathrm{\mathrm{Re}\,}\,}}a\ne 0\), \({{\,\mathrm{\mathrm{Re}\,}\,}}b\ne 0\) and let \(\varepsilon >0.\) Then for every \(y\in {\mathcal {C}}^{2}({\mathbb {R}}, X)\) satisfying

$$\begin{aligned} \Vert L(y)\Vert _{\infty }\le \varepsilon \end{aligned}$$
(10)

there exists a unique \(y_0\in {{\,\mathrm{\mathrm{ker}\,}\,}}L\) such that

$$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le K\varepsilon \end{aligned}$$
(11)

where

$$\begin{aligned} K= \left\{ \begin{array}{ll} \frac{1}{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a>0, {{\,\mathrm{\mathrm{Re}\,}\,}}b>0, a\ne b\\ \frac{1}{|a-b|}\int _{-\infty }^{0}|e^{-av}-e^{-bv}|dv,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a<0, {{\,\mathrm{\mathrm{Re}\,}\,}}b<0,a\ne b\\ \frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| ,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a\cdot {{\,\mathrm{\mathrm{Re}\,}\,}}b<0,\\ \frac{1}{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^{2}},&{}\quad \text{ if } a=b. \end{array} \right. \end{aligned}$$
(12)

Proof

Existence. First we consider the case \(a\ne b.\) Suppose that \(y\in {\mathcal {C}}^{2}({\mathbb {R}}, X)\) satisfies (10) and let \(L(y)=f.\) Then \(\Vert f\Vert _{\infty }\le \varepsilon \) and

$$\begin{aligned} y(x)=C_1e^{ax}+C_2e^{bx}+\frac{e^{ax}}{a-b}\int _{0}^{x}f(t)e^{-at}dt- \frac{e^{bx}}{a-b}\int _{0}^{x}f(t)e^{-bt}dt,\quad x\in {\mathbb {R}}, \end{aligned}$$

for some \(C_1,C_2\in X.\)

  1. (i)

    Let \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b>0.\) Define \(y_0\) by the relation

    $$\begin{aligned} y_0(x)=C_3e^{ax}+C_4e^{bx},\quad x\in {\mathbb {R}}, C_3, C_4\in X, \end{aligned}$$

    where

    $$\begin{aligned} C_3=C_1+\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-at}dt \end{aligned}$$

    and

    $$\begin{aligned} C_4=C_2-\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-bt}dt. \end{aligned}$$

    Since

    $$\begin{aligned} \Vert f(t)e^{-at}\Vert \le \varepsilon |e^{-at}|=\varepsilon e^{-t{{\,\mathrm{\mathrm{Re}\,}\,}}a},\quad t\ge 0, \end{aligned}$$

    and \(\int _{0}^{\infty }e^{-t{{\,\mathrm{\mathrm{Re}\,}\,}}a}dt\) is convergent it follows that \(\int _{0}^{\infty }f(t)e^{-at}dt\) is absolutely convergent, so \(C_3\) is well defined (analogously for \(C_4\)). Then:

    $$\begin{aligned} y(x)-y_{0}(x)= & {} e^{ax}\left( \frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-at}dt+C_1-C_3\right) \\&+\,e^{bx}\left( -\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-bt}dt+C_2-C_4\right) \\= & {} -\frac{e^{ax}}{a-b}\int _{x}^{\infty }f(t)e^{-at}dt+\frac{e^{bx}}{a-b}\int _{x}^{\infty }f(t)e^{-bt}dt\\= & {} \frac{1}{a-b}\int _{x}^{\infty }f(t)\left( e^{b(x-t)}-e^{a(x-t)}\right) dt. \end{aligned}$$

    Now, letting \(x-t=-v\) in the above integral we obtain

    $$\begin{aligned} y(x)-y_0(x)=\frac{1}{a-b}\int _{0}^{\infty }f(x+v)\left( e^{-bv}-e^{-av}\right) dv,\quad x\in {\mathbb {R}}. \end{aligned}$$

    Hence

    $$\begin{aligned} \Vert y(x)-y_{0}(x)\Vert\le & {} \frac{1}{|a-b|}\int _{0}^{\infty }\Vert f(x+v)\Vert |e^{-bv}-e^{-av}|dv\\\le & {} \frac{\varepsilon }{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv,\quad x\in {\mathbb {R}}, \end{aligned}$$

    therefore

    $$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le K\varepsilon . \end{aligned}$$
  2. (ii)

    Let \({{\,\mathrm{\mathrm{Re}\,}\,}}a<0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b<0.\) The proof follows analogously, defining

    $$\begin{aligned} y_0(x)=C_3e^{ax}+C_4e^{bx},\quad x\in {\mathbb {R}}, \end{aligned}$$

    with

    $$\begin{aligned} C_3=C_1-\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-at}dt \end{aligned}$$

    and

    $$\begin{aligned} C_4=C_2+\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-bt}dt. \end{aligned}$$

    Then

    $$\begin{aligned} y(x)-y_{0}(x)= & {} \frac{1}{a-b}\int _{-\infty }^{x}f(t)\left( e^{a(x-t)}-e^{b(x-t)}\right) dt\\= & {} \frac{1}{a-b}\int _{-\infty }^{0}f(x+v)\left( e^{-av}-e^{-bv}\right) dv,\quad x\in {\mathbb {R}}, \end{aligned}$$

    where \(v=t-x.\) Hence

    $$\begin{aligned} \Vert y(x)-y_{0}(x)\Vert\le & {} \frac{\varepsilon }{|a-b|}\int _{-\infty }^{0}|e^{-av}-e^{-bv}|dv=K\varepsilon ,\quad x\in {\mathbb {R}}, \end{aligned}$$

    which entails

    $$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le K\varepsilon . \end{aligned}$$
  3. (iii)

    Let \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b<0.\) Define \(y_0\) by the relation

    $$\begin{aligned} y_0(x)=C_3e^{ax}+C_4e^{bx},\quad x\in {\mathbb {R}}, C_3, C_4\in X, \end{aligned}$$

    where

    $$\begin{aligned} C_3=C_1+\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-at}dt \end{aligned}$$

    and

    $$\begin{aligned} C_4=C_2+\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-bt}dt. \end{aligned}$$

    Then

    $$\begin{aligned} y(x)-y_{0}(x) =-\frac{1}{a-b}\left( \int _{x}^{\infty }f(t)e^{a(x-t)}dt+\int _{-\infty }^{x}f(t)e^{b(x-t)}dt\right) ,\quad x\in {\mathbb {R}}. \end{aligned}$$

    Letting \(x-t=-v,\) respectively \(x-t=v\) in the previous integrals it follows

    $$\begin{aligned} y(x)-y_{0}(x) =\frac{1}{b-a}\int _{0}^{\infty }(f(x+v)e^{-av}+f(x-v)e^{bv})dv,\quad x\in {\mathbb {R}}, \end{aligned}$$

    and

    $$\begin{aligned} \Vert y(x)-y_{0}(x)\Vert\le & {} \frac{1}{|a-b|}\int _{0}^{\infty }\left( \Vert f(x+v)\Vert |e^{-av}|+\Vert f(x-v)\Vert |e^{bv}|\right) dv\\\le & {} \frac{\varepsilon }{|a-b|}\int _{0}^{\infty }(e^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}a}+e^{v{{\,\mathrm{\mathrm{Re}\,}\,}}b})dv, \\= & {} \frac{\varepsilon }{|a-b|}\left( \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right) ,\quad x\in {\mathbb {R}}, \end{aligned}$$

    which entails

    $$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le K\varepsilon . \end{aligned}$$
  4. (iv)

    Now let \(a=b.\) Suppose again that \(y\in {\mathcal {C}}^{2}({\mathbb {R}}, X)\) satisfies (10) and let \(L(y)=f.\) Then, according to (9)

    $$\begin{aligned} y(x)=(C_1+C_2x)e^{ax}-e^{ax}\int _{0}^{x}tf(t)e^{-at}dt+xe^{ax}\int _{0}^{x}f(t)e^{-at}dt. \end{aligned}$$

    Consider first that \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0\) and define \(y_0\) by

    $$\begin{aligned} y_{0}(x)=(C_3+C_4x)e^{ax} \end{aligned}$$

    with

    $$\begin{aligned} C_3= & {} C_1-\int _{0}^{\infty }tf(t)e^{-at}dt,\\ C_4= & {} C_2+\int _{0}^{\infty }f(t)e^{-at}dt. \end{aligned}$$

    The integrals in the definition of \(C_3\) and \(C_4\) are absolutely convergent since \(\Vert f(t)\Vert _{\infty }\le \varepsilon ,\) for all \(t\in {\mathbb {R}},\) and \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0.\) Then

    $$\begin{aligned} y(x)-y_{0}(x)=\int _{x}^{\infty }f(t)(t-x)e^{a(x-t)}dt,\quad x\in {\mathbb {R}}. \end{aligned}$$

    The substitution \(t-x=v,\) in the previous integral, leads to

    $$\begin{aligned} y(x)-y_0(x)=\int _{0}^{\infty }f(x+v)ve^{-av}dv,\quad x\in {\mathbb {R}}, \end{aligned}$$

    therefore

    $$\begin{aligned} \Vert y(x)-y_{0}(x)\Vert\le & {} \int _{0}^{\infty }\Vert f(x+v)\Vert |ve^{-av}|dv\\\le & {} \varepsilon \int _{0}^{\infty }ve^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}a} dv\\= & {} \frac{\varepsilon }{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^{2}},\quad x\in {\mathbb {R}}, \end{aligned}$$

    and finally

    $$\begin{aligned} \Vert y-y_0\Vert _{\infty }\le \frac{\varepsilon }{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^{2}}. \end{aligned}$$

    The proof follows analogously if \({{\,\mathrm{\mathrm{Re}\,}\,}}a<0.\) The existence of \(y_0\) is proved. Uniqueness. Suppose that for some \(y\in {\mathcal {C}}^{2}({\mathbb {R}}, X)\) satisfying (10) there exist \(y_1, y_2\in {{\,\mathrm{\mathrm{ker}\,}\,}}L\) such that

    $$\begin{aligned} \Vert y-y_j\Vert _{\infty }\le K\varepsilon ,\quad j=1,2. \end{aligned}$$

    Then

    $$\begin{aligned} \Vert y_1-y_2\Vert _{\infty }\le \Vert y_1-y\Vert _{\infty }+\Vert y-y_2\Vert _{\infty }\le 2K\varepsilon . \end{aligned}$$

    But \(y_1-y_2\in {{\,\mathrm{\mathrm{ker}\,}\,}}L,\) hence there exist \(C_1,C_2\in X\) such that for all \(x\in {\mathbb {R}}\)

    $$\begin{aligned} y_1(x)-y_2(x)= \left\{ \begin{array}{ll} C_1e^{ax}+C_2e^{bx},&{}\quad \text{ if } a\ne b\\ (C_1+C_2x)e^{ax},&{}\quad \text{ if } a=b. \end{array} \right. \end{aligned}$$
    (13)

    If \((C_1,C_2)\ne (0,0),\) then

    $$\begin{aligned} \Vert y_1-y_2\Vert _{\infty }=\sup \limits _{x\in {\mathbb {R}}}\Vert y_1(x)-y_2(x)\Vert =+\infty , \end{aligned}$$

    contradiction with the boundedness of \(y_1-y_2.\) We conclude that \(C_1=C_2=0,\) therefore \(y_1=y_2.\) The theorem is proved.

Theorem 3

The best Ulam constant of L is given by

$$\begin{aligned} K_{L}= \left\{ \begin{array}{ll} \frac{1}{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a>0, {{\,\mathrm{\mathrm{Re}\,}\,}}b>0, a\ne b\\ \frac{1}{|a-b|}\int _{-\infty }^{0}|e^{-av}-e^{-bv}|dv,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a<0, {{\,\mathrm{\mathrm{Re}\,}\,}}b<0,a\ne b\\ \frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| ,&{}\quad \text{ if } {{\,\mathrm{\mathrm{Re}\,}\,}}a\cdot {{\,\mathrm{\mathrm{Re}\,}\,}}b<0\\ \frac{1}{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^{2}},&{}\quad \text{ if } a=b. \end{array} \right. \end{aligned}$$
(14)

Proof

  1. (i)

    Let \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0, {{\,\mathrm{\mathrm{Re}\,}\,}}b>0, a\ne b.\)

    • First, let \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0, {{\,\mathrm{\mathrm{Re}\,}\,}}b>0, {{\,\mathrm{\mathrm{Re}\,}\,}}a\ne {{\,\mathrm{\mathrm{Re}\,}\,}}b.\) Suppose that L admits an Ulam constant \(K_1<K_L,\)

      $$\begin{aligned} K_{L}=\frac{1}{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv, \end{aligned}$$

      and let \(\varepsilon >0.\)

      Let \(h(x)=e^{-ax}-e^{-bx},\)\(x\in {\mathbb {R}},\)\(u\in X, \Vert u\Vert =1,\) and define

      $$\begin{aligned} f(x)= \left\{ \begin{array}{ll} \varepsilon \frac{\overline{h(x)}}{|h(x)|}u,&{}\quad \text{ if } x>0\\ \varepsilon \frac{\overline{b-a}}{|b-a|}u,&{}\quad \text{ if } x\le 0.\\ \end{array} \right. \end{aligned}$$
      (15)

      The function f is well defined since \(h(x)\ne 0\) for \(x\in (0,\infty )\) and is continuous on \({\mathbb {R}}.\) Indeed

      $$\begin{aligned} \lim \limits _{x\searrow 0}f(x)= & {} \varepsilon \lim \limits _{x\searrow 0}\frac{\overline{h(x)}}{|h(x)|}u=\varepsilon \lim \limits _{x\searrow 0}\frac{\frac{e^{\overline{(b-a)}x}-1}{e^{\overline{b}x}}}{\left| \frac{e^{(b-a)x}-1}{e^{bx}}\right| }u\\= & {} \varepsilon \lim \limits _{x\searrow 0}\frac{e^{\overline{(b-a)}x}-1}{|e^{(b-a)x}-1|}u= \varepsilon \lim \limits _{x\searrow 0}\frac{\frac{e^{\overline{(b-a)}x}-1}{x}}{\left| \frac{e^{(b-a)x}-1}{x}\right| }u=\varepsilon \frac{\overline{b-a}}{|b-a|}u. \end{aligned}$$

      Let \({\widetilde{y}}\) be the solution of the equation

      $$\begin{aligned} y''(x)+py'(x)+qy(x)=f(x),\quad x\in {\mathbb {R}}, \end{aligned}$$

      given by

      $$\begin{aligned} {\widetilde{y}}(x)=C_1e^{ax}+C_2e^{bx}+\frac{e^{ax}}{a-b}\int _{0}^{x}f(t)e^{-at}dt- \frac{e^{bx}}{a-b}\int _{0}^{x}f(t)e^{-bt}dt, \end{aligned}$$
      (16)

      with

      $$\begin{aligned} C_1=\frac{-1}{a-b}\int _{0}^{\infty }f(t)e^{-at}dt,\quad C_2=\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-bt}dt. \end{aligned}$$

      The improper integrals in the definition of \(C_1\) and \(C_2\) are obviously absolutely convergent since \(\Vert f(x)\Vert =\varepsilon ,\)\(x\in {\mathbb {R}},\) and \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b>0.\) Then

      $$\begin{aligned} {\widetilde{y}}(x)= & {} \frac{1}{a-b}\int _{x}^{\infty }f(t)\left( e^{b(x-t)}-e^{a(x-t)}\right) dt\\= & {} \frac{1}{a-b}\int _{0}^{\infty }f(x+v)\left( e^{-bv}-e^{-av}\right) dv\nonumber \end{aligned}$$
      (17)

      and

      $$\begin{aligned} \Vert {\widetilde{y}}(x)\Vert\le & {} \frac{1}{|a-b|}\int _{0}^{\infty }\Vert f(x+v)\Vert |e^{-bv}-e^{-av}|dv\\\le & {} \frac{\varepsilon }{|a-b|}\int _{0}^{\infty }|e^{-bv}-e^{-av}|dv,\quad x\in {\mathbb {R}}, \end{aligned}$$

      therefore \({\widetilde{y}}(x)\) is bounded on \({\mathbb {R}}.\) Since \(\Vert L({\widetilde{y}})\Vert _{\infty }=\varepsilon \) and L is Ulam stable with the constant \(K_1\) it follows that there exists \(y_0\in {{\,\mathrm{\mathrm{ker}\,}\,}}L\)

      $$\begin{aligned} y_{0}(x)=C_3e^{ax}+C_4e^{bx},\quad x\in {\mathbb {R}}, \end{aligned}$$

      for some \(C_3, C_4\in X\) such that

      $$\begin{aligned} \Vert {\widetilde{y}}-y_0\Vert _{\infty }\le K_1\varepsilon . \end{aligned}$$
      (18)

      If \((C_3,C_4)\ne (0,0)\) we get, in view of the boundedness of \({\widetilde{y}}\)

      $$\begin{aligned} \lim \limits _{x\rightarrow \infty }\Vert {\widetilde{y}}(x)-y_0(x)\Vert =+\infty , \end{aligned}$$
      (19)

      contradiction with the existence of \(K_1\) satisfying (18). Therefore \(C_3=C_4=0,\) and the relation (18) leads to

      $$\begin{aligned} \Vert {\widetilde{y}}(x)\Vert \le K_1\varepsilon ,\quad \text{ for } \text{ all } x\in {\mathbb {R}}. \end{aligned}$$
      (20)

      Now let \(x=0\) in (20). We get, according to (15) and (17)

      $$\begin{aligned} \frac{\varepsilon }{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv\le K_1\varepsilon , \end{aligned}$$

      or \(K_L\varepsilon \le K_1\varepsilon ,\) contradiction with the supposition \(K_1<K_L.\)

    • Let now \({{\,\mathrm{\mathrm{Re}\,}\,}}a={{\,\mathrm{\mathrm{Re}\,}\,}}b\) and suppose that \({{\,\mathrm{\mathrm{Im}\,}\,}}a>{{\,\mathrm{\mathrm{Im}\,}\,}}b.\) The function f given by (15) is not defined at the points where \(h(x)=0,\) i.e., \(x_k=\frac{2k\pi }{{{\,\mathrm{\mathrm{Im}\,}\,}}a-{{\,\mathrm{\mathrm{Im}\,}\,}}b}\), but it is easy to check that there exist \(f(x_k+0)\) and \(f(x_k-0)\) satisfying \(\Vert f(x_k+0)\Vert =1=\Vert f(x_k-0)\Vert \) for \(k=1,2,\ldots .\) For an arbitrary \(\delta >0,\) take the intervals \(I_k=[x_k-\frac{\delta }{2^k}, x_k]\) and define the function

      $$\begin{aligned} f_1(x)= \left\{ \begin{array}{ll} f(x),&{} \text{ if } x\in {\mathbb {R}}{\setminus }\bigcup \limits _{k=1}^{\infty }I_k\\ w_k(x),&{} \text{ if } x\in I_k,\\ \end{array} \right. \end{aligned}$$
      (21)

      where \(w_k\) is the affine function passing through the points \(\left( x_k-\frac{\delta }{2^k}, f(x_k-\frac{\delta }{2^k})\right) \) and \((x_k, f(x_k+0)),\)\(k=1,2,\ldots .\) Remark that \(f_1\) is an extension by affine function of a restriction of f to a continuous function satisfying the relation \(\Vert f_1(x)\Vert \le \varepsilon ,\)\(x\in {\mathbb {R}}.\)

      Similarly to (16) let \({\tilde{y}}\) be the solution of the equation \(L({\tilde{y}})=f_1\) given by

      $$\begin{aligned} {\tilde{y}}(x)=\frac{1}{a-b}\int _{0}^{\infty }f_1(x+v)\left( e^{-bv}-e^{-av}\right) dv. \end{aligned}$$

      Suppose that L admits an Ulam constant \(K_1<K_L.\) Then analogous to the case \({{\,\mathrm{\mathrm{Re}\,}\,}}a\ne {{\,\mathrm{\mathrm{Re}\,}\,}}b,\) we get

      $$\begin{aligned} \Vert {\tilde{y}}(x)\Vert \le K_1 \varepsilon ,\quad x\in {\mathbb {R}}, \end{aligned}$$

      therefore \(\Vert {\tilde{y}}(0)\Vert \le K_1\varepsilon ,\) i.e.,

      $$\begin{aligned} \frac{1}{|a-b|}\left\| \int _{0}^{\infty }f_1(v)\left( e^{-bv}-e^{-av}\right) dv\right\| \le K_1\varepsilon , \end{aligned}$$

      or

      $$\begin{aligned} \frac{1}{|a-b|}\left\| \int _{0}^{\infty }f(v)\left( e^{-bv}-e^{-av}\right) dv+\int _{0}^{\infty }\left( f_1(v)-f(v)\right) \left( e^{-bv}-e^{-av}\right) dv\right\| \le K_1\varepsilon \end{aligned}$$

      or

      $$\begin{aligned} \left\| K_L\varepsilon +\frac{1}{|a-b|}\int _{0}^{\infty }\left( f_1(v)-f(v)\right) \left( e^{-bv}-e^{-av}\right) dv\right\| \le K_1\varepsilon . \end{aligned}$$
      (22)

      Since \({{\,\mathrm{\mathrm{Re}\,}\,}}a={{\,\mathrm{\mathrm{Re}\,}\,}}b>0,\) it follows that there exists \(M\ge 0\) such that \(|e^{-bv}-e^{-av}|\le M\) for all \(v\ge 0.\) We get

      $$\begin{aligned}&\left\| \int _{0}^{\infty }\left( f_1(v)-f(v)\right) \left( e^{-bv}-e^{-av}\right) dv\right\| \le \int _{0}^{\infty }\Vert f_1(v)-f(v)\Vert |e^{-bv}-e^{-av}|dv \\&\quad =\sum \limits _{k=1}^{\infty }\int _{I_k}\Vert f_1(v)-f(v)\Vert \cdot |e^{-bv}-e^{-av}|dv\le \sum \limits _{k=1}^{\infty }\int _{I_k}2\varepsilon Mdv\\&\quad =2\varepsilon M\sum _{k=1}^{\infty }\frac{\delta }{2^k}=2\varepsilon M\delta . \end{aligned}$$

      Since \(\delta \) is an arbitrary positive number, letting \(\delta \rightarrow 0\) in (22) it follows that \(K_L\le K_1,\) contradiction.

  2. (ii)

    The case \({{\,\mathrm{\mathrm{Re}\,}\,}}a<0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b<0,\)\(a\ne b\) follows analogously. Let f be given by

    $$\begin{aligned} f(x)= \left\{ \begin{array}{ll} \varepsilon \frac{\overline{h(x)}}{|h(x)|}u,&{}\quad \text{ if } x< 0\\ \varepsilon \frac{\overline{b-a}}{|b-a|}u,&{}\quad \text{ if } x\ge 0.\\ \end{array} \right. \end{aligned}$$

    and \({\widetilde{y}}\) by (16) with

    $$\begin{aligned} C_1=\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-at}dt,\quad C_2=-\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-bt}dt. \end{aligned}$$

    Then \({\widetilde{y}}\) can be rewritten in the form

    $$\begin{aligned} {\widetilde{y}}(x)=\frac{1}{a-b}\int _{-\infty }^{0}f(x+v)\left( e^{-av}-e^{-bv}\right) dv,\quad x\in {\mathbb {R}}. \end{aligned}$$

    The arguments used in the proof of the previous case (of course by taking the limit to \(-\infty \)) lead to the conclusion of the theorem.

  3. (iii)

    Let \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0, {{\,\mathrm{\mathrm{Re}\,}\,}}b<0.\) Take \(\varepsilon >0,\)\(u\in X,\)\(\Vert u\Vert =1\) and define the function \(f:{\mathbb {R}}\rightarrow X\) by

    $$\begin{aligned} f(x)=\varepsilon u \left\{ \begin{array}{ll} e^{ix{{\,\mathrm{\mathrm{Im}\,}\,}}a},&{}\quad \text{ if } x\ge 0\\ e^{ix{{\,\mathrm{\mathrm{Im}\,}\,}}b},&{}\quad \text{ if } x<0. \end{array} \right. \end{aligned}$$
    (23)

    Then f is continuous on \({\mathbb {R}}\) and \(\Vert f(x)\Vert =\varepsilon \) for all \(x\in {\mathbb {R}}.\) Let \({\widetilde{y}}\) be the solution of the equation

    $$\begin{aligned} L(y)=f \end{aligned}$$

    given by (16) with

    $$\begin{aligned} C_1=-\frac{1}{a-b}\int _{0}^{\infty }f(t)e^{-at}dt,\quad C_2=-\frac{1}{a-b}\int _{-\infty }^{0}f(t)e^{-bt}dt. \end{aligned}$$

    Then

    $$\begin{aligned} {\widetilde{y}}(x)=-\frac{e^{ax}}{a-b}\int _{x}^{\infty }f(t)e^{-at}dt-\frac{e^{bx}}{a-b}\int _{-\infty }^{x}f(t)e^{-bt}dt,\quad x\in {\mathbb {R}}, \end{aligned}$$

    or, by using the change of variable \(x-t=-v,\) respectively \(x-t=v\) in the integrals defining \({\widetilde{y}}\) we get

    $$\begin{aligned} {\widetilde{y}}(x)=\frac{1}{b-a}\int _{0}^{\infty }\left( f(x+v)e^{-av}+f(x-v)e^{bv}\right) dv, \quad x\in {\mathbb {R}}. \end{aligned}$$
    (24)

    Suppose that the operator L admits an Ulam constant

    $$\begin{aligned} K_1<K_L=\frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| . \end{aligned}$$
    (25)

    Since \(\Vert L(y)\Vert _{\infty }=\varepsilon \) it follows that there exists \(y_0\in {{\,\mathrm{\mathrm{ker}\,}\,}}L\)

    $$\begin{aligned} y_0(x)=C_3e^{ax}+C_4e^{bx},\quad C_3,C_4\in X, \end{aligned}$$

    such that

    $$\begin{aligned} \Vert {\widetilde{y}}-y_0\Vert _{\infty }\le K_1\varepsilon . \end{aligned}$$
    (26)

    If \((C_3,C_4)\ne (0,0)\) we get

    $$\begin{aligned} \lim \limits _{x\rightarrow \infty }\Vert {\widetilde{y}}(x)-y_0(x)\Vert =+\infty , \end{aligned}$$
    (27)

    contradiction with (26). If \(C_3=C_4=0,\) then (26) leads to

    $$\begin{aligned} \Vert {\widetilde{y}}(x)\Vert \le K_1\varepsilon , \quad x\in {\mathbb {R}}. \end{aligned}$$
    (28)

    Letting now \(x=0\) in (28) we obtain

    $$\begin{aligned} \frac{1}{|b-a|}\left\| \int _{0}^{\infty }(f(v)e^{-av}+f(-v)e^{bv})dv\right\| \le K_1\varepsilon \end{aligned}$$

    or

    $$\begin{aligned} \frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| <K_1, \end{aligned}$$

    contradiction with (25).

  4. (iv)

    Let \(a=b.\) Suppose first that \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0.\) Take \(\varepsilon >0,\)\(u\in X,\)\(\Vert u\Vert =1,\) and let f be given by

    $$\begin{aligned} f(x)=\varepsilon u e^{ix{{\,\mathrm{\mathrm{Im}\,}\,}}a},\quad x\in {\mathbb {R}}. \end{aligned}$$

    Let \({\widetilde{y}}\) be the solution of the equation \(L(y)=f\) given by

    $$\begin{aligned} {\widetilde{y}}(x)=(C_1+C_2x)e^{ax}-e^{ax}\int _{0}^{x}tf(t)e^{-at}dt+xe^{ax}\int _{0}^{x}f(t)e^{-at}dt,\quad x\in {\mathbb {R}}, \end{aligned}$$

    with

    $$\begin{aligned} C_1=\int _{0}^{\infty }tf(t)e^{-at}dt,\quad C_2=-\int _{0}^{\infty }f(t)e^{-at}dt. \end{aligned}$$

    Then

    $$\begin{aligned} {\widetilde{y}}(x)= & {} e^{ax}\int _{x}^{\infty }t f(t)e^{-at}dt-xe^{ax}\int _{x}^{\infty }f(t)e^{-at}dt\\= & {} \int _{x}^{\infty }f(t)(t-x)e^{a(x-t)}dt\\= & {} \int _{0}^{\infty }f(x+v)ve^{-av}dv. \end{aligned}$$

    Suppose that L is stable with an Ulam constant \(K_1<K_L=\frac{1}{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^2}.\) Then there exists \(y_0\in {{\,\mathrm{\mathrm{ker}\,}\,}}L,\)\(y_{0}(x)=(C_3+C_4x)e^{ax},\)\(C_3,C_4\in X,\) such that

    $$\begin{aligned} \Vert {\widetilde{y}}-y_0\Vert _{\infty }\le K_1\varepsilon . \end{aligned}$$
    (29)

    If \((C_3,C_4)\ne (0,0)\) we have

    $$\begin{aligned} \lim \limits _{x\rightarrow \infty }\Vert {\widetilde{y}}(x)-y_0(x)\Vert =+\infty , \end{aligned}$$

    contradiction with (29), since \({\widetilde{y}}\) is bounded. If \((C_3,C_4)=(0,0),\) then for \(x=0\) the Eq. (29) leads to

    $$\begin{aligned} \left\| \int _{0}^{\infty }vf(v)e^{-av}dv\right\| \le K_1\varepsilon \quad \text{ or }\quad \frac{\varepsilon }{({{\,\mathrm{\mathrm{Re}\,}\,}}a)^2}\le K_1\varepsilon , \end{aligned}$$

    contradiction with the supposition \(K_1<K_L.\) The case \({{\,\mathrm{\mathrm{Re}\,}\,}}a<0\) follows analogously. The theorem is proved.

Corollary 1

If \(a\ne b,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}a\cdot {{\,\mathrm{\mathrm{Re}\,}\,}}b>0\) and \({{\,\mathrm{\mathrm{Im}\,}\,}}a={{\,\mathrm{\mathrm{Im}\,}\,}}b,\) then the best Ulam constant of L is \(K_L=\frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| .\)

Proof

Suppose first that \({{\,\mathrm{\mathrm{Re}\,}\,}}a>0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b>0,\)\(a\ne b.\) Then, according to Theorem 3

$$\begin{aligned} K_L=\frac{1}{|a-b|}\int _{0}^{\infty }|e^{-av}-e^{-bv}|dv. \end{aligned}$$
(30)

Since \({{\,\mathrm{\mathrm{Im}\,}\,}}a={{\,\mathrm{\mathrm{Im}\,}\,}}b\) the complex numbers a and b are of the form \(a=a_1+ic,\) and \(b=b_1+ic,\)\(a_1,b_1,c\in {\mathbb {R}},\) respectively. Moreover

$$\begin{aligned} \left| e^{-av}-e^{-bv}\right|= & {} \left| e^{-a_1v-icv}-e^{-b_1v-icv}\right| =\left| \left( e^{-a_1v}-e^{-b_1v}\right) \cdot e^{-icv}\right| \\= & {} \left| e^{-a_1v}-e^{-b_1v}\right| =\left| e^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}a}-e^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| . \end{aligned}$$

Consequently, in view of relation (30), the best Ulam constant \(K_L\) is given by

$$\begin{aligned} K_L=\frac{1}{|a-b|}\int _{0}^{\infty }\left| e^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}a}-e^{-v{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| dv=\frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| . \end{aligned}$$

The case \({{\,\mathrm{\mathrm{Re}\,}\,}}a<0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b<0,\)\(a\ne b,\) follows analogously.

Corollary 2

If \(a,b\in \mathbb {R,}\)\(a\cdot b\ne 0,\) then the best Ulam constant of L is \(K_L=\frac{1}{|a b|}.\)

Proof

The result is a simple consequence of Theorem 3 and Corollary 1. Since \({{\,\mathrm{\mathrm{Re}\,}\,}}a=a\) and \({{\,\mathrm{\mathrm{Re}\,}\,}}b=b\), we get

$$\begin{aligned} \frac{1}{|a-b|}\left| \frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}a}-\frac{1}{{{\,\mathrm{\mathrm{Re}\,}\,}}b}\right| =\frac{1}{|ab|}. \end{aligned}$$

3 Applications: damped oscillations

Oscillating systems are described by second order differential equations. In the case of undamped simple harmonic motion we get an equation of the form

$$\begin{aligned} y''(t)+\alpha ^2y(t)=0,\quad t\ge 0, \end{aligned}$$
(31)

where \(\alpha =\sqrt{\frac{k}{M}}\) is a constant (k is Hook’s constant and M is the mass of the body involved in the harmonic motion); see [16]. According to Theorem 1 the Eq. (31) is not stable in Ulam sense if \(t\in {\mathbb {R}}\) since its characteristic equation \(r^2+\alpha ^2=0\) admits the roots \(r_{1,2}=\pm \alpha i\) which lie on the imaginary axis (Fig. 1). We will prove that the Eq. (31) is also nonstable Ulam if t runs on the interval \([0,\infty ).\) Let \(\varepsilon >0\) and consider the equation

$$\begin{aligned} y''(t)+\alpha ^2y(t)=\varepsilon \sin \alpha t,\quad t\in [0,\infty ). \end{aligned}$$
(32)

Then (32) is a perturbation of the Eq. (31) satisfying the relation

$$\begin{aligned} |y''(t)+\alpha ^2y(t)|\le \varepsilon ,\quad t\in [0,\infty ). \end{aligned}$$
(33)

The function \({\widetilde{y}}(t)=-\frac{\varepsilon }{2\alpha }t\cos \alpha t,\)\(t\in [0,\infty )\) is a solution of (32). On the other hand for every function \(y(t)=C_1\cos \alpha t+C_2\sin \alpha t,\)\(t\in [0,\infty ),\)\(C_1,C_2\in {\mathbb {R}},\) which is a solution of (31), we have

$$\begin{aligned} \sup \limits _{t\in [0,\infty )}|{\widetilde{y}}(t)-y(t)|=+\infty . \end{aligned}$$
(34)

To prove (34) it is sufficient to consider the sequence \((t_n)_{n\ge 1,}\)\(t_n=\frac{2\pi n}{\alpha },\)\(n\ge 0,\) for which we obtain

$$\begin{aligned} |{\widetilde{y}}(t_n)-y(t_n)|=\left| \frac{\varepsilon \pi n}{\alpha ^2}-C_1\right| \rightarrow +\infty \quad \text{ as } t_n\rightarrow \infty , \end{aligned}$$

for every \(C_1\in {\mathbb {R}}.\) Therefore we conclude that there is no solution of the Eq. (31) near the solution \({\widetilde{y}}(t)\) of the perturbed Eq. (33), i.e., the Eq. (31) is nonstable Ulam for \(t\in [0,\infty )\).

Fig. 1
figure 1

Nonstability of the harmonic equation \({y''(t)+4y(t)=0}\). For \(\varepsilon =0.5\) and \(f(t)=0.5\sin 2t\) the gap between the approximate solution \(y(t)=-\frac{1}{8}t\cos 2t\) and any solution of the exact equation (in this case \(y_0(t)=\cos 2t-\sin 2t\)) is unbounded

The case of damped oscillations leads to an equation of the form

$$\begin{aligned} y''(t)+2\beta y'(t)+\alpha ^2y(t)=0,\quad t\ge 0, \end{aligned}$$
(35)

where \(\beta =\frac{c}{2M},\)\(\alpha =\sqrt{\frac{k}{M}},\) and c is a positive constant defining the friction force \(F(t)=-cy'(t)\) which measures the resistance of the medium. Notice that F(t) is proportional to the velocity of the body of mass M involved in the oscillatory motion. The characteristic equation of (35)

$$\begin{aligned} r^2+2\beta r+\alpha ^2=0 \end{aligned}$$
(36)

has the roots \(r_{1,2}=-\beta \pm \sqrt{\beta ^2-\alpha ^2},\) which do not lie on the imaginary axis for every positive \(\alpha \) and \(\beta .\) Hence Eq. (35) is stable in Ulam sense, i.e. the damped oscillating system is Ulam stable.

Fig. 2
figure 2

Ulam stability of damped oscillating systems. For \(\varepsilon =5\) and \(f(t)=5\cos t\) the gap between the approximate solution \(y(t)=2\sin t+\cos t\) of the equation \(y''(t)+2y'(t)+2y(t)=0\) and the exact solution \(y_0(t)=-e^{-t}(\cos t+3\sin t)\) remains bounded

Forced vibrations of a damped oscillating system are obtained when an external force f(t),  \(t\ge 0\) acts on the system. In this case the equation of the motion is given by

$$\begin{aligned} y''(t)+2\beta y'(t)+\alpha ^2y(t)=f(t),\quad t\ge 0, \end{aligned}$$
(37)

which is a perturbation of the Eq. (35). We are interested in the behavior of the solutions of the Eq. (37) with respect to the solutions of the Eq. (35) when \(|f(t)|\le \varepsilon ,\)\(t\ge 0,\) for some fixed positive \(\varepsilon .\) We obtain, according to Theorem 2, the following result (Fig. 2).

Theorem 4

Let \(\varepsilon >0.\) Then for every solution y of the Eq. (37) with \(|f(t)|\le \varepsilon \) for all \(t\in [0,\infty )\) there exists a unique solution \(y_0\) of the Eq. (35) such that

$$\begin{aligned} |y(t)-y_0(t)|\le K\varepsilon ,\quad t\in [0,\infty ), \end{aligned}$$

where

$$\begin{aligned} K= \left\{ \begin{array}{ll} \frac{1}{\alpha ^2},&{}\quad \text{ if } \beta \ge \alpha \\ \frac{1}{\alpha ^2}\coth \frac{\beta \pi }{2\sqrt{\alpha ^2-\beta ^2}},&{}\quad \text{ if } \beta <\alpha .\\ \end{array} \right. \end{aligned}$$
(38)

Proof

The characteristic equation of (37) has the roots \(a=-\beta +\sqrt{\beta ^2-\alpha ^2},\)\(b=-\beta -\sqrt{\beta ^2-\alpha ^2}.\) If \(\beta \ge \alpha ,\) then \(a,b\in {\mathbb {R}}\) and \(K=\frac{1}{|ab|}=\frac{1}{\alpha ^2}\) in view of Corollary 2.

If \(\beta <\alpha ,\) then \(a,b\notin \mathbb {R,}\)\({{\,\mathrm{\mathrm{Re}\,}\,}}a<0,\)\({{\,\mathrm{\mathrm{Re}\,}\,}}b<0\) and (37) has the best Ulam constant \(K=\frac{1}{|a-b|}\int _{-\infty }^{0}|e^{-av}-e^{-bv}|dv.\) We get

$$\begin{aligned} K= & {} \frac{1}{2\sqrt{\alpha ^2-\beta ^2}}\int _{-\infty }^{0} e^{\beta v}|2\sin v\sqrt{\alpha ^2-\beta ^2}|dv\\= & {} \frac{1}{\sqrt{\alpha ^2-\beta ^2}}\int _{0}^{\infty }e^{-\beta v}|\sin v\sqrt{\alpha ^2-\beta ^2}|dv. \end{aligned}$$

The substitution \(v\sqrt{\alpha ^2-\beta ^2}=u\) leads to

$$\begin{aligned} K=\frac{1}{\alpha ^2-\beta ^2}\int _{0}^{\infty }e^{-\frac{\beta u}{\sqrt{\alpha ^2-\beta ^2}}}|\sin u|du, \end{aligned}$$

and taking account

$$\begin{aligned} \int _{0}^{\infty }e^{-\lambda x}|\sin x|dx=\frac{1}{1+\lambda ^2}\coth \frac{\lambda \pi }{2},\quad \lambda >0, \end{aligned}$$

it follows \(K=\frac{1}{\alpha ^2}\coth {\frac{\beta \pi }{2\sqrt{\alpha ^2-\beta ^2}}}.\)

4 Conclusions

In this paper we obtain the best Ulam constant for the second order linear differential operator, acting in Banach spaces. In this way, we give an optimal evaluation between the solutions of an equation and the solutions of a perturbation of it, which has applications in many branches of sciences as: engineering, economy and physics. Consequently, the result is applied in the study of oscillating systems, namely we show that damped oscillating systems are Ulam stable while harmonic oscillating systems are nonstable. We emphasize the influence of the action of an external force, which produces a perturbation, on the behavior of oscillating systems with respect to the behavior of unperturbed systems.