Fourier Series on the Unit Interval

• POTW
• Euge
In summary, a Fourier Series on the Unit Interval is a mathematical representation of a periodic function on the interval [0,1]. It is calculated using the Fourier coefficients, which are determined by integrating the original function over one period and solving for the coefficients using the Fourier series formula. The purpose of using a Fourier Series on the Unit Interval is to approximate a periodic function using simpler sine and cosine functions, which can be useful in various applications. However, it has limitations in accurately representing functions that are not periodic or continuous on the interval [0,1]. For non-periodic functions, other methods such as the Fourier Transform should be used.
Euge
Gold Member
MHB
POTW Director
Evaluate the Fourier series

$$\frac{1}{\pi^2}\sum_{k = 1}^\infty \frac{\cos 2\pi kx}{k^2}$$ for ##0 \le x \le 1##.

benorin, julian, I like Serena and 2 others
The formula equals

$$-4 Re \int^x ds \int^s dt \sum_{k=1}^\infty e^{2\pi kti}$$

$$=-4 Re \int^x ds \int^s dt \frac{e^{2\pi ti}}{1-e^{2\pi ti}}$$

$$=2Re \int^x ds \int^s dt (1-i \cot \pi t )$$

$$=x^2+Bx+C$$

$$=x(x-1)+\frac{1}{6}$$

$$=x^2-x+\frac{1}{6}$$

because for x=0,1 it is ##\zeta(2)/\pi^2=1/6##. Minimum for x=1/2 is ##-\frac{1}{12}## which coincides with -##\eta(2)/\pi^2## using eta function or alternate zeta function. Ref. https://mathworld.wolfram.com/DirichletEtaFunction.html

Last edited:
benorin
We will evaluate the sum:

\begin{align*}
\frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2}
\end{align*}

for ##-\frac{1}{2} \leq x \leq \frac{1}{2}## first and then make the shift ##x \mapsto x - \frac{1}{2}##.

I will express the sum via a complex contour integration. It employs the fact that the function

\begin{align*}
\dfrac{\cos 2 \pi z x}{\sin \pi z}
\end{align*}

has simple poles at all integer values except when ##\cos 2 \pi z x = 0##, as we now verify. First consider the case where ##\cos 2 \pi z x \not= 0## for ##z=n##,

\begin{align*}
\dfrac{\cos 2 \pi z x}{\sin \pi z} & = \dfrac{\cos 2 \pi n x}{\sin \pi [n + (z-n)]}
\nonumber \\
& = \dfrac{\cos 2 \pi n x}{(-1)^n [\pi (z-n) - \frac{1}{3!} \pi^3 (z-n)^3 + \cdots]}
\nonumber \\
& = (-1)^n \dfrac{\cos 2 \pi n x}{(z-n) \pi [1 - \frac{1}{3!} \pi^2 (z-n)^2 + \cdots]}
\nonumber \\
& = (-1)^n \dfrac{\cos 2 \pi n x}{(z-n) \pi} + \cdots
\end{align*}

Now consider the case where ##\cos 2 \pi z x = 0## for some ##z=n##,

\begin{align*}
\left| \lim_{z \rightarrow n} \dfrac{\cos 2 \pi z x}{\sin \pi z} \right| & = \left| \lim_{z \rightarrow n} \dfrac{\frac{d}{dz} \cos 2 \pi z x}{\frac{d}{dz} \sin \pi z} \right|
\nonumber \\
& = \left| \lim_{z \rightarrow n} \dfrac{- 2 \pi x \sin 2 \pi z x}{\pi \cos \pi z} \right| < \infty
\end{align*}

So when ##\cos 2 \pi z x## vanishes for ##z = n##, there is no pole at ##n##. This allows us to write

\begin{align*}
\frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2} = \frac{1}{2 \pi^2 i} \oint_C \dfrac{\cos 2 \pi z x}{z^2 \sin \pi z} dz
\end{align*}

where the contour ##C## is defined in fig (a).

We have

\begin{align*}
2 \frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2} & = \frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2} + \frac{1}{\pi^2} \sum_{k=-1}^{-\infty} (-1)^k\frac{\cos 2 \pi k x}{k^2}
\nonumber \\
& = \frac{1}{2 \pi^2 i} \oint_{C+C'} \dfrac{\cos 2 \pi z x}{z^2 \sin \pi z} dz
\end{align*}

where the contour ##C'## is defined in fig (a). We complete the path of integration along semicircles at infinity (see fig (b)) since the integrand vanishes there. Since the resulting enclosed area contains no singularities except at ##z=0##, we can shrink this contour down to an infinitesimal circle ##C_0## around the origin (see fig (c)). So that

\begin{align*}
\frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2} = \frac{1}{4 \pi^2 i} \oint_{C_0} \dfrac{\cos 2 \pi z x}{z^2 \sin \pi z} dz
\end{align*}

We expand the integrand in powers of ##z## about ##z=0## and isolate the ##z^{-1}## term. We get

