Show that for $0This a question from Fourier Series:
Show that for $0<x<\pi$
$x(\pi-x)=\frac{\pi^2}{6}-\big(\frac{\cos2x}{1^2}+\frac{\cos4x}{2^2}+\frac{\cos6x}{3^2}+.....\big)$
First of all, the interval given is an open interval i.e. $(0,\pi)$, but I have read that Fourier Series are only applicable for closed intervals. Then how can I solve this question using Fourier Series ?
Finding out the Fourier coefficients considering the interval $[-\pi,\pi]$, I have calculated the following:
$a_{0}=-\frac{\pi^2}{3}$
$a_{k}=\frac{4(-1)^{k+1}}{k^2},\forall k=1,2,3....$
$b_k=\frac{2(-1)^{k+1}}{k},\forall k=1,2,3,....$
But I think all this not useful in this question as the interval given is different. Also, even if I consider the Fourier series in the interval $[0,\pi]$, then also I will not be able to write the equality ($=$) sign in the equality to be shown in the question because equality means the series converges to the function $x(\pi-x)$ and for convergence of the Fourier series, the initial assumption is that the given function is a periodic function of periodicity $2\pi$. But here the function $x(\pi-x)$ is defined over a period of $\pi$.
Can anyone help me out here ? I will be highly grateful.,

This is a standard application of Fourier series. See https://en.wikipedia.org/wiki/Fourier_series for the basics.
To compute the Fourier series of a given function, you first need a periodic function. For the Fourier series to involve only cosine terms, you need the function to also be even. Note that the period need not be $2\pi$.
Let $f$ be a $\pi$-periodic function, defined on $[0,\pi]$ by $f(x)=x(\pi-x)$. $f$ is even, because the function $x\to x(\pi-x)$ is symmetric with respect to $x=\pi/2$.
Here is a plot of $f$, showing $6$ periods:

Then the cosine Fourier coefficients are, for $n>0$:
$$a_n=\frac{2}{\pi}\int_0^{\pi} f(x)\cos(2nx)\,\mathrm dx=\frac{2}{\pi}\int_0^{\pi}x(\pi-x)\cos(2nx)\,\mathrm dx$$
Now, two integrations by parts:
$$a_n=\frac{2}{\pi}\left[x(\pi-x)\frac{\sin (2nx)}{2n}\right]_0^\pi-\frac{2}{\pi}\int_0^{\pi}(\pi-2x)\frac{\sin(2nx)}{2n}\,\mathrm dx\\=-\frac{2}{\pi}\int_0^{\pi}(\pi-2x)\frac{\sin(2nx)}{2n}\,\mathrm dx\\=\frac{2}{\pi}\left[(\pi-2x)\frac{\cos (2nx)}{4n^2}\right]_0^\pi+\frac{2}{\pi}\int_0^{\pi}2\frac{\cos(2nx)}{3n^2}\,\mathrm dx\\=\frac{2}{\pi}\left[(\pi-2x)\frac{\cos (2nx)}{4n^2}\right]_0^\pi\\=-\frac{1}{n^2}$$
The sine coefficients are $b_n=0$ since the function $f$ is even.
Last, the constant coefficient:
$$a_0=\frac{2}{\pi}\int_0^\pi f(x)\,\mathrm dx=\frac{2}{\pi}\int_0^\pi x(\pi-x)\,\mathrm dx\\=\frac{2}{\pi}\left[\pi\frac{x^2}2-\frac{x^3}{3}\right]_0^\pi=\frac{2}{\pi}\cdot\frac{\pi^3}{6}=\frac{\pi^2}{3}$$
Now, the function $f$ is continuous and piecewise $C^1$, hence the series converges everywhere to the function, hence, for all $x\in[0,\pi]$,
$$x(\pi-x)=\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(2n x)=\frac{\pi^2}{6}-\sum_{n=1}^\infty \frac{\cos(2n x)}{n^2}$$
Note that for $x=0$, you get the classic series:
$$\sum_{n=1}^\infty\frac1{n^2}=\frac{\pi^2}6$$
