I have been given the following initial value problem.
$y'' + 4y = f(t)$
$y(0)=3,y'(0)=-1$
I need to use the Laplace transform to show that the answer is of the form:
$y=A\cos(2t) + B\sin(2t) + \frac{1}{2}\int_{0}^{t}f(\tau)\sin(2(t-\tau))d\tau$
I then need to deduce the value of the integral :
$\int_{0}^{t}\tau\sin(2(t-\tau))$
My working so far is using the normal method with the transform of both sides.
$s^2Y(s) - 3s + 1 + Y(s) = \int_{-infty}^{infty}e^{-st}f(t)dt$
Re-arranging we get:
$Y(s) = \frac{\int_{-\infty}^{\infty}e^{-st}f(t)dt}{s^2+1} + \frac{3s}{s^2 + 1} - \frac{1}{s^2 + 1}$
I get that the inverse transforms of the two fractions on the right-hand side are $3\cos(t)$ and $-\sin(t)$ but I am unsure what I am supposed to do with the integral of the arbitrary function or how to obtain the given result, as the sinusoidal terms look wrong anyway
Is there some result I am missing? I can see a shift in the final exponential so is the shift theorem involved somewhere? The textbook I am using is of no help and goes off on a tangent about circuits. The videos and examples from textbooks are just simple examples with 0 or an exponential on the RHS where you solve by doing a partial fraction decomposition to get the final answer.
Firstly : you have forgotten coefficient $4$ in your fifth equation which should be :
$$\tag{1}s^2Y(s) - 3s + 1 + 4Y(s) = F(s)$$
Comment: Instead of coming back to the Laplace Transform definition, I write as $F(s)$ the Laplace Transform of $f(t).$
Thus,
$$\tag{2}Y(s) =3\frac{s}{s^2 + 2^2} - \dfrac{3}{2}\frac{2}{s^2 + 2^2}+ \dfrac{1}{2}F(s) \times \frac{2}{s^2+2^2}$$
Now, applying the inverse Laplace Transform to (2) we get:
$$y(t)=3\cos(2t) - \dfrac{3}{2}\sin(2t) + \frac{1}{2}f(t) \star \sin(2t) $$
because the inverse Laplace Transform of a product of two $s$-expressions is the convolution (notation $\star$) of their inverse Laplace Transforms.
Indeed, this convolution can be written :
$$f(t) \star \sin(2t) \ = \ \int_{0}^{t}f(\tau)\sin(2(t-\tau))d\tau,$$
the defining formula for the so-called one-sided convolution being :
$$f(t) \star g(t) \ = \ \int_{0}^{t}f(\tau)g(t-\tau)d\tau$$
See this MIT document.
Following our exchanges, here is a MatLab program displaying a numerical way to get a convolution; I have taken your example with $f(t):=t$ (it is true that in this case there is an explicit expression which is $\tfrac12t-\tfrac14 \sin(2t)$).