\begin{align*}
\dfrac{\cos 2 \pi z x}{z^2 \sin \pi z} & = \dfrac{1 - \frac{1}{2!} 2^2 \pi^2 x^2 z^2 + \cdots}{z^2 [\pi z - \frac{1}{3!} \pi^3 z^3 + \cdots]}
\nonumber \\
& = \dfrac{1 - 2 \pi^2 x^2 z^2 + \cdots}{z^3 \pi [1 - \frac{1}{6} \pi^2 z^2 + \cdots]}
\nonumber \\
& = \dfrac{1 - 2 \pi^2 x^2 z^2 + \cdots}{z^3 \pi} (1 + \frac{1}{6} \pi^2 z^2 + \cdots)
\nonumber \\
& = \cdots + \left( \dfrac{1}{6} - 2 x^2 \right) \pi \frac{1}{z} + \cdots
\end{align*}

So that for ##- \frac{1}{2} \leq x \leq \frac{1}{2}##,

\begin{align*}
\frac{1}{\pi^2} \sum_{k=1}^\infty (-1)^k \frac{\cos 2 \pi k x}{k^2} & = \frac{1}{4 \pi^2 i} \oint_{C_0} \dfrac{\cos 2 \pi z x}{z^2 \sin \pi z} dz
\nonumber \\
& = \frac{1}{4 \pi^2 i} (-2 \pi i) \left( \dfrac{1}{6} - 2 x^2 \right) \pi
\nonumber \\
& = x^2 - \frac{1}{12}
\end{align*}

Finally, we do the shift ##x \mapsto x - \frac{1}{2}## and obtain:

\begin{align*}
\frac{1}{\pi^2} \sum_{k=1}^\infty \frac{\cos 2 \pi k x}{k^2} = \left( x - \frac{1}{2} \right)^2 - \frac{1}{12} = x^2 - x + \frac{1}{6} .
\end{align*}

for ##0 \leq x \leq 1##.

Last edited:
benorin, I like Serena and anuttarasammyak
The Fourier cosine series for an even periodic function ##f(x)## with period ##2L## is
\begin{array}{cl}f(x)&=\frac{c_0}2 + \sum_{k=1}^\infty c_k \cos\frac{k\pi x}{L}\\
c_k &= \frac 2L\int_0^L f(x) \cos\frac{k\pi x}{L}\,dx\end{array}
Pick ##L=\frac 12## and let ##f(x)## be the desired function. It follows that for ##k>0##: $$\pi^2 c_k=4\pi^2\int_0^{1/2} f(x) \cos(2k\pi x)\,dx=\frac 1{k^2}$$
We have for ##k>0##:
$$\begin{cases}4\pi^2\int_0^{1/2} x \cos(2k\pi x)\,dx = \frac{(-1)^k-1}{k^2}\\ 4\pi^2\int_0^{1/2} x^2 \cos(2k\pi x)\,dx = \frac{(-1)^k}{k^2}\end{cases}\implies 4\pi^2\int_0^{1/2} (x^2-x) \cos(2k\pi x)\,dx = \frac{1}{k^2}$$
Furthermore, ##f(0)=\frac 1{\pi^2}\sum_{k=1}^\infty \frac 1{k^2}=\frac 16##.
So the function is ##f(x)=x^2-x+\frac 16## on the interval [0,1], which is indeed an even periodic function if we extend it periodically.

Last edited:
benorin
Using a method that employs ##\frac{1}{n^2} = \int_0^\infty u e^{-nu} du##, I write the sum as an integral. I evaluate the integral two ways.

We consider ##0 < x < 1##. The cases ##x=0,1## can be dealt with separately, taken as a standard result. We have:

\begin{align*}
& \sum_{n=0}^\infty \dfrac{\cos (2 \pi n x)}{n^2}
\nonumber \\
& = \sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} \int_0^\infty u e^{-u} du
\nonumber \\
& = \sum_{n=1}^\infty \cos (2 \pi n x) \int_0^\infty u e^{-nu} du
\nonumber \\
& = \frac{1}{2} \sum_{n=1}^\infty \int_0^\infty (e^{-nu + i n 2 \pi x} + e^{-nu - i n 2 \pi x}) u du
\nonumber \\
& = \frac{1}{2} \int_0^\infty \sum_{n=1}^\infty (e^{-nu + i n 2 \pi x} + e^{-nu - i n 2 \pi x}) u du
\nonumber \\
& = \frac{1}{2} \int_0^\infty \left( \dfrac{1}{e^{u - 2 \pi x i} - 1} + \dfrac{1}{e^{u + 2 \pi x i} - 1} \right) u du
\end{align*}

To justify interchanging summation and integration in the above, we can use Fubini:

\begin{align*}
\sum_{n=1}^\infty \int_0^\infty | \cos (2 \pi n x)u e^{-nu} | du & \leq \sum_{n=1}^\infty \int_0^\infty u e^{-nu} du
\nonumber \\
& = \sum_{n=1}^\infty \frac{1}{n^2}
\nonumber \\
& < 1 + \lim_{N \rightarrow \infty} \sum_{n=2}^N \frac{1}{n (n-1)}
\nonumber \\
& = 1 + \lim_{N \rightarrow \infty} \sum_{n=2}^N \left( \frac{1}{n-1} - \frac{1}{n} \right)
\nonumber \\
& = 1 + 1 - \lim_{N \rightarrow \infty} \frac{1}{N} = 2 < \infty
\end{align*}

From the above

