PAGE 1

9.1 (continued)

If \( f(x) \) is periodic w/ period of \( 2\pi \) defined on \( -\pi < x < \pi \), then its Fourier series representation is

\[ \frac{1}{2} a_0 + \sum_{n=1}^{\infty} [a_n \cos(nx) + b_n \sin(nx)] \]

where

\[ a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx) \, dx \quad n = 0, 1, 2, 3, \dots \]
\[ b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin(nx) \, dx \quad n = 1, 2, 3, \dots \]

Last time:

\[ f(x) = \begin{cases} 1 & \text{if } -\pi < x < 0 \\ 0 & \text{if } 0 < x < \pi \end{cases} \]

period \( 2\pi \)

A graph of a periodic square wave function f(x) on a Cartesian coordinate system. The x-axis is labeled with multiples of \pi including -\pi, \pi, 2\pi, and 3\pi. The y-axis is labeled f(x) with a value of 1 marked. The function f(x) alternates between a value of 1 and 0. Specifically, f(x) = 1 for intervals like (-\pi, 0) and (\pi, 2\pi), and f(x) = 0 for intervals like (0, \pi) and (2\pi, 3\pi). The segments at y=1 are drawn in green, and the segments at y=0 are drawn in blue along the x-axis. Vertical dashed lines indicate the jumps between 0 and 1.
Graph of the periodic square wave function \( f(x) \).
PAGE 2

Fourier Series Coefficients and Representation

We had:

\[ a_0 = 1, \quad a_n = 0 \quad n \geq 1 \]
\[ b_n = -\frac{1}{n\pi} (1 - (-1)^n) = \begin{cases} 0 & \text{if } n \text{ is even} \\ -\frac{2}{n\pi} & \text{if } n \text{ is odd} \end{cases} \]

Fourier Series Representation

So, its Fourier series representation is

\[ f(x) \sim \frac{1}{2}(1) + \sum_{n=1}^{\infty} -\frac{1}{n\pi} (1 - (-1)^n) \sin(nx) \]
Note: The series converges to true \( f(x) \)
\[ \sim \frac{1}{2} - \frac{2}{\pi} \sin(x) - \frac{2}{3\pi} \sin(3x) - \frac{2}{5\pi} \sin(5x) - \dots \]

Convergence and Approximation

Just like Taylor series, the more terms we include the better the Fourier series resembles the true \( f(x) \).

A Cartesian coordinate system showing the approximation of a periodic function  f(x)  by its Fourier series. The x-axis is labeled with  -\pi  and  \pi . The y-axis is labeled  f(x) . A blue curve represents a 'low order' approximation, which is a smooth wave oscillating around the target function. A red curve represents a 'higher order' approximation, which more closely follows the square-wave-like shape of the target function, showing more rapid oscillations (Gibbs phenomenon) near the discontinuities at  -\pi , 0, and  \pi .
Figure 1: Comparison of low-order (blue) and higher-order (red) Fourier series approximations of a periodic function.
PAGE 3

Fourier Series Example: Piecewise Function

Let's look at the function defined by:

\[f(x) = \begin{cases} 0 & -\pi < x < 0 \\ \pi - x & 0 < x < \pi \end{cases}\]

The function has a period of \(2\pi\).

A Cartesian coordinate system showing a periodic function f(x). The horizontal x-axis is labeled with -\pi and \pi. The vertical y-axis is labeled f(x) with a value of \pi marked. The function is zero on the interval [-\pi, 0] and then follows a linear downward slope from (0, \pi) to (\pi, 0). This sawtooth-like pattern repeats periodically across the x-axis.
Figure 1: Periodic piecewise function \(f(x)\) with period \(2\pi\).

The Fourier coefficient \(a_n\) is given by:

\[a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx) \, dx\]

Calculate \(a_0\) separately

We calculate the first coefficient by finding the area under the curve:

\[a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \, dx = \frac{1}{\pi} \left( \frac{1}{2} \cdot \pi \cdot \pi \right) = \frac{1}{2} \pi\]
Note: The integral \(\int_{-\pi}^{\pi} f(x) \, dx\) represents the area under \(f(x)\).

Calculate \(a_n\) for \(n \geq 1\)

Using integration by parts:

\[a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx) \, dx \quad \text{by parts}\]

After performing the integration:

\[= \dots\]\[= \frac{1}{n^2 \pi} (1 - (-1)^n) \quad \text{for } n = 1, 2, 3, \dots\]
PAGE 4

Fourier Series Coefficients and Approximation

Calculating the sine coefficients using integration by parts:

\[b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin(nx) \, dx \quad \text{by parts}\]
\[= \dots = \frac{1}{n} \quad n = 1, 2, 3, \dots\]

Fourier Series Expansion

The resulting Fourier series for \( f(x) \) is:

\[f(x) \sim \frac{1}{2} \left( \frac{1}{2} \pi \right) + \sum_{n=1}^{\infty} \left[ \frac{1}{n^2 \pi} (1 - (-1)^n) \cos(nx) + \frac{1}{n} \sin(nx) \right]\]

Expanding the first few terms of the series:

\[f(x) \sim \frac{\pi}{4} + \underbrace{\frac{2}{\pi} \cos(x) + \sin(x)}_{n=1} + \underbrace{\frac{1}{2} \sin(2x)}_{n=2} + \underbrace{\frac{2}{9\pi} \cos(3x) + \frac{1}{3} \sin(3x)}_{n=3} + \dots\]

Visualizing Convergence and Gibbs Phenomenon

A Cartesian coordinate system showing the approximation of a periodic function  f(x)  using Fourier series. The horizontal x-axis is labeled with  -\pi  and  \pi . The vertical axis is labeled  f(x) . A blue curve represents a 'low n' approximation, which is smoother and follows the general shape of the function. A red curve represents a 'high n' approximation, which shows more oscillations and a distinct overshoot at the points of discontinuity, illustrating the Gibbs phenomenon. The underlying function appears to be a periodic sawtooth or step-like wave.
Figure 1: Comparison of Fourier series approximations for low and high values of \( n \).

Fourier series properties discussed later:

  • Notice the overshoot right before and after a discontinuity that does not go away even with high \( n \).
  • Also, Fourier series seems to cut through the middle at the discontinuity.
PAGE 5

Fourier Series Example: Absolute Value Function

Try this one: \( f(x) = |x| \) for \( -\pi < x < \pi \) with period \( 2\pi \).

A Cartesian coordinate system showing a periodic triangular wave function f(x) = |x|. The x-axis has tick marks at -pi, 0, and pi. The y-axis is labeled f(x) and reaches a height of pi. The graph consists of connected line segments forming a 'V' shape between -pi and pi, which then repeats periodically.
Figure 1: Periodic extension of \( f(x) = |x| \)

The piecewise definition of the function over one period is:

\[ f(x) = \begin{cases} -x & -\pi < x < 0 \\ x & 0 < x < \pi \end{cases} \]

Calculating Fourier Coefficients

The constant coefficient \( a_0 \) is calculated as the average value over the period:

\[ a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \, dx = \frac{1}{\pi} \left( \frac{1}{2} \cdot 2\pi \cdot \pi \right) = \pi \]

The cosine coefficients \( a_n \) are found to be:

\[ a_n = \dots = \frac{-2}{n^2\pi} (1 - (-1)^n) \]

The sine coefficients \( b_n \) are zero because the function is even:

\[ b_n = \dots = 0 \]