Dr. Cho’s Website
Course Materials

$\newcommand{\sgn}{\operatorname{sgn}}$

# Fourier series

## 1   Fourier series in terms of angular frequency

The Fourier series is expressed as a sum of cosines and sines as follows: $$f(x)=\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(nx)+\sum_{n=1}^\infty b_n\sin(nx) \label{eq:fourier_series}$$ where \begin{align} a_0&=\frac{1}{\pi}\int_0^{2\pi}f(x)\,dx \label{eq:a_0_first}\\ a_n&=\frac{1}{\pi}\int_0^{2\pi}f(x)\cos(nx)\,dx \label{eq:a_m_first}\\ b_n&=\frac{1}{\pi}\int_0^{2\pi}f(x)\sin(nx)\,dx. \label{eq:b_m_first} \end{align}

In an exponential form, $$f(x)=\sum_{n=-\infty}^\infty A_ne^{inx} \label{eq:fourier_series_exponential_first}$$ where $$A_n=\frac{1}{2\pi}\int_0^{2\pi}f(x)e^{-inx}\,dx. \label{eq:A_n_first}$$

## 2   Fourier series in terms of oscillation frequency

Certain fields use the oscillation frequency $f=\frac{1}{T}$ and time $t$ over the angular frequency $\omega=\frac{2\pi}{T}=2\pi f$ and angle $x$ where $T$ is the period. The relationship between $t$ and $x$ is $$x=\omega t=\frac{2\pi}{T}t. \label{eq:x}$$ Replacing $x$ in Eqs. \eqref{eq:fourier_series}-\eqref{eq:A_n_first} results in $$f(t)=\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(2\pi nt/T)+\sum_{n=1}^\infty b_n\sin(2\pi nt/T) \label{eq:fourier_series_t}$$ where \begin{align} a_0&=\frac{2}{T}\int_0^T f(t)\,dt \label{eq:a_0_t}\\ a_n&=\frac{2}{T}\int_0^T f(t)\cos(2\pi nt/T)\,dt \label{eq:a_m_t}\\ b_n&=\frac{2}{T}\int_0^T f(t)\sin(2\pi nt/T)\,dt. \label{eq:b_m_t} \end{align}

In an exponential form, $$f(t)=\sum_{n=-\infty}^\infty A_ne^{2i\pi nt/T} \label{eq:fourier_series_exponential_t}$$ where $$A_n=\frac{1}{T}\int_0^T f(t)e^{-2i\pi nt/T}\,dt. \label{eq:A_n_t}$$

In the following sections, we will derive Eqs. \eqref{eq:fourier_series}-\eqref{eq:A_n_first}.

## 3   Properties of trigonometric functions

First, we need to understand some properties of trigonometric functions. For positive integers $m$ and $n$, $$\int_0^{2\pi}\cos(mx)\,dx=\int_0^{2\pi}\sin(mx)=0 \label{eq:intcos_intsin}$$ because both cosine and sine functions complete an $m$ number of complete cycles.

$$\begin{split} \int_0^{2\pi}\cos(mx)\cos(nx)\,dx&=\int_0^{2\pi}\frac{1}{2}\left[\cos\left((m+n)x\right)+\cos\left((m-n)x\right)\right]\,dx\\ &=\frac{1}{2}\int_0^{2\pi}\cos\left((m+n)x\right)\,dx+\frac{1}{2}\int_0^{2\pi}\cos\left((m-n)x\right)\,dx. \end{split} \label{eq:intcoscos}$$ For $m\neq n$, the two integrals are $0$ from Eq. \eqref{eq:intcos_intsin}. For $m=n$, only the first integral is $0$ and $\int_0^{2\pi}\cos\left((m-n)x\right)\,dx=\int_0^{2\pi}\cos 0\,dx=\int_0^{2\pi}1\,dx=2\pi$. Therefore, Eq. \eqref{eq:intcoscos} reduces to $$\int_0^{2\pi}\cos(mx)\cos(nx)\,dx=\pi\delta_{m,n} \label{eq:intcoscos_final}$$ where $\delta_{m,n}$ is the Kronecker delta ($\delta_{m,n}=0$ for $m\neq n$ and $\delta_{m,n}=1$ for $m=n$).