\begin{align*}
\sum_{n=0}^\infty \dfrac{\cos (2 \pi n x)}{n^2} & = \frac{1}{2} \int_0^\infty \left( \dfrac{1}{e^{u - 2 \pi x i} - 1} + \dfrac{1}{e^{u + 2 \pi x i} - 1} \right) u du
\nonumber \\
& = \frac{1}{2} \int_0^\infty \left( \dfrac{e^{2 \pi x i} u}{e^u - e^{2 \pi x i}} + \dfrac{e^{-2 \pi x i} u}{e^u - e^{-2 \pi x i}} \right) du
\nonumber \\
& = \frac{1}{4} \int_0^\infty \left( \dfrac{e^{2 \pi x i} e^u u^2}{(e^u - e^{2 \pi x i})^2} + \dfrac{e^{-2 \pi x i} e^u u^2}{(e^u - e^{-2 \pi x i})^2} \right) du
\nonumber \\
& = \frac{1}{8} \int_{-\infty}^\infty \left( \dfrac{e^{2 \pi x i} e^u u^2}{(e^u - e^{2 \pi x i})^2} + \dfrac{e^{-2 \pi x i} e^u u^2}{(e^u - e^{-2 \pi x i})^2} \right) du
\nonumber \\
& = \frac{1}{4} Re \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u u^2}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

where I done an integration by parts. Extending the range of integration is valid if you use both terms.

Define

\begin{align*}
I (\alpha) = \frac{1}{4} e^{2 \pi x i} \int_{-\infty}^\infty \dfrac{e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

for ##\frac{1}{2} \leq \alpha \leq \frac{3}{2}##. Then

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} = \left. \dfrac{\partial^2}{\partial \alpha^2} Re I (\alpha) \right|_{\alpha =1}
\end{align*}

In order to evaluate ##I(\alpha)##, consider the contour in the figure

and the integral

\begin{align*}
\oint_C \dfrac{e^{2 \pi x i} e^{\alpha z}}{(e^z - e^{2 \pi x i})^2}
\end{align*}

whose integrand has pole at ##2 \pi x i##.
The integral along the vertical edges vanishes as:

\begin{align*}
f(z) = \dfrac{e^{2 \pi x i} e^{\alpha (u+iv)}}{(e^{u+iv} + e^{2 \pi x i})^2} =
\begin{cases}
e^{2 \pi x i} e^{(\alpha - 2) (u+iv)} & u \rightarrow \infty \\
\dfrac{e^{\alpha (u+iv)}}{e^{2 \pi x i}} & u \rightarrow - \infty \\
\end{cases}
\end{align*}

So that

\begin{align*}
& \frac{1}{4} \oint_C \dfrac{e^{2 \pi x i} e^{\alpha z}}{(e^z - e^{2 \pi x i})^2}
\nonumber \\
& = \frac{1}{4} \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du - \frac{1}{4} e^{\alpha 2 \pi i} \int_{-\infty + 2 \pi i}^{\infty + 2 \pi i} \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = (1-e^{\alpha 2 \pi i}) \frac{1}{4} \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

Which rearranged is

