Example 3
Find the Fourier coefficients of:
$$
\begin{align*}
f(x) &= \frac{(\pi-x)^2}{4}
\end{align*}
$$
defined for \(0 \leq x \leq 2\pi\).
Note that if we want to integrate instead of \(-\pi\) to \(\pi\), then \(0\le x\le\pi\)
These \(x\)-values are already inside the original interval, so nothing changes. However when \(-\pi\le x<0\)
These values are outside the original interval. Add \(2\pi\) to move them into \([0,2\pi]\). Therefore,
$$
\begin{align*}
f(x+2\pi) &=\frac{\left(\pi-(x+2\pi)\right)^2}{4}\\
&=\frac{(-x-\pi)^2}{4}\\
&=\frac{(\pi+x)^2}{4}.
\end{align*}
$$
Thus, on \([-\pi,\pi]\), the same periodic function is
$$
\begin{align*}
f(x)=
\begin{cases}
\dfrac{(\pi+x)^2}{4},&-\pi\le x<0,\\[4pt]
\dfrac{(\pi-x)^2}{4},&0\le x\le\pi.
\end{cases}
\end{align*}
$$
Solution
Recall that the Fourier coefficient is
$$
\begin{align*}
\widehat{f}(n) &= \frac{1}{2\pi}\int_{0}^{2\pi} f(x)e^{-inx}\ dx
\end{align*}
$$
If we substitute \(f(x)\), then we get
$$
\begin{align*}
\widehat{f}(n)
&= \frac{1}{2\pi}
\int_0^{2\pi}
\frac{(\pi-x)^2}{4}e^{-inx}\,dx \\
&= \frac{1}{8\pi}
\int_0^{2\pi}
(\pi-x)^2e^{-inx}\,dx \tag{1}
\end{align*}
$$
Integration by parts
To evaluate (1) we need to use integration by parts. Choose \(u\) to be the part that becomes simpler when differentiated and
\(dv\) to be the part that is easy to integrate.
$$
\begin{align*}
u &= (\pi-x)^2, &du &= -2(\pi-x)\,dx, \\
dv &= e^{-inx}\,dx, &v &= \frac{e^{-inx}}{-in}
\end{align*}
$$
and recall that
$$
\begin{align*}
\int udv = uv - \int vdu
\end{align*}
$$
Then
$$
\begin{align*}
\int_0^{2\pi}(\pi-x)^2e^{-inx}\,dx &= \left[ (\pi-x)^2\frac{e^{-inx}}{-in} \right]_0^{2\pi} -
\int_0^{2\pi} \frac{e^{-inx}}{-in} \bigl[-2(\pi-x)\bigr]\,dx
\end{align*}
$$
Note that \(e^{-i2\pi n} = \cos(2\pi n)-i\sin(2\pi n) = 1\). Hence
$$
\begin{align*}
\left[
(\pi-x)^2\frac{e^{-inx}}{-in}
\right]_0^{2\pi}
&=
(\pi-2\pi)^2\frac{e^{-in(2\pi)}}{-in} - (\pi-0)^2\frac{e^{-in(0)}}{-in} \\
&= (-\pi)^2\frac{e^{-i2\pi n}}{-in} - \pi^2\frac{e^0}{-in} \\
&= \pi^2\frac{1}{-in} - \pi^2\frac{1}{-in} \\
&= \frac{\pi^2}{-in} - \frac{\pi^2}{-in} = 0 \tag{2}
\end{align*}
$$
And the integral evaluates to
$$
\begin{align*}
\int_0^{2\pi}(\pi-x)^2e^{-inx}\,dx
&=
-\frac{2}{in}
\int_0^{2\pi}
(\pi-x)e^{-inx}\,dx \tag{3}
\end{align*}
$$
which implies that we need to use integration by parts again using
$$
\begin{align*}
u &= \pi-x, &du &= -dx, \\
dv &= e^{-inx}\,dx, &v &= \frac{e^{-inx}}{-in}
\end{align*}
$$
Thus,
$$
\begin{align*}
\int_0^{2\pi}(\pi-x)e^{-inx}\,dx
&= \left[ (\pi-x)\frac{e^{-inx}}{-in}
\right]_0^{2\pi}
+ \frac{1}{-in}
\int_0^{2\pi}e^{-inx}\,dx
\end{align*}
$$
The first part evaluates to
$$
\begin{align*}
\left[ (\pi-x)\frac{e^{-inx}}{-in} \right]_0^{2\pi}
&= \frac{-\pi e^{-i2\pi n}}{-in}
-
\frac{\pi}{-in} = \frac{2\pi}{in} \tag{4}
\end{align*}
$$
While the integral evaluates to
$$
\begin{align*}
\frac{1}{-in}
\int_0^{2\pi}e^{-inx}\,dx
&=
\frac{1}{-in}
\left[ \frac{e^{-inx}}{-in}
\right]_0^{2\pi} = \frac{1}{(-in)^2} \left(e^{-i2\pi n}-1\right) = 0 \tag{5}
\end{align*}
$$
Substituting the results back in the Fourier Coefficient
Collecting the results from (2),(3), (4) and (5) we now substitute back in (1)
$$
\begin{align*}
\widehat{f}(n) &= \frac{1}{8\pi} \int_0^{2\pi} (\pi-x)^2e^{-inx}\,dx \\
&= \frac{1}{8\pi} \left[ -\frac{2}{in} \int_0^{2\pi} (\pi-x)e^{-inx}\,dx \right] \quad \text{By (2) and (3)}\\
&=
\frac{1}{8\pi} \left[ -\frac{2}{in} \cdot \frac{2\pi}{in}
\right]
\qquad \text{by (4) and (5)} \\
&=
\frac{1}{8\pi}
\left[
\frac{4\pi}{n^2}
\right] \\
&=
\frac{1}{2n^2},
\qquad n\neq 0
\end{align*}
$$
When \(n=0\)
$$
\begin{align*}
\widehat{f}(0)
&=
\frac{1}{2\pi}
\int_0^{2\pi}
\frac{(\pi-x)^2}{4}\,dx \\
&=
\frac{1}{8\pi}
\int_0^{2\pi}
\left(\pi^2-2\pi x+x^2\right)\,dx \\
&=
\frac{1}{8\pi}
\left[
\pi^2x-\pi x^2+\frac{x^3}{3}
\right]_0^{2\pi} \\
&=
\frac{1}{8\pi}
\left(
2\pi^3-4\pi^3+\frac{8\pi^3}{3}
\right) \\
&=
\frac{\pi^2}{12}
\end{align*}
$$
Hence the Fourier coefficients are
$$
\begin{align*}
\widehat{f}(n)
&=
\begin{cases}
\dfrac{\pi^2}{12}, & n=0, \\[6pt]
\dfrac{1}{2n^2}, & n\neq 0
\end{cases}
\end{align*}
$$
and the Fourier series becomes
$$
\begin{align*}
f(x)
&\sim
\sum_{n\in\mathbb{Z}}
\widehat{f}(n)e^{inx} = \frac{\pi^2}{12} +
\sum_{\substack{n\in\mathbb{Z}\\n\neq 0}}
\frac{e^{inx}}{2n^2}
\end{align*}
$$
If we pair the negative and positive terms together \(n\) and \(-n\) and noting that \(e^{inx}+e^{-inx} = 2\cos(nx)\), then
$$
\begin{align*}
f(x)
&\sim
\sum_{n\in\mathbb{Z}}
\widehat{f}(n)e^{inx} \\
&=
\widehat{f}(0)
+
\sum_{n=1}^{\infty}
\left[
\widehat{f}(n)e^{inx}
+
\widehat{f}(-n)e^{-inx}
\right] \\
&=
\frac{\pi^2}{12}
+
\sum_{n=1}^{\infty}
\left[
\frac{e^{inx}}{2n^2}
+
\frac{e^{-inx}}{2(-n)^2}
\right] \\
&=
\frac{\pi^2}{12}
+
\sum_{n=1}^{\infty}
\frac{e^{inx}+e^{-inx}}{2n^2} \\
&=
\frac{\pi^2}{12}
+
\sum_{n=1}^{\infty}
\frac{2\cos(nx)}{2n^2} \\
&=
\frac{\pi^2}{12}
+
\sum_{n=1}^{\infty}
\frac{\cos(nx)}{n^2}
\end{align*}
$$
References
- SFSU Fourier Analysis by Professor Chun-Kit Lai
- Fourier Analysis: An Introduction by Elias M.Stein and Rami Shakarchi