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

Since it is important to me I would like to award a user who would kindly explain me what are my mistakes and what is the correct way to solve the whole problem with 500 points.

I'd really like your help with understanding how to solve this Cauchy problem: $(t^2+1)(y''-2y+1)=e^t$ with the initial conditions: $y(0)=y'(0)=1$.

I see a lot of methods and I am completely confused about what are the steps for solving this equation. First I wrote $$(y''-2y+1)=\frac{e^t}{(t^2+1)}.$$

I read that I need to solve first the homogeneous equation $(y''-2y+1)=0$. Do I use Abel to reduce the order of the equation? I know that I need particular solution, so $y=0.5$ would do.

Now as far as I understand I need to use Wronskian determinant $$\begin{vmatrix} 0.5 &y \\ 0 &y' \end{vmatrix}=c\cdot e^{\int^t_0-(2)/1 ds}=c\cdot e^{-2t}=0.5y'$$

so $y'=2ce^{-2t}$, here I can use the data given me in the beginning so $c=0.5$ and $y'=e^{-2t}$ and $y=-0.5e^{-2t}+d$ and from the initial data again $d=1.5$ and $y=-0.5e^{-2t}+1.5$.

so now $y_h=-0.5e^{-2t}+1.5$ now I need to find $y_p=-0.5e^{-2t}u_1(t)+1.5u_2(t)$.

Then, I wrote the floowing :$$\begin{bmatrix} -0.5e^{-2t} &1.5 \\ e^{-2t}& 0 \end{bmatrix}\begin{pmatrix} u_1'\\ u_2' \end{pmatrix}=\begin{pmatrix} 0\\ \frac{e^t}{(t^2+1)} \end{pmatrix}.$$ By using this system, I found $u_1$ and $u_2$ and the final solution is $y_=y_h+y_p$.

Please tell me- am I right? Is this basically the way to do that? Was I allowed to divide the original solution with $(t^2+1)$ or should I had to solve $(t^2+1)(y''-2y+1)$ as a homogeneous equation?

Thank you!!

-
wolframalpha.com/input/?i=y%27%27-2*y%2B1%3De%5Et%2F%28t%5E2%2B1%29 please copy this and paste on browser,nonhomogenous form could not be solved using elementary functions –  dato datuashvili Jul 4 '12 at 18:27
Can you please explain what do you mean? –  Jozef Jul 4 '12 at 18:30
Do you mean $y'' - 2y + 1$ or $y'' - 2y' + y$? –  Zarrax Jul 4 '12 at 18:58
@Zarrax: 1..... –  Jozef Jul 4 '12 at 18:58
One thing I should mention, there's something called "variation of parameters" that can be used to find particular solutions to the inhomogeneous equation. It works best for constant coefficient 2nd order equations, like the one you have. In general, you have to solve the homogeneous equation first to use it. –  Zarrax Jul 7 '12 at 21:36

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*}

-
Thanks a lot :) very kind of you. –  Jozef Jul 6 '12 at 19:02
@Jozef: Glad to help. Thanks for the interesting question! –  user26872 Jul 6 '12 at 19:41

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.

-
The 2nd to 1st order trick with matrices. Very nice. (+1) –  user26872 Jul 8 '12 at 18:28

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.

-
Thanks, Zarrax. Another way to look at the 2nd to 1st order trick. (+1) –  user26872 Jul 5 '12 at 16:50

i will mention about solution of $y''-2*y=0$, so it is second order linear differential equation,for solution ,take form $y=e^{a*t}$,if you differentiate it and put into homogenose equation you will get $(a^2-2)=0$ or $a=-\sqrt{2}$ and $a=\sqrt{2}$ we know that if we know some number of solution of given equation,then linear combination of these solutions is also solution,so $y(t)=c_1*e^{-\sqrt{2}*t}+c_2*e^{\sqrt{2}*t}$,for find $c_1$ and $c_2$ use initial conditions

for nonhomogenouse equation you have $y''-2*y=e^{t}/(t^2+1)-1$,solution of this is here

http://www.wolframalpha.com/input/?i=y%27%27-2*y%2B1%3De%5Et%2F%28t%5E2%2B1%29


general solution would be homogenouse solution+nonhomogenouse solution

-
it does not matter ,just for simplification ,you can use this one for nonhomogenouse,both would be simple and very easy –  dato datuashvili Jul 4 '12 at 18:47
actually it is good idea to left on left side everything which contains one variable let say $y(t)$ and on second side all another variable –  dato datuashvili Jul 4 '12 at 18:54