Quantum Fourier transform

From HandWiki
Short description: Change of basis applied in quantum computing
In quantum computing, the quantum Fourier transform (QFT) is a linear transformation on quantum bits, and is the quantum analogue of the discrete Fourier transform. The quantum Fourier transform is a part of many quantum algorithms, notably Shor's algorithm for factoring and computing the discrete logarithm, the quantum phase estimation algorithm for estimating the eigenvalues of a unitary operator, and algorithms for the hidden subgroup problem. The quantum Fourier transform was discovered by Don Coppersmith.[1]

The quantum Fourier transform can be performed efficiently on a quantum computer with a decomposition into the product of simpler unitary matrices. The discrete Fourier transform on [math]\displaystyle{ 2^n }[/math] amplitudes can be implemented as a quantum circuit consisting of only [math]\displaystyle{ O(n^2) }[/math] Hadamard gates and controlled phase shift gates, where [math]\displaystyle{ n }[/math] is the number of qubits.[2] This can be compared with the classical discrete Fourier transform, which takes [math]\displaystyle{ O(n2^n) }[/math] gates (where [math]\displaystyle{ n }[/math] is the number of bits), which is exponentially more than [math]\displaystyle{ O(n^2) }[/math].

The quantum Fourier transform acts on a quantum state vector (a quantum register), and the classical Discrete Fourier transform acts on a vector. Both types of vectors can be written as lists of complex numbers. In the quantum case it is a sequence of probability amplitudes for all the possible outcomes upon measurement (the outcomes are the basis states, or eigenstates). Because measurement collapses the quantum state to a single basis state, not every task that uses the classical Fourier transform can take advantage of the quantum Fourier transform's exponential speedup.

The best quantum Fourier transform algorithms known (as of late 2000) require only [math]\displaystyle{ O(n \log n) }[/math] gates to achieve an efficient approximation, provided that a controlled phase gate is implemented as a native operation.[3]


The quantum Fourier transform is the classical discrete Fourier transform applied to the vector of amplitudes of a quantum state, which usually has length [math]\displaystyle{ N = 2^n }[/math].

The classical Fourier transform acts on a vector [math]\displaystyle{ (x_0, x_1, \ldots , x_{N-1}) \in \mathbb{C}^N }[/math] and maps it to the vector [math]\displaystyle{ (y_0, y_1, \ldots , y_{N-1}) \in \mathbb{C}^N }[/math] according to the formula:

[math]\displaystyle{ y_k = \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1} x_n \omega_N^{-nk}, \quad k=0,1,2, \ldots ,N-1, }[/math]

where [math]\displaystyle{ \omega_N= e^{\frac{2 \pi i}{N}} }[/math] and [math]\displaystyle{ \omega_N^n }[/math] is an N-th root of unity.

Similarly, the quantum Fourier transform acts on a quantum state [math]\displaystyle{ |x\rangle = \sum_{i=0}^{N-1} x_i |i\rangle }[/math] and maps it to a quantum state [math]\displaystyle{ \sum_{i=0}^{N-1} y_i |i\rangle }[/math] according to the formula:

[math]\displaystyle{ y_k = \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1} x_n \omega_N^{nk}, \quad k=0,1,2, \ldots ,N-1, }[/math]

(Conventions for the sign of the phase factor exponent vary; here the quantum Fourier transform has the same effect as the inverse discrete Fourier transform, and vice versa.)

Since [math]\displaystyle{ \omega_N^n }[/math] is a rotation, the inverse quantum Fourier transform acts similarly but with:

[math]\displaystyle{ x_n = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} y_k \omega_N^{-nk}, \quad n=0,1,2, \ldots ,N-1, }[/math]

In case that [math]\displaystyle{ |x\rangle }[/math] is a basis state, the quantum Fourier Transform can also be expressed as the map

[math]\displaystyle{ \text{QFT}: |x\rangle \mapsto \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \omega_N^{xk} |k\rangle. }[/math]

