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 amplitudes can be implemented as a quantum circuit consisting of only Hadamard gates and controlled phase shift gates, where is the number of qubits. This can be compared with the classical discrete Fourier transform, which takes gates (where is the number of bits), which is exponentially more than . 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 gates to achieve an efficient approximation.
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 .
The classical Fourier transform acts on a vector and maps it to the vector
according to the formula:
Similarly, the quantum Fourier transform acts on a quantum state and maps it to a quantum state according to the formula:
(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 is a rotation, the inverse quantum Fourier transform acts similarly but with:
In case that is a basis state, the quantum Fourier Transform can also be expressed as the map
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 is given by
where . We get, for example, in the case of and phase the transformation matrix
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 holds, where is the Hermitian adjoint of . 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 . 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.
with the primitive -th root of unity. The circuit is composed of gates and the controlled version of
All quantum operations must be linear, so it suffices to describe the function on each one of the basis states and let the mixed states be defined by linearity. This is in contrast to how Fourier transforms are usually described. We normally describe Fourier transforms in terms of how the components of the results are calculated on an arbitrary input. This is how you would calculate the path integral or show BQPis inPP. But it is much simpler here (and in many cases) to just explain what happens to a specific arbitrary basis state, and the total result can be found by linearity.
The quantum Fourier transform can be approximately implemented for any N; however, the implementation for the case where N is a power of 2 is much simpler. As already stated, we assume . We have the orthonormal basis consisting of the vectors
The basis states enumerate all the possible states of the qubits:
where, with tensor product notation , indicates that qubit is in state , with either 0 or 1. By convention, the basis state index orders the possible states of the qubits lexicographically, i.e., by converting from binary to decimal in this way:
It is also useful to borrow fractional binary notation:
For instance, and
With this notation, the action of the quantum Fourier transform can be expressed in a compact manner:
where we have used:
This can be seen by rewriting the formula for the Fourier transform in the binary expansion:
then , because , for , and , thus the becomes:
since for all .
Then we can write:
To obtain this state from the circuit depicted above, a swap operations of the qubits must be performed to reverse their order. At most swaps are required, each one being accomplished using three controlled-NOT (C-NOT) gates.
After the reversal, the n-th output qubit will be in a superposition state of and , and similarly the other qubits before that (take a second look at the sketch of the circuit above).
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 controlledphase gates. The first term requires one Hadamard gate and controlled phase gates, the next one requires a Hadamard gate and 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 gates, which is quadratic polynomial in the number of qubits.
Consider the quantum Fourier transform on 3 qubits. It is the following transformation:
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 . However, it also makes sense to consider the qubits as indexed by the Boolean group, 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. Note that Shor's algorithm uses both types of Fourier transforms, both an initial Hadamard transform as well as a QFT.
^Coppersmith, D. (1994). "An approximate Fourier transform useful in quantum factoring". Technical Report RC19642, IBM.