So, the Lagrangian governing the time evolution of the transverse displacement ##y(x,t)## is ##L = \int_{0}^{a} dx \bigg[ \frac{\sigma}{2} \Big( \frac{\partial y}{\partial t}\Big)^{2} - \frac{T}{2} \Big( \frac{\partial y}{\partial x}\Big)^{2} \bigg]##.
Now, the displacement ##y(x,t)## can be expressed as a sine series Fourier expansion of the form ##y(x,t) = \sqrt{\frac{2}{a}} \sum_{n=1}^{\infty} \text{sin} \big(\frac{n\pi x}{a}\big) q_{n}(t)##, because the boundary condition ##y(0,t)=0## ensures that all the amplitudes for the cosine terms of the Fourier expansion are zero. The factor of ##\sqrt{\frac{2}{a}}## can be absorbed into the amplitudes ##q_{n}(t)##, but the factor of ##\sqrt{\frac{2}{a}}## has been pulled out from the amplitudes ##q_{n}(t)## for reasons that will become clear later. The reason for rewriting the displacement ##y(x,t)## and hence the Lagrangian ##L## in terms of the Fourier amplitudes ##q_{n}(t)## will also become clear later.
Now,
##y(x,t) = \sqrt{\frac{2}{a}} \sum_{n=1}^{\infty} \text{sin} \big(\frac{n\pi x}{a}\big) q_{n}(t)##
## \implies \frac{\partial y(x,t)}{\partial t} = \sqrt{\frac{2}{a}} \sum_{n=1}^{\infty} \text{sin} \big(\frac{n\pi x}{a}\big) \dot{q}_{n}(t)##
##\implies \Big(\frac{\partial y(x,t)}{\partial t}\Big)^{2}= \frac{2}{a} \sum_{m,n=1}^{\infty} \text{sin} \big(\frac{m\pi x}{a}\big) \text{sin} \big(\frac{n\pi x}{a}\big) \dot{q}_{m}(t) \dot{q}_{n}(t)##
and
##y(x,t) = \sqrt{\frac{2}{a}} \sum_{n=1}^{\infty} \text{sin} \big(\frac{n\pi x}{a}\big) q_{n}(t)##
## \implies \frac{\partial y(x,t)}{\partial x} = \sqrt{\frac{2}{a}} \sum_{n=1}^{\infty} \Big(\frac{n\pi}{a}\Big) \text{cos} \big(\frac{n\pi x}{a}\big) q_{n}(t)##
## \implies \Big(\frac{\partial y(x,t)}{\partial x}\Big)^{2}= \frac{2}{a} \sum_{m,n=1}^{\infty} \Big(\frac{m\pi}{a}\Big)\Big(\frac{n\pi}{a}\Big) \text{cos} \big(\frac{m\pi x}{a}\big) \text{cos} \big(\frac{n\pi x}{a}\big) q_{m}(t) q_{n}(t)##
so that
##L = \int_{0}^{a} dx \bigg[ \frac{\sigma}{2} \Big( \frac{\partial y}{\partial t}\Big)^{2} - \frac{T}{2} \Big( \frac{\partial y}{\partial x}\Big)^{2} \bigg]##
## = \frac{\sigma}{a} \sum_{m,n=1}^{\infty}\dot{q}_{m}(t)\dot{q}_{n}(t)\int_{0}^{a}dx\ \text{sin}\big(\frac{n\pi x}{a}\big)\text{sin}\big(\frac{m\pi x}{a}\big) - \frac{T}{a} \sum_{m,n=1}^{\infty} \Big(\frac{m\pi}{a}\Big)q_{m}(t)\Big(\frac{n\pi}{a}\Big)q_{n}(t)\int_{0}^{a}dx\ \text{cos}\big(\frac{n\pi x}{a}\big)\text{cos}\big(\frac{m\pi x}{a}\big)##.
Now,
##\int_{0}^{a} dx\ \text{sin}\big(\frac{n\pi x}{a}\big)\text{sin}\big(\frac{m\pi x}{a}\big)##
##=\frac{1}{2}\int_{0}^{a}dx\ \text{cos}\big[\frac{(n-m)\pi x}{a}\big]-\text{cos}\big[\frac{(n+m)\pi x}{a}\big]##
##=\frac{1}{2}\Big[\frac{a}{(n-m)\pi}\text{sin}\big[\frac{(n-m)\pi x}{a}\big]-\frac{a}{(n+m)\pi}\text{sin}\big[\frac{(n+m)\pi x}{a}\big]\Big]_{0}^{a}##
##=\frac{1}{2}\Big[\frac{a\ \text{sin}(n-m)\pi}{(n-m)\pi}-\frac{a\ \text{sin}(n+m)\pi}{(n+m)\pi}\Big]##
##=\frac{a}{2}\delta_{mn}##
and
##\int_{0}^{a} dx\ \text{cos}\big(\frac{n\pi x}{a}\big)\text{cos}\big(\frac{m\pi x}{a}\big)##
##=\frac{1}{2}\int_{0}^{a}dx\ \text{cos}\big[\frac{(n-m)\pi x}{a}\big]+\text{cos}\big[\frac{(n+m)\pi x}{a}\big]##
##=\frac{1}{2}\Big[\frac{a}{(n-m)\pi}\text{sin}\big[\frac{(n-m)\pi x}{a}\big]+\frac{a}{(n+m)\pi}\text{sin}\big[\frac{(n+m)\pi x}{a}\big]\Big]_{0}^{a}##
##=\frac{1}{2}\Big[\frac{a\ \text{sin}(n-m)\pi}{(n-m)\pi}+\frac{a\ \text{sin}(n+m)\pi}{(n+m)\pi}\Big]##
##=\frac{a}{2}\delta_{mn}##
so that
##L = \frac{\sigma}{a} \sum_{m,n=1}^{\infty}\dot{q}_{m}(t)\dot{q}_{n}(t)\frac{a}{2}\delta_{mn} - \frac{T}{a} \sum_{m,n=1}^{\infty} \Big(\frac{m\pi}{a}\Big)q_{m}(t)\Big(\frac{n\pi}{a}\Big)q_{n}(t)\frac{a}{2}\delta_{mn}##
##= \frac{\sigma}{2}\sum_{n=1}^{\infty}(\dot{q}_{n}(t))^{2}-\frac{T}{2}\sum_{n=1}^{\infty}\big(\frac{n\pi}{a}\big)^{2}(q_{n}(t))^{2}##
##=\sum_{n=1}^{\infty}\frac{\sigma}{2}(\dot{q}_{n}(t))^{2}-\frac{T}{2}\big(\frac{n\pi}{a}q_{n}(t)\big)^{2}##
Therefore, the Lagrangian ##L## in terms of the Fourier amplitudes ##q_{n}(t)## consists of ##n## terms, one for each amplitude ##q_{n}(t)##. Therefore, the motion of the system in Fourier-transformed space is decoupled. This can be demonstrated more explicitly by calculating the Euler-Lagrange equations of motion for the system:
##\frac{d}{dt}\Big(\frac{\partial L}{\partial \dot{q}_{m}}\Big)-\frac{\partial L}{\partial q_{m}}=0##
##\implies \frac{d}{dt}(\sigma \dot{q}_{m})+T \big(\frac{m\pi}{a}\big)^{2} q_{m}=0##
##\implies \sigma \ddot{q}_{m}+T\big(\frac{m\pi}{a}\big)^{2}q_{m}=0##
##\implies \ddot{q}_{m}=-\frac{T}{\sigma}\big(\frac{m\pi}{a}\big)^{2}q_{m}##
Therefore, the dynamics of the string, i.e., the motion of the transverse displacement ##y(x,t)## of the string has been Fourier-transformed into the motion of an infinite set of decoupled harmonic oscillators with frequencies ##\omega_{n}=\sqrt{\frac{T}{\sigma}}\big(\frac{n\pi}{a}\big)##.
The harmonic oscillators are decoupled from each other because each of the equations of motion contains only a single index and therefore describes the dynamics of only one of the infinitely many harmonic oscillators.
Would you please comment on my solution?