Again for positive intergers $m$ and $n$, $$\begin{split} \int_0^{2\pi}\sin(mx)\sin(nx)\,dx&=\int_0^{2\pi}\frac{1}{2}\left[\cos\left((m-n)x\right)-\cos\left((m+n)x\right)\right]\,dx\\ &=\frac{1}{2}\int_0^{2\pi}\cos\left((m-n)x\right)\,dx-\frac{1}{2}\int_0^{2\pi}\cos\left((m+n)x\right)\,dx. \end{split} \label{eq:intsinsin}$$ Similar to Eq. \eqref{eq:intcoscos_final}, Eq. \eqref{eq:intsinsin} reduces to $$\int_0^{2\pi}\sin(mx)\sin(nx)\,dx=\pi\delta_{m,n}. \label{eq:intsinsin_final}$$

Now from Eq. \eqref{eq:intcos_intsin}, we obtain $$\begin{split} \int_0^{2\pi}\cos(mx)\sin(nx)\,dx&=\int_0^{2\pi}\frac{1}{2}\left[\sin\left((m+n)x\right)-\sin\left((m-n)x\right)\right]\,dx\\ &=\frac{1}{2}\int_0^{2\pi}\sin\left((m+n)x\right)\,dx-\frac{1}{2}\int_0^{2\pi}\sin\left((m-n)x\right)\,dx\\ &=0. \end{split} \label{eq:intcossin}$$ Note that the second integral $\int_0^{2\pi}\sin\left((m-n)x\right)\,dx=\int_0^{2\pi}\sin 0\,dx=\int_0^{2\pi}0\,dx=0$ for $m=n$.

## 4   Orthonormal bases

For now, let’s rewrite Eq. \eqref{eq:fourier_series} as $$f(x)=c_0C_0+\sum_{n=1}^\infty a_n\cos(nx)+\sum_{n=1}^\infty b_n\sin(nx). \label{eq:fourier_series_rewritten}$$ We need to prove the following equations: \begin{align} c_0&=\left\langle f(x),C_0\right\rangle \label{eq:basis_c}\\ a_m&=\left\langle f(x),\cos(mx)\right\rangle \label{eq:basis_cos}\\ b_m&=\left\langle f(x),\sin(mx)\right\rangle \label{eq:basis_sin} \end{align} for $m\geq 1$. In other words, we will show that $C_0$, $\cos(nx)$, and $\sin(nx)$ for $n\geq 1$ in Eq. \eqref{eq:fourier_series_rewritten} are orthonormal bases for an inner product space on real functions.

Let’s start with a typical inner product of real-valued functions that are periodic over $[0,2\pi]$ $$\left\langle f(x), g(x)\right\rangle=\int_0^{2\pi}f(x)g(x)\,dx. \label{eq:typical_inner_product}$$

We could try Eq. \eqref{eq:basis_c} first, but since the inner product in Eq. \eqref{eq:typical_inner_product} will need to be redefined later, we will tackle Eq. \eqref{eq:basis_cos} first. The right-hand side of Eq. \eqref{eq:basis_cos} becomes $$\begin{split} \left\langle f(x),\cos(mx)\right\rangle&=c_0C_0\int_0^{2\pi}\cos(mx)\,dx+\sum_{n=1}^\infty a_n\int_0^{2\pi}\cos(nx)\cos(mx)\,dx\\ &\quad+\sum_{n=1}^\infty b_n\int_0^{2\pi}\sin(nx)\cos(mx)\,dx\\ &=a_m\pi \end{split} \label{eq:try_basis_cos_proof}$$ from Eqs. \eqref{eq:intcos_intsin}, \eqref{eq:intcoscos_final}, and \eqref{eq:intcossin}. Note that Eq. \eqref{eq:try_basis_cos_proof} is not $a_m$. To make this equality, we need to redefine the inner product as $$\left\langle f(x), g(x)\right\rangle=\frac{1}{\pi}\int_0^{2\pi}f(x)g(x)\,dx. \label{eq:inner_product}$$