\begin{align*}
\frac{1}{4} e^{2 \pi x i} \int_{-\infty}^\infty \dfrac{e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du & = \frac{i \pi}{2} \frac{1}{1-e^{\alpha 2 \pi i}} \frac{1}{2 \pi i} \oint_C \dfrac{e^{2 \pi x i} e^{\alpha z}}{(e^z - e^{2 \pi x i})^2} dz
\nonumber \\
& = \frac{i \pi}{2} \frac{1}{1-e^{\alpha 2 \pi i}} Res [f(z)]
\end{align*}

We have

\begin{align*}
\frac{1}{(e^z - e^{z_0})^2} & = \frac{e^{-2 z_0}}{(e^{z-z_0} - 1)^2}
\nonumber \\
& = \dfrac{e^{-2 z_0}}{(z-z_0)^2 [1 + \frac{1}{2!} (z-z_0) + \cdots]^2}
\nonumber \\
& = \dfrac{e^{-2z_0}}{(z-z_0)^2} [1 - (z-z_0) + \cdots]
\nonumber \\
& = \dfrac{e^{-2z_0}}{(z-z_0)^2} - \dfrac{e^{-2z_0}}{z-z_0} + \cdots
\end{align*}

where ##z_0## is the position of the pole ##2 \pi x i##. We use this in extracting the residue of ##f(z)## at ##z_0##:

\begin{align*}
e^{z_0} \dfrac{e^{\alpha z}}{(e^z - e^{z_0})^2} & = e^{-z_0} \dfrac{ e^{\alpha z_0 + \alpha (z-z_0)} }{ (z-z_0)^2 } - e^{-z_0} \dfrac{ e^{\alpha z_0} }{ z-z_0 } + \cdots
\nonumber \\
& = e^{-z_0} \dfrac{ e^{\alpha z_0} [1 + \alpha (z-z_0) + \cdots] }{ (z-z_0)^2 } - e^{-z_0} \dfrac{ e^{\alpha z_0} }{ z-z_0 } + \cdots
\nonumber \\
& = e^{-z_0} \dfrac{ e^{\alpha z_0} }{ (z-z_0)^2 } + e^{-z_0} \dfrac{ (\alpha - 1) e^{\alpha z_0} }{ z-z_0 } + \cdots
\end{align*}

Combining everything

\begin{align*}
I(\alpha) & = \frac{1}{4} e^{2 \pi x i} \int_{-\infty}^\infty \dfrac{e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = \frac{i \pi}{2} \frac{1}{1-e^{\alpha 2 \pi i}} \cdot e^{-2 \pi x i} (\alpha - 1) e^{\alpha 2 \pi x i}
\nonumber \\
& = - \frac{\pi}{4} e^{(\alpha - 1) 2 \pi x i - \alpha \pi i} \frac{(\alpha - 1) 2i}{e^{\alpha \pi i} - e^{-\alpha \pi i}}
\end{align*}

So that

\begin{align*}
Re I(\alpha) & = - \frac{\pi}{4} \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{\alpha - 1}{\sin \alpha \pi}
\end{align*}

Taking second derivative w.r.t. ##\alpha## results in

\begin{align*}
& \dfrac{\partial^2}{\partial \alpha^2} Re I(\alpha)
\nonumber \\
& = \frac{\pi}{4} \pi^2 (2x-1)^2 \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{\alpha - 1}{\sin \alpha \pi}
\nonumber \\
& \frac{\pi}{2} \pi (2x-1) \sin [(\alpha - 1) 2 x \pi - \alpha \pi] \dfrac{\partial}{\partial \alpha} \frac{\alpha - 1}{\sin \alpha \pi}
\nonumber \\
& - \frac{\pi}{4} \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \dfrac{\partial^2}{\partial \alpha^2} \frac{\alpha - 1}{\sin \alpha \pi}
\nonumber \\
& = \frac{\pi}{4} \pi^2 (2x-1)^2 \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{\alpha - 1}{\sin \alpha \pi}
\nonumber \\
& \frac{\pi}{2} \pi (2x-1) \sin [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{\sin \alpha \pi - (\alpha - 1) \pi \cos \alpha \pi}{\sin^2 \alpha \pi}
\nonumber \\
& - \frac{\pi}{4} \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{(\alpha - 1) \pi^2\sin^3 \alpha \pi - [\sin \alpha \pi - (\alpha - 1) \pi \cos \alpha \pi] 2 \pi \cos \alpha \pi \sin \alpha \pi}{\sin^4 \alpha \pi}
\end{align*}

I handled all but the last term with L'Hopital. With the last term, initially we do the Taylor expansion:

\begin{align*}
& \frac{[\sin \alpha \pi - (\alpha - 1) \pi \cos \alpha \pi] 2 \pi \cos \alpha \pi \sin \alpha \pi}{\sin^4 \alpha \pi}
\nonumber \\
& = 2 \pi \left( \dfrac{\cos \alpha \pi}{\sin^2 \alpha \pi} \left( 1 - \pi \dfrac{\alpha - 1}{\sin \alpha \pi} \cos \alpha \pi \right) \right)
\nonumber \\
& = 2 \pi \left( \dfrac{\cos \alpha \pi}{\sin^2 \alpha \pi} \left( 1 - \pi \dfrac{\alpha - 1}{\sin (\alpha - 1) \pi} \cos (\alpha - 1) \pi \right) \right)
\nonumber \\
& = 2 \pi \left( \dfrac{\cos \alpha \pi}{\sin^2 \alpha \pi} \left( 1 - \pi \dfrac{\alpha - 1}{(\alpha - 1) \pi [ 1 - \frac{1}{3!} (\alpha - 1)^2 \pi^2 \cdots]} [ 1 - \frac{1}{2!} (\alpha - 1)^2 \pi^2 + \cdots \right) \right)
\nonumber \\
& = 2 \pi \left( \dfrac{\cos \alpha \pi}{\sin^2 \alpha \pi} \left( 1 - [ 1 + \frac{1}{3!} (\alpha - 1)^2 \pi^2 + \cdots] [ 1 - \frac{1}{2!} (\alpha - 1)^2 \pi^2 + \cdots \right) \right)
\nonumber \\
& = 2 \pi \left( \dfrac{\cos \alpha \pi}{\sin^2 \alpha \pi} \left( \frac{1}{3} (\alpha - 1)^2 \pi^2 + \cdots \right) \right)
\nonumber \\
& = \frac{2}{3} \pi^3 \cos \alpha \pi \dfrac{(\alpha - 1)^2}{\sin^2 \alpha \pi} + \text{terms that vanish as } \alpha \rightarrow 1
\end{align*}

So that

\begin{align*}
& \lim_{\alpha \rightarrow 1} \frac{\pi}{4} \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \frac{[\sin \alpha \pi - (\alpha - 1) \pi \cos \alpha \pi] 2 \pi \cos \alpha \pi \sin \alpha \pi}{\sin^4 \alpha \pi}
\nonumber \\
& = \lim_{\alpha \rightarrow 1} \frac{\pi}{6} \cos [(\alpha - 1) 2 x \pi - \alpha \pi] \pi^3 \cos \alpha \pi \dfrac{(\alpha - 1)^2}{\sin^2 \alpha \pi}
\nonumber \\
& = \frac{\pi^2}{6}
\end{align*}

From using L'Hopital on the first terms and using the result just proven:

\begin{align*}
\left. \dfrac{\partial^2}{\partial \alpha^2} Re I(\alpha) \right|_{\alpha = 1} & = \frac{\pi}{4} \pi^2 (2x-1)^2 \frac{1}{\pi} + \frac{\pi^2}{2} (2x-1)^2 - \frac{\pi^2}{2} (2x-1)^2
\nonumber \\
& - \frac{\pi^2}{4} + \frac{\pi^2}{6}
\end{align*}

So finally:

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} = \pi^2 \left( x^2 - x + \frac{1}{6} \right) .
\end{align*}

2nd method for calculating integral

We use the same rectangular contour. In the complex contour integrals here, the integral along vertical edges vanishes.

Consider

\begin{align*}
\oint_C \dfrac{e^{2 \pi x i} e^z z^3}{(e^z - e^{2 \pi x i})^2} dz & = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u u^3}{(e^u - e^{2 \pi x i})^2} du - \int_{-\infty+2 \pi i}^{\infty + 2 \pi i} \dfrac{e^{2 \pi x i} e^u (u+ 2 \pi i)^3}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = - \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u (3 u^2 (2 \pi i) + 3u (2 \pi i)^2 + (2\pi i)^3)}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = - 3 (2 \pi i) \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} u^2 e^u}{(e^u - e^{2 \pi x i})^2} du - 3 (2 \pi i)^2 \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} u e^u}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& - (2 \pi i)^3 \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& - 3 (2 \pi i) I_2 - 3 (2 \pi i)^2 I_1 - (2 \pi i)^3 I_0
\end{align*}

