Solve wave equation with Neumann boundary conditions 
Solve the wave equation with Neumann boundary conditions:
  $$\begin{cases}
v_{tt} = c^2 v_{xx} \ \ \text{for} \ \ 0 < x < l\\
v_x(0,t) = v_x(l,t) = 0\\
v(x,0) = x(l - x)\\
v_t(x,0) = x\\
\end{cases}$$
  Your final answer should remain in series form. You can use, without proof, that, for $0 < x < l$,
  $$ x(l - x) = \frac{l^2}{6} + \sum_{n=1}^{\infty}\frac{2 l ^2}{n^2 \pi ^2}((-1)^{n+1} - 1)\cos\left(\frac{n\pi x}{l}\right); \ \ \ x = \frac{l}{2} + \sum_{n=1}^{\infty}\frac{2l}{n^2 \pi^2}((-1)^{n+1} - 1)\cos\left(\frac{n\pi x}{l}\right)$$

Attempted solution - Using separation of variables we have $$v(x,t) = X(x)T(t)$$ This PDE yields $$X(x)T^{\prime \prime} = c^2 X^{\prime\prime}T(t)$$
Rearranging we have $$\frac{1}{c^2}\frac{T^{\prime\prime}}{T(t)} = \frac{X^{\prime\prime}}{X(x)} = -\lambda$$
Rearranging we get 
\begin{equation}
X^{\prime\prime}(x) + \lambda X(x) = 0
\end{equation}
and 
\begin{equation}
T^{\prime\prime}(t) + \lambda c^2 T(t) = 0
\end{equation}
ODE $(1)$ is a Strum-Lioville problem when coupled with boundary conditions 
$$v_x(0,t) = X'(0)T(t) = 0 \Rightarrow X'(0) = 0$$
and 
$$v_x(l,t) = X'(l)T(t) = 0 \Rightarrow X'(l) = 0$$
For $\lambda = 0$ we get $X^{\prime\prime}(x) = 0$. The solution is $X(x) = c_1 + c_2 x$. Applying boundary conditions
\begin{align*}
X'(0) &= c_2 = 0\\
X'(l) &= c_2 = 0\\
\end{align*}
So we have $\lambda_0 = 0$ and $X_0(x) = 1$ as the first eigenvalue and eigenfunction of the system.\
For $\lambda < 0$, say $\lambda = -\mu^2$, $(1)$ becomes
$$X^{\prime\prime}(x) - \mu^2 X(x) = 0$$
$$X'(0) = 0, \ \ X'(l) = 0$$
The characteristic equaiton is $$m^2 - \mu^2 = 0\Rightarrow m = \pm \mu$$
So $X(x) = c_1 e^{-\mu x} + c_2 e^{\mu x}$. Applying boundary conditions.
$$X'(0) = -c_1 + c_2 = 0$$
$$X^{\prime}(l) = -c_1 e^{-\mu l} + c_2 e^{\mu l} = 0$$
Solving for $c_1,c_2$, we get $c_1 = c_2 = 0$. Thus $X(x) = 0$.\
Now for $\lambda > 0$, say $\lambda = \mu^2$ $(1)$ becomes 
$$X^{\prime\prime}(x) + \mu^2 X(x) = 0$$
$$X'(0) = 0, \ \ X'(l) = 0$$
The characteristic equation is $$m^2 + \mu^2 = 0 \Rightarrow m = \pm \mu i$$
So $X(x) = c_1 \cos(\mu x) + c_2 \sin(\mu x)$. Applying boundary conditions, 
\begin{align*}
X'(0) &= c_2 = 0\\
X'(l) &= -\mu c_1 \sin(\mu l) = 0
\end{align*}
For $c_1 \neq 0$, 
\begin{align*}
\sin(\mu l) &= 0\\
\sin(\mu l) &= \sin(n\pi) \ \ n = 1,2,\ldots\\
\Rightarrow \mu l &= n \pi\\
\mu &= \frac{n\pi}{l}
\end{align*}
Thus we have eigenvalues $\lambda_n = \frac{n^2 \pi^2}{l^2}$, and corresponding eigenfunction $X_n(x) = \cos\left(\frac{n\pi x}{l} \right) n = 1,2,\ldots$. Noew we can solve $(2)$ for $T(t)$ using $\lambda_n = \frac{n^2 \pi^2}{l^2}$
$$T^{\prime\prime}(t) + \frac{n^2 \pi^2}{l^2}c^2 T(t) = 0$$
The characteristic equation being $$m^2 + \frac{n^2\pi^2 c^2}{l^2} = 0 \Rightarrow m = \pm \frac{n\pi c}{l}i$$
So 
$$T_n(t) = a_n\cos\left( \frac{n\pi c}{l} t\right) + b_n \sin\left( \frac{n\pi c}{l}t \right) \ \ n = 1,2,\ldots$$
For $n = 0$, we get $T^{\prime\prime}(t) = 0$ $$T_0(t) = a_0 + b_0 t$$
The solution is now ready to be expressed in series form
$$u(x,t) = (a_0 + b_0 t) + \sum_{n=1}^{\infty}\left[a_n \cos\left(\frac{n\pi c}{l}t \right) + b_n \sin\left(\frac{n\pi c}{l}t \right) \right]\cos\left(\frac{n\pi x}{l} \right)$$
All is left is to determine the coefficients $a_n$,$b_n$. This can be done by the initial conditions 
$$v(x,0) = a_0 + \sum_{n=1}^{\infty}a_n\cos\left(\frac{n\pi x}{l} \right) = x(l-x)$$
In other words, the Fourier cosine series of $x(l-x)$ which is given by $$x(l-x) = \frac{l^2}{6} + \sum_{n=1}^{\infty}\frac{2 l^2}{n^2 \pi^2}((-1)^{n+1} - 1)\cos\left(\frac{n\pi x}{l} \right)$$
Equating coefficients, we get 
$$a_0 = \frac{l^2}{6}, \ \ a_n = \frac{2 l^2}{n^2 \pi^2}((-1)^{n+} - 1)$$
Next,
$$v_t(x,0) = b_0 + \sum_{n=1}^{\infty}\frac{n \pi c}{l} b_n \cos\left(\frac{n\pi x}{l} \right) = x$$
Again a Fourier cosine series, which is given by
$$x = \frac{l}{2} + \sum_{n=1}^{\infty}\frac{2 l}{n^2 \pi^2}((-1)^n - 1)\cos\left(\frac{n\pi x}{l} \right)$$
Equating coefficients we get 
$$b_0 = \frac{l}{2}, b_n = \frac{2l}{n^2 \pi^2}((-1)^n - 1)$$
Thus finally, 
$$v(x,t) = \frac{l^2}{6} + \frac{l}{2}t + \sum_{n=1}^{\infty}\left[\frac{2 l^2}{n^2 \pi^2}((-1)^{n+1} - 1)\cos\left(\frac{n\pi c}{l}t \right) + \frac{2l}{n^2 \pi^2}((-1)^{n} - 1)\sin\left(\frac{n\pi c}{l}t \right) \right]\cos\left(\frac{n \pi x}{l} \right)$$
I know this is long, but I just wanted to check if this is correct. Any suggestions are greatly appreciated. 
 A: Solve the wave equation with  initial and boundary conditions:
