What is the quantum Fourier transform?

The QFT is the discrete Fourier transform written as a gate sequence on n qubits. It turns a hidden period into a sharp peak, and that is its whole job inside Shor’s algorithm and phase estimation.

9 min read · reviewed December 2026

The ordinary Fourier transform in one paragraph

A discrete Fourier transform takes a list of N numbers and returns another list of N numbers. The output says how much of each frequency is present in the input. If the input repeats every r steps, the output has large values at frequencies that are multiples of N/r and small values elsewhere. That one fact, a period in the input becomes a peak in the output, is the reason Fourier transforms appear in signal processing, in image compression and, in quantum computing, in the algorithms that find hidden periods.

The quantum Fourier transform is the same linear map, applied to the amplitudes of a quantum state instead of to a list of stored numbers. A register of n qubits has N = 2^n amplitudes, one for each basis state, so the register can hold exactly the kind of list a Fourier transform acts on. The input list is the list of amplitudes. The output list is the list of amplitudes after the transform.

The definition

On the basis state |j⟩, with j an integer from 0 to N − 1, the transform gives an equal-size mixture of every basis state, each carrying a phase that depends on the product j·k:

F |j⟩ = N^(−1/2) Σ over k = 0 … N−1 of e^(2πi·j·k / N) |k⟩

  • Every output state |k⟩ has the same size of amplitude, 1/√N, so a basis state goes to a flat spread. Measuring it would tell you almost nothing.
  • The information is in the phases. For output |k⟩ the phase is j·k/N of a full turn, taken modulo 1. A larger j makes the phase wind faster as k increases.
  • A general state is a sum of basis states, and F acts on each piece and adds the results. This is what linearity means.

What it does to a basis state

The table below lists the phase of each output state for the first four inputs on three qubits (N = 8). Read each row from left to right: the row for j = 0 is all zeros, which is the equal superposition with no phase twist. The row for j = 1 climbs by 1/8 of a turn at each step. The row for j = 2 climbs by 2/8, and so on. The input j is stored as the speed at which the phase winds.

This is the picture to keep in mind. The QFT does not move amplitude around much; it converts the label of a basis state into a rotation pattern across the register. The inverse transform does the opposite, and it can read a rotation pattern back into a label.

QFT of a basis state |j⟩ on 3 qubits. Every output has chance 1/8; the phase of |k⟩ is j·k/8 of a turn (mod 1).
jk = 000k = 001k = 010k = 011k = 100k = 101k = 110k = 111
00.0000.0000.0000.0000.0000.0000.0000.000
10.0000.1250.2500.3750.5000.6250.7500.875
20.0000.2500.5000.7500.0000.2500.5000.750
30.0000.3750.7500.1250.5000.8750.2500.625

What it does to a periodic state

Now suppose the input is an equal superposition of the basis states x = a, a + r, a + 2r, and so on up to N. This is a quantum list that repeats every r steps. After the transform, the amplitude is concentrated on outputs that are close to multiples of N/r.

When r divides N exactly, the peaks are exact: there are r equally likely outputs, each at chance 1/r, and every other output has chance zero. The offset a changes the phases of the peaks but does not move them. This offset-blindness matters: the algorithm learns the period without learning where in the list the pattern starts. When r does not divide N, N/r is not a whole number, so the peaks smear over two neighbouring outputs, and most of the probability stays within one step of a multiple of N/r. You can see both cases in the Period finding tab of the lab.

Why it is a legal quantum operation

Quantum gates must be unitary: they preserve the total chance of 100 percent and can be undone. The Fourier matrix with the 1/√N factor is unitary. Its inverse is the same matrix with the sign of the exponent flipped, and the inverse is also a valid quantum operation. Phase estimation uses the inverse QFT, so both directions matter.

The lab checks this numerically on every state you build: the circuit result is compared with the formula above, and the largest difference is displayed. It stays below 1e-12 because the simulator is exact and the circuit really does equal the matrix.

What it is not

It is easy to read the QFT as a faster Fourier transform for data. It is not, and the guide on the classical FFT explains why. To use it you must first load your data into the amplitudes of a register, and at the end a measurement gives one sample, not the full list of N numbers. The QFT is useful when the input state is easy to prepare, for example because an oracle or a modular exponentiation produced it, and when one sample of the output is enough, for example because a peak position gives you the period.

The QFT turns a period into a peak. It does not give you a list of Fourier coefficients you can read out.

Try it

Questions

Is the quantum Fourier transform the same as the discrete Fourier transform?

It applies the same matrix, but to the amplitudes of a quantum state. The difference is in how you get data in and out, not in the mathematics of the map.

Why does a basis state give equal chances for every output?

Because the transform spreads each input over all outputs with the same size and different phases. The phase pattern carries the input value.

What is N here?

N = 2 to the power n, the number of basis states of an n-qubit register.

Read next

Sources and further reading

Check the original sources for exact citations.