\documentclass[a4paper,12pt]{article}
\begin{document}

\parindent=0pt

QUESTION

Solve the differential equation $$y''+y'-2y=x^2+e^x$$ given that
$y=1$ and $y'=0$ when $x=0$.
\begin{description}

\item[(a)]
by using particular integral and complementary function,

\item[(b)]
by using Laplace transforms.

\end{description}

\bigskip

ANSWER

 $y''+y'-2y=x^2+e^x,\ \ y(0)=1,\ \ y'(0)=0$

\begin{description}

\item[(a)]
 Complementary function: try $y=e^{mx}\\
 m^2+m-2=0\Rightarrow m_1=-2, m_2=1\\
 y_{CF}=C_1e^{-2x}+C_2e^x$\\
 To find a particular integral of $ y''+y'-2y=x^2$ try
 $y=Ax^2+Bx+C\\
 2A+(2Ax+B)-2(ax^2+Bx+C)=x^2\\
 A=-\frac{1}{2}\Rightarrow B=-\frac{1}{2} \Rightarrow
 C=-\frac{3}{4}$\\
 To find a particular integral of $y''+y'-2y=e^x$ try
 $y=p(x)e^x\\
 (D+2)(D-1)p(x)e^x=e^x\Rightarrow (D+3)Dp(x)=1\\
 p(x)=\frac{1}{D}\frac{1}{D+3}1=\frac{1}{D}\frac{1}{3}=\frac{1}{3}x$\\
 Hence the general solution is

 \begin{eqnarray*}
  y&=&C_1e^{-2x}+C_2e^x-\frac{1}{2}x^2-\frac{1}{2}x-\frac{3}{4}+\frac{1}{3}xe^x\\
  y(0)&=&C_1+C_2-\frac{3}{4}=1\Rightarrow C_2=-C_1+\frac{7}{4}\\
  y'(0)&=&-2C_1+C_2-\frac{1}{2}+\frac{1}{3}=0\\
  &\Rightarrow&3C_1=-\frac{6}{12}+\frac{4}{12}+\frac{21}{12}=\frac{19}{21}\\
  &\Rightarrow&
  C_1=\frac{19}{36}\\
 &\Rightarrow& C_2=-\frac{19}{36}+\frac{63}{36}=\frac{11}{9}
 \end{eqnarray*}

\item[(b)]
$$\left(s^2Y(s)-sy(0)-y'(o)\right)+\left(sY(s)-y(0)\right)-2Y(S)=\frac{2}{s^3}+\frac{1}{s-1}$$
$$(s^2+s-2)Y(s)=\frac{2}{s^3}+\frac{1}{s-1}+s+1$$
$$Y(s)=\frac{2}{s^3(s+2)(s-1)}+\frac{1}{(s+2)(s-1)^2}+\frac{s+1}{(s+2)(s-1)}$$
$\textrm{Res}\left(\frac{2e^{sx}}{s^3(s+2)(s-1)},0\right)$ (a
triple pole)=coefficient of $s^{-1}$ in
$$-\frac{e^{sx}}{s^3\left(1+\frac{s}{2}\right)(1-s)}=-\frac{1}{s^3}\left(1+sx+\frac{s^2x^2}{2!}
+\ldots\right)\left(1-\frac{s}{2}+\frac{s^2}{4}+\ldots\right)$$
$$\left(1+s+s^2+\ldots\right)
-\frac{1}{s^3}\left[1+\left(x-\frac{1}{2}+1\right)s+
\left(\frac{x^2}{2}+\frac{1}{4}+1-\frac{x}{2}+x-\frac{1}{2}\right)s^2+\ldots\right]
$$
 $\textrm{Res}=-\frac{x^2}{2}-\frac{x}{2}-\frac{3}{4}\\
\textrm{Res}\left(Y(s)e^{sx},-2\right)$ (a simple pole)

\begin{eqnarray*}&=&e^{-2x}\left(\frac{2}{(-2)^3(-2-1)}
+\frac{1}{(-2-1)^2}+\frac{-2+1}{(-2-1)}\right)\\
&=&e^{-2x}\left(\frac{1}{\sqrt{2}}+\frac{1}{9}+\frac{1}{3}\right)=\frac{19}{36}e^{-2x}
\end{eqnarray*}

\begin{eqnarray*}
\textrm{Res}\left(Y(s)e^{sx},1\right)&=&e^x\left(\frac{2}{1(1+2)}+\frac{1+1}{1+2}\right)
+\lim_{s\to 1} \frac{d}{ds}\frac{e^sx}{s+2}\\
&=&\frac{4}{3}e^x+\lim_{x\to1}
\left(\frac{xe^{sx}}{s+2}-\frac{e^{sx}}{(s+2)^2}\right)\\
&=&\left(\frac{4}{3}+\frac{x}{3}-\frac{1}{9}\right)e^x\\
&=&\frac{x}{3}+\frac{11}{9}\\
\end{eqnarray*}
$$y(x)=\frac{19}{36}e^{-2x}+\left(\frac{x}{3}+\frac{11}{9}\right)e^x
-\frac{x^2}{2}-\frac{x}{2}-\frac{3}{4}$$
as in (a).

\end{description}

\end{document}