So that

\begin{align*}
\frac{1}{2 \pi i} \oint_C \dfrac{e^{2 \pi x i} e^z z^3}{(e^z - e^{2 \pi x i})^2} dz = - 3 I_2 - 3 (2 \pi i) I_1 - (2 \pi i)^2 I_0
\end{align*}

The integral ##I_0## is straightforward to do:

\begin{align*}
I_0 & = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = \int_{-\infty}^\infty \left( - \frac{d}{du} \dfrac{e^{2 \pi x i}}{e^u - e^{2 \pi x i}} \right) du
\nonumber \\
& = \left[ - \dfrac{e^{2 \pi x i}}{e^u - e^{2 \pi x i}} \right]_{-\infty}^\infty = - 1
\end{align*}

We have the following residue (see below for details)

\begin{align*}
\text{Res}_{z = 2 \pi x i} \dfrac{e^{2 \pi x i} e^z z^3}{(e^z - e^{2 \pi x i})^2} = - 12 \pi^2 x^2 = - 3 I_2 - 3 (2 \pi i) I_1 - (2 \pi i)^2 I_0
\end{align*}

Consider

\begin{align*}
\oint_C \dfrac{e^{2 \pi x i} e^z z^2}{(e^z - e^{2 \pi x i})^2} dz & = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u u^2}{(e^u - e^{2 \pi x i})^2} du - \int_{-\infty+2 \pi i}^{\infty + 2 \pi i} \dfrac{e^{2 \pi x i} e^u (u+ 2 \pi i)^2}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = - \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u (2 u (2 \pi i) + (2\pi i)^2}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = - 2 (2 \pi i) \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} u e^u}{(e^u - e^{2 \pi x i})^2} du - (2 \pi i)^2 \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& - 2 (2 \pi i) I_1 + (2 \pi i)^2
\end{align*}

So that

\begin{align*}
\frac{1}{2 \pi i} \oint_C \dfrac{e^{2 \pi x i} e^z z^2}{(e^z - e^{2 \pi x i})^2} dz = - 2 I_1 + (2 \pi i)
\end{align*}

We have the following residue

\begin{align*}
\text{Res}_{z = 2 \pi x i} \dfrac{e^{2 \pi x i} e^z z^2}{(e^z - e^{2 \pi x i})^2} = i 4 \pi x = - 2 I_1 + (2 \pi i)
\end{align*}

Collecting results

\begin{align*}
- 12 \pi^2 x^2 & = - 3 I_2 - 3 (2 \pi i) I_1 + (2 \pi i)^2
\nonumber \\
i 2 \pi x & = - I_1 + (\pi i)
\nonumber \\
I_0 & = -1
\end{align*}

So that

\begin{align*}
I_2 & = 4 \pi^2 x^2 - 2 \pi i I_1 - \frac{4}{3} \pi^2
\nonumber \\
& = 4 \pi^2 x^2 - 2 \pi i (- i 2 \pi x + \pi i) - \frac{4}{3} \pi^2
\nonumber \\
& = 4 \pi^2 x^2 - 4 \pi^2 x + \frac{2}{3} \pi^2
\end{align*}

So finally,

\begin{align*}
\sum_{n=0}^\infty \dfrac{\cos (2 \pi n x)}{n^2} & = \frac{1}{4} Re \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u u^2}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = \frac{1}{4} Re I_2
\nonumber \\
& = \pi^2 \left( x^2 - x + \frac{1}{6} \right) .
\end{align*}

Calculating residues

We calculate

\begin{align*}
\text{Res}_{z = 2 \pi x i} \dfrac{e^{2 \pi x i} e^z z^k}{(e^z - e^{2 \pi x i})^2} .
\end{align*}

Again,

\begin{align*}
\frac{1}{(e^z - e^{z_0})^2} = \dfrac{e^{-2z_0}}{(z-z_0)^2} - \dfrac{e^{-2z_0}}{z-z_0} + \cdots
\end{align*}

So

