[EDIT]: The correct solution is definately $$ \frac{\pi^2}{12}+ \sum_{k=1}^\infty \frac{\cos(nx)}{n^2} $$ from the book Calculus of several variables, by Lang (Springer) Please can you make sure this is the answer you give as it is definately correct. Many thanks
I have a question on fourier series which i am a bit confused about.
Find the fourier series of the $2\pi$-periodic function defined by $f(x)=\frac{( \pi-x)^2}{4}$ for $0\leq x\leq2\pi$.
So i have
$$f(x)={a_0\over2}+\sum_{k=1}^\infty ( a_n \cos(nx) +b_n\sin(nx) dx$$ with
$a_0={1\over\pi}\int_0^{2\pi} f(x) dx $
$a_n={1\over\pi}\int_0^{2\pi} f(x)\cos(nx)\ dx= $
$b_n={1\over\pi}\int_0^{2\pi} f(x)\sin(nx)\ dx= $
So with some working out i have $$a_0={1\over\pi}\int_0^{2\pi} f(x) dx =\frac{-2\pi^2}{12}$$ but
$$a_n={1\over\pi}\int_0^{2\pi} f(x)\cos(nx)\ dx ={1\over\pi}\int_0^{2\pi} \frac{( \pi-x)^2}{4}\cos(nx)\ dx$$
is giving me the longest answer ever which i am pretty sure it uncorrrect.
I have that the correct solution is $$ \frac{\pi^2}{12}+ \sum_{k=1}^\infty \frac{\cos(nx)}{n^2} $$
and when i put my $a_n$ and $b_n$ in i get something completely different.
Could someone please help me get to this answer?
Many thanks in advance
For $n\geq 1$: $$a_n={1\over\pi}\int_0^{2\pi} f(x)\cos(nx)\ dx ={1\over\pi}\int_0^{2\pi} \frac{( \pi-x)^2}{4}\cos(nx)\ dx={1\over\pi}\int_0^{2\pi} \frac{\pi^2}{4}\cos(nx)\ dx-\\ {1\over\pi}\int_0^{2\pi} \frac{\pi x}{2}\cos(nx)\ dx+ {1\over\pi}\int_0^{2\pi} \frac{ x^2}{4}\cos(nx)\ dx; $$
the first integral vanishes; the last two are tackled using integration by parts (taking care of coefficients and prefactors), i.e.
$$\int x\cos x dx=x\sin x+\cos x+C $$ $$\int x^2\cos x dx=(x^2-2)\sin x +2x\cos x+C'. $$
For $b_n$ the methodology is analogous.