Using Laplace Transform to solve a equation with piecewise function Using Laplace Transform to solve$$y''+4y=f$$ Where $y(0)=0, y'(0)=-1,$ and:$$f(t)=\begin{cases}\cos(2t)&\text{if $0\le t \lt \pi$}\\0 &\text{otherwise}\\\end{cases}
$$
Do I need to solve the question on different interval of $f$? If so, how to tansform back?
what is the integral interval for $s$ in the inverse transform?
 A: Before we worry about the inverse Laplace transform, let's first determine take the Laplace transform of your ODE.
\begin{align}
\mathcal{L}\{\ddot{y}+4y\}(s) &= \mathcal{L}\{f(t)\}(s)\\
s^2Y(s)+4Y(s)-sy(0)-\dot{y}(0) &= \int_0^{\infty}f(t)e^{-st}dt\\
Y(s)(s^2+4)+1&= \int_0^{\pi}\cos(2t)e^{-st}dt + \int_{\pi}^{\infty}0\cdot e^{-st}dt\\
Y(s)(s^2+4) &= \frac{s(1-e^{-s\pi})}{s^2+4}-1\\
Y(s) &= \frac{s(1-e^{-s\pi})}{(s^2+4)^2}-\frac{1}{s^2+4}
\end{align}
Now let's consider the inverse Laplace transform.
\begin{align}
y(t)&=\frac{1}{2i\pi}\int_{\gamma-i\infty}^{\gamma+i\infty}\frac{se^{st}}{(s^2+4)^2}ds-\frac{1}{2i\pi}\int_{\gamma-i\infty}^{\gamma+i\infty}\frac{se^{s(t-\pi)}}{(s^2+4)^2}ds\\
&-\frac{1}{2i\pi}\int_{\gamma-i\infty}^{\gamma+i\infty}\frac{e^{st}}{s^2+4}ds\tag{1}
\end{align}
The first and third integrals of equation $(1)$ should be no trouble and evaluate to
$$
\frac{\sin(2t)}{4}(t-2)
$$
since the first integral has two poles of order two at $s=\pm 2i$, and for the third integral, two poles of order one at $s=\pm 2i$. Let's consider the second integral then. In the time domain, we will have a problem with convergence if $e^{s(t-\pi)}\to\infty$; therefore, we need $s(t-\pi)<0\iff t<\pi$ which leads to the shifted unit step function $\mathcal{U}(t-\pi)$. The second integral is then 
\begin{align}
-\frac{1}{2i\pi}\int_{\gamma-\infty}^{\gamma+i\infty}\frac{se^{s(t-\pi)}}{(s^2+4)^2}ds &=-\lim_{s\to 2i}\frac{d}{ds}(s-2i)^2\frac{se^{s(t-\pi)}}{(s^2+4)^2}\mathcal{U}(t-\pi)\\
&-\lim_{s\to -2i}\frac{d}{ds}(s+2i)^2\frac{se^{s(t-\pi)}}{(s^2+4)^2}\mathcal{U}(t-\pi)\\
&=-\frac{\sin(2t)}{4}(t-\pi)\mathcal{U}(t-\pi)
\end{align}
Combining the result we have that
$$
\mathcal{L}^{-1}\{F(s)\}(t) = \frac{\sin(2t)}{4}(t-2-(t-\pi)\mathcal{U}(t-\pi))
$$
A: The Laplace transform for $f(t)$ is defined as
$$F(s) = \int_0^\infty f(t) e^{-st}\ dt.$$
For your function, $f(t) \equiv 0$ for $t \ge \pi$. As such, $\int_\pi^\infty f(t)e^{-st}\ dt - \int_\pi^\infty 0\ dt = 0.$