\begin{align*}
\frac{e^{z_0} e^z z^k}{(e^z - e^{z_0})^2} & = \frac{e^{2z_0} e^{z-z_0} [z_0 +(z-z_0)]^k}{(e^z - e^{z_0})^2}
\nonumber \\
& = \dfrac{[1 + (z-z_0) + \cdots] [z_0^k + kz_0^{k-1} (z-z_0) + \cdots]}{(z-z_0)^2} - \dfrac{z_0^k}{z-z_0} + \cdots
\nonumber \\
& = \dfrac{z_0^k}{(z-z_0)^2} + \dfrac{kz_0^{k-1}}{z-z_0} + \cdots
\end{align*}

So

\begin{align*}
\text{Res}_{z = 2 \pi x i} \dfrac{e^{2 \pi x i} e^z z^k}{(e^z - e^{2 \pi x i})^2} & = k (2 \pi x i)^{k-1}
\nonumber \\
& = i^{k-1} 2^{k-1} k \pi^{k-1} x^{k-1} .
\end{align*}

Last edited:
It is much easier to evaluate ##\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2}## by Taylor expanding ##I(\alpha)## and obtaining the coefficient of ##\alpha^2## rather than differentiating it twice, as I did in the previous post. I do this in this post.

The method used in the previous post can be used to evaluate the general Fourier series

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}}
\end{align*}

for ##k=1,2,\dots## with the result being proportional to the Bernoulli polynomial ##B_{2k} (x)##, as ##I(\alpha)## is basically the generating function for Bernoulli polynomials. There is an explicit expression for Bernoulli polynomials in terms of Bernoulli numbers, which can be easily obtained using their respective generating functions. Using generating functions makes extracting the answer easier than differentiating ##I(\alpha)##. I obtain the expression for ##\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2}## this way.

We will evaluate the general Fourier series

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}}
\end{align*}

for ##k=1,2,\dots##. We have:

\begin{align*}
& \sum_{n=0}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}}
\nonumber \\
& = \frac{1}{(2k-1)!} \sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}} \int_0^\infty u^{2k-1} e^{-u} du
\nonumber \\
& = \frac{1}{(2k-1)!} \sum_{n=1}^\infty \cos (2 \pi n x) \int_0^\infty u^{2k-1} e^{-nu} du
\nonumber \\
& = \frac{1}{(2k-1)!} \frac{1}{2} \sum_{n=1}^\infty \int_0^\infty (e^{-nu + i n 2 \pi x} + e^{-nu - i n 2 \pi x}) u^{2k-1} du
\nonumber \\
& = \frac{1}{2 (2k-1)!} \int_0^\infty \sum_{n=1}^\infty (e^{-nu + i n 2 \pi x} + e^{-nu - i n 2 \pi x}) u^{2k-1} du
\nonumber \\
& = \frac{1}{2 (2k-1)!} \int_0^\infty \left( \dfrac{1}{e^{u - 2 \pi x i} - 1} + \dfrac{1}{e^{u + 2 \pi x i} - 1} \right) u^{2k-1} du
\end{align*}

To justify interchanging summation and integration in the above, we can use Fubini:

\begin{align*}
\frac{1}{(2k-1)!} \sum_{n=1}^\infty \int_0^\infty | \cos (2 \pi n x) u^{2k-1} e^{-nu} | du & \leq \frac{1}{(2k-1)!} \sum_{n=1}^\infty \int_0^\infty u^{2k-1} e^{-nu} du
\nonumber \\
& = \sum_{n=1}^\infty \frac{1}{n^{2k}}
\nonumber \\
& < \sum_{n=1}^\infty \frac{1}{n^2}
\nonumber \\
& < 1 + \lim_{N \rightarrow \infty} \sum_{n=2}^N \frac{1}{n (n-1)}
\nonumber \\
& = 1 + \lim_{N \rightarrow \infty} \sum_{n=2}^N \left( \frac{1}{n-1} - \frac{1}{n} \right)
\nonumber \\
& = 1 + 1 - \lim_{N \rightarrow \infty} \frac{1}{N} = 2 < \infty
\end{align*}

From the above

\begin{align*}
\sum_{n=0}^\infty \dfrac{\cos (2 \pi n x)}{n^2} & = \frac{1}{2 (2k-1)!} \int_0^\infty \left( \dfrac{1}{e^{u - 2 \pi x i} - 1} + \dfrac{1}{e^{u + 2 \pi x i} - 1} \right) u^{2k-1} du
\nonumber \\
& = \frac{1}{2 (2k-1)!} \int_0^\infty \left( \dfrac{e^{2 \pi x i} u^{2k-1}}{e^u - e^{2 \pi x i}} + \dfrac{e^{-2 \pi x i} u^{2k-1}}{e^u - e^{-2 \pi x i}} \right) du
\nonumber \\
& = \frac{1}{2 (2k)!} \int_0^\infty \left( \dfrac{e^{2 \pi x i} e^u u^{2k}}{(e^u - e^{2 \pi x i})^2} + \dfrac{e^{-2 \pi x i} e^u u^{2k}}{(e^u - e^{-2 \pi x i})^2} \right) du
\nonumber \\
& = \frac{1}{4 (2k)!} \int_{-\infty}^\infty \left( \dfrac{e^{2 \pi x i} e^u u^{2k}}{(e^u - e^{2 \pi x i})^2} + \dfrac{e^{-2 \pi x i} e^u u^{2k}}{(e^u - e^{-2 \pi x i})^2} \right) du
\nonumber \\
& = \frac{1}{2 (2k)!} Re \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^u u^{2k}}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

where I have done an integration by parts. Extending the range of integration is valid if you use both terms.

Define

\begin{align*}
I (\alpha) = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u} e^u}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

for ##-\frac{1}{2} \leq \alpha \leq \frac{1}{2}##. Then

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}} = \frac{1}{2 (2k)!} \left. \dfrac{\partial^{2k}}{\partial \alpha^{2k}} Re I (\alpha) \right|_{\alpha =0} \qquad (*) .
\end{align*}

In order to evaluate ##I(\alpha)##, consider the contour in the figure.

and the integral

\begin{align*}
\oint_C \dfrac{e^{2 \pi x i} e^{\alpha z} e^z}{(e^z - e^{2 \pi x i})^2}
\end{align*}

whose integrand has pole at ##2 \pi x i##. The integral along the vertical edges vanishes as:

\begin{align*}
f(z) = \dfrac{e^{2 \pi x i} e^{(\alpha + 1) (u+iv)}}{(e^{u+iv} + e^{2 \pi x i})^2} =
\begin{cases}
e^{2 \pi x i} e^{(\alpha - 1) (u+iv)} & u \rightarrow \infty \\
\dfrac{e^{(\alpha + 1) (u+iv)}}{e^{2 \pi x i}} & u \rightarrow - \infty \\
\end{cases}
\end{align*}

So that

\begin{align*}
\oint_C \dfrac{e^{2 \pi x i} e^{\alpha z} e^z}{(e^z - e^{2 \pi x i})^2} & = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du - e^{\alpha 2 \pi i} \int_{-\infty+2 \pi i}^{\infty+ 2 \pi i} \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = (1-e^{\alpha 2 \pi i}) \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\end{align*}

Which rearranged is

\begin{align*}
\int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u} e^u}{(e^u - e^{2 \pi x i})^2} du & = \frac{2 \pi i }{1-e^{\alpha 2 \pi i}} \frac{1}{2 \pi i} \oint_C \dfrac{e^{2 \pi x i} e^{\alpha z} e^z}{(e^z - e^{2 \pi x i})^2} dz
\nonumber \\
& = \frac{2 \pi i}{1-e^{\alpha 2 \pi i}} Res [f(z)]
\end{align*}

We wish to expand the integrand in powers of ##z-z_0## about pole ##z_0= 2\pi x i##. First note:

\begin{align*}
\frac{1}{(e^z - e^{z_0})^2} & = \frac{e^{-2 z_0}}{(e^{z-z_0} - 1)^2}
\nonumber \\
& = \dfrac{e^{-2z_0}}{(z-z_0)^2} - \dfrac{e^{-2z_0}}{z-z_0} + \cdots
\end{align*}

Then note:

\begin{align*}
\dfrac{e^{z_0} e^{\alpha z} e^z}{(e^z - e^{z_0})^2} & = e^{-z_0} \dfrac{ e^{(\alpha + 1) z_0 + (\alpha + 1) (z-z_0)} }{ (z-z_0)^2 } - e^{-z_0} \dfrac{ e^{(\alpha + 1) z_0} }{ z-z_0 } + \cdots
\nonumber \\
& = e^{-z_0} \dfrac{ e^{(\alpha + 1) z_0} [1 + (\alpha + 1) (z-z_0) + \cdots] }{ (z-z_0)^2 } - e^{-z_0} \dfrac{ e^{(\alpha + 1) z_0} }{ z-z_0 } + \cdots
\nonumber \\
& = \dfrac{ e^{\alpha z_0} }{ (z-z_0)^2 } + \dfrac{ \alpha e^{\alpha z_0} }{ z-z_0 } + \cdots
\end{align*}

Combining everything

\begin{align*}
I(\alpha) & = \int_{-\infty}^\infty \dfrac{e^{2 \pi x i} e^{\alpha u}}{(e^u - e^{2 \pi x i})^2} du
\nonumber \\
& = 2 \pi i \frac{1}{1-e^{\alpha 2 \pi i}} \cdot \alpha e^{\alpha 2 \pi x i}
\nonumber \\
& = - e^{\alpha 2 \pi x i - \alpha \pi i} \dfrac{\alpha \pi}{\sin \alpha \pi}
\end{align*}

This expression is related to the generating function for Bernoulli polynomials, as we establish in a moment. First we take the case ##k=1## and Taylor expand in ##\alpha## to obtain the coefficient of ##\alpha^2##.

Taylor expanding ##I (\alpha)## to get ##\sum_{n=1}^\infty \frac{\cos 2 \pi x}{n^2}##

We Taylor expand ##I(\alpha)##:

\begin{align*}
I(\alpha) & = - e^{\alpha 2 \pi x i - \alpha \pi i} \dfrac{\alpha \pi}{\sin \alpha \pi}
\nonumber \\
& = - \left[ 1 + \alpha \pi i (2x-1) - \frac{1}{2} \alpha^2 \pi^2 (2x-1)^2 + \cdots \right] \dfrac{1}{1 - \dfrac{1}{3!} \alpha^2 \pi^2 + \cdots}
\nonumber \\
& = - \left[ 1 + \alpha \pi i (2x-1) - \frac{1}{2} \alpha^2 \pi^2 (2x-1)^2 + \cdots \right] \left[ 1 + \dfrac{1}{6} \alpha^2 \pi^2 + \cdots \right]
\nonumber \\
& = - \left[ 1 + \alpha \pi i (2x-1) - \frac{1}{2} \alpha^2 \pi^2 (2x-1)^2 + \dfrac{1}{6} \alpha^2 \pi^2 + \cdots \right]
\end{align*}

