up to Schedule & Notes

Real Fourier Series

Wavenumbers

The cosine function $\cos k x$ has angular wavenumber $k$.

$k$ is the number of cycles per $2\pi$ (see the figures below).

If a 1-dimensional image, $I(x)$, has width $N$ and we want a single cycle to occur across the image, we can map

$\displaystyle x \;\; \rightarrow \;\; {2 \pi x \over N}$

So that, for $x \in [0,N)$, the corresponding ${2 \pi x \over N} \in [0,2\pi)$ and $\cos {2 \pi x \over N}$ goes through one cycle.

Fourier basis functions

Fourier realized that any periodic or bounded-domain function can be written as a linear combination of sine and cosine functions at different frequencies.

The Fourier basis functions are

$\sin k\:x, \cos k\:x\ \text{for}\ k \in { 0, 1, 2, \ldots }$

$\sin 0x, \cos 0x, \sin 1x, \cos 1x, \sin 2x, \cos 2x, \sin 3x, \cos 3x, \ldots $

These basis functions are orthogonal. For all $m \neq n$:

$\begin{array}{r} \sin mx \cdot \sin nx = 0 \\ \cos mx \cdot \cos nx = 0 \end{array}$

and

$\begin{array}{r} \sin mx \cdot \cos nx = 0 \\ \sin mx \cdot \cos mx = 0 \end{array}$

Projection onto basis functions

Let $f(x)$ be an arbitrary function that is periodic in $[0,2\pi)$. (If $f(x)$ is instead periodic in $[0,N)$, we reparameterize it as $f({2 \pi x \over N})$.)

We can project $f(x)$ onto all of these basis functions and get the Real Fourier Series:

$\begin{array}{rl} f(x) & = \sum_{k=0}^\infty\limits a_k \cos k x\ \ +\ \ \sum_{k=0}^\infty\limits b_k \sin k x \\ & = a_0 + \sum_{k=1}^\infty\limits a_k \cos k x\ \ +\ \ \sum_{k=1}^\infty\limits b_k \sin k x \\ \end{array}$

The $a_k$ and $b_k$ show how much of $\cos kx$ and $\sin kx$ are present in $f(x)$.

To get $a_k$ and $b_k$, project $f(x)$ onto the basis functions:

$\begin{array}{rl} a_k & = \displaystyle { f(x)\ \cdot\ \cos kx \over \cos kx\ \cdot\ \cos kx} \\ \\ & = \displaystyle { \int_0^{2\pi} f(x) \cos kx\ dx \over \int_0^{2\pi} \cos^2 kx\ dx } \\ \\ & = \displaystyle { \int_0^{2\pi} f(x) \cos kx\ dx \over \pi } \\ \\ & = \displaystyle { 1 \over \pi } \int_0^{2\pi} f(x) \cos kx\ dx \\ \\ \\ b_k & = \displaystyle { f(x)\ \cdot\ \sin kx \over \sin kx\ \cdot\ \sin kx} \\ & = \displaystyle { \int_0^{2\pi} f(x) \sin kx\ dx \over \int_0^{2\pi} \sin^2 kx\ dx } \\ & = \displaystyle { \int_0^{2\pi} f(x) \sin kx\ dx \over \pi } \\ & = \displaystyle { 1 \over \pi } \int_0^{2\pi} f(x) \sin kx\ dx \end{array}$

Note that

$\begin{array}{rl} a_0 & = \displaystyle { \int_0^{2\pi} f(x)\ dx \over 2 \pi } \\ \\ b_0 & = \displaystyle 0 \end{array}$

So $a_0$ is the average of $f(x)$ on the interval $[0,2\pi]$.

Alternative interpretation

Given $a \cos x + b \sin x$, what is the corresponding $A \cos(x - \theta)$ ?

Recall that $A \cos(x - \theta) = (A \cos\theta) \cos x + (A \sin\theta) \sin x$.

So, given the $a$ and $b$ in $a \cos x + b \sin x$, we can find the $A$ and $\theta$ of the corresponding $A \cos(x - \theta)$:

$\begin{array}{rcl} a & = & A \cos\theta \\ b & = & A \sin\theta \\ a^2 + b^2 & = & A^2 (\cos^2\theta + \sin^2\theta) = A^2\\ A & = & \sqrt{ a^2 + b^2 } \\ \\ {b \over a} & = & { A \sin\theta \over A \cos\theta} = \tan\theta \\ \theta & = & \arctan { b \over a } \end{array}$

This works for any wavenumber, $k$.

So the $k^{th}$ sin/cos pair can be thought of as a shifted, modulated sinusoid of wavenumber $k$.

$a_k \cos kx + b_k \sin kx = A_k \cos(k \; x - \theta_k)$
where $a_k = A_k \cos k\theta_k$ and $b_k = A_k \sin k\theta_k$.

In other words, it's a single sinusoid where $A_k = \sqrt{a_k^2 + b_k^2}$ is the amplitude and $\theta_k = \arctan{b_k \over a_k}$ is the phase shift.

up to Schedule & Notes