In quantum computing, the quantum Fourier transform (QFT) is a linear transformation on quantum bits, and is the quantum analogue of the inverse 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.
The quantum Fourier transform can be performed efficiently on a quantum computer, with a particular decomposition into a product of simpler unitary matrices.
Using a simple decomposition, the discrete Fourier transform on 2^n amplitudes can be implemented as a quantum circuit consisting of only O(n^2) Hadamard gates and controlled phase shift gates, where n is the number of qubits.
This can be compared with the classical discrete Fourier transform, which takes O(n2^n) gates (where n is the number of bits), which is exponentially more than O(n^2).
However, the quantum Fourier transform acts on a quantum state, whereas the classical Fourier transform acts on a vector, so not every task that uses the classical Fourier transform can take advantage of this exponential speedup.
The best quantum Fourier transform algorithms known (as of late 2000) require only O(n \log n) gates to achieve an efficient approximation.
Definition
The quantum Fourier transform is the classical discrete Fourier transform applied to the vector of amplitudes of a quantum state, where we usually consider vectors of length N = 2^n.
The classical Fourier transform acts on a vector  (x_0, x_1, \ldots , x_{N-1}) \in \mathbb{C}^N and maps it to the vector  (y_0, y_1, \ldots , y_{N-1}) \in \mathbb{C}^N according to the formula:
y_k = \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1} x_n \omega_N^{-kn}, \quad k=0,1,2, \ldots ,N-1,
where \omega_N= e^{\frac{2 \pi i}{N}} and \omega_N^n is an N-th root of unity.
Similarly, the quantum Fourier transform acts on a quantum state |x\rangle = \sum_{i=0}^{N-1} x_i |i\rangle and maps it to a quantum state \sum_{i=0}^{N-1} y_i |i\rangle according to the formula:
y_k = \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1} x_n \omega_N^{nk}, \quad k=0,1,2, \ldots ,N-1,
(Conventions for the sign of the phase factor exponent vary; here we use the convention that the quantum Fourier transform has the same effect as the inverse discrete Fourier transform, and vice versa.)
Since \omega_N^n is a rotation, the inverse quantum Fourier transform acts similarly but with:
x_n = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} y_k \omega_N^{-nk}, \quad n=0,1,2, \ldots ,N-1,
In case that |x\rangle  is a basis state, the quantum Fourier Transform can also be expressed as the map
\text{QFT}: |x\rangle \mapsto  \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \omega_N^{xk} |k\rangle.
Equivalently, the quantum Fourier transform can be viewed as a unitary matrix (or a quantum gate, similar to a Boolean logic gate for classical computers) acting on quantum state vectors, where the unitary matrix F_N is given by
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}
where \omega = \omega_N.
We get, for example, in the case of N=4=2^2 and phase \omega = i the transformation matrix
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}
Properties
Unitarity
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 FF^{\dagger}=F^{\dagger}F=I holds, where F^\dagger is the Hermitian adjoint of F. 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 F^{-1}=F^{\dagger}.
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 are the Hadamard gate and the controlled phase gate R_m, here in terms of
H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \qquad \text{and} \qquad   R_m = \begin{pmatrix} 1 & 0 \\ 0 & e^{2\pi i/2^m}  \end{pmatrix}
with e^{2 \pi i/2^m} = \omega_m' = \omega_{\left(2^m\right)}  the primitive 2^m-th root of unity.
The circuit is composed of H gates and the controlled version of R_m
700px|Quantum circuit for Quantum-Fourier-Transform with n qubits (without rearranging the order of output states).
It uses the binary fraction notation introduced below.
As already stated, we assume N = 2^n.
We have the orthonormal basis consisting of the vectors
|0\rangle, \ldots , |2^n - 1\rangle.
The basis states enumerate all the possible states of the qubits:
| x \rangle = | x_1 x_2 \ldots x_n \rangle = | x_1 \rangle \otimes | x_2 \rangle \otimes \cdots \otimes | x_n \rangle
where, with tensor product notation \otimes, |x_j\rangle indicates that qubit j is in state x_j, with x_j either 0 or 1.
By convention, the basis state index x is the binary number encoded by the x_j, with x_1 the most significant bit.
With this convention, we may write the quantum Fourier transform as:
\text{QFT}(|x\rangle) = \frac{1}{\sqrt{N}} \bigotimes_{j=1}^{n} \left( |0\rangle + \omega_n'^{x2^{n-j}} |1\rangle \right).
It is also useful to borrow fractional binary notation:
[0. x_1 \ldots x_m] = \sum_{k = 1}^m x_k 2^{-k}.
With this notation, the action of the quantum Fourier transform can be expressed in a compact manner:
\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).
To obtain this state from the circuit depicted above, a swap operation of the qubits must be performed to reverse their order.
At most n/2 swaps are required.
In other words, the discrete Fourier transform, an operation on n qubits, can be factored into the tensor product of n single-qubit operations, suggesting it is easily represented as a quantum circuit (up to an order reversal of the output).
In fact, each of those single-qubit operations can be implemented efficiently using a Hadamard gate and controlled phase gates.
The first term requires one Hadamard gate and (n-1) controlled phase gates, the next one requires a Hadamard gate and (n-2) 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 n + (n-1) + \cdots + 1 = n(n+1)/2 = O(n^2) gates, which is quadratic polynomial in the number of qubits.
Example
Consider the quantum Fourier transform on 3 qubits.
It is the following transformation:
\text{QFT}: |x\rangle \mapsto  \frac{1}{\sqrt{2^3}} \sum_{k=0}^{2^3-1} \omega_3'^{xk} |k\rangle,
where \omega_3' = \omega_{\left(2^3\right)} is a primitive eighth root of unity satisfying \omega_3'^8=\left(e^{\frac{2\pi i}{2^3}}\right)^8=1 (since N = 2^3 = 8).
For short, setting \omega = \omega_3' = \omega_8, the matrix representation of this transformation on 3 qubits is:
F_{2^3} = \frac{1}{\sqrt{2^3}} \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}.
The 3-qubit quantum Fourier transform can be rewritten as:
\text{QFT}(|x_1, x_2, x_3 \rangle ) = \frac{1}{\sqrt{2^3}} \ \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).
In the following sketch, we have the respective circuit for n=3 (with wrong order of output qubits with respect to the proper QFT):
600px|QFT for 3 Qubits (without rearranging the order of the output qubits)
As calculated above, the number of gates used is n(n+1)/2 which is equal to 6, for n=3.
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 \Z / 2^n \Z.
However, it also makes sense to consider the qubits as indexed by the Boolean group (\Z / 2 \Z)^n, 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.Fourier Analysis of Boolean Maps– A Tutorial –, pp.
12-13Lecture 5: Basic quantum algorithms, Rajat Mittal, pp.
4-5 Note that Shor's algorithm uses both types of Fourier transforms, both an initial Hadamard transform as well as a QFT.
References
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
Wolfram Demonstration Project: Quantum Circuit Implementing Grover's Search Algorithm
Wolfram Demonstration Project: Quantum Circuit Implementing Quantum Fourier Transform
Quirk online life quantum fourier transform
