Trying to figure out how to use Laplace Transform to find $y(t)$: The problem is $$y''+4y'+4y=f(t)$$ where $f(t) = \cos(\omega t)$ if $0 < t < \pi$ and $f(t)=0$ if $t > \pi$?
Initial conditions are $y(0) = 0$, $y'(0) = 0$.
Using the Laplace Transform: $L[y''] = s^2F(s) -s\cdot y(0) - y'(0)$, $L[y'] = s\cdot F(s) - y(0)$, and $L[y] = F(s)$, I got for the Left Hand Side: $$(s+2)^2\cdot F(s) - 1$$ and for the Right Hand Side, $ \frac{s}{s^2 + w^2} + L[\cos(\omega t + \pi)]$, where $\cos(\omega t + \pi)$, using the identity for $\cos(x+y)$, $=\cos(-\omega t)$
Therefore, the LHS is: $$ \frac{s}{s^2 + w^2} + e^{-πs} \cdot \frac{s}{s^2 + ω^2}$$
For you equation, we have the following Laplace transform \begin{align} \mathcal{L}\{\ddot{y}+4\dot{y}+4y\} &=\mathcal{L}\{\cos(\omega t)\}\\ Y(s)(s + 2)^2 &= \int_0^{\infty}\cos(\omega t)e^{-st}dt\\ &= \int_0^{\pi}\cos(\omega t)e^{-st}dt + \int_{\pi}^{\infty}0\cdot e^{-st}dt \end{align} Now, let's find the Laplace transform of the RHS. Let $u=\cos(\omega t)$ and $dv = e^{-st}dt$ so $du = -\omega\sin(\omega t)dt$ and $v=-\frac{1}{s}e^{-st}$ \begin{align} \int_0^{\pi}\cos(\omega t)e^{-st}dt &= \frac{-\cos(\omega t)e^{-st}}{s}\biggl|_0^{\pi} - \frac{\omega}{s}\int_0^{\pi}\sin(\omega t)e^{-st}dt\\ &= \frac{1}{s}(-\cos(\omega\pi)e^{-s\pi}+1)- \frac{\omega}{s}\int_0^{\pi}\sin(\omega t)e^{-st}dt \end{align} We will do integration by parts again where this time $u=\sin(\omega t)$ so $du = \omega\cos(\omega t)dt$. \begin{align} \int_0^{\pi}\cos(\omega t)e^{-st}dt &= \frac{1}{s}(-e^{-s\pi}\cos(\omega\pi)+1)- \frac{\omega}{s}\Biggl[-\frac{\sin(\omega t)e^{-st}}{s}\biggr|_0^{\pi}+\frac{\omega}{s}\int_0^{\pi}\cos(\omega t)e^{-st}dt\Biggr]\\ &=\frac{1}{s}(-e^{-s\pi}\cos(\omega\pi)+1)+\frac{\omega}{s^2}\sin(\omega\pi)e^{-s\pi}-\frac{\omega^2}{s^2}\int_0^{\pi}\cos(\omega t)e^{-st}dt\\ \Bigl(1+\frac{\omega^2}{s^2}\Bigr)\int_0^{\pi}\cos(\omega t)e^{-st}dt&=\frac{1}{s}(-e^{-s\pi}\cos(\omega\pi)+1)+\frac{\omega}{s^2}\sin(\omega\pi)e^{-s\pi}\\ \int_0^{\pi}\cos(\omega t)e^{-st}dt&=\frac{s + e^{-s\pi}\omega\sin(\omega\pi)-se^{-s\pi}\cos(\omega\pi)}{s^2+\omega^2} \end{align} Thus, the Laplace transform is $$ Y(s) = \frac{s + e^{-s\pi}\omega\sin(\omega\pi)-se^{-s\pi}\cos(\omega\pi)}{(s^2+\omega^2)(s+2)^2} $$