Initial Value Problem involving Laplace Transforms I am trying to solve the initial value problem:
$y' + 5y = $
0 if $t \in [0,3]$
9 if $3 \in [3,6)$
0 if $t \in [6, \infty)$.
with $y(0)=9$.
I am asked to take the Laplace Transform of both sides which I have done. I then get $sY(s) - 9 + 5Y(s)$ on the left side of the equality (which I've verified is correct) however I do not know what to do for Laplace transform of the piece-wise function on the right-hand side of the equality.
I had thought about using the heaviside function and try letting the right-hand side $\mathcal{L}\{9(\theta(t-3)-\theta(t-6))\} = 9[e^{-6s}-e^{-3s}]$ but it was apparently incorrect.
Another strategy I'm trying to do is to use the integral-definition of the Laplace Transform and to consider 9$\int_{3}^{6}e^{-st} dt$ = $9[\dfrac{e^{-6s}-e^{-3s}}{s}]$ however I am not sure if I have set up the integral correctly. Help is appreciated.
 A: Consider the first order equation $y' + a y = f(t)$ where
\begin{align}
f(t) = \left\{ \begin{array}{cc} 0 & t \in [0,3) \\ 9 & t \in (3,6) \\ 0 & t \in (6, \infty] \end{array} \right.
\end{align}
with initial condition $y(0) = b$. Now,
\begin{align}
\mathcal{L}\{ y' + a y \} &= \int_{0}^{\infty} e^{-st} ( y' + ay) \, dt \\
&= s \overline{y} + a \overline{y} - y(0)
\end{align}
and
\begin{align}
\mathcal{L}\{f(t) \} &= \int_{0}^{3} e^{-st} (0) \, dt + \int_{3}^{6} e^{-st} (9) \, dt + \int_{6}^{\infty} e^{-st} (0) \, dt \\
&= 9 \, \int_{3}^{6} e^{-st} \, dt = \frac{9}{s} \left( e^{-6s} - e^{-3s} \right).
\end{align}
The right and left sides have been calculated and can now be utilized in the following way. 
\begin{align}
(s+a) \overline{y} = y(0) + \frac{9}{s} \left( e^{-6s} - e^{-3s} \right)
\end{align}
or
\begin{align}
\overline{y} = \frac{y(0)}{s+a} + \frac{9}{s(s+a)} \left( e^{-6s} - e^{-3s} \right).
\end{align}
Inversion leads to
\begin{align}
y(t) = y(0) \, e^{-at} + 9 \, \mathcal{L}^{-1}\left\{ \frac{e^{-6s} - e^{-3s}}{s(s+a)} \right\}
\end{align}
From the use of 
\begin{align}
\mathcal{L}\{e^{-p(t-c)} \, H(t-c) \} = \frac{e^{-c s}}{s+p}
\end{align}
and
\begin{align}
\mathcal{L}\left\{ \int_{0}^{t} f(u) \, du \right\} = \frac{F(s)}{s}
\end{align}
then it is seen that
\begin{align}
\mathcal{L}^{-1} \left\{ \frac{e^{-6s}}{s(s+a)} \right\} &= \int_{0}^{t} e^{-a(u-6)} \, H(u-6) \, du = \int_{6}^{t} e^{-a(u-6)} \, du = \left[ \frac{e^{-a(u-6)}}{-a} \right]_{6}^{t} \\
&= \frac{1}{a} \left( 1 - e^{-a(t-6)} \right).
\end{align}
Applying the same to the remaining part leads to the solution
\begin{align}
y(t) = y(0) \, e^{-at} + \frac{9}{a} \left[ e^{-a(t-3)} - e^{-a(t-6)} \right] 
\end{align}
or
\begin{align}
y(t) = y(0) \, e^{-at} - 2 \, \sinh\left(\frac{3a}{2}\right) \, e^{-a\left(t - \frac{9}{2}\right)}.
\end{align}
The proposed question uses $a=5$ and $y(0)=9$ for which
\begin{align}
y(t) = 9 \, e^{-5t} + \frac{9}{5} \left( e^{-5(t-3)} - e^{-5(t-6)} \right).
\end{align}
