15
$\begingroup$

Sometimes the forward DFT is defined with a negative sign in the exponent, sometimes with a positive one and occasionally with a $1/N$ coefficient. I see this all over the place online. I don’t see how the forward and the inverse are equivalent: at minimum they have opposite exponential signs and a $1/N$ factor in the inverse DFT.

What's the deal?

$\endgroup$
6
  • $\begingroup$ They are never the same if the authors are not making a mistake. But you have to check their initial assumptions. Do they assume the sampling freq. in Hz or rad/s. Are they normalizing or not? These kind of nonstandard stuff cause different presentations of the material. Just derive one time and one time for all and try to obtain the rest by yourself. But you will never get the sign change in the exponential at least that part is settled as a convention. $\endgroup$
    – user13838
    Aug 17, 2011 at 21:21
  • $\begingroup$ Great response, thank you. Yes, I have derived it myself and settled on my own convention, it's simply frustrating. When you say "But you will never get the sign change in the exponential...", are you saying that DFT and DFT^-1 are both exp(+)? $\endgroup$
    – nick_name
    Aug 17, 2011 at 21:26
  • $\begingroup$ Oh no, sorry maybe I got it wrong. If you are asking why the inverse DFT has a sign change in the exponential, then the story is different. But keep in mind that it is essentially the same with the continuous version. Just plug in the forward DFT definition into the inverse DFT definition and you can see that it is clever to define that way. $\endgroup$
    – user13838
    Aug 17, 2011 at 21:35
  • $\begingroup$ Man, now I see what you mean. Excuse my stupidity. I forgot to mention that the inverse DFT can have a negative sign or positive because the signal is usually real valued. Hence the resulting DFT is symmetric with respect to zero. Therefore the sum doesn't change if you start from the left or right. $\endgroup$
    – user13838
    Aug 17, 2011 at 21:39
  • $\begingroup$ There we go! Thanks for the insightful response. :) $\endgroup$
    – nick_name
    Aug 18, 2011 at 7:55

2 Answers 2

8
$\begingroup$

Simply convention. The Wikipedia gets it quite right:

... the normalization factor multiplying the DFT and IDFT (here 1 and 1/N) and the signs of the exponents are merely conventions, and differ in some treatments. The only requirements of these conventions are that the DFT and IDFT have opposite-sign exponents and that the product of their normalization factors be 1/N.

A normalization of $1/\sqrt{N}$ for both the DFT and IDFT makes the transforms unitary, which has some theoretical advantages, but it is often more practical in numerical computation to perform the scaling all at once as above (and a unit scaling can be convenient in other ways).

(The convention of a negative sign in the exponent is often convenient because it means that X_k is the amplitude of a "positive frequency" 2πk / N. Equivalently, the DFT is often thought of as a matched filter: when looking for a frequency of +1, one correlates the incoming signal with a frequency of −1.)

Regarding the last paragraph, about exponent signs: that means that the common convention of having negative exponents in the DFT (which might appear a little unnatural) looks natural when we think our signal as a juxtaposition (linear combination) of sinusoids (complex exponentials). And this corresponds to the IDFT equation (which, in this convention, will have positive exponents) :

$$x[n] = \sum_k X(k) \; \exp{(i 2 \pi k n /N)}$$

... so that $X(k)$ is the "weight" associated with the sinusoid of frequency $k$. In other words, the convention looks natural when we think in terms of synthesis rather than analysis.

Regarding the normalization factor: The convention is less universal here, in my experience. I actually tend to divide by $N$ in the DFT, so that the Fourier transform at frequency zero gives the average value of the signal (the "DC component"). It's true that using $1/\sqrt{N}$ makes everything more mathematically elegant (DFT is a unitary transform, and the inverse is just the Hermitian transpose), but this is seldom useful in numerical work.

$\endgroup$
4
  • 1
    $\begingroup$ It might prove illustrative if somebody shows an instance where the convention is to have "-" for the forward transform, and another instance where "+" is the forward transform. That being said, the convention I'm used to has "-" as the forward transform. Mathematica is the only system I've seen so far that conventionally normalizes by $\frac1{\sqrt N}$... $\endgroup$ Aug 29, 2011 at 1:40
  • $\begingroup$ Actually, I don't recall + for the forward transform in the usual context of the transform (time <-> frecuency). In other contexts, one might argue that, in probability, the "characteristic function" is a forward Fourier transform with positive exponent, for example. en.wikipedia.org/wiki/… $\endgroup$
    – leonbloy
    Aug 29, 2011 at 1:59
  • 1
    $\begingroup$ Putting the 1/N factor on the inverse DFT is convenient for computing convolution using the frequency domain. Otherwise you'd have to track the number of 1/N terms multiplied and scale accordingly. Also, 1/N corresponds to Δf in the Riemann sum approximation of the inverse Discrete-Time Fourier Transform (DTFT). $\endgroup$
    – Eryk Sun
    May 11, 2012 at 4:15
  • 1
    $\begingroup$ The $1/N$ factor properly belongs not with the FT as such, but with the measure you choose on your domain—the finite group $\mathbf Z/n\mathbf Z$: either the counting one (treating it as a discrete group, like $\mathbf Z$) or the normalized one (treating it as a compact group, like $\mathbf T\equiv\mathbf R/2\pi\mathbf Z$). The general theory tells you the FT switches discrete and compact groups with their standard measures, but it doesn’t tell you which to choose. The $1/\sqrt N$ normalization is pretty, but does not tie into this at all AFAIK. $\endgroup$ Dec 15, 2018 at 20:27
3
$\begingroup$

Not using a negative exp in the definition of the forward DFT is a really bad idea. I know that Numerical Recipes uses a positive exp, but it's still a bad idea. I fear that most uses of the positive exp can be traced to be influenced by Numerical Recipes (*).

Whether you include the 1/N term in the forward or backward transform or not at all is really just a convention. There are at least two good reasons to not include the 1/N term:

  1. The FFTW library is a de facto reference implementation of the FFT, and it doesn't include the 1/N term.
  2. It would be unclear whether it should be included in the forward or backward transform, and hence a constant source of confusion.

Another reason in favor of not including the 1/N term is that it has become common practice (**) to define the (continuous) Fourier transform in a way that no normalization factors are needed (by using the frequency $\xi$ instead of the angular frequency $\omega$):

$\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\ e^{- 2\pi i x \xi}\,dx$

$f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi)\ e^{2 \pi i x \xi}\,d\xi$

So omitting the 1/N term from the DFT makes the definition look more similar to the continuous case. However, I have to admit that I have the habit of including the 1/N factor in the forward transform, because then the DFT of a constant function is independent of N.

(*) You probably don't believe me ("It's just a convention, why should it matter?"), but I recently googled for NFFT (nonequispaced FFT) and read some of the related papers. One of the authors used the positive exp in his thesis, but changed to the negative exp in later papers and presentations. While reading one of his later presentations, I was surprised by the amount of sign mistakes and surprising differences in sign conventions between closely related definitions.

(**) I think this change must have occurred only in the last few years. Wikipedia claims that the mathematics literature always used the "frequency convention" and only the physics literature used the "angular frequency convention", but this doesn't match with my own experience.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .