Verify that $\frac{\pi}{4} = 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+....$ can be found via a Fourier series for $x$ in $-\pi\lt x \le \pi$

Using the general Fourier series expansion: $$f(x)=\frac{a_0}{2}+ \sum_{r=1}^{r=\infty}\left(a_r\cos\left(\frac{2\pi r x}{T}\right)+b_r\sin\left(\frac{2\pi r x}{T}\right)\right)\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\color{blue}{(1)}$$ and noting that $f(x)=x$ is odd such that only the sine terms contribute to the sum. Here $T$ is the period of the function.

Taking $T$ to be $2\pi$. To find the coefficients $b_r$ I used $$b_r= \frac{2}{T}\int_{-\pi}^{\pi}f(x)\sin\left(\frac{2 \pi r x}{T}\right)=\frac{2}{2\pi}\int_{-\pi}^{\pi}f(x)\sin\left(\frac{2 \pi r x}{2\pi}\right)=\frac{4}{2\pi}\int_{0}^{\pi}x\sin(rx)=\left[-\frac{2}{\pi}\frac{x\cos(rx)}{r}\right]_{x=0}^{\pi}+\frac{2}{\pi}\int_{x=0}^{\pi}\frac{\cos(rx)}{r}\mathrm{d}x=-\frac{2\pi (-1)^r}{\pi r}+ \left[\frac{2}{\pi}\frac{\sin(rx)}{r^2}\right]_{x=0}^{\pi}=-2\frac{(-1)^r}{r}=2\frac{(-1)^{r+1}}{r}$$

To find $a_0$ I used $$a_0=\color{red}{\frac{2}{T}\int_{-\pi}^{\pi}f(x)\mathrm{d}x=\frac{2}{2\pi}\int_{-\pi}^{\pi}x\mathrm{d}x}=0$$

Insertion of $a_0$ and $b_r$ into $\color{blue}{(1)}$ yields $$f(x) = x =2\sum_{r=1}^{\infty}\frac{(-1)^{r+1}}{r}\sin(rx)$$ as the Fourier series for $f(x)=x$ in $-\pi\lt x \le \pi$

Now setting $x=\frac{\pi}{2}$ in the expression found for $f(x)$ yields $$\frac{\pi}{4} = 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+....$$ as required.

Finally, my question involves the part of the calculation coloured $\color{red}{red}$. I do not understand the origin of this formula since it was given to me without proof in a text book.

In order for the above calculation to be plausible I need to know the derivation and meaning of the left hand side of the general formula marked red for computing $a_0$.

Could someone please explain where this equation comes from?

Or, put in another way, should I use $$a_r = \frac{2}{T}\int_{-\pi}^{\pi}f(x)\cos\left(\frac{2 \pi r x}{T}\right)\mathrm{d}x$$$$=\frac{2}{2\pi}\int_{-\pi}^{\pi}f(x)\cos\left(\frac{2 \pi r x}{2\pi}\right)\mathrm{d}x$$$$=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\mathrm{d}x= \frac{1}{\pi}\int_{-\pi}^{\pi}x\mathrm{d}x=a_0=0$$ formula with $r=0$ even though I don't have any cosine terms in my series?

Thank you

Kindest regards,

Blaze.

Fourier Series is defined as $$f(x)=\frac{a_0}{2}+ \sum_{r=1}^{r=\infty}\left(a_r\cos\left(\frac{2\pi r x}{T}\right)+b_r\sin\left(\frac{2\pi r x}{T}\right)\right)\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\color{blue}{(1)}$$

For $r>0$ You can obtain the coefficients using the formulas you wrote down first. For the case $r=0$ you have to use the formula for $a_r$

$$a_r=\frac{2}{T}\int_{-\pi}^{\pi}f(x)\cos{(\frac{2\pi rx}{T})}\mathrm{d}x$$

and set $r = 0$. Applying this will lead to $f(x)\cos(\frac{2\pi x\cdot0}{T})=f(x)\cos(0)=f(x)$. Now integrate this from $-\pi$ to $\pi$ and multiply this by $\frac{2}{T}$ to get what is written in red.

Alternatively:

• You can also conclude $a_n=0\space \forall n\geq0$ as $f(x)$ is odd.
• Another way to see that $a_0=0$ can be obtained by pluging in $x=0$ into the series, as all sine terms will vanish and $a_r=$ in the sum we directly obtain: $$f(0)=x|_{x=0}=0=\frac{a_0}{2}$$
• What is $n$? I haven't defined $n$ anywhere in my proof. Sep 19, 2015 at 9:25
• sorry, edited my post. I always work with $n$ as summation index :D. Sep 19, 2015 at 9:26
• Yes. Using the formula for the $a_r$ coefficients would be the more algorithmic way in solving this task. But if you know that a function is odd (all $a_r=0$) or even (all $b_r=0$), you can save alot of useless calculations. Actually this "red" step is not necessary, because the fact that $f(x)$ is odd implies that all $a_r=0 \forall r \geq 0$, which trivially includes $a_0=0$. Sep 19, 2015 at 9:35
• Sorry, had real problems then with the Latex in the comments; I have edited my post in accordance to what you suggested. I'm still a bit confused as to why I can just set $r=0$ in that formula for $a_r$ when there are no such terms in my series? Sep 19, 2015 at 9:56
• The formula is a general formula for all $a_r$, and imagine the constant term beeing the cosine term with $r_0$, the division by $2$ is just a tricky way to be able to use the general formula for all $a_r$. Btw you can always use the formulas for $a_r$ and $b_r$ is is not important if you have cosine or sine terms. Using the formula will just help you to obtain the coefficients. If all $b_r=0$ you can conclude that there are no sine terms involved, if all the $a_r=0$ you can conclude that there are no cosine terms and no constant term. Sep 19, 2015 at 10:00

Also related but not directly an answer to the question is that the Taylor expansion for $\arctan(x), x = 1$ gives exactly the same series.

Another interesting exercise would then be to try and find a connection between the fourier series and mentioned Taylor expansion. Arctan is related to tan which is related to sin and cos which are related to fourier series and transforms...

• Yes, it sure is interesting to see how the same series can be found from two different approaches :) Sep 19, 2015 at 18:21