We had to calculate
$$\begin{equation} \begin{cases} u_{tt}=3u_{xx}+sin\left(2x\right)\\ u\left(x,0\right)=3x^2 \\ u_t\left(x,0\right)=2x \end{cases} \end{equation}$$
So we are looking for a solution of the type $u=u_1+u_2$
We first calculate $u_1$, that's the solution for:
$$\begin{equation} \begin{cases} u_{tt}=3u_{xx}\\ u\left(x,0\right)=3x^2 \\ u_t\left(x,0\right)=2x \end{cases} \end{equation}$$
Using D'Alembert Formula it's $u_1\left(x,t\right)=3x^2+9t^2+2xt$
That was the easier part.
Now, to calculate $u_2$, we first have to find the solution for:
$$\begin{equation} \begin{cases} u_{tt}\left(x,t;s\right)=3u_{xx}\left(x,t;s\right)\\ u\left(x,t;s\right)=0 & s=t\\ u_t\left(x,t;s\right)=sin\left(2x\right) & s=t \end{cases} \end{equation}$$
Which still is easy to calculate (D'Alembert Formula again), we get:
$$\tilde{u}\left(x,t;s\right)=\frac{1}{4\sqrt{3}}\left(cos\left(2x-2\sqrt{3}\left(t-s\right)\right)-cos\left(2x+2\sqrt{3}\left(t-s\right)\right)\right)$$
But to find our $u_2$, we need to calculate
$$u_2\left(x,t\right)=\int _0^t\tilde{u}\left(x,t;s\right)ds=\int^t_0\left(cos\left(2x-2\sqrt{3}\left(t-s\right)\right)-cos\left(2x+2\sqrt{3}\left(t-s\right)\right)\right)ds\:$$
We had like 15 minutes for this exercise to do today, and regarding the last integral, it seems like it was a bit too little time given, doesn't it? Or is there a way to simplify this last integral in such a way that it is a fast and quick calculation?
Or would you approach this exercise completely differently (so that one can easily solve it in 15 minutes)?
Using the identity $\cos x - \cos y = -2\sin\frac{x+y}{2}\sin\frac{x-y}{2}$, we have $$ \int ^t_0\left(\cos\left(2x-2\sqrt{3}\left(t-s\right)\right)-\cos\left(2x+2\sqrt{3}\left(t-s\right)\right)\right)\mathrm{d}s$$ $$\begin{align} &= \int_0^t 2\sin\left(2x\right)\sin\left(2\sqrt 3(t-s)\right)\mathrm ds \\ &= \color{red}{2\sin(2x)}\int_0^t\sin(2\sqrt 3(t-s))\mathrm ds \\ &= \color{red}{2\sin(2x)}\left[\frac{1}{2\sqrt 3}\cos(2\sqrt 3 (t-s))+C\right]_{s=0}^{s=t}\end{align}$$ where the red expression is constant with respect to $s$.
The integral at the last line comes from the fact that $$\int \sin(a+bx)\mathrm dx = -\frac{1}{b}\cos(a+bx)+C$$ In our case, $a = 2\sqrt 3 t$ and $b = -2\sqrt 3$.