<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\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=r(x),$$
where

$$ r(x)=\left\{
\begin{array}{ll} 0 &amp; \mbox{if\ \ $0&lt; x&lt; 2$};\\ 1 &amp; \mbox{otherwise},\end{array} \right. $$
and where $y(0)=1;\ \ y'(0)=0.$ \vspace{0.5in}

{\bf Solution}

Using the Heaviside function gives $r(x)=H(x-2).$

Transforming the differential equation gives $\displaystyle
p^2\bar{y}-p+\bar{y}=\frac{\mathrm{e}^{-2p}}{p}.$
\begin{eqnarray*}
\bar{y}&amp;=&amp;\frac{\mathrm{e}^{-2p}}{p(p^2+1)}+\frac{p}{p^2+1}\\ &amp;=&amp;
\frac{\mathrm{e}^{-2p}}{p}-\frac{\mathrm{e}^{-2p}.p}{p^2+1}+\frac{p}{p^2+1}\\
y&amp;=&amp;H(x-2)-H(x-2)\cos(x-2)+\cos x.
\end{eqnarray*}



\end{document}
</pre></body></html>