Now, Eq. \eqref{eq:try_basis_cos_proof} resolves to $$\begin{split} \left\langle f(x),\cos(mx)\right\rangle&=\frac{c_0C_0}{\pi}\int_0^{2\pi}\cos(mx)\,dx+\sum_{n=1}^\infty\frac{a_n}{\pi}\int_0^{2\pi}\cos(nx)\cos(mx)\,dx\\ &\quad+\sum_{n=1}^\infty\frac{b_n}{\pi}\int_0^{2\pi}\sin(nx)\cos(mx)\,dx\\ &=a_m \end{split} \label{eq:basis_cos_proof}$$ and satisfies Eq. \eqref{eq:basis_cos}.

Now, let’s try Eq. \eqref{eq:basis_c} as follows: $$\begin{split} \left\langle f(x),C_0\right\rangle&=\frac{c_0C_0^2}{\pi}\int_0^{2\pi}\,dx+\sum_{n=1}^\infty\frac{a_nC_0}{\pi}\int_0^{2\pi}\cos(nx)\,dx+\sum_{n=1}^\infty\frac{b_nC_0}{\pi}\int_0^{2\pi}\sin(nx)\,dx\\ &=2c_0C_0^2. \end{split} \label{eq:basis_c_proof}$$ Since $2c_0C_0^2=c_0$ from Eq. \eqref{eq:basis_c}, $$C_0=\frac{1}{\sqrt{2}}. \label{eq:c}$$

Last, the right-hand side of Eq. \eqref{eq:basis_sin} can be solved as $$\begin{split} \left\langle f(x),\sin(mx)\right\rangle&=\frac{c_0C_0}{\pi}\int_0^{2\pi}\sin(mx)\,dx+\sum_{n=1}^\infty\frac{a_n}{\pi}\int_0^{2\pi}\cos(nx)\sin(mx)\,dx\\ &\quad+\sum_{n=1}^\infty\frac{b_n}{\pi}\int_0^{2\pi}\sin(nx)\sin(mx)\,dx\\ &=b_m \end{split} \label{eq:basis_sin_proof}$$ from Eqs. \eqref{eq:intcos_intsin}, \eqref{eq:intcossin}, and \eqref{eq:intsinsin}, and satisfies Eq. \eqref{eq:basis_sin}.

## 5   Fourier series equation

Now, we proved that the Fourier series equation is based on orthonormal bases. From Eqs. \eqref{eq:fourier_series_rewritten} and \eqref{eq:c}, the final equation for Fourier series can be written as $$f(x)=\frac{c_0}{\sqrt{2}}+\sum_{n=1}^\infty a_n\cos(nx)+\sum_{n=1}^\infty b_n\sin(nx). \label{eq:fourier_series_again}$$ For complex Fourier series, it is beneficial to define the constant term $\frac{c_0}{\sqrt{2}}$ as $\frac{a_0}{2}$ where $a_0=c_0\sqrt{2}$, so the final equation becomes $$f(x)=\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(nx)+\sum_{n=1}^\infty b_n\sin(nx). \label{eq:fourier_series_final}$$

## 6   Fourier series coefficients

