I am trying to compute: $$\int_{-\pi}^\pi\bigg(\sum_{n=1}^\infty\frac{\cos(nx)}{2^n}\bigg)^2dx$$
I tired to expand the integrand but it is too messy and lengthy.The Thing is I'm not sure how to deal with the square. If anyone has an idea on how to compute I will appreciate.