Thursday, February 13, 2014

Fourier Transforms! The True Story

In class today, Prof. Johnson went over the math behind Fourier transforms.  Here we'll recap that---with a somewhat math-y idea, one may need more than one pass!

The Fourier transform is just a way to express any function as a sum of cosines and sines with different frequency.  To build up a given function, you need different amounts of each frequency component.  This can be expressed if we use discrete frequencies by writing

$$f(x)=\sum_n \bigg[ia_n \sin(\omega_n x)+b_n \cos(\omega_n x)\bigg].$$

The \(a_n\) and \(b_n\)  are the weight that the sine and cosine with frequency \(\omega_n\) contribute to the total sum building up \(f\).

Now if we let the frequencies take on any value instead of using some discrete set of frequencies
$$\big\{\omega_1, \omega_2,\cdots,\omega_n \big\},$$ we go from a sum over discrete frequencies to an integral over all possible frequencies.

So we write
$$f(x)=\int_{-\infty}^{\infty} F(\omega)\big[i\sin(\omega x)+\cos (\omega x)\big] d\omega.$$

Notice I've added in an \(i=\sqrt{-1}\)  to the sine term.  That's so that we can keep separate track of our sines and cosines---we can recover their coefficients by looking at the imaginary and the real parts of the Fourier transform.  Check out this picture (black dot is F, the F.T. of f(x)):




There's nothing that fundamental about this: it's just a choice we include in the definition of the Fourier transform.  There are things called "Fourier sine transforms" and "Fourier cosine transforms" where you use only sines or cosines, and then you don't need to worry about the i. However, because sine is an odd function (symmetric about x=0), you can only represent other odd functions with a sum of sines.  The opposite holds for cosine: it's even, so you can only represent other even functions with a sum of only cosines.

Anyway, we have the convenient identity that

$$e^{i\omega x}=\cos(\omega x)+i\sin(\omega x).$$

This is actually not too scary to show.  Just write out the Taylor series for each side:
$$\sum_{n=0}^{\infty}\dfrac{(i\omega x)^n}{n!}=\sum_{n\;odd} \dfrac{(\omega x)^n}{n!}(\pm1)+\sum_{n\;even}\dfrac{(\omega x)^n}{n!}.$$

Incidentally, I am lazy: I calculated these Taylor series using wolframalpha.com: go there and type in "Taylor series for e^(iwx)""Taylor series for sine" and "Taylor series for cosine."
It is not a joke that my GPA in college went up about 30% around the time wolframalpha came online! USE it---it's good to do the calculation on paper once, so you know you can, and can have an intuition for when the computer's wrong, but then you should ease up any algebra you can with things like this!

Okay, so using this we can now write our Fourier transform as

$$f(x)=\int_{-\infty}^{\infty} e^{i\omega x}F(\omega)d\omega.$$

Now suppose we wanted to actually FIND \(F(\omega)?\)  It turns out that if we multiply both sides of the above equation by \(e^{-i\omega' x}\) and then integrate both sides with respect to x, we will get

$$\int_{-\infty}^{\infty}f(x)e^{-i\omega' x}dx=\int_{-\infty}^{\infty}dx e^{-i\omega' x}\int_{-\infty}^{\infty} e^{i\omega x}F(\omega)d\omega.$$

It turns out that the righthand side will be zero except when \(\omega=\omega'\).  This is a cool mathematical thing that I'll come back to at the end.  But for now, it means that we MUST HAVE \(\omega=\omega'\), meaning the equation reduces to

$$\int_{-\infty}^{\infty}f(x)e^{-i\omega' x}dx=F(\omega).$$

So now we can go ahead and calculate Fourier transforms!  I should note that usually, there's a factor of \(2\pi\) in front of all of the \(\omega\)s, because they are really angular frequency.  For this reason, usually a factor of \(1/2\pi\)  will show up in front of one or the other side of the equation above for \( F(\omega)\).
to be continued . . .
---
Finally, a point about modulus.  Modulus is the magnitude of a complex number, and it is a little bit more complicated than just taking an absolute value as you'd do to find the magnitude of a real number!  Have a look at the diagram below!



No comments:

Post a Comment