Equivalently, the quantum Fourier transform can be viewed as a unitary matrix (or quantum gate) acting on quantum state vectors, where the unitary matrix [math]\displaystyle{ F_N }[/math] is the DFT matrix

[math]\displaystyle{ F_N = \frac{1}{\sqrt{N}} \begin{bmatrix} 1&1&1&1&\cdots &1 \\ 1&\omega&\omega^2&\omega^3&\cdots&\omega^{N-1} \\ 1&\omega^2&\omega^4&\omega^6&\cdots&\omega^{2(N-1)}\\ 1&\omega^3&\omega^6&\omega^9&\cdots&\omega^{3(N-1)}\\ \vdots&\vdots&\vdots&\vdots&&\vdots\\ 1&\omega^{N-1}&\omega^{2(N-1)}&\omega^{3(N-1)}&\cdots&\omega^{(N-1)(N-1)} \end{bmatrix} }[/math]

where [math]\displaystyle{ \omega = \omega_N }[/math]. For example, in the case of [math]\displaystyle{ N=4=2^2 }[/math] and phase [math]\displaystyle{ \omega = i }[/math] the transformation matrix is

[math]\displaystyle{ F_4 = \frac{1}{2} \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & i & -1 & -i \\ 1 & -1 & 1 & -1 \\ 1 & -i & -1 & i \end{bmatrix} }[/math]



Most of the properties of the quantum Fourier transform follow from the fact that it is a unitary transformation. This can be checked by performing matrix multiplication and ensuring that the relation [math]\displaystyle{ FF^{\dagger}=F^{\dagger}F=I }[/math] holds, where [math]\displaystyle{ F^\dagger }[/math] is the Hermitian adjoint of [math]\displaystyle{ F }[/math]. Alternately, one can check that orthogonal vectors of norm 1 get mapped to orthogonal vectors of norm 1.

From the unitary property it follows that the inverse of the quantum Fourier transform is the Hermitian adjoint of the Fourier matrix, thus [math]\displaystyle{ F^{-1}=F^{\dagger} }[/math]. Since there is an efficient quantum circuit implementing the quantum Fourier transform, the circuit can be run in reverse to perform the inverse quantum Fourier transform. Thus both transforms can be efficiently performed on a quantum computer.

Circuit implementation

The quantum gates used in the circuit of [math]\displaystyle{ n }[/math] qubits are the Hadamard gate and the phase gate [math]\displaystyle{ R_k }[/math]:

[math]\displaystyle{ H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \qquad \text{and} \qquad R_k = \begin{pmatrix} 1 & 0 \\ 0 & e^{i2\pi/2^k} \end{pmatrix} }[/math]

The circuit is composed of [math]\displaystyle{ H }[/math] gates and the controlled version of [math]\displaystyle{ R_k }[/math]:

Quantum circuit for Quantum-Fourier-Transform with n qubits (without rearranging the order of output states) using the fractional binary notation defined below.

An orthonormal basis consists of the basis states

[math]\displaystyle{ |0\rangle, \ldots , |2^n - 1\rangle. }[/math]

These basis states span all possible states of the qubits:

[math]\displaystyle{ | x \rangle = | x_1 x_2 \ldots x_n \rangle = | x_1 \rangle \otimes | x_2 \rangle \otimes \cdots \otimes | x_n \rangle }[/math]

where, with tensor product notation [math]\displaystyle{ \otimes }[/math], [math]\displaystyle{ |x_j\rangle }[/math] indicates that qubit [math]\displaystyle{ j }[/math] is in state [math]\displaystyle{ x_j }[/math], with [math]\displaystyle{ x_j }[/math] either 0 or 1. By convention, the basis state index [math]\displaystyle{ x }[/math] is the binary number encoded by the [math]\displaystyle{ x_j }[/math], with [math]\displaystyle{ x_1 }[/math] the most significant bit.

