This is how the DFT may be computed efficiently.
has to be evaluated for N values of u, which if done in the obvious way clearly takes multiplications.
It is possible to calculate the DFT more efficiently than this, using the fast Fourier transform or FFT algorithm, which reduces the number of operations to .
We shall assume for simplicity that N is a power of 2, .
If we define to be the root of unity given
by , and set M=N/2, we have
This can be split apart into two separate sums of alternate terms from the original sum,
Now, since the square of a root of unity is an
root of unity, we have that
If we call the two sums demarcated above and respectively, then we have
Note that each of and for is in itself a discrete Fourier transform over N/2=M points.
How does this help us?
and we can also write
Thus, we can compute an N-point DFT by dividing it into two parts:
To show how many operations this requires, let T(n) be the time taken to perform a
transform of size , measured by the number of multiplications performed. The
above analysis shows that
the first term on the right hand side coming from the two transforms of half the original size, and the second term coming from the multiplications of by . Induction can be used to prove that
A similar argument can also be applied to the number of additions required, to show that the algorithm as a whole takes time .
Also Note that the same algorithm can be used with a little
modification to perform the inverse DFT too. Going back to the definitions of the
DFT and its inverse,
If we take the complex conjugate of the second equation, we have that
This now looks (apart from a factor of 1/N) like a forward DFT, rather than an inverse DFT.
Thus to compute an inverse DFT,
The same fast Fourier transform algorithm can be used -- applying the separability property of the 2D transform.
Rewrite the 2D DFT
The right hand sum is basically just a one-dimensional DFT if x is held constant. The left hand sum is then another one-dimensional DFT performed with the numbers that come out of the first set of sums.
So we can compute a two-dimensional DFT by
This requires a total of 2 N one dimensional transforms, so the overall process takes time .