Mathematical Physics 202 Part B
Course Notes
Fourier Series
\[ \boxed{f(x) = \frac{a_{0}}{2} + \sum_{n=1}^{\infty} \left( a_{n} \cos\left( \frac{2n\pi x}{L} \right) + b_{n} \sin\left( \frac{2n\pi x}{L} \right) \right) } \]
Originally conceived by Joseph Fourier (early 1800s) to describe \(T=T(x,y,z,t)\) in a solid body.
One can imagine Fourier Series being applied to describe \(f(x)\) if \(f(x)\) is continuous (and periodic with period L) but the remarkable thing is that Fourier series can converge to \(f(x)\) even if \(f(x)\) is discontinuous!



As you will see, they can also be used to solve differential equations (indeed our solutions to \(\frac{du}{dt} = Au\) were a preview of this). The very task is to determine the coefficients \(a_{n}\) and \(b_{n}\). This can be done using so-called orthogonality relations:
\[ \boxed{ \begin{array}{l} \displaystyle \frac{2}{L} \int_{x_{0}}^{x_{0}+L} \cos\left(\frac{2n\pi x} {L}\right) \cos\left(\frac{2m\pi x}{L}\right) \, dx &= \delta_{nm} \\ \displaystyle \frac{2}{L} \int_{x_{0}}^{x_{0}+L} \sin\left(\frac{2n\pi x} {L}\right) \sin\left(\frac{2m\pi x}{L}\right) \, dx &= \delta_{nm} \\ \displaystyle \frac{2}{L} \int_{x_{0}}^{x_{0}+L} \sin\left(\frac{2n\pi x} {L}\right) \cos\left(\frac{2m\pi x}{L}\right) \, dx &= 0 \end{array} } \]

