{
  "id": 21182766,
  "title": "Notes on the discrete Fourier transform (DFT)",
  "url": "https://urgent.news/2026/11/22/notes-on-the-discrete-fourier-transform-dft",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-22T06:52:25.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://eli.thegreenplace.net/2026/notes-on-the-discrete-fourier-transform-dft/"
  },
  "original_language": "en",
  "account": "In the previous discussion on Discrete-Time Fourier Series (DTFS) and transform (DTFT), we explored their application in analyzing infinite-duration periodic and non-periodic discrete signals. However, in practical digital signal processing, signals are often finite in duration. Given N samples of a signal - represented as a list of N numbers - we aim to determine the frequencies present in this signal by finding the coefficients of complex exponentials that reconstruct the signal.\n\nInitially, one might assume that x[n] is an infinite domain signal with zero values outside our N samples and compute its DTFT. Nevertheless, this results in a continuous function of frequency w, making it computationally challenging. An alternative approach is to consider the N samples as representing a single period of a periodic signal. In this case, we can employ the DTFS, which allows us to find precise coefficients that reconstruct the discrete, periodic signal x[n].\n\nThe concept of the Discrete Fourier Transform (DFT) emerges from this analysis. By convention, we define the DFT of x[n] as X[k]. Although it may seem more appropriate to call it a series, \"transform\" has a broader meaning in mathematics - it signifies a mapping that converts a mathematical object into another. In this context, the DFT transforms an object - x[n] - into another object - X[k].\n\nInterestingly, the DFT can be viewed as N equally spaced samples of the DTFT, as it provides a way to sample the continuous DTFT variable into the discrete domain. This relationship between the DFT and DTFT enables us to compute the DFT using Python code. The Numpy library in Python is vectorized by default, facilitating efficient computation of the weights array for every k.\n\nThe theoretical connection between the roots of unity and the DFT is noteworthy. The N-th roots of unity can be expressed as z_k = e^{i2πk/N}, where ω = z_1^* = e^{-i2π/N}. When we raise ω to integer powers from 0 to N-1, we form a matrix called the Fourier Matrix or DFT Matrix. This matrix, when multiplied with the signal x[n] represented as a column vector in ℂ^N, yields the DFT of x.\n\nThere are two equivalent methods to reconstruct a signal from its DFT representation: the formula derived from the DTFS and the linear algebra interpretation using the Fourier Matrix. Both approaches lead to the inverse DFT formula, which allows us to find the reconstructed signal x[n] given X[k]. The linear algebra perspective further highlights the orthogonal basis formed by the vectors derived from powers of complex roots of unity, emphasizing the connection between discrete and continuous Fourier analysis.",
  "summary": null,
  "summary_source": "publisher",
  "key_points": [],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}