Non-homogeneous wave equation We have the following problem: 
$$v_{tt}=c^2v_{xx}+f(x,t), \ \ 0<x<\ell , \  t>0 \\ v(x,0)=\phi (x) , \ \ 0\leq x\leq \ell \\ v_t(x,0)=\psi (x) , \ \ 0\leq x\leq \ell \\ v_x(0,t)=v_x(\ell , t)=0 , \ \ t\geq 0$$ The general solution is of the form $$v(x,t)=u(x,t)+w(x,t)$$ where $u(x,t)$ is the solution of teh homogeneous differential equation $u_{tt}=c^2u_{xx}$. 
So, we have to solve the following two problems: 
The first one is: 
$$u_{tt}=c^2u_{xx}, \ \ 0<x<\ell , \  t>0 \\ u(x,0)=\phi (x)-w(x,0) , \ \ 0\leq x\leq \ell \\ u_t(x,0)=\psi (x)-w_t(x,0) , \ \ 0\leq x\leq \ell \\ u_x(0,t)=u_x(\ell , t)=0 , \ \ t\geq 0$$ 
and the second problem is: 
$$w_{tt}=c^2w_{xx}+f(x,t), \ \ 0<x<\ell , \  t>0 \\ w(x,0)=0 , \ \ 0\leq x\leq \ell \\ w_t(x,0)=0, \ \ 0\leq x\leq \ell \\ w_x(0,t)=w_x(\ell , t)=0 , \ \ t\geq 0$$ 
Right? Or do we have to do something else? 
Is everything is correct so far, the solution of the first problem can we found by d'Alembert's formula, or not? 
How can we solve the second problem? 
 A: d'Alembert's formula is for free space, so you won't have much luck with it. Even if you are able to find a solution, the B.C.s will not match up and you'll need another function to subtract off the boundary values. Overall, this results in a worse problem than before.
Here's a method that will work:
Note that the B.C.s are homogeneous. This suggests decomposing the solution into
$$ u(x,t) = \sum_{\lambda} T_\lambda(t) X_\lambda(x) $$
where $X\lambda(x)$ are eigenfunctions of the homogeneous problem
$$ X'' + \lambda^2X = 0 $$
$$ X'(0) = X'(\ell) = 0 $$
Solving this, you'll find
$$ X_n(x) = \cos(\lambda_nx) $$
$$ \lambda_n = \frac{n\pi}{\ell}, \quad n =0,1,2,\dots $$
This decomposition works because the $x$ eigenfunctions form a complete solution space in $[0,\ell]$. Plugging this in yields
$$ u(x,t) = \sum_{n=0}^\infty T_n(t)\cos(\lambda_n x) $$
with the equation
$$ u_{tt} - c^2u_{xx} = \sum_{n=0}^\infty \big[{T_n}''(t) + c^2{\lambda_n}^2T_n(t)\big]\cos(\lambda_nx) = f(x,t) $$
and initial values
\begin{align}
u(x,0) &= \sum_{n=0}^\infty T_n(0)\cos(\lambda_nx) = \phi(x) \\
u_t(x,0) &= \sum_{n=0}^\infty {T_n}'(0)\cos(\lambda_nx) = \psi(x)
\end{align}
If you decompose these functions into their respective Fourier series, i.e.
\begin{align}
f(x,t) &= f_0(t) + \sum_{n=1}^\infty f_n(t) \cos(\lambda_n x) \\
\phi(x) &= \phi_0 + \sum_{n=1}^\infty \phi_n \cos(\lambda_n x) \\
\psi(x) &= \psi_0 + \sum_{n=1}^\infty \psi_n \cos(\lambda_n x)
\end{align}
Then we have the following family of ODEs that you can solve
$$ {T_n}'' + c^2{\lambda_n}^2 T_n = f_n(t) $$
$$ T_n(0) = \phi_n, \ {T_n}'(0) = \psi_n $$
Edit: The general solution is
\begin{align} 
T_n(t) &= \phi_n\cos\big(c\lambda_n t\big) + \frac{\psi_n}{c\lambda_n}\sin\big(c\lambda_n t\big) \\
&\quad - \frac{\cos\big(c\lambda_n t\big)}{c\lambda_n}\int_0^t \sin\big(c\lambda_n\tau\big)f_n(\tau)d\tau \\
&\quad + \frac{\sin\big(c\lambda_n t\big)}{c\lambda_n}\int_0^t \cos\big(c\lambda_n\tau\big)f_n(\tau)d\tau 
\end{align}