The action of the Hadamard gate is [math]\displaystyle{ H|x_i\rangle=\left(\frac{1}{\sqrt{2}}\right)\left(|0\rangle+e^{2\pi i x_i 2^{-1}}|1\rangle \right) }[/math], where the sign depends on [math]\displaystyle{ x_i }[/math].

The quantum Fourier transform can be written as the tensor product of a series of terms:

[math]\displaystyle{ \text{QFT}(|x\rangle) = \frac{1}{\sqrt{N}} \bigotimes_{j=1}^{n} \left( |0\rangle + \omega_N^{x2^{n-j}} |1\rangle \right). }[/math]

Using the fractional binary notation

[math]\displaystyle{ [0. x_1 \ldots x_m] = \sum_{k = 1}^m x_k 2^{-k}. }[/math]

the action of the quantum Fourier transform can be expressed in a compact manner:

[math]\displaystyle{ \text{QFT}(|x_1 x_2 \ldots x_n \rangle) = \frac{1}{\sqrt{N}} \ \left(|0\rangle + e^{2 \pi i \, [0.x_n] }|1\rangle\right) \otimes \left(|0\rangle + e^{2 \pi i \, [0.x_{n-1} x_n] }|1\rangle\right) \otimes \cdots \otimes \left(|0\rangle + e^{2 \pi i \, [0.x_1 x_2 \ldots x_n] }|1\rangle\right). }[/math]

To obtain this state from the circuit depicted above, a swap operation of the qubits must be performed to reverse their order. At most [math]\displaystyle{ n/2 }[/math] swaps are required.[2]

Because the discrete Fourier transform, an operation on n qubits, can be factored into the tensor product of n single-qubit operations, it is easily represented as a quantum circuit (up to an order reversal of the output). Each of those single-qubit operations can be implemented efficiently using one Hadamard gate and a linear number of controlled phase gates. The first term requires one Hadamard gate and [math]\displaystyle{ (n-1) }[/math] controlled phase gates, the next term requires one Hadamard gate and [math]\displaystyle{ (n-2) }[/math] controlled phase gate, and each following term requires one fewer controlled phase gate. Summing up the number of gates, excluding the ones needed for the output reversal, gives [math]\displaystyle{ n + (n-1) + \cdots + 1 = n(n+1)/2 = O(n^2) }[/math] gates, which is quadratic polynomial in the number of qubits.

The circuit-level implementation of the quantum Fourier transform on a linear nearest neighbor architecture has been studied before.[4][5] The circuit depth is linear in the number of qubits.


The quantum Fourier transform on three qubits, [math]\displaystyle{ F_8 }[/math] with [math]\displaystyle{ n=3, N=8=2^3 }[/math], is represented by the following transformation:

[math]\displaystyle{ \text{QFT}: |x\rangle \mapsto \frac{1}{\sqrt{8}} \sum_{k=0}^{7} \omega^{xk} |k\rangle, }[/math]

where [math]\displaystyle{ \omega = \omega_{8} }[/math] is an eighth root of unity satisfying [math]\displaystyle{ \omega^8=\left(e^{\frac{i2\pi}{8}}\right)^8=1 }[/math].

The matrix representation of the Fourier transform on three qubits is:

[math]\displaystyle{ F_8 = \frac{1}{\sqrt{8}} \begin{bmatrix} 1&1&1&1&1&1&1&1 \\ 1&\omega&\omega^2&\omega^3&\omega^4&\omega^5&\omega^6&\omega^7 \\ 1&\omega^2&\omega^4&\omega^6&1&\omega^2&\omega^4&\omega^6 \\ 1&\omega^3&\omega^6&\omega&\omega^4&\omega^7&\omega^2&\omega^5 \\ 1&\omega^4&1&\omega^4&1&\omega^4&1&\omega^4 \\ 1&\omega^5&\omega^2&\omega^7&\omega^4&\omega&\omega^6&\omega^3 \\ 1&\omega^6&\omega^4&\omega^2&1&\omega^6&\omega^4&\omega^2 \\ 1&\omega^7&\omega^6&\omega^5&\omega^4&\omega^3&\omega^2&\omega \\ \end{bmatrix}. }[/math]

