I've got the following problem to solve:
Find Fourier series expansion of $f(x)=sign(x)$ in $L_2[-\pi, \pi]$. Use this expansion to prove Leibniz formula for $\pi$: $\sum_{n=0}^\infty \frac{(-1)^n}{2n+1} = \frac{\pi}{4}$.
My first idea was just use Parseval's identity to prove this. So I found an expansion: first, we can observe that $sign(x)$ is odd and therefore we will check only functions of the form $\sin(nx)$. Then we will find $||\sin(nx)||^2 = \int_{-\pi}^{\pi}\sin^2(nx)dx = \pi$.
Now we can calculate Fourier coefficients: $c_n=(f,\frac{\sin(nx)}{\sqrt{\pi}}) = \frac{1}{\sqrt{\pi}}\int_{-\pi}^{\pi}sign(x)\sin(nx)dx = 2\frac{1}{\sqrt{\pi}}\int_0^{\pi}\sin(nx)dx=\frac{2}{\sqrt{\pi}}(\frac{1-(-1)^n}{n})$.
So now I am stack. I need a hint how can I use it to prove Leibniz formula.
Thanks!
Since you've calculated the Fourier coefficients for the sign function as
$$c_n=\frac{2}{\sqrt\pi}\frac{1-(-1)^n}{n}=\begin{cases}\frac{4}{\sqrt\pi n}&n\,\text{odd}\\\\0&,n\,\text{even}\end{cases}$$
we have
$$\text{sgn}(x)\sim\sum_{n=1}^\infty c_n\frac{\sin(nx)}{\sqrt\pi}=\frac4\pi\sum_{n=0}^\infty \frac{\sin((2n+1)x)}{2n+1}$$
Now, which value of $x\in (0,\pi)$ is such that $\sin((2n+1)x)=(-1)^{n}$?