I want to solve $$v_{tt}(x,t) - v_{xx}(x,t) = -\left(\frac{3}{4} \cos(t) + \frac{1}{4} \cos(3t)\right) \sin(x)$$ with boundary conditions $$v(0,t) = v(\pi,t) = 0$$ and initial conditions $$v(x,0) = v_t(x,0) = 0.$$
I know that the solution must be of the form $v = v_h + v_p$, where $v_h$ is the solution of the homogeneous equation and $v_p$ is a particular solution.
Given the homogeneous equation and the BC and IC, it follows that $v_h = 0$. We therefore need to find a particular solution.
Is it justified to make the ansatz $v_p = A(t)B(x)$? If I expand B(x) into a Fourier series, is it justified to say that the only term surviving is the $c\sin(x)$ term, given the RHS? What can I say about A(t)?
Split up the solution to $v = w_1 + w_2 + u$ such that $u$ is homogeneous and $w_1$, $w_2$ are 2 particular solutions:
\begin{align} w_{1tt}-w_{1xx} &= -\frac34\cos t\sin x \\ w_{2tt}-w_{2xx} &= -\frac14\cos 3t\sin x \end{align}
The second particular solution is easy enough, it has the same form as the RHS function: $$w_2(x,t) = A\cos 3t\sin x $$
For the first particular solution, this guess will not work since $\cos t\sin x$ is a homogeneous solution. Think back to when you were solving ODEs, if we came across a similar situation, i.e
$$ y'' + y = \cos x $$
where the RHS is a homogeneous solution, we would add a factor of $x$ (the independent variable) to our particular guess, so it's $y_p(x) = Ax\cos x + Bx\sin x$. We can sort of do the same here, by adding either a factor of $t$ or $x$ into our particular solution, so $w_1$ can have one of these forms:
Ideally, we would like for this solution to also satisfy the boundary conditions, i.e. $w_1(0,t) = w_1(\pi,t)=0$ so as to not cause more problems down the line. Hence, the second particular form is superior. Plug that into the PDE to find the constants $A$, $B$.
Once you've found both particular solutions, it remains to solve
\begin{cases} u_{tt} - u_{xx} = 0 \\ u(0,t) = u(\pi,t) = 0 \\ u(x,0) = -w_1(x,0) - w_2(x,0) \\ u_t(x,0) = -w_{1t}(x,0) - w_{2t}(x,0) \end{cases}
which you can use separation of variables.