Solution (source code)

= Solution

For a mode $y_n=A_n\sin(n\pi x/L)\cos(\omega_nt)$, integrate the kinetic-energy density:
$$
K_n(t)=\frac\rho2\int_0^L(\partial_ty_n)^2dx=\frac{\rho L A_n^2\omega_n^2}{4}\sin^2(\omega_nt).
$$
Here $A_1=1$, $A_3=-1/3$ and $\omega_3=3\omega_1$, so
$$
\boxed{K_1(t)=\frac{T\pi^2}{4L}\sin^2\frac{\pi ct}L,\qquad K_3(t)=\frac{T\pi^2}{4L}\sin^2\frac{3\pi ct}L.}
$$
All other modes have zero energy. The <equal modal energies for inverse-harmonic string amplitudes> give each excited mode total energy $T\pi^2/(4L)$, even though their displacement amplitudes differ. The corresponding potential energy replaces sine squared by cosine squared, so their sum recovers the constant total energy from part (a).