Here we're interested in solving the one-dimensional case of the wave equation:
$$\frac{\partial^2u}{\partial t^2}=a^2\frac{\partial^2u}{\partial x^2}$$Since this is a boundary-value problem we find Dirichlet boundary conditions for \(x\) and Cauchy for \(t\):$$u(0,t)=0,u(\pi,t)=0\\u(x,0)=0, \partial u/\partial t(x,0)=\sin x$$Presume our solution \(u(x,t)\) is completely separable i.e. \(u(x,t)=F(x)G(t)\) and thus \(\partial^2u/\partial x^2=F''(x)G(t),\partial^2u/\partial t^2=F(x)G''(t)\):$$F(x)G''(t)=a^2 F''(x)G(t)\implies \frac{F''(x)}{F(x)}=\frac{G''(x)}{a^2G(x)}$$Since \(x,t\) are independent, we know these ratios are equal to a constant -- in particular, a *separation constant* \(-\lambda^2\):$$\frac{F''(x)}{F(x)}=-\lambda^2\implies F''(x)+\lambda^2 F(x)=0\\\frac{G''(t)}{a^2G(t)}=-\lambda^2\implies G''(t)+a^2\lambda^2G(t)=0$$These are both trivial and yield solutions \(F(x)=c_1\cos\lambda x+c_2\sin\lambda x,G(t)=c_3\cos a\lambda t+c_4\sin a\lambda t\). Now, let's satisfy our boundary conditions:$$u(0,t)=0\implies F(0)=0\implies c_1=0\\u(\pi, t)=0\implies F(\pi) = 0\implies \lambda \text{ is an integer}\\u(x,0)=0\implies G(0)=0\implies c_3=0$$.. so we have so far \(F(x)=c_2\sin\lambda x,G(t)=c_4\sin a\lambda t\). Since \(\lambda\) can be any integer, by super position we have:$$F(x)=\sum_{\lambda=1}^{\infty}c_{2,\lambda}\sin\lambda x\\G(t)=\sum_{\lambda=1}^\infty c_{4,\lambda}\sin a\lambda t\\\implies u(x,t)=\sum_{\lambda=1}^\infty c_\lambda\sin\lambda t\sin a\lambda t$$