lecturenotes10
lecturenotes10
Dave Bacon
Department of Computer Science & Engineering, University of Washington
What use is the quantum Fourier transform? Well we’ve already seen Jordan’s algorithm which was like the
Bernstein-Vazirani problem. But the most important use for the quantum Fourier transform was discovered by Peter
Shor when he showed how to us it to efficiently factor numbers. In these notes we’ll develop the quantum machinery
necessary to get to the point where we can understand Shor’s algorithm.
Now what we learned from the Bernstein-Vazirani problem was that if we could get the information about the function
into the ±1 phase of each state, then we could use this, for the Hadamard basis states, to find a hidden string s for
the function f (x) = s · x. What might the analogy be for the quantum Fourier transform? Well the first thing to
notice is that there are roots of unity which are not just ±1 here. Intuitively this means that a phase kickback trick
will have to do phase kickback with roots of unity. Recall that the eigenvalues of unitary matrices are roots of unity.
This leads us naturally to the quantum phase estimation algorithm.
Suppose that you are in the following situation. You can prepare an eigenstate |ψi of a unitary operator U . Further,
j
you have the ability to apply a controlled-U 2 operator. How can you use these tools to estimate the eigenvalue of
this unitary. First recall that unitary matrices have eigenvalues which are roots of unity. Let’s call the eigenvalue
corresponding to the eigenvector |ψi, ei2πφ , where 0 ≤ φ < 1. Our goal is to find an estimate of φ. The quantum
phase estimation algorithm performs exactly this task. How does this algorithm work? It begins by preparing doing
a phase kickback trick. Consider the following quantum circuit on n qubits,
|0i H • ···
.. .. ..
. . .
|0i H ··· •
|ψi / U2
n−1
U2
n−2
··· U
j j
Recall that U |ψi = e2πiφ |ψi, so U 2 |ψi = e2πiφ2 |ψi. Thus if we input √1 (|0i + |1i) into the control of one of these
2
j
2
controlled-U gates which itself acts on an the eigenstate |ψi, then this will perform the transform
1 1 j
√ (|0i + |1i)|ψi → √ (|0i + e2πi2 |1i)|ψi (4)
2 2
Therefore we calculate that the output of the above circuit is
1 n−1 n−2 0
√ (|0i + e2πi2 φ |1i) ⊗ (|0i + e2πi2 φ |1i) ⊗ · · · ⊗ (|0i + e2πi2 φ |1i) (5)
2 n
2
Now it may be that φ does not have a n bit binary fraction expansion. We will treat this case in a second. First,
to understand what is going on, let’s just assume that φ does have exactly a n bit binary fraction expansion. How
do we determine φ? Simple. We simply perform the Fourier transform on the output of this circuit. Notice that the
Fourier transform will take the output of the phase kickback state above to the state
|φ1 , φ2 , . . . , φn i (8)
What happens to the phase estimation algorithm when we are not given a φ with an exact n bit binary fraction
expansion? In particular, suppose that we wish to obtain φ to n bits of accuracy with some probability of failing .
How do we do this?
Well the output of the phase kickback circuit is
n
2 −1
1 X 2πiφx
√ e |xi (9)
2n x=0
What about |1 − r| Again we can consider the chord from 1 to r in the complex plane. Then this ratio is at least 1,
2πδ
≥1 (15)
|1 − r|
3
1 (4δ2n )2 4
Pr ≥ 2n 2
= 2 > 0.4 (16)
2 (2π) π
This implies that we will get the correct answer with greater than a constant probability.
Actually we can do even better than this because the probability that we will obtain values which are far from the
correct value are very small. To show this, wennote that the probability of our getting
n
the incorrect outcome can be
1
calculated using |δ| > 2n+1 Then using |1 − r2 | ≤ 2 and |1 − r| ≥ 4δ (like the r2 before but now for r instead), we
see that
1 22
P r(δ) ≤ (17)
22m (4δ)2
c
If δ = 2n , this becomes
1
P r(c) ≤ (18)
4c2
Thus we see that the probability of getting worse approximations falls off as we move further and further away from
the correct value.
So far I have showed you a circuit for computing the quantum Fourier transform over n qubits. But what if instead
of working with these qubits we want to treat n qubits as a register holding a number between 0 and N − 1 < 2n and
then perform the quantum Fourier transform over this vector of N amplitudes? Kitaev has given a very nice method
for approximating just such a quantum Fourier transform.
Recall that we are working on n qubits. Define the state
N −1
1 X −xy
|Φx i = √ ωN |yi (19)
N y=0
Kitaev’s procedure for this proceeds in two steps. First an ancilla register is prepared as |0i and then the transform
is enacted followed by
Notice that the inverse of the last step is the phase estimation algorithm! In other words all we need to do to
approximately produce the QFT is the first step in the transform.
How do we do this efficiently? Well first we prepare the state |Φ0 i. Then conditional on the first register we will
transform |xi ⊗ |Φ0 i = |xi ⊗ |Φx i.
Okay, so how do we prepare |Φx i? Here is a procedure for producing any state
X
|Φi = αx1 ,...,xn |x1 , . . . , xn i (23)
x1 ,...,xn ∈{0,1}
where the αx1 ,...,xn are positive real coefficients. Suppose that you measure this state in the computation basis. The
probability that you obtain 0 for the first qubit is
X
2
α0,x 2 ,...,xn
(24)
x2 ,...,xn ∈{0,1}
4
Call this α02 and similarly define α12 for the probability that we obtain 1 for the first qubit. Then the first rotation to
perform is on the first qubit and is
|0i → α0 |0i + α1 |1i (25)
What I’ve done here is only defined the rotation on the |0i basis state. Fortunately it has amplitudes whose square
sum to unity, so we can choose its action arbitrarily on |1i to make it unitary. I will use this observation repeatedly
for here on out. Now what do we do for the next qubit? The probability that the second qubit is 0 given that the
first qubit is 0 is
X
2
α0,0,x 2 ,...,xn
(26)
x3 ,...,xn ∈{0,1}
2
We can use this to define α0|0 , which stands for the probability that the second qubit is measured 0 given that the
first qubit was measured 0. In a similar fashion we can define αx2 2 |x1 which is the probability that the second qubit
was measured as x2 given that the first qubit was measured x1 . Then the next operation we need to apply is the
conditional rotation:
|x1 , 0i → |x1 i ⊗ (α0|x1 |0i + α1|x1 |1i (27)
We can carry on in a similar fashion for all n qubits. First applying the single qubit rotation, then performing a
controlled single qubit rotation, then perform a doubly controlled-single qubit rotation, etc. If we define αx2 k |x1 ,...,xk−1
as the probability of obtaining outcome xk given that we have measured x1 , . . . , xk−1 , then this allows us to define
the k − 1 qubit controlled single qubit rotation
|x1 , . . . , xk−1 , 0i → |x1 , . . . , xk−1 i ⊗ (α0|x1 ,...,xk−1 |0i + α1|x1 ,...,xk−1 |1i (28)
Why does this work? One way to see why this works is that it is guaranteed to obtain the correct probabilities for all of
the conditional probabilities for obtaining measurement outcome xk given measurement outcomes x1 , . . . , xk−1 . Since
the rotation only transform into positive real coefficients, this implies that the amplitudes for the state so produced
must match those of |Φi. A circuit for this transform will be of the form
|Ψi ...
|0i U1 • • • (29)
|Ψi
|0i U2 • •
|Ψi
|0i U3 •
.. ..
. .
|0i ··· |Ψi
Un
We can use the above construction to prepare the state |Φ0 i. How do we then perform the transform |xi|Φ0 i →
|xi|Φx i? This part is easy. We just perform a conditional phase rotation between the qubits of the two registers.
Recalling our definition of Rk ,
1 0
Rk = 2πi (30)
0 e 2k
then the circuit to do this is
• ... (31)
• ...
|xi
... •
R1 ...
|Φ0 i R2 ...
..
.
... Rn
Thus we see that we can approximately implement the QFT for any N .
5
Acknowledgments
The diagrams in these notes were typeset using Q-circuit a latex utility written by graduate student extraordinaires
Steve Flammia and Bryan Eastin.