The Discrete Fourier Transform, takes in a sequence of N complex numbers and converts them to another sequence, let’s say .

Inverse-DFT or IDFT, as the name implies, reverses the DFT. This whole process of conversion and de-conversion is achieved using the following equation pair.



Now this may look daunting. And this whole process certainly raised quite a few questions in my head the first time I saw it.

  • Why are we doing it? (this post)
  • Why complex exponentials? (part II)
  • And most importantly, why do these pair of equations work? (part III)


If you’re familiar with music you would know that different notes sound different because of pitch. Some sound shrill, some sound heavy. This difference is due to the frequency of the wave produced when you sing or play the note.

Each note is a vibration in the air, a to-and-fro motion. And the ones that vibrate faster sound shrill, the ones that vibrate slower sound bassy.

You can draw the wave, the to-and-fro intensity of air pressure vs time, on a graph using a sine-like wave. If the wave has small period, it has high-frequency, ie high pitch. And a larger period means low pitch.

Here is the so called frequency of the wave. If , ie the to-and-fro motion happens times in a second, we get the note.

As you can see in the figure above, the wave covered 4.4 periods in 0.01 seconds.

A computer can’t record a continous wave of always-changing intensities, because there are uncountably infinite points on a continuous line. So it samples the pressure value thousands of times within a second. Like take a sample at th of a second, then at th and so on.

Doing this, you get a string of discrete numbers which represent the wave’s intensity at evenly spaced points of time. That is a sequence like:

Here each represents the th sample. For , and sampling rate you can calculate the continuous time this sample corresponds to. It will be the amplitude of the wave at .

For example here are the first 10 samples of a 440Hz sine wave sampled at 8000 Hz:

X = [0, 0.33873792, 0.63742399, 0.86074203, 0.98228725, 0.98768834, 0.87630668, 0.66131187, 0.36812455, 0.03141076]

Now suppose you played two or three notes together, like in a chord. And you recorded that on a computer.

You’ve now got the sound signal of the chord as a list of numbers in your computer and you want to somehow figure out what notes were played in the chord, and with what intensites. How would you go about it?

If you played two notes of frequencies: and . The continuous wave in the air would be something like:

For example:
(~ C4)
(~ E4)

The string of numbers you’ll get will be given by:

Here are the first few numbers from the C4-E4 chord (with )

x = 0.0, 0.66379131852805939, 1.2933946833211722, 1.8564778507641972, 2.3243141125985418, 2.673326659067349, 2.886340129304954, 2.9534693906900813, 2.8725970774257692, 2.649415684497730, ...

Our aim here is to find a conversion method, which will take in this sequence of and give us information about each frequency component in the wave.

We again encounter a problem though. The possible frequencies between suppose and are infinite, i.e. frequencies are also continuous. But our sad little computer needs to deal with non-infinite precision, i.e. discrete stuff.

Hence we reduce our problem from finding intensities of all possible frequencies, to just evenly spaced discrete frequencies. (NB: analytically, finding it for all frequencies is possible for a discrete-time sequence. It is called Discrete-Time Fourier Transform or DTFT)

We need to find a list of numbers , where each corresponds to the contribution of a specific continous frequency by the given formula:

It’s weird how and popped up here, isn’t it? I’ll hopefully cover it in another article, as it would be a major digression here. For now, think of as just placeholders for equally spaced frequencies, and you can convert it back-and-forth using the formula given above.

Let’s apply this to conversion on our C4-E4 chord. The and we picked, got sampled as (luckily integers):

Thus the chord wave in our computer can also be written as:

Now we want to convert this sequence of to a sequence of , such that:

How to do this conversion? Answer of course is DFT, but I’ll cover it in Part II and III of this post.

To wrap up the motivation, consider this: In general if we already know all the values for a sound wave, we can get the samples of the audio simply by adding all the sine waves of the frequencies:

You might notice how this looks eerily similar to the IDFT equation in the introduction. The only difference is the scary complex exponential instead of the sine, and the constant factor. So IDFT equation is just adding different discrete frequency contributions to form the sequence.

If you’ve hung around till the end of this post without sleeping, congrats you almost understand IDFT. See you in the next post :)

Published: 27 July 2017

Disqus has been disabled. If you have a comment, feel free to email it to me.