Solution (source code)

= Solution

For $k>0$, the <harmonic oscillator equation> gives $X=C\sin(kx)+D\cos(kx)$. The condition at zero requires $D=0$, and the condition at $L$ requires $C\sin(kL)=0$. A nonzero <normal mode> therefore has
$$
\boxed{k_n=\frac{n\pi}{L},\qquad X_n(x)=\sin\frac{n\pi x}{L},\qquad n=1,2,\ldots.}
$$
A multiplicative normalization has been absorbed into the temporal amplitude. The $k=0$ candidate is affine and the two zero endpoint values force it to vanish. A positive separation constant gives hyperbolic functions, whose two zero endpoint values likewise give only the trivial solution. Negative $n$ adds no new <eigenfunctions> because it only reverses their signs.