Show that the Fourier series expansion for $f(x)$ is $$\frac2{\sqrt3}\left(\cos x-\frac{\cos5x}5+\frac{\cos7x}7-\frac{\cos11x}{11}+\cdots\right)$$ where $$f(x)=\begin{cases}\dfrac\pi3&\text{for }x\in\left[0,\dfrac\pi3\right)\\[1ex]0&\text{for }x\in\left[\dfrac\pi3,\dfrac{2\pi}3\right)\\[1ex]-\dfrac\pi3&\text{for }x\in\left[\dfrac{2\pi}3,\pi\right)\end{cases}$$ and $f(x)=f(x+\pi)$ for all $x\in\mathbb R$.




$$a_0=\frac2\pi\int_0^\pi f(x)\,\mathrm dx$$ $$a_n=\frac2\pi\int_0^\pi f(x)\cos2nx\,\mathrm dx$$ $$b_n=\frac2\pi\int_0^\pi f(x)\sin2nx\,\mathrm dx$$

I know that $f(x)$ is odd, so $a_0=0$ and $a_n=0$ for all $n\in\mathbb N$. For the sine series, I end up with, among several equivalent expressions,

$$b_n=\frac1{3n}\left(2-\cos\frac{2n\pi}3-\cos\frac{4n\pi}3\right)$$ $$b_n=\frac2{3n}\left(\sin^2\frac{2n\pi}3+\sin^2\frac{4n\pi}3\right)$$

which gives me (using $g$ to distinguish my result from the expected $f$)


where $c_n=1$ if $n$ is not a multiple of $3$, and $0$ otherwise. Plotting the first few partial sums suggests that this answer is just as valid as the suggested one.

Is there some manipulation I can do to my result in order to get the solution to match? Or is there another way of finding the series expansion to arrive at the cosine series directly?

There is also a second part to the problem, which is to

Show that $$\frac\pi{2\sqrt3}=1-\frac15+\frac17-\frac1{11}+\cdots$$

which I can easily get from evaluating $f(x)$ and the given expansion at $x=0$:


but I don't immediately see a way to use $g(x)$. At first glance, choosing $x=\dfrac\pi4$ seems to be the right thing to do, but this yields



2 Answers 2


You need to make an even $2\pi$-periodic extension of the function $f$, that is, define $\tilde{f}$ such that

$$ \tilde{f}(-x) = \tilde{f}(x) $$


$$ \tilde{f}(x) = f(x) ~~~\mbox{for}~~ 0 < x < \pi $$

Since $\tilde{f}$ is periodic, the only Fourier coefficients that are not trivially zero are

$$ a_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}{\rm d}x~\tilde{f}(x)\cos n x $$

After evaluating the integral you get $a_0 = 0$ and

$$ a_{n} = \frac{2}{3n}\left[\sin \frac{n\pi}{3} + \sin\frac{2n\pi}{3} -\sin n\pi \right] ~~~ n \ge 1 $$

Here's a reconstruction of the function with the 60 lowest modes $n \le 60$

$$ \tilde{f}(x) = \sum_{n\ge 1} a_n \cos nx $$

enter image description here

With this you can solve the second problem

$$ f(0) = \frac{\pi}{3} = \sum_{n\ge 1} a_n = \frac{2}{\sqrt{3}}\left[ 1 - \frac{1}{5} + \frac{1}{7} \cdots \right] $$

or equivalently

$$ \frac{\pi}{2\sqrt{3}} = 1 -\frac{1}{5} + \frac{1}{7} \cdots $$

  • $\begingroup$ Does this even periodic extension match the periodicity condition $f(x+\pi)=f(x)$? It seems as if it would necessarily conflict with the symmetry $f(\pi-x)=-f(x)$ for $x\in [0,\pi]$. $\endgroup$ Commented May 8, 2017 at 18:56
  • $\begingroup$ You're right, but the constraint $f(x + \pi) = f(x)$ is not satisfied by the series $$ f(x) = \frac{2}{\sqrt{3}}\left[\cos x - \frac{\cos 5x}{5} + \frac{\cos 7x}{7} - \cdots\right] $$ either $\endgroup$
    – caverac
    Commented May 8, 2017 at 19:11
  • $\begingroup$ Agreed. This can be seen explicitly in the plots of the two series (see the answer I just added). On those grounds I'd say that the sine series is the correct one for the conditions stated. $\endgroup$ Commented May 8, 2017 at 19:18

It's illuminating to plot the two series that you've come up with. For the sum of the first 10 terms in the Fourier cosine series $f(x)$, we obtain

enter image description here

Plot[(2/Sqrt[3]) Sum[
 Cos[(6 n + 1) x]/(6 n + 1) - Cos[(6 n + 5) x]/(6 n + 5), {n, 0,  9}],
 {x, -\[Pi], 2 \[Pi]}, PlotPoints -> 30]

By contrast, the first ten terms of in the Fourier sine series $g(x)$ yields

enter image description here

 Plot[Sum[Boole[Not[Divisible[n, 3]]] Sin[2 n x]/n, {n, 1, 15}], {x, -\[Pi], 2 \[Pi]}]

Setting aside the differing rates of convergence, what's immediately apparent is that the two series agree only for $x\in[0,\pi)$; for $x\in [-\pi,0)$ one has $f(-x)=f(x)$ but $g(x)=-g(x)$. A further consequence is that, of the two series, only the sine series $g(x)$ has the appropriate $x\to x+\pi$ periodicity. The Fourier cosine series in fact satisfies $f(x+\pi)=-f(x)$ i.e. $f(x)$ is $\pi$-antiperiodic. Hence the Fourier cosine series given does not actually satisfy the periodicity condition it asks for.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .