Calculation of $ \int\limits_{-\pi}^\pi \cos^4(x)dx$ using Fourier series of $\cos^2(x)$ The Fourier series of $\cos^2(x)={1\over2}+{1\over2}\cos(2x)$ is $a_0=1, a_2={1\over2}$ and the other terms are zero since $$Ff(x)={a_0\over2}+\sum\limits_{k=1}^{\infty}[a_k\cos(kx)+b_k\sin(kx)]$$
So in order to calculate $\int\limits_{-\pi}^\pi \cos^4(x)dx $ we use Parseval's identity :
$$\|f\|^2={1\over T}\int\limits_{-T/2}^{T/2}f^2(x)dx=a_0^2+{1\over2}\sum\limits_{k=1}^{\infty}a_k^2+b_k^2$$
But what I get is false:
$${1\over 2\pi}\int\limits_{-\pi}^\pi (\cos^2(x))^2dx=1+{1\over2}\Big({1\over2}\Big)^2={9\over 8}$$ $$\int\limits_{-\pi}^\pi \cos^4(x)dx=2\pi\cdot{9\over8}={9\pi\over4}$$
But it should be ${3\over4}\pi$
What am I doing wrong?
 A: It should be that 
$$ \frac{1}{L}\int_{-L}^L f^2(x)\, dx = \frac{a_0^2}{2} + \sum_{n=1}^\infty \left(a_n^2 + b_n^2\right). $$
Hence, 
$$ \frac{1}{\pi}\int_{-\pi}^\pi \cos^4(x)\, dx = \frac{a_0^2}{2} + a_1^2 = \frac{1}{2} + \left(\frac{1}{2}\right)^2 = \frac{1}{2} + \frac{1}{4} = \frac{3}{4} $$
and the desired answer follows. 
A: As we've already seen, the error is you had the coefficient of $a_0^2$ in Parseval wrong. That $a_0$ is a nasty little thing - Parseval is one of many places where the complex form for a Fourier series, that is $\sum c_ne^{int}$, is simpler:
$$\cos^2(t)=\left(\frac{e^{it}+e^{-it}}2\right)^2=\frac14e^{-2it}+\frac12+\frac14e^{2it},$$
so$$\frac1{2\pi}\int_0^{2\pi}\cos^4(t)=\frac1{16}+\frac14+\frac1{16}=\frac38.$$
A: It can also be $$\|f\|^2={1\over T}\int\limits_{-T/2}^{T/2}f^2(x)dx=\color{blue}{\left(\frac{a_0}{2}\right)^2}+{1\over2}\sum\limits_{k=1}^{\infty}a_k^2+b_k^2.$$
So $${1\over 2\pi}\int\limits_{-\pi}^\pi (\cos^2(x))^2dx=\frac{1}{4}+{1\over2}\Big({1\over2}\Big)^2={3\over 8}.$$
