Let's say we have the following function
$$ \int \left( \sum_{i = 1}^\infty a_i \sin(b_ix)\right)^2$$
Assuming that this series converges (it is actually a Fourier Series of the Lagrangian of the Wave Equation), how would we go about solving this? I know I need to move the integral inside of the sum, but the squared is making this difficult.
Added note: I can't find the tag for homework, but I don't need a full solution, simply how to get the integral inside of the sum.
$$\int\left(\sum_{j=1}^{\infty } a_j \sin (b_j x )\right)^2 dx =\sum_{j=1}^{\infty} a_j ^2 \int\sin^2 (b_j x ) dx+2\sum_{1\leq i<j<\infty}a_i a_j\int \sin (b_i x)\sin (b_j x) dx$$ under suitable assumptions concerning convergence of the above series.