How do we show that for $-\pi \leq x \leq \pi $, $$\sum_{n=1}^{\infty} \frac{(-1)^{n}}{n^{2}}\cos nx=\frac{1}{12}(3x^{2}-\pi^2)$$
I know that without $(-1)^{n}$ term, the series converges to $\frac{x^{2}}{4}-\frac{\pi x }{2}+\frac{\pi^{2}}{6}$ for $x$ in $[0,2\pi]$. But I'm not sure how to find the sum if there is a $(-1)^{n}$ term there.
Thank you for your help!
You could use the Fourier Series of $f(x)=\frac1{12}(3x^2-\pi^2)$ in $[-\pi,\pi].$ $$f(x)=\frac{a_0}2+\sum_{n=1}^\infty[a_n\cos(nx)+b_n\sin(nx)]$$where$$a_{n\ge0}=\frac1\pi\int_{-\pi}^\pi f(x)\cos(nx)~dx=\frac1{12\pi}\int_{-\pi}^\pi(3x^2-\pi^2)\cos(nx)~dx$$For $n=0$,$$a_0=\frac1{6\pi}[x^3-\pi^2x]_0^\pi=0$$For $n\ge1$,
$a_n=\frac1{12\pi}\left\{\left[(3x^2-\pi^2)\int\cos(nx)~dx\right]_{-\pi}^\pi-6\int_{-\pi}^\pi x\int\cos(nx)~dx~dx\right\}\\=-\frac1{n\pi}\int_0^\pi x\sin(nx)~dx=-\frac1{n\pi}\left\{\left[x\int\sin(nx)~dx\right]^\pi_0-\int_0^\pi\int\sin(nx)~dx\right\}\\=\frac{\cos(n\pi)}{n^2}$
and$$b_{n\ge1}=\frac1\pi\int_{-\pi}^\pi f(x)\sin(nx)~dx=0~\forall n.$$ Since $f(x)$ is continuous in the given domain, the Fourier series$$\sum_{n=1}^\infty\frac{(-1)^n}{n^2}\cos(nx)$$will converge to $f(x)$ for each point due to Dirichlet conditions.