We need a way to determine $c_0$, $a_n$, and $b_n$ for $n\geq 1$. Since $\frac{1}{\sqrt{2}}$, $\cos(nx)$, and $\sin(nx)$ are orthonormal bases for $f(x)$, \begin{align} c_0&=\left\langle f(x),\frac{1}{\sqrt{2}}\right\rangle=\frac{1}{\pi}\int_0^{2\pi}f(x)\frac{1}{\sqrt{2}}\,dx=\frac{1}{\pi\sqrt{2}}\int_0^{2\pi}f(x)\,dx \label{eq:c_0}\\ c_0C_0&=\frac{1}{2\pi}\int_0^{2\pi}f(x)\,dx \label{eq:c_0C_0}\\ a_0&=\frac{1}{\pi}\int_0^{2\pi}f(x)\,dx \label{eq:a_0}\\ a_n&=\left\langle f(x),\cos(nx)\right\rangle=\frac{1}{\pi}\int_0^{2\pi}f(x)\cos(nx)\,dx \label{eq:a_m}\\ b_n&=\left\langle f(x),\sin(nx)\right\rangle=\frac{1}{\pi}\int_0^{2\pi}f(x)\sin(nx)\,dx. \label{eq:b_m} \end{align} Note that the constant term in Eq. \eqref{eq:c_0C_0} is the average of the function over $[0,2\pi]$.

## 7   Complex Fourier series

From Euler’s formula, we know \begin{align} \cos x&=\frac{e^{ix}+e^{-ix}}{2} \label{eq:euler_cos}\\ \sin x&=\frac{e^{-ix}-e^{ix}}{2}i. \label{eq:euler_sin} \end{align} Plugging these definitions into Eq. \eqref{eq:fourier_series_final} results in $$\begin{split} f(x)&=\frac{a_0}{2}+\sum_{n=1}^\infty\left[\frac{a_n}{2}\left(e^{inx}+e^{-inx}\right)+i\frac{b_n}{2}\left(e^{-inx}-e^{inx}\right)\right]\\ &=\frac{a_0}{2}+\sum_{n=1}^\infty\left(\frac{a_n-ib_n}{2}e^{inx}+\frac{a_n+ib_n}{2}e^{-inx}\right)\\ &=\frac{a_0}{2}+\sum_{n=1}^\infty\frac{a_n+ib_n}{2}e^{-inx}+\sum_{n=1}^\infty\frac{a_n-ib_n}{2}e^{inx}\\ &=\frac{a_0}{2}e^0+\sum_{n=-\infty}^{-1}\frac{a_{|n|}+ib_{|n|}}{2}e^{inx}+\sum_{n=1}^\infty\frac{a_n-ib_n}{2}e^{inx}\\ &=\sum_{n=-\infty}^\infty A_ne^{inx} \end{split} \label{eq:fourier_series_exponential}$$ where $$A_n= \begin{cases} \dfrac{a_{|n|}+ib_{|n|}}{2}&\text{for }n\leq -1\\ \dfrac{a_0}{2}&\text{for }n=0\\ \dfrac{a_n-ib_n}{2}&\text{for }n\geq 1. \end{cases} \label{eq:A_n}$$ For simplicity, let $b_0$ be $0$ and $$A_n=\frac{a_{|n|}-\sgn(n)b_{|n|}}{2}.$$

## 8   Complex Fourier series coefficients

Integrating $e^{inx}$ yields $$\int_0^{2\pi}e^{inx}\,dx=\int_0^{2\pi}\cos nx+i\sin nx\,dx=\int_0^{2\pi}\cos nx\,dx+i\int_0^{2\pi}\sin nx\,dx=2\pi\delta_{n,0}. \label{eq:inte}$$ Now, by multiplying both sides of Eq. \eqref{eq:fourier_series_exponential} by $e^{-imx}$ and integrating them, we obtain $$\int_0^{2\pi}f(x)e^{-imx}\,dx=\int_0^{2\pi}\sum_{n=-\infty}^\infty A_ne^{i(n-m)x}\,dx=\sum_{n=-\infty}^\infty A_n\int_0^{2\pi}e^{i(n-m)x}\,dx=2\pi A_m \label{eq:intfe}$$ and $$A_m=\frac{1}{2\pi}\int_0^{2\pi}f(x)e^{-imx}\,dx. \label{eq:A_m}$$ Since $m$ is a dummy variable, we can write $$A_n=\frac{1}{2\pi}\int_0^{2\pi}f(x)e^{-inx}\,dx. \label{eq:A_n_final}$$ Note that $A_n$ in Eq. \eqref{eq:A_n_final} is the average of $f(x)e^{-inx}$ over $[0,2\pi]$.