# need help with separation or variable to solve wave equation

If you are given, $\frac{\partial^2 u}{\partial t^2} = k^2 \frac{\partial^2 u}{\partial x^2}$ ( $k>0$)
With boundary conditions $u(0,t) = u(\pi,t) = 0$.
And with initial conditions $u(x,0) = f(x)$ and $u_t(x,0) = g(x)$.
Where $f(x) = \sum_{n=1}^N b_n \sin (nx)$ and $g(x) = \sum_{n=1}^N a_n \sin (nx)$.
$u(x,t) = \sum_{n=1}^N \left[ \frac{a_n}{kn} \sin (nt) + b_n \cos (nt) \right] \sin (nx)$