\documentclass[a4paper,12pt]{article}
\setlength\oddsidemargin{0pt} \setlength\evensidemargin{0pt}
\setlength\topmargin{0pt}
\begin{document}
\parindent=0pt
{\bf Exam Question

Topic: LaplaceODE}

Find the solution of the differential equation $$y''-y'-2y=f(x),$$
where

$$ f(x)=\left\{
\begin{array}{ll} 1 & \mbox{if\ \ $0\le x\le 2$};\\ 0 & \mbox{otherwise},\end{array} \right. $$
and where $y(0)=y'(0)=0.$ \vspace{0.5in}

{\bf Solution}

Using the Heaviside function we can write $f(x)=1-H(x-2).$

Transforming the differential equation gives
\begin{eqnarray*}
y''-y'-2y&=&1-H(x-2)\\
p^2\bar{y}=p\bar{y}-2\bar{y}&=&\frac{1}{p}\left(1-\mathrm{e}^{-2p}\right)
\end{eqnarray*}
Rearranging this equation gives
\begin{eqnarray*}
\bar{y}&=&\frac{1}{p(p-2)(p+1)}\left(1-\mathrm{e}^{-2p}\right)\\
&=&\left(-\frac{1}{2p}+\frac{1}{6(p-2)}+\frac{1}{3(p+1)}\right)\left(1-\mathrm{e}^{-2p}\right)
\end{eqnarray*}

$$\mathrm{So}\ \
y=-\frac{1}{2}+\frac{\mathrm{e}^{2x}}{6}+\frac{\mathrm{e}^{-x}}{3}
+\left(-\frac{1}{2}+\frac{\mathrm{e}^{2(x-2)}}{6}+\frac{\mathrm{e}^{-(x-2)}}{3}\right)H(x-2).$$


\end{document}
