Solving $(t^2+1)(y''-2y+1)=e^t$ with the initial conditions: $y(0)=y'(0)=1$

Solution 1:

Separating the inhomogeneous part in the usual way we find $$\begin{equation*} y''-2y = \frac{e^t}{t^2+1} - 1.\tag{1} \end{equation*}$$ Notice that $y''-2y+1=0$ is not homogeneous.

The solution to (1) is $y = y_h + y_p$ where $y_h$ and $y_p$ are given below. Here is the solution in terms of the exponential integral. $\def\a{\sqrt{2}}$

Homogeneous solution

The homogeneous solutions to (1) are of the form $y = e^{r t}$. Plugging this into $y'' - 2 y = 0$ we find the characteristic equation $r^2 - 2 = 0$. The roots are $\pm \a$, so $y_h = A e^{\a t} + B e^{-\a t}$. Applying the boundary conditions we find $$\begin{eqnarray*} A+B &=& 1 \\ \a(A-B) &=& 1, \end{eqnarray*}$$ so $A = \frac{1}{4}(2+\a)$ and $B = \frac{1}{4}(2-\a)$. Therefore, $$\begin{eqnarray*} y_h &=& \frac{1}{4}(2+\a)e^{\a t} + \frac{1}{4}(2-\a)e^{-\a t} \\ &=& \cosh(\a t) + \frac{1}{\a} \sinh(\a t). \end{eqnarray*}$$

Particular solution

For convenience let $a=\a$ and $f(t) = \frac{e^t}{t^2+1} - 1$, so the differential equation takes the form $$\begin{equation*} y''-a^2y = f.\tag{2} \end{equation*}$$ There are many approaches to finding the particular solution to ODEs. A standard approach involves the direct use of Green's functions on (2). Let's try a different method.

Let $D = d/dt$. Then $(D^2-a^2)y = f$. Formally, $$\begin{eqnarray*} y &=& \frac{1}{D^2-a^2} f \\ &=& \frac{1}{(D+a)(D-a)} f \\ &=& \frac{1}{2a}\left(\frac{1}{D-a} - \frac{1}{D+a}\right)f, \end{eqnarray*}$$ where we have expanded in partial fractions. What is the meaning of $\frac{1}{D-a}f$? Of course it is the solution to the first order inhomogeneous ODE $$(D-a)u = f.$$ The solution to this equation can be found using the integrating factor technique, $$u(t) = e^{a t} \int_0^t ds\, e^{-a s} f(s).$$ The solution to $(D+a)v = f$ can be found similarly, $$v(t) = e^{-a t} \int_0^t ds\, e^{a s} f(s).$$ We choose the lower limits of integration so that $u(0) = v(0) = 0$. In fact we find $u'(0) = v'(0) = 0$ so the boundary conditions will not be disturbed when we add the particular solution to $y_h$.

The particular solution is then $$\begin{eqnarray*} y_p &=& \frac{1}{2a}(u-v) \\ &=& -\sinh^2\left(\frac{t}{\a}\right) +\frac{1}{2\a}\left( e^{\a t} \int_0^t ds\, \frac{e^{s(1-\a)}}{s^2+1} - e^{-\a t} \int_0^t ds\, \frac{e^{s(1+\a)}}{s^2+1} \right) \\ &=& -\sinh^2\left(\frac{t}{\a}\right) + \frac{1}{\a} \int_0^t ds\, \frac{e^s}{s^2+1} \sinh(\a(t-s)). \end{eqnarray*}$$ The integral can be written in terms of the exponential integral, as given in the link above, but that form is not particularly enlightening.

Addendum: Connection to the exponential integral. \begin{eqnarray*} \int_0^t ds\, \frac{e^{b s}}{s^2+1} &=& \int_0^t ds\, e^{b s} \frac{1}{2i}\left(\frac{1}{s-i} - \frac{1}{s+i}\right) \\ &=& \int_0^t ds\, e^{b s} \mathrm{Im}\, \frac{1}{s-i} \\ &=& \mathrm{Im}\,e^{i b} \int_{-i b}^{b(t-i)} dz\, \frac{e^{z}}{z} \hspace{10ex} (\textrm{let }z=b(s-i)) \\ &=& \mathrm{Im}\, e^{i b} \left[ \mathrm{Ei}(b(t-i)) - \mathrm{Ei}(-i b) \right] \end{eqnarray*}

Solution 2:

Setting $x=(y,y')^T$, the problem becomes $$ \dot{x}=Ax+f(t)e_2, \ x(0)=(1,1)^T, $$ with $e_2=(0,1)^T$, $f(t)=e^t/(t^2+1)-1$ and $A=\left[\begin{array}{cc}0&1\cr2&0\end{array}\right]$.

Thus $$ x(t)=e^{tA}\left[x(0)+\int_0^tf(s)e^{-sA}e_2ds\right]=e^{tA}x(0)+\int_0^tf(s)e^{(t-s)A}e_2, $$ and $y$ corresponds to the first component of $x$.

Since $A^2=2I$, it follow that \begin{eqnarray} e^{sA}&=&\sum_{k=0}^{\infty}\frac{s^{2k}}{(2k)!}A^{2k}+\sum_{k=0}^{\infty}\frac{s^{2k+1}}{(2k+1)!}A^{2k+1} =\sum_{k=0}^{\infty}\frac{2^ks^{2k}}{(2k)!}I+\sum_{k=0}^{\infty}\frac{2^ks^{2k+1}}{(2k+1)!}A\cr &=&\cosh(\sqrt{2}s)I+\frac{1}{\sqrt{2}}\sinh(\sqrt{2}s)A =\left[\begin{array}{cc}\cosh(\sqrt{2}s)&\frac{\sinh(\sqrt{2}s)}{\sqrt{2}}\cr\sqrt{2}\sinh(\sqrt{2}s)&\cosh(\sqrt{2}s)\end{array}\right]. \end{eqnarray} So we have \begin{eqnarray} y(t)&=&\cosh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\sinh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\int_0^tf(s)\sinh(\sqrt{2}(t-s))ds\cr &=&\cosh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\sinh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\int_0^t\left(\frac{e^s}{s^2+1}-1\right)\sinh(\sqrt{2}(t-s))ds\cr &=&\cosh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\sinh(\sqrt{2}t)+\frac{1}{2}(1-\cosh(\sqrt{2}t))+g(t)\cr &=&\frac{1}{2}+\frac{1}{2}\cosh(\sqrt{2}t)+\frac{1}{\sqrt{2}}\sinh(\sqrt{2}t)+g(t), \end{eqnarray} where $$ g(t):=\frac{1}{\sqrt{2}}\int_0^t\frac{e^s}{s^2+1}\sinh(\sqrt{2}(t-s))ds $$ cannot be expressed with elementary functions.

Solution 3:

Concerning finding a solution to the inhomogeneous equation.. as in oenamen's answer, for $a = \sqrt{2}$ write it as $$(D- a)(D + a)f = {e^t \over t^2 + 1} - 1$$ So letting $g = (D + a)f$, this is the same as the first order linear equation $$(D - a)g = {e^t \over t^2 + 1} - 1$$ You can solve this for $g = (D + a)f$ using standard first order linear methods, using the integrating factor and so on. Replacing $a$ by $-a$ in the formula immediately gives $h = (D - a)f$, and then the equation is solved by $f = {1 \over 2a} (g - h)$.

In practice one normally uses the method oenamen used in his answer since partial fractions is easier to use for more complicated problems, but for those who are worried about whether such methods are rigorous, I just wanted to mention that one can do what I did here to get the answer in this case.