Then, for ##k=1##:

\begin{align*}
\left. \frac{1}{4} \dfrac{\partial^2}{\partial \alpha^2} I(\alpha) \right|_{\alpha=0} & = \pi^2 \left( x-\frac{1}{2} \right)^2 - \dfrac{\pi^2}{12}
\nonumber \\
& = \pi^2 \left( x^2 - x + \frac{1}{6} \right)
\end{align*}

and so

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} = \pi^2 \left( x^2 - x + \frac{1}{6} \right) .
\end{align*}

Bernoulli polynomials

We return to the evaluation of the general sum, ##\sum_{n=1}^\infty \frac{\cos (2 \pi n x)}{n^{2k}}##. The generating function for the Bernoulli polynomials is

\begin{align*}
\dfrac{t e^{xt}}{e^t-1} = \sum_{k=0}^\infty B_k (x) \frac{t^k}{k!} .
\end{align*}

We have

\begin{align*}
\dfrac{t e^{xt}}{\sinh \frac{t}{2}} = \dfrac{2t e^{ t ( x+\frac{1}{2} ) }}{e^t-1} = 2 \sum_{k=0}^\infty B_k (x+\frac{1}{2}) \frac{t^k}{k!}
\end{align*}

We perform ##t \mapsto i 2 \pi t## and ##x \mapsto x-\frac{1}{2}##,

\begin{align*}
\dfrac{\pi t}{\sin \pi t} e^{i 2 \pi t x - i \pi t} = \sum_{k=0}^\infty B_k (x) \frac{(i 2 \pi t)^k}{k!}
\end{align*}

We recognise the LHS as our expression for ##-I(\alpha)## with ##\alpha## replaced with ##t##. Taking the real part:

\begin{align*}
Re \dfrac{\pi t}{\sin \pi t} e^{i 2 \pi t x - i \pi t} = \sum_{k=0}^\infty B_{2k} (x) \frac{(-1)^k (2 \pi)^{2k}}{(2k)!} t^{2k}
\end{align*}

Using this in ##(*)## we obtain the general formula:

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^{2k}} & = \left. - \frac{1}{2 (2k)!} \dfrac{\partial^{2k}}{\partial \alpha^{2k}} Re \; e^{\alpha 2 \pi x i - \alpha \pi i} \dfrac{\alpha \pi}{\sin \alpha \pi} \right|_{\alpha=0}
\nonumber \\
& = \frac{(-1)^{k+1} (2 \pi)^{2k}}{2 (2k)!} B_{2k} (x)
\end{align*}

For ##k=1##,

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} = \pi^2 B_2 (x) .
\end{align*}

We need to compute ##B_2 (x)##. We next derive an explicit formula for Bernoulli polynomials.

Explicit formula for Bernoulli polynomials

The generating function for Bernoulli numbers is

\begin{align*}
\dfrac{t}{ e^t - 1 } = \sum_{n=0}^\infty B_n \frac{t^n}{n!} .
\end{align*}

From the generating function for Bernoulli polynomials and Cauchy product of series:

\begin{align*}
\sum_{n=0}^\infty B_n (x) \frac{t^n}{n!} & = \dfrac{t}{ e^t - 1 } e^{tx}
\nonumber \\
& = ( \sum_{k=0}^\infty \frac{B_k t^k}{k!} ) ( \sum_{l=0}^\infty \frac{x^l t^l}{l!} )
\nonumber \\
& = \sum_{n=0}^\infty \sum_{k=0}^n \frac{n!}{(n-k)! k!} B_{n-k} x^k \frac{t^n}{n!}
\end{align*}

\begin{align*}
B_n (x) = \sum_{k=0}^n \frac{n!}{(n-k)! k!} B_{n-k} x^k
\end{align*}

It is easy to expand the generating function for Bernoulli numbers to find ##B_0=1##, ##B_1 = -\frac{1}{2}##, and ##B_2 = \frac{1}{6}##. Substituting them into the expression for ##B_2 (x)##,

\begin{align*}
B_2 (x) & = B_0 + 2 B_1 x + B_2 x^2
\nonumber \\
& = x^2 - x + \frac{1}{6} .
\end{align*}

So finally,

\begin{align*}
\sum_{n=1}^\infty \dfrac{\cos (2 \pi n x)}{n^2} = \pi^2 \left( x^2 - x - \frac{1}{6} \right) .
\end{align*}

Last edited:

• Math POTW for University Students
Replies
1
Views
576
• Math POTW for University Students
Replies
16
Views
1K
• Calculus and Beyond Homework Help
Replies
3
Views
561
• Calculus and Beyond Homework Help
Replies
1
Views
444
• Calculus and Beyond Homework Help
Replies
1
Views
569
• Math POTW for University Students
Replies
8
Views
835
• Math POTW for University Students
Replies
1
Views
2K
• Topology and Analysis
Replies
4
Views
674
• Differential Equations
Replies
4
Views
2K
• Calculus and Beyond Homework Help
Replies
6
Views
619