Calculate $\int_{-\pi}^\pi\bigg(\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}\bigg)^2dx$ 
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.
 A: Hint:
First,
$$\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}= Im\bigg( \sum_{n=1}^\infty\bigg(\frac{e^{ix}}{2}\bigg)^n\bigg) =  Im\bigg(\frac{1}{1-\frac{e^{ix}}{2}}\bigg) =  Im\bigg(2\frac{2-\cos x+i\sin x}{(2-\cos x)^2+\sin^2 x}\bigg)= \frac{2\sin(x)}{5-4\cos(x)}$$
Thus, 
$$\int_{-\pi}^\pi\bigg(\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}\bigg)^2dx = 2\int^{\pi}_0\bigg(\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}\bigg)^2dx = 8\int^{\pi}_0\bigg(\frac{\sin(x)}{5-4\cos(x)}\bigg)^2dx$$
From here you can use standard rule for integration of trigonometries functions.
See here: What is tha simpliest way to compute :$\int^{\pi}_0\bigg(\frac{\sin(x)}{5-4\cos(x)}\bigg)^2dx$
A: Note that $$\int_{-\pi}^{\pi} \sin(nx)\sin(mx) dx = \begin{cases} 0 \quad \text{ if } n\neq m\\ \pi \quad \text{ if } n=m\end{cases}$$
Hence $$\int_{-\pi}^\pi\bigg(\sum_{n=1}^\infty\frac{\sin(nx)}{2^n}\bigg)^2dx = \pi \sum_{n=1}^{\infty} \frac{1}{2^{2n}} = \frac{\pi}{3}$$

Alternatively, we can use the Parseval's theorem on the $C^\infty$ function $f(x) = \sum_{n=1}^{\infty} \frac{\sin(nx)}{2^n}$.

If the Fourier series of $g(x)$ is $$g(x) \sim \frac{a_0}{2} + \sum_{n=1}^{\infty} [a_n \cos(nx) + b_n \sin(nx)]$$
  Then $$\frac{1}{\pi}\int_{-\pi}^{\pi} g^2(x) dx = \frac{a_0^2}{2}+\sum_{n=1}^{\infty} (a_n^2+b_n^2)$$

Here $a_n=0$ and $b_n=\frac{1}{2^n}$.
