Solve u_(tt)=a^2u_(xx) with u(0,t)=u(l,t)=0 , u(x,0)=f(x)…
Solve $u_{tt}=a^2u_{xx}$ with $u(0,t)=u(l,t)=0$, $u(x,0)=f(x)$, $u_t(x,0)=\varphi(x)$.
Explanation of Method
Separate variables $u=X(x)T(t)$; the fixed-end boundary conditions select a discrete set of sine eigenfunctions, and the two initial conditions determine the Fourier coefficients of the superposition.
Step 1 · Separate variables
Substituting $u=XT$ gives $T''/(a^2T)=X''/X=-\lambda$, so \[ X''+\lambda X=0,\qquad T''+a^2\lambda T=0. \]
Step 2 · Solve the spatial eigenvalue problem
With $X(0)=X(l)=0$ and $\lambda=\mu^2>0$: $X=A\sin\mu x$, and $\sin\mu l=0$ forces \[ \mu_n=\frac{n\pi}{l},\qquad X_n(x)=\sin\frac{n\pi x}{l},\quad n=1,2,\ldots \]
Step 3 · Solve the temporal equation and superpose
$T_n=C_n\cos\dfrac{n\pi at}{l}+D_n\sin\dfrac{n\pi at}{l}$, so \[ u(x,t) = \sum_{n=1}^\infty\left(C_n\cos\frac{n\pi at}{l}+D_n\sin\frac{n\pi at}{l}\right)\sin\frac{n\pi x}{l}. \]
Step 4 · Fix the coefficients from the initial data
$u(x,0)=f(x)$ gives the sine-series coefficients $C_n$; $u_t(x,0)=\varphi(x)$ gives $D_n$: \[ C_n=\frac2l\int_0^lf(x)\sin\frac{n\pi x}{l}\,dx,\qquad D_n=\frac{2}{n\pi a}\int_0^l\varphi(x)\sin\frac{n\pi x}{l}\,dx. \]
Remark: d'Alembert form
Using product-to-sum identities and the Fourier representations of $f,\varphi$ (extended as odd, $2l$-periodic functions), the series can be recast as \[ u(x,t) = \frac{f(x+at)+f(x-at)}{2}+\frac{1}{2a}\int_{x-at}^{x+at}\varphi(\xi)\,d\xi. \]
Result
The solution is: