Consider a vibrating string with fixed ends, having length $a$, tension $T$, linear density $\sigma$, (longitudinal) coordinate $x$, and transverse displacement $y(x,t)$.
I'm given the following Lagrangian: $$ L = \int_0^a \left[ \frac{\sigma}{2}\left(\frac{\partial y}{\partial t} \right)^2 - \frac{T}{2}\left( \frac{\partial y}{\partial x} \right)^2 \right] dx$$
and, assuming a Fourier series solution of the form: $$y(x,t) = \sqrt{\frac{2}{a}} \sum_{n=1}^\infty \sin\left(\frac{n\pi x}{a}\right) q_n(t)$$
I'm supposed to be able to re-write the Lagrangian as the discrete sum
$$L = \sum_{n=1}^\infty \left[ \frac{\sigma}{2} \dot{q}_n^2 -\frac{T}{2}\left( \frac{n\pi}{a} \right)^2 q_n^2 \right].$$
At first glance, I was expecting a "plug and chug" but realized that I'd have to expand a product of infinite Fourier series to calculate the squared partial derivatives. Should I expand the series, and hope most terms will cancel in the integration? Or is there a shortcut for calculating squares of odd Fourier series like this?
Source: working an old problem set I found online.