The 3-qubit quantum Fourier transform can be rewritten as:

[math]\displaystyle{ \text{QFT}(|x_1, x_2, x_3 \rangle ) = \frac{1}{\sqrt{8}} \ \left(|0\rangle + e^{2 \pi i \, [0.x_3] }|1\rangle\right) \otimes \left(|0\rangle + e^{2 \pi i \, [0.x_2 x_3] }|1\rangle\right) \otimes \left(|0\rangle + e^{2 \pi i \, [0.x_1 x_2 x_3] }|1\rangle\right). }[/math]

The following sketch shows the respective circuit for [math]\displaystyle{ n=3 }[/math] (with reversed order of output qubits with respect to the proper QFT):

QFT for 3 Qubits (without rearranging the order of the output qubits)

As calculated above, the number of gates used is [math]\displaystyle{ n(n+1)/2 }[/math] which is equal to [math]\displaystyle{ 6 }[/math], for [math]\displaystyle{ n=3 }[/math].

Relation to quantum Hadamard transform

Using the generalized Fourier transform on finite (abelian) groups, there are actually two natural ways to define a quantum Fourier transform on an n-qubit quantum register. The QFT as defined above is equivalent to the DFT, which considers these n qubits as indexed by the cyclic group [math]\displaystyle{ \Z / 2^n \Z }[/math]. However, it also makes sense to consider the qubits as indexed by the Boolean group [math]\displaystyle{ (\Z / 2 \Z)^n }[/math], and in this case the Fourier transform is the Hadamard transform. This is achieved by applying a Hadamard gate to each of the n qubits in parallel.[6][7] Shor's algorithm uses both types of Fourier transforms, an initial Hadamard transform as well as a QFT.


  1. Coppersmith, D. (1994). "An approximate Fourier transform useful in quantum factoring.". Technical Report RC19642, IBM. 
  2. 2.0 2.1 Michael Nielsen and Isaac Chuang (2000). Quantum Computation and Quantum Information. Cambridge: Cambridge University Press. ISBN 0-521-63503-9. OCLC 174527496. 
  3. Hales, L.; Hallgren, S. (November 12–14, 2000). "An improved quantum Fourier transform algorithm and applications". Proceedings 41st Annual Symposium on Foundations of Computer Science. pp. 515–525. doi:10.1109/SFCS.2000.892139. ISBN 0-7695-0850-2. 
  4. Fowler, A. G.; Devitt, S. J.; Hollenberg, L. C. L. (2004-07-01). "Implementation of Shor's algorithm on a linear nearest neighbour qubit array". Quantum Information & Computation 4 (4): 237–251. doi:10.26421/QIC4.4-1. ISSN 1533-7146. https://dl.acm.org/doi/10.5555/2011827.2011828. 
  5. Maslov, Dmitri (2007-11-15). "Linear depth stabilizer and quantum Fourier transformation circuits with no auxiliary qubits in finite-neighbor quantum architectures". Physical Review A 76 (5): 052310. doi:10.1103/PhysRevA.76.052310. https://link.aps.org/doi/10.1103/PhysRevA.76.052310. 
  6. Fourier Analysis of Boolean Maps– A Tutorial –, pp. 12-13
  7. Lecture 5: Basic quantum algorithms, Rajat Mittal, pp. 4-5
  • K. R. Parthasarathy, Lectures on Quantum Computation and Quantum Error Correcting Codes (Indian Statistical Institute, Delhi Center, June 2001)
  • John Preskill, Lecture Notes for Physics 229: Quantum Information and Computation (CIT, September 1998)

External links