Expansions of Simple Functions
Learning Fourier series through concrete examples
Introduction (High School Level)
Introduction
Let us apply the Fourier series formulas to concrete functions and work through several important examples. These examples not only deepen our understanding of Fourier analysis but are also important in applications.
Square Wave
Consider the square wave of period $2\pi$:
$$f(x) = \begin{cases} 1 & (0 < x < \pi) \\ -1 & (-\pi < x < 0) \end{cases}$$
Computing the Fourier Coefficients
This function is odd, so $a_n = 0$. Computing $b_n$:
$$b_n = \dfrac{1}{\pi}\displaystyle\int_{-\pi}^{\pi}f(x)\sin nx\,dx = \dfrac{2}{\pi}\displaystyle\int_0^{\pi}\sin nx\,dx$$
$$= \dfrac{2}{\pi}\left[-\dfrac{\cos nx}{n}\right]_0^{\pi} = \dfrac{2}{n\pi}(1 - \cos n\pi) = \dfrac{2}{n\pi}(1 - (-1)^n)$$
When $n$ is even, $b_n = 0$; when $n$ is odd, $b_n = \dfrac{4}{n\pi}$.
Result
$$f(x) = \dfrac{4}{\pi}\left(\sin x + \dfrac{1}{3}\sin 3x + \dfrac{1}{5}\sin 5x + \dfrac{1}{7}\sin 7x + \cdots\right)$$
It consists only of odd-harmonic sine waves, reflecting the symmetry of the square wave.
Triangle Wave
Consider the triangle wave of period $2\pi$:
$$f(x) = |x| \quad (-\pi \leq x \leq \pi)$$
Computing the Fourier Coefficients
This function is even, so $b_n = 0$.
$$a_0 = \dfrac{1}{\pi}\displaystyle\int_{-\pi}^{\pi}|x|\,dx = \dfrac{2}{\pi}\displaystyle\int_0^{\pi}x\,dx = \pi$$
$$a_n = \dfrac{2}{\pi}\displaystyle\int_0^{\pi}x\cos nx\,dx = \dfrac{2}{n^2\pi}(\cos n\pi - 1) = \dfrac{2}{n^2\pi}((-1)^n - 1)$$
When $n$ is even, $a_n = 0$; when $n$ is odd, $a_n = -\dfrac{4}{n^2\pi}$.
Result
$$|x| = \dfrac{\pi}{2} - \dfrac{4}{\pi}\left(\cos x + \dfrac{1}{9}\cos 3x + \dfrac{1}{25}\cos 5x + \cdots\right)$$
Since the coefficients decay as $1/n^2$, convergence is faster than for the square wave.
Sawtooth Wave
The sawtooth wave of period $2\pi$ (the example from the previous chapter):
$$f(x) = x \quad (-\pi < x < \pi)$$
Result (recap)
$$x = 2\left(\sin x - \dfrac{1}{2}\sin 2x + \dfrac{1}{3}\sin 3x - \dfrac{1}{4}\sin 4x + \cdots\right)$$
$$= 2\displaystyle\sum_{n=1}^{\infty}\dfrac{(-1)^{n+1}}{n}\sin nx$$
Parabola
The parabola of period $2\pi$:
$$f(x) = x^2 \quad (-\pi \leq x \leq \pi)$$
Computing the Fourier Coefficients
Since it is even, $b_n = 0$.
$$a_0 = \dfrac{1}{\pi}\displaystyle\int_{-\pi}^{\pi}x^2\,dx = \dfrac{2\pi^2}{3}$$
$$a_n = \dfrac{2}{\pi}\displaystyle\int_0^{\pi}x^2\cos nx\,dx = \dfrac{4(-1)^n}{n^2}$$
Result
$$x^2 = \dfrac{\pi^2}{3} + 4\left(-\cos x + \dfrac{1}{4}\cos 2x - \dfrac{1}{9}\cos 3x + \cdots\right)$$
Application to computing $\pi^2$
Substituting $x = \pi$:
$$\pi^2 = \dfrac{\pi^2}{3} + 4\left(1 + \dfrac{1}{4} + \dfrac{1}{9} + \cdots\right)$$
Rearranging:
$$\displaystyle\sum_{n=1}^{\infty}\dfrac{1}{n^2} = \dfrac{\pi^2}{6}$$
we obtain the famous result known as Euler's Basel problem.
Comparison of Convergence Speed
| Function | Coefficient decay | Convergence speed |
|---|---|---|
| Square wave | $1/n$ | Slow |
| Sawtooth wave | $1/n$ | Slow |
| Triangle wave | $1/n^2$ | Fast |
| Parabola | $1/n^2$ | Fast |
In general, the smoother the function, the faster its Fourier coefficients decay and the faster the series converges. Functions with discontinuities (the square and sawtooth waves) converge slowly.
Summary
- A square wave is a sum of odd-harmonic sine waves
- A triangle wave is a sum of odd-harmonic cosine waves
- A sawtooth wave is a sum of sine waves of all orders
- The smoother the function, the faster its Fourier coefficients decay
- Series identities such as $\pi^2/6$ can be derived from Fourier series
Frequently Asked Questions
Q1: Can you give examples of Fourier expansions of simple functions?
A: The square wave $f(x) = \mathrm{sgn}(\sin x)$ (for $-\pi < x < \pi$) is $f(x) = \dfrac{4}{\pi}\displaystyle\sum_{n=1,3,5,\dots}^{\infty} \dfrac{1}{n}\sin nx$. The Fourier series of $x$ (for $-\pi < x < \pi$) is $2\displaystyle\sum_{n=1}^{\infty} \dfrac{(-1)^{n+1}}{n}\sin nx$, and Parseval's identity then gives $\displaystyle\sum_{n=1}^{\infty} \dfrac{1}{n^2} = \dfrac{\pi^2}{6}$.
Q2: Why does the triangle wave converge faster than the square wave?
A: Because the smoother the function, the faster its Fourier coefficients decay. The square and sawtooth waves have discontinuities and their coefficients decay as $1/n$, whereas the triangle wave and parabola are continuous and decay as $1/n^2$. Faster decay means fewer terms are needed to approximate the function, so the triangle wave converges faster.
Q3: What form do the Fourier expansions of even and odd functions take?
A: An even function ($f(-x) = f(x)$) becomes a cosine-only Fourier cosine series $\dfrac{a_0}{2} + \displaystyle\sum_{n=1}^{\infty} a_n \cos nx$ (with $b_n = 0$). An odd function ($f(-x) = -f(x)$) becomes a sine-only Fourier sine series $\displaystyle\sum_{n=1}^{\infty} b_n \sin nx$ (with $a_n = 0$).