\begin{cases}
v_{tt} = c^2 v_{xx} \ \ \text{for} \ \ 0 < x < l\\
v(x,0) = \varphi(x)\qquad\qquad\qquad\qquad   (1)\\
v_t(x,0) = \psi(x)\\
+\text{"boundary conditions"}\\
\end{cases}


*

*Solve eigenvalue problem
$$-X''_k=\lambda_k X_k$$
with "boundary conditions".

*Find eigenvalue expansions
$\varphi(x)=\sum\varphi_kX_k,\quad \psi(x)=\sum\psi_kX_k$,
$$\varphi_k=\frac{1}{\|X_k\|^2}\langle \varphi,X_k\rangle,\quad
\psi_k=\frac{1}{\|X_k\|^2}\langle \psi,X_k\rangle.
$$
Here $\|u\|^2=\int_0^lu^2dx,\quad \langle u,v\rangle=\int_0^luvdx$.

*Solve ode problems
$$T''_k(t)+c^2\lambda_kT_k(t)=0,\;T_k(0)=\varphi_k,\;T'_k(0)=\psi_k.$$

*Then solution of problem  $(1)$ is
$$v=\sum T_k(t)X_k$$


In our case


*

*$$\lambda_k=(\pi k)^2,\quad X_k=\cos{\left( \frac{k\pi  x}{l}\right) },\;k=0,\,1,\,2,\,\ldots$$

*$$\varphi_0=\frac{l^2}{6},\quad\psi_0=\frac l2$$
$$\varphi_k=-\frac{2 \left( {{\left( -1\right) }^{k}}+1\right) \, {{l}^{2}}}{{{\pi }^{2}}\, {{k}^{2}}},\quad\psi_k=\frac{2 \left( {{\left( -1\right) }^{k}}-1\right)  l}{{{\pi }^{2}}\, {{k}^{2}}},\;k=1,\,2,\,\ldots$$

*if $k=0$ solve ode 
$T''(t)=0,\;T(0)=\frac{l^2}{6},\;T'(0)=\frac l2$, $\quad\Longrightarrow\quad$ $T_0(t)=\frac{l t}{2}+\frac{{{l}^{2}}}{6}$


if $k>0$ solve ode
$$T''(t)+c^2(\pi k)^2\,T(t)=0,\;T(0)=\varphi_k,\;T'(0)=\psi_k$$
$\quad\Longrightarrow\quad$
$$T_k(t)=\varphi_k \cos{\left( \frac{\pi c k t}{l}\right)+\psi_k\frac{ l \sin{\left( \frac{\pi c k t}{l}\right) }}{\pi c k} }$$
Final solution is
$$v=\sum_{k=0}^\infty T_k(t)X_k=\frac{l t}{2}+\frac{{{l}^{2}}}{6}\\
 +\sum_{k=1}^{\infty }{\left. \left( \frac{2 \left( {{\left( -1\right) }^{k}}-1\right) \, {{l}^{2}} \sin{\left( \frac{\pi c k t}{l}\right) }}{{{\pi }^{3}} c\, {{k}^{3}}}-\frac{2 \left( {{\left( -1\right) }^{k}}+1\right) \, {{l}^{2}} \cos{\left( \frac{\pi  c k t}{l}\right) }}{{\pi^{2}}\, {{k}^{2}}}\right)  \cos{\left( \frac{\pi  k x}{l}\right) }\right.}.
$$
