Calculate:$$\int_{-\pi}^\pi\bigg(\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}\bigg)^2dx$$
One can prove $\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}$ converges uniformly by Dirichlet's test, integrate term-by-term, and since $\int_{-\pi}^\pi\frac{\sin(nx)}{2^n}dx=0,$ we get series of $0$'s and the final result would be $0.$
Thing is I'm not sure how to deal with the square.
Any help appreciated.