We can therefore ‘pick out’ a specific term by multiplying the series by the appropriate sine or cosine and integrating over one full period:
\[ \boxed{ \begin{array}{l} \displaystyle a_{n} = \frac{2}{L} \int_{x_{0}}^{x_{0}+L} \cos\left(\frac{2n\pi x}{L}\right)f(x)dx \\ \displaystyle b_{n} = \frac{2}{L} \int_{x_{0}}^{x_{0}+L} \sin\left(\frac{2n\pi x}{L}\right)f(x)dx \\ \end{array} } \] \[ \begin{array}{l} \displaystyle \frac{2}{L} \int_{x_{0}}^{x_{0}+L} f(x)\sin\left(\frac{2n\pi x}{L}\right) dx = \frac{2}{L} \Bigg[ \frac{a_{0}}{2} \int_{x_{0}}^{x_{0}+L} \sin\left(\frac{2n\pi x}{L}\right) dx \\[10pt] \displaystyle \quad + \sum_{m=1}^{\infty} a_{m} \int_{x_{0}}^{x_{0}+L} \cos\left(\frac{2m\pi x}{L}\right) \sin\left(\frac{2n\pi x}{L}\right) dx \\[10pt] \displaystyle \quad + \sum_{m=1}^{\infty} b_{m} \int_{x_{0}}^{x_{0}+L} \sin\left(\frac{2m\pi x}{L}\right) \sin\left(\frac{2n\pi x}{L}\right) dx \Bigg] \\[10pt] \displaystyle \frac{2}{L} \int_{x_{0}}^{x_{0}+L} f(x)\sin\left(\frac{2n\pi x}{L}\right) dx = b_{n} \end{array} \]
It is often useful to consider the form of \(f(x)\) to save calculation:
- If \(f(x)\) is even (\(f(-x) = f(x)\)) then all sine terms must be zero.
- If \(f(x)\) is odd (\(f(-x) = -f(x)\)) then all cosine terms must be zero.
Example: back to the square wave \[ f(x) = \left\{ \begin{array}{l@{\,}l} +1 \quad -\pi \leq x \leq 0 \\[5pt] -1 \quad 0 \leq x \leq \pi \\[5pt] f(x+2\pi) \end{array} \right. \mbox{~arithmetic algebra} \]

Odd function means that all \(a_{n}\) coefficients will be zero, such that: \[ b_{n} = \frac{1}{\pi}\int_{-\pi}^{+\pi}\sin(k_{n}x)f(x)dx\]
To evaluate this, split this expression into two integrals: \[ \begin{align} b_{n} &= \frac{1}{\pi} \left( \int_{-\pi}^{0} 1 \cdot \sin(k_{n}x) \, dx + \int_{0}^{\pi} -1 \cdot \sin(k_{n}x) \, dx \right) \\[10pt] &= \frac{1}{\pi} \left( \left[ \frac{-\cos(k_{n}x)}{k_{n}} \right]_{-\pi}^{0} + \left[ \frac{\cos(k_{n}x)}{k_{n}} \right]_{0}^{\pi} \right) \\[10pt] &= \frac{1}{\pi k_{n}} \left( -\cos(0) + \cos(-\pi k_{n}) + \cos(\pi k_{n}) - \cos(0) \right) \\[10pt] &= \frac{2}{\pi k_{n}} \left( \cos(\pi k_{n}) - 1 \right) \\[10pt] f(x) &= \frac{-4}{\pi} \left( \sin(x) + \frac{\sin(3x)}{3} + \frac{\sin(5x)}{5} + \dots \right) \end{align} \]
Keeping in mind that the parts in brackets on second to last line returns 0 for all even n and 2 for all odd n.
Dirichlet’s conditions
The Fourier representation of \(f(x)\) will converge as long as within one period of the function, \(f(x)\):
- is single-valued;
- does hot have an infinite number of discontinuities or any infinite discontinuities;
- does not have an infinite number of maxima;
- the integral of its magnitude \(\int|f(x)|\) is finite.
Dirichlet conditions are true for most common functions, even those with a discontinuity (where the Fourier transform series will converge to the midpoint). Not that these conditions are sufficient but not necessary.
Gibb’s phenomenon
At a discontinuous jump, the Fourier representation will normally overshoot. Although the Fourier series for any \(f(x)\) satisfying Dirichlet’s conditions converges, the size of the offshoot may approach a constant, but its location moves closes and closes to the discontinuity. This can play an important role in signal processing (‘ringing’ at the edge of pulses).

Example 2 - ramp function
Consider the function \(f(x) = 1 - \frac{2x}{\pi}\) on the interval \(0 \leq x \leq \pi\).

\(f(x)\) is even, so all \(b_{k}\) coefficients must be zero.\[ \begin{align} f(x) &= \frac{a_{0}}{2} + \sum_{k=1}^{\infty} a_{k} \cos(kx), \quad a_{0} = 0 \quad (\text{average value of } f(x)) \\[10pt] a_{k} &= \frac{2}{\pi} \int_{0}^{\pi} f(x) \cos(kx) \, dx \\[10pt] &= \frac{2}{\pi} \int_{0}^{\pi} \left( 1 - \frac{2x}{\pi} \right) \cos(kx) \, dx \\[10pt] &= \frac{-4}{\pi^{2}} \underbrace{\int_{0}^{\pi} x \cos(kx) \, dx}_{\text{integration by parts}} \\[10pt] \int_{0}^{\pi} x \cos(kx) \, dx &= \left[x\frac{\sin(kx)}{k}\right]_{0}^{\pi} - \int_{0}^{\pi} \frac{\sin(kx)}{k} \, dx \quad \left(\int u \, dv = uv - \int v \, du\right) \\[10pt] -\int_{0}^{\pi} \frac{\sin(kx)}{k} \, dx &= \frac{1}{k^{2}} \left[\cos(kx)\right]_{0}^{\pi} = \begin{cases} \frac{-2}{k^{2}}, & k = 1, 3, 5, \dots \\[10pt] 0, & k = 2, 4, 6, \dots \end{cases} \\[10pt] a_{k} &= \begin{cases} \frac{8}{\pi^{2}k^{2}}, & k = 1, 3, 5, \dots \\[10pt] 0, & k = 2, 4, 6, \dots \end{cases} \\[10pt] f(x) &= \frac{8}{\pi^{2}} \left( \cos(x) + \frac{\cos(3x)}{3^{2}} + \frac{\cos(5x)}{5^{2}} + \dots \right) \end{align} \]
- Interesting aside 1: \(f(0) = 1 = \frac{8}{\pi^{2}}(1+\frac{1}{3^{2}} + \frac{1}{5^{2}} + \dots) \rightarrow \frac{\pi^{2}}{8} = (1+\frac{1}{3^{2}} + \frac{1}{5^{2}} + \dots)\)
- Interesting aside 2: Compare square wave with ramp function

\(\displaystyle f_{1}(x) = ... , f_{2}(x) = \frac{2}{\pi}\int f_{1}(x)dx\)
\[ f_{1}(x) = \frac{4}{\pi} \left( \sin(x) + \frac{\sin(3x)}{3} + \frac{\sin(5x)}{5} + \dots \right), \quad f_{2}(x) = \frac{8}{\pi^{2}} \left( \cos(x) + \frac{\cos(3x)}{3^{2}} + \frac{\cos(5x)}{5^{2}} + \dots \right) \]
Example 3
Consider \[ f(x) = \begin{cases} 0, & -\pi \leq x \leq 0 \\[10pt] \frac{x}{\pi}, & 0 \leq x \leq \pi \end{cases} \\[10pt] \]

This function is neither odd nor even, hence we require all \(a_{n}, b_{n}\).
\[ \begin{align} a_{n} &= \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(kx) \, dx = \frac{1}{\pi^{2}} \int_{0}^{\pi} x \cos(kx) \, dx, \\[10pt] a_{k} &= \begin{cases} \frac{-4}{\pi^{2}k^{2}}, & k = 1, 3, 5, \dots \\[10pt] 0, & k = 2, 4, 6, \dots \end{cases} \\[10pt] b_{k} &= \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin(kx) \, dx = \underbrace{\frac{1}{\pi^{2}} \int_{0}^{\pi} x \sin(kx) \, dx}_{\text{integration by parts}}, \\[10pt] \frac{1}{\pi^{2}} \int_{0}^{\pi} x \sin(kx) \, dx &= \frac{1}{\pi^{2}} \left( \left[ \frac{-x \cos(kx)}{k} \right]_{0}^{\pi} + \int_{0}^{\pi} \frac{\cos(kx)}{k} \, dx \right), \\[10pt] &= \frac{1}{\pi^{2}} \left( \frac{\pi}{k} - 0 \right) = \frac{1}{\pi k}, \quad k = 1, 2, 3, \dots \end{align} \]
\[ f(x) = \underbrace{\frac{1}{4}}_{\bar{f(k)}} - \frac{4}{\pi^{2}}\sum_{k=1}^{\infty}\cos\left(\left(\frac{k-1}{2}\right)\pi x\right)\frac{-1}{k^{2}} + \frac{1}{\pi}\sum_{k=1}^{\infty}\frac{k\pi x}{k} \]