Solving wave equation by fourier method I'm trying solve this wave equation using Fourier method, but I am stuck...
$${ u }_{ tt } ={ c }^{ 2 }{ u }_{ xx } - \alpha{ u } =0, \  0<x\le L, t  >0 $$
$${ u }( 0,t) = { u }( L,t) = 0$$
$${ u }( x,0) = f(x), { u }_{ t }( x,0) = g(x) $$
I know that first I have to use variable separation:
$${ u }( x,t) = T(t)X(x) $$
Making the calculations
$$\frac{T''+ \alpha T}{c^{2}T} = \frac{X''}{X} = -\lambda  $$
I guess I'm right at this point?Ok? Now I have to solve:
$$X'' + \lambda X = 0$$
and
$$\frac{T'' + \alpha T}{c^{2}T}  = -\lambda$$
I don't know how to solve the second equation and how I add the two equations to solve the first problem. 
I will be very grateful for the help!!!!
 A: For the equation
$$u_{tt} = c^{2} \, u_{xx} -\alpha u, \,  0<x\leq L, t>0$$
$$u(0,t) = u(L,t) = 0$$
$$u(x,0) = f(x), \, u(x,L) = g(x)$$
let $u(x,t) = F(x) G(t)$ for which
\begin{align}
\frac{1}{c^{2}} \left( \frac{G''}{G} + \alpha \right) = - \lambda^{2} = \frac{F''}{F}
\end{align}
or 
\begin{align}
F'' + \lambda^{2} \, F &= 0 \\
G'' + (\alpha + \lambda^{2} c^{2}) G &= 0
\end{align}
The solutions are
\begin{align}
F(x) &= A_{1} \, \cos(\lambda x) + B_{1} \, \sin(\lambda x) \\
G(t) &= A_{2} \, \cos(\sqrt{\alpha + \lambda^{2} c^{2}} \, t) + B_{2} \, \sin(\sqrt{\alpha + \lambda^{2} c^{2}} \, t) 
\end{align}
The conditions are given by $F(0) = F(L) = 0$ for which
\begin{align}
F(x) = B_{1} \sin\left(\frac{n \pi x}{L}\right).
\end{align}
The general series solution is of the form
\begin{align}
u(x,t) = \sum_{n=1}^{\infty} \left(A_{n} \, \cos(\sqrt{\alpha + \lambda^{2} c^{2}} \, t) + B_{n} \, \sin(\sqrt{\alpha + \lambda^{2} c^{2}} \, t) \right) \, \sin\left(\frac{n \pi x}{L}\right).
\end{align}
Since $u(x,0) = f(x)$ then
\begin{align}\tag{1}
f(x) = \sum_{n=1}^{\infty} A_{n} \, \sin\left(\frac{n\pi x}{L}\right)
\end{align}
for which the coefficients $A_{n}$ may be obtained. The remaining condition is
$u(x,L) = g(x)$ for which
\begin{align}\tag{2}
g(x) = \sum_{n=1}^{\infty} \left( A_{n} \, \cos(\sqrt{\alpha L^{2} + n^{2} \pi^{2}}) + B_{n} \, \sin(\sqrt{\alpha L^{2} + n^{2} \pi^{2}}) \right) \, \sin\left(\frac{n \pi x}{L}\right).
\end{align}
Since $A_{n}$ can be obtained from (1) the coefficients $B_{n}$ can be obtained from (2). It may be more usefull to "shift" the coefficients in (2) by making use of $C_{n} = A_{n} \, \cos(\sqrt{\alpha L^{2} + n^{2} \pi^{2}})$
and $D_{n} = B_{n} \, \sin(\sqrt{\alpha L^{2} + n^{2} \pi^{2}})$ for which
$P_{n} = C_{n} + D_{n}$ and 
\begin{align}\tag{3}
g(x) = \sum_{n=1}^{\infty} P_{n} \, \sin\left(\frac{n \pi x}{L}\right)
\end{align}
Coefficients
By use of Fourier Sine series it can be seen that
\begin{align}
A_{n} &= \frac{2}{L} \, \int_{0}^{L} f(x) \, \sin\left(\frac{n \pi x}{L}\right) \, dx \\
P_{n} &= \frac{2}{L} \, \int_{0}^{L} g(x) \, \sin\left(\frac{n \pi x}{L}\right) \, dx.
\end{align}
$B_{n}$ is found to be
\begin{align}
B_{n} &= \frac{2}{L} \, \int_{0}^{L} \left( \cot(\sqrt{\alpha L^{2} + n^{2} \pi^{2}}) \, f(x) + \csc(\sqrt{\alpha L^{2} + n^{2} \pi^{2}}) \, g(x) \right) \, \sin\left(\frac{n \pi x}{L}\right)
\end{align}
