Article Image
IPFS News Link • Science, Medicine and Technology

The Math Trick Behind MP3s, JPEGs, and Homer Simpson's Face

• GetPocket

Over a decade ago, I was sitting in a college math physics course and my professor spelt out an idea that kind of blew my mind. I think it isn't a stretch to say that this is one of the most widely applicable mathematical discoveries, with applications ranging from optics to quantum physics, radio astronomy, MP3 and JPEG compression, X-ray crystallography, voice recognition, and PET or MRI scans. This mathematical tool—named the Fourier transform, after 18th-century French physicist and mathematician Joseph Fourier—was even used by James Watson and Francis Crick to decode the double helix structure of DNA from the X-ray patterns produced by Rosalind Franklin. (Crick was an expert in Fourier transforms, and joked about writing a paper called, "Fourier Transforms for birdwatchers," to explain the math to Watson, an avid birder.)

You probably use a descendant of Fourier's idea every day, whether you're playing an MP3, viewing an image on the web, asking Siri a question, or tuning in to a radio station. (Fourier, by the way, was no slacker. In addition to his work in theoretical physics and math, he was also the first to discover the greenhouse effect.)

So what was Fourier's discovery, and why is it useful? Imagine playing a note on a piano. When you press the piano key, a hammer strikes a string that vibrates to and fro at a certain fixed rate (440 times a second for the A note). As the string vibrates, the air molecules around it bounce to and fro, creating a wave of jiggling air molecules that we call sound. If you could watch the air carry out this periodic dance, you'd discover a smooth, undulating, endlessly repeating curve that's called a sinusoid, or a sine wave. (Clarification: In the example of the piano key, there will really be more than one sine wave produced. The richness of a real piano note comes from the many softer overtones that are produced in addition to the primary sine wave. A piano note can be approximated as a sine wave, but a tuning fork is a more apt example of a sound that is well-approximated by a single sinusoid.)

The sound wave produced by a piano note can be thought of a simple sine wave. Credit: Milan B / Shutterstock.

Now, instead of single key, say you play three keys together to make a chord. The resulting sound wave isn't as pretty—it looks like a complicated mess. But hidden in that messy sound wave is a simple pattern. After all, the chord was just three keys struck together, and so the messy sound wave that results is really just the sum of three notes (or sine waves).

The sound wave produced by a piano chord can look like a mess, but it's just three different notes (sine waves) added together. Credit: Christine Daniloff / MIT.

Fourier's insight was that this isn't just a special property of musical chords, but applies more generally to any kind of repeating wave, be it square, round, squiggly, triangular, whatever. The Fourier transform is like a mathematical prism—you feed in a wave and it spits out the ingredients of that wave—the notes (or sine waves) that when added together will reconstruct the wave.

If this sounds a little abstract, here are a few different ways of visualizing Fourier's trick. The first one comes to us from Lucas V. Barbosa, a Brazilian physics student who volunteers his time to make incredible math and science animations for Wikipedia, where he goes by "LucasVB."

So let's take a squarish looking wave, pass it through Fourier's prism, and see what comes out the other side.