Finding Trigonometric Fourier Series of Functions of Period 2π

# Finding Trigonometric Fourier Series of Functions of Period 2π

We will now look at some examples of finding the trigonometric Fourier series of various functions. Recall from The Fourier Series of Functions Relative to an Orthonormal System page that if $I$ is an interval of length $2\pi$ and $f \in L(I)$ then the trigonometric Fourier series of $f$ is given by:

(1)
\begin{align} \quad f(x) \sim \frac{a_0}{2} + \sum_{n=1}^{\infty} (a_n\cos nx + b_n \sin nx) \end{align}

Where $\displaystyle{a_n = \frac{1}{\pi} \int_I f(t) \cos nt \: dt}$ and $\displaystyle{b_n = \frac{1}{\pi} \int_I f(t) \sin nt \: dt}$.

On the Trigonometric Fourier Series of Even and Odd Functions page we also looked at some nice shortcut formulas for Fourier series of certain functions. Recall that if $f \in L([-\pi, \pi])$ is a $2\pi$-periodic function and $f$ is even ($f(x) = f(-x)$ for all $x \in [-\pi, \pi]$) then for $\displaystyle{c_n = \frac{2}{\pi} \int_0^{\pi} f(t) \cos nt \: dt}$ we have that:

(2)
\begin{align} \quad f(x) \sim \frac{c_0}{2} + \sum_{n=1}^{\infty} c_n \cos nx \end{align}

And if instead $f$ is odd ($-f(x) = f(-x)$ for all $x \in [-\pi, \pi]$) then for $\displaystyle{d_n = \frac{2}{\pi} \int_0^{\pi} f(t) \sin nt \: dt}$ we have that:

(3)
\begin{align} \quad f(x) \sim \sum_{n=1}^{\infty} d_n \sin nx \end{align}

Let's look at an example.

Suppose that we want to graph and find the Fourier series for the square-wave function defined by $f(x) = \left\{\begin{matrix} 0 & \mathrm{if} \: -\pi \leq x < 0\\ 1 & \mathrm{if} \: 0 \leq x < \pi \end{matrix}\right.$ where $f(x + 2\pi) = f(x)$ for all $x \in \mathbb{R}$ ($f$ is $2\pi$-periodic). Then: We also have that:

(4)
\begin{align} \quad a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t) \: dt = \frac{1}{\pi} \left ( \int_{-\pi}^{0} 0 \: dt + \int_0^{\pi} 1 \: dt \right ) = \frac{1}{\pi} [\pi] = 1 \end{align}
(5)
\begin{align} \quad a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t) \cos nt \: dt = \frac{1}{\pi} \left ( \int_{-\pi}^0 0 \: dt + \int_0^{\pi} \cos nt \: dt \right ) = \frac{1}{\pi} \left [ \frac{\sin nt}{n} \right ]_{t=0}^{t=\pi} = 0 \end{align}
(6)
\begin{align} \quad b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(t) \sin nt \: dt = \frac{1}{\pi} \left ( \int_{-\pi}^0 0 \: dt + \int_0^{\pi} \sin nt \: dt \right ) = \frac{1}{\pi} \left [ - \frac{\cos nt}{n} \right ]_{t=0}^{t=\pi} = \frac{1}{\pi} \left [ \frac{1 - \cos n \pi}{n} \right ] = \frac{1}{\pi} \left [ \frac{1 - (-1)^n}{n} \right ] \end{align}

Therefore the trigonometric Fourier series of $f$ is given by:

(7)
\begin{align} \quad f(x) & \sim \frac{1}{2} + \sum_{n=1}^{\infty} \frac{1}{\pi} \left [ \frac{1 - (-1)^n}{n} \right ] \sin nx \: dt \\ & \sim \frac{1}{2} + \frac{2}{\pi} \sin x + \frac{2}{3\pi} \sin 3x + \frac{2}{5\pi} \sin 5x + ... \\ & \sim \frac{1}{2} + \sum_{n=1}^{\infty} \frac{2}{(2n-1)\pi} \sin (2n - 1)x \end{align}