# Applications of the Fourier transform: a mathematical swiss knife￼

What does compressing images, hunting exoplanets, removing noise from sound signal and analysing the molecular content of substances have in common? These seemingly unrelated tasks can be solved using the same tool: the Fourier transform. In this article, we will see what is the Fourier transform and why it is so versatile.

## Introduction to Fourier transform

In music, each note has a frequency. In the 4th octave, A has a frequency of 440Hz and C is 261.63Hz. Physically both of these notes are simple sine waves. However, play these two notes at the same time and the resulting wave is some combination of both A and C which is a more complex wave as we can see below.

Now let’s take this new “A+C” wave and feed it to the Fourier transform. What we get in return is a new chart with two peaks corresponding to the component frequencies of A+C. These two peaks correspond to the frequency of A and C.

Hence the Fourier transform allows us to take a complex wave and extract the atomic frequencies that compose it. Formally, we have transformed the original wave from the Spatio-temporal space into the frequency space. We will see that this simple idea has many applications!

## Compressing image using Fourier transform

We can compress images using the Fourier transform. Let’s take a black and white image as an example. We can think of this image as a 2D wave. The brighter a pixel is, the higher the amplitude will be. As exemplified below, the bright reflection in the eye of the cat corresponds to a higher amplitude than the blackness of the pupil.

We can observe that some part of an image has more details than others. The fur of the cat has many changes in brightness compared to its nose. Hence, when looking at an image as a wave, highly detailed areas correspond to higher frequency waves. Whereas areas where the brightness does not change much correspond to lower frequency waves.

Hence, the more detailed an image is, the more high-frequency waves it contains. Then, one way to compress an image is to remove these high frequencies. By only keeping the lower ones, we keep an image that is less detailed but also lighter in memory.

Since an image can be seen as a wave, using Fourier transform we can transform an image into its component frequencies. Now that we are in the frequency space, we can simply select and get rid of the high-frequency waves. Then, we can transform back the remaining component frequencies into an image. And voila, this is how JPG compresses images!

Below is the image of the cat where we have removed more than 90% of the high frequencies. The image is of less quality but the size in memory went from 160KB to 4KB. You can see how the individual hairs of the fur of the cat are not visible anymore but we still recognize the cat.

## Other applications of the Fourier transform

We can use the Fourier transform to hunt exoplanets as well! When two bodies orbit each other, they actually orbit a common centre of mass. Thus, as a planet orbits a star, we can see the star wobble. If we have multiple planets, each of them will make the star wobble a bit differently. If we observe a star, we can see this wobbling and translate it into a wave.

If we apply the Fourier transform to this wave, each frequency extracted corresponds to a planet. Planets that are closer orbit faster and result in higher frequencies. The amplitude of each frequency also gives us the ratio between the mass of the star and the planet as more massive planets will lead to a bigger wobbling of the star.

In molecular analysis, we can send a beam of light onto a substance and analyse the light reflected. Since light is a wave, the Fourier transform is also really useful here! Different atoms and molecules will absorb and reflect different kinds of light. Thus, by applying the Fourier transform to the reflected light, we can extract the frequencies composing this light, each of which corresponds to a specific element composing the substance. This process is called spectography.

Finally, in signal processing, noise often corresponds to higher frequencies. Again, we can use the Fourier transform to transform a signal and easily remove these frequencies. Then we can convert the signal back into the original space and voila we have removed the noise. This is called a low pass filter. This is used to clean sounds recorded from a microphone in a noisy area or to clean electrical signals inside a processor.

## Conclusion

Fourier transforms really are mathematical swiss knives. They can be used in almost any domain from image processing to hunting exoplanets and analysing the chemical compositions of substances. Understandably, the Fourier transform is one of the most important discoveries of mathematics to date. Can you think of other applications of the Fourier transform? I hope to see you in the comment section 😉

- The Transformer Revolution: How AI was democratized - 21 February 2024
- AI Model Distillation : how to compress a brain? - 15 January 2024
- Prompt Engineering: How to Talk to AIs like ChatGPT? - 22 November 2023