# Fourier Analysis

## Fourier Series

### Fourier's theorem

#### Statement

A function is periodic with period $$2\pi$$ if $f(x) = f(x + 2\pi).$ $$f(x)$$ need only be given on the half-open interval $x \in [0, 2\pi)$ for it to be specified everywhere.

Fourier's theorem states that any such $$f(x)$$ which is well behaved can be written as one of the three following forms:

\begin{align} f(x) &= \frac{a_0}{2} + \sum_{n = 1}^{\infty} \left[ a_n \mathrm{cos}(nx) + b_n \mathrm{sin}(nx) \right]\\ f(x) &= \frac{a_0}{2} + \sum_{n = 1}^{\infty} A_n \mathrm{cos}(nx + \phi_n)\\ f(x) &= \sum_{n = -\infty }^{\infty} c_n e^{inx} \end{align}

The different sets of coefficients $$(a_n, b_n), \ (A_n, \phi_n), \ c_n$$ can be converted between easily via trigonometric relations.

### Formulae for the coefficients

We are going to make use of the integrals

\begin{align} I_{n,m} &= \int_0^{2\pi } \mathrm{cos} (nx) \ \mathrm{cos} (mx) \ dx = \delta_{n,m}\pi \\ J_{n,m} &= \int_0^{2\pi } \mathrm{cos} (nx) \ \mathrm{sin} (mx) \ dx = 0 \\ K_{n,m} &= \int_0^{2\pi } \mathrm{sin} (nx) \ \mathrm{sin} (mx) \ dx = \delta_{n,m}\pi. \end{align}

If we integrate $$f(x)$$ over its range, $\int_0^{2\pi} f(x) \ dx$ we see that since the average value of $$\mathrm{sin}(nx)$$ and $$\mathrm{cos}(nx)$$ is zero, the integral reduces to $\int_0^{2\pi} \frac{a_0}{2} \ dx$ so we find $a_0 = \frac{1}{\pi} \int_0^{2\pi} f(x) \ dx.$

Note: we can integrate over $$2\pi$$ at any point in the function's range, so this is perfectly equivalent to

$\frac{a_0}{2} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) \ dx.$

In other words, $$\frac{a_0}{2}$$ is the average value of $$f(x)$$.

For the $$a_n$$ coefficients, multiply $$f(x)$$ by $$\cos (mx)$$ and integrate over the range:

\begin{align} \begin{split} \int_0^{2\pi} \cos(mx) f(x) \ dx &= \int_0^{2\pi} \sum_{n=1}^{\infty} a_n \cos(nx) \cos(mx) \ dx \\ &= \sum_{n=1}^{\infty}\int_0^{2\pi} a_n \cos(nx) \cos(mx) \ dx \\ &= a_m \int_0^{2\pi} \cos^2(mx) \ dx = \pi a_m, \end{split} \end{align}

finally, relabelling m to n gives $a_n = \frac{1}{\pi} \int_0^{2\pi} \cos(nx) f(x) \ dx.$

Exactly the same argument holds for the $$b_n$$, so similarly

$b_n = \frac{1}{\pi} \int_0^{2\pi} \sin(nx) f(x) \ dx.$

### Examples

#### Square wave example

Given the function

$$f(x)=\left\{ \begin{array}{@{}ll@{}} -1, -\pi \leq x < 0\\ 1, \ 0 \leq x < \pi \end{array}\right.$$

We see that since it is odd, $$a_n$$ must be zero, and we find the $$b_n$$ to be $b_n = \frac{2}{n\pi} \left( 1 - (-1)^n \right)$

So the Fourier series representation of $$f(x)$$ is

$f(x) = \sum_{n=1}^{\infty} \frac{2}{n\pi} \left( 1 - (-1)^n \right) \sin(nx).$

#### Triangle wave example

Given the function

$$f(x)=\left\{ \begin{array}{@{}ll@{}} -x, -\pi \leq x < 0\\ x, \ 0 \leq x < \pi \end{array}\right.$$

We see that since it is even, $$b_n$$ must be zero, and we find the $$a_n$$ to be $a_n = \frac{2}{n^2 \pi} \left( (-1)^n - 1 \right)$

So the Fourier series representation of $$f(x)$$ is

$f(x) = \sum_{n=1}^{\infty} \frac{2}{n^2 \pi} \left( (-1)^n - 1 \right) \cos(nx) .$

### Extension to other periods

Suppose $f(x) = f(x + T),$ that is $$f(x)$$ is periodic with some arbitrary period. Then we would write

$f(x) = \frac{a_0}{2} + \sum_{n = 1}^{\infty} \left[ a_n \mathrm{cos}\left(\frac{2\pi nx}{T} \right) + b_n \mathrm{sin}\left(\frac{2\pi nx}{T} \right) \right]$

And the formulae for the coefficients would become

\begin{align} a_0 &= \frac{2}{T} \int_{-\frac{T}{2}}^{\frac{T}{2}} f(x) \ dx \\ a_n &= \frac{2}{T} \int_{-\frac{T}{2}}^{\frac{T}{2}} \cos \left(\frac{2\pi nx}{T} \right) f(x) \ dx \\ b_n &= \frac{2}{T} \int_{-\frac{T}{2}}^{\frac{T}{2}} \sin \left(\frac{2\pi nx}{T} \right) f(x) \ dx. \\ \end{align}

This can be simplified by rewriting in terms of angular frequency $T = \frac{2\pi}{\omega}$

giving

$f(x) = \frac{a_0}{2} + \sum_{n = 1}^{\infty} \left[ a_n \mathrm{cos}(n \omega x) + b_n \mathrm{sin}(n \omega x) \right].$

## Fourier Transform

### Derivation from Fourier Series

From equation $$(3)$$, we see that the Fourier series can be written $f(x) = \sum_{n=-\infty}^{\infty} c_n e^{inx}.$

Using the fact that $\int_{-\pi}^{\pi} e^{-imx} e^{inx} \ dx = 2\pi \delta_{n,m}$ and integrating over the series representation, we find that $c_n = \frac{1}{2\pi} \int_{-\pi}^{\pi} e^{-inx} f(x) \ dx.$

For a period of $$2\pi L$$, the series becomes

\begin{align} f(x) &= \sum_{n=-\infty}^{\infty} c_n e^{\frac{inx}{L}}\\ c_n &= \frac{1}{2\pi L} \int_{-\pi L}^{\pi L} e^{\frac{-inx}{L}} f(x) \ dx.\\ \end{align}

Now we define $\hat{f}\left( \frac{n}{L}\right) = c_n,$ that is, a function that is only defined at the points $$\frac{n}{L}$$. The series now looks like

\begin{align} f(x) &= \sum_{n=-\infty}^{\infty}\hat{f}\left( \frac{n}{L}\right) e^{\frac{inx}{L}}\\ \hat{f}\left( \frac{n}{L}\right) &= \frac{1}{2\pi L} \int_{-\pi L}^{\pi L} e^{\frac{-inx}{L}} f(x) \ dx.\\ \end{align}

Further, if we define $\widetilde{f}\left( \frac{n}{L} \right) = \sqrt{2\pi} L \hat{f}\left( \frac{n}{L}\right)$ we get

\begin{align} f(x) &= \frac{1}{\sqrt{2\pi}} \sum_{n=-\infty}^{\infty}\widetilde{f}\left( \frac{n}{L}\right) e^{\frac{inx}{L}} \frac{1}{L}\\ \widetilde{f}\left( \frac{n}{L} \right) &= \frac{1}{\sqrt{2\pi}} \int_{-\pi L}^{\pi L} e^{\frac{-inx}{L}} f(x) \ dx.\\ \end{align}

Rewriting $$\frac{n}{L}$$ as $$k$$ and taking $$L \rightarrow \infty$$ finally gives us

\begin{align} f(x) &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{ikx}\widetilde{f}(k) \ dx\\ \widetilde{f}(k) &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-ikx} f(x) \ dx.\\ \end{align}

### Examples

#### Gaussian function

Suppose we have $f(x) = e^{-\alpha x^2}.$ The Fourier transform of this is

\begin{align*} \widetilde{f}(k) &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-ikx} e^{-\alpha x^2} \ dx\\ &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-\alpha \left( x + \frac{ik}{2\alpha} \right)^2 - \frac{k^2}{4\alpha}} \ dx.\\ \end{align*}

Shifting this by the substitution $y = x + \frac{ik}{2\alpha}$ gives

\begin{align*} \widetilde{f}(k) &= \frac{1}{\sqrt{2\pi}} e^{-\frac{k^2}{4\alpha}} \int_{-\infty}^{\infty} e^{-\alpha y^2} \ dy\\ &= \frac{1}{\sqrt{2\pi}} e^{-\frac{k^2}{4\alpha}} \sqrt{\frac{\pi}{\alpha}}\\ &= \frac{1}{\sqrt{2\alpha}} e^{-\frac{k^2}{4\alpha}}. \end{align*}

Another Gaussian, but stretched.

#### Square pulse

Given the function

$$f(x)=\left\{ \begin{array}{@{}ll@{}} \frac{1}{A}, -A \leq x \leq A\\ 0, \ |x| > A\\ \end{array}\right.$$

its Fourier transform is

\begin{align*} \widetilde{f}(k) &= \frac{1}{\sqrt{2\pi}} \int_{-A}^{A} \frac{1}{A} e^{-ikx} \ dx \\ &= \frac{1}{A\sqrt{2\pi}} \left[ \frac{e^{ikA} - e^{-ikA}}{ik} \right]\\ &= \sqrt{\frac{2}{\pi}} \frac{\sin(kA)}{kA}\\ &= \sqrt{\frac{2}{\pi}} \mathrm{sinc}(kA)\\ \end{align*}

## Convolutions

### Definition

A convolution is an integral transform that takes two functions and composes them, forming a new function. The definition is

$(f \star g)(x) = \int_{-\infty}^{\infty} f(x')g(x-x') \ dx'.$

### Fourier Transform of a Convolution

The Fourier transform of the convolution of two functions is $$\sqrt{2\pi}$$ times the product of the Fourier transforms.

\begin{align*} \mathcal{F}\{f \star g\} &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-ikx} \left[ \int_{-\infty}^{\infty} f(x') g(x-x') \ dx' \right] dx\\ &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} f(x') \int_{-\infty}^{\infty} g(x-x') e^{-ikx} \ dx' dx\\ \end{align*}

Setting $$y = x - x'$$ gives

\begin{align*} \mathcal{F}\{f \star g\} &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} f(x') \ dx' \int_{-\infty}^{\infty} e^{-ik(x'+y)} g(y) \ dy\\ &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-ikx'} f(x') \ dx' \int_{-\infty}^{\infty} e^{-iky} g(y) \ dy\\ &= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-ikx'} f(x') \ dx' \int_{-\infty}^{\infty} e^{-iky} g(y) \ dy\\ &= \sqrt{2\pi} \widetilde{f}(k) \widetilde{g}(k). \end{align*}

Created: 2018-10-05 Fri 00:20