0% found this document useful (0 votes)
17 views6 pages

Quic03 Phase Estimation

phase estimation

Uploaded by

Pushkar Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Quic03 Phase Estimation

phase estimation

Uploaded by

Pushkar Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

QuIC Seminar 4

The Phase Estimation Algorithm

Contents
4.1 Why “Phase Estimation?” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 Action of Controlling an Operator on its Eigenstate . . . . . . . . . . . . . . . . 28
4.3 Controlling Higher Powers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4 General Phase Estimation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.5 Closing Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

The phase estimation algorithm is used to determine the eigenvalues of a unitary operator. Convention-
ally, it is presented after the quantum Fourier Transform (QFT), a subroutine used in phase estimation.
Our presentation will use one result from the QFT, which we will derive in a future seminar. The QFT
is interesting in that it can perform a basis transformation analogous to a Fourier transform exponentially
faster than the best known classical algorithm. We will discuss this result more in the second semester when
we introduce (quantum) computational complexity.
For now we want to provide an introduction to the utility of quantum algorithms, which is why we focus
on the phase estimation algorithm first. Computing eigenvalues has an enormous number of applications in
an enormous number of fields. As such, the phase estimation algorithm is used in a large number of other
quantum algorithms from solving linear systems of equations in linear algebra (search for the HHL algorithm)
to minimizing the number of features required in machine learning applications (search for quantum principal
component analysis).

4.1 Why “Phase Estimation?”


Let’s ponder the name of “phase estimation” as we introduce some background notation. The meaning will
shortly become clear.
First, we’re concerned with an eigenvalue problem, namely an equation of the form

Ax = λx (4.1)
where A ∈ C 2m ×2m
, x ∈ C , and λ ∈ C. Note that we write the dimension as 2 for convenience, since
2m m

m qubits imply a state space of size 2m as we have previously seen. (We’re using m instead of the standard
n because we’ll introduce another n qubits later in the algorithm.)
In the quantum case, we’re only going to be concerned with unitary operators, which we normally write
as U . Since these operators satisfy U † U = I, any eigenvalue has magnitude one.

Exercise 32: Let λ be an eigenvalue of a unitary matrix U . Prove that |λ| = 1.

27
QUIC SEMINAR 4. THE PHASE ESTIMATION ALGORITHM 28

Solution 5: Since U |x⟩ = λ|x⟩, we have ⟨x|λ∗ λ|x⟩ = ⟨x|U † U |x⟩, hence |λ|2 ⟨x|x⟩ = ⟨x|x⟩, from which
the result follows immediately. (Recall eigenvectors are nonzero by definition.)
Since |λ| = 1, we can write it without loss of generality as

λ = e2πiϕ (4.2)
where 0 ≤ ϕ ≤ 1 is called the phase. Hence the term “phase” in “phase estimation.” The term “estimation”
comes about not from the fact that quantum computation is probabilistic, but rather in the degree of precision
that we are going to compute, or estimate, the phase to. The most general case of phase estimation is when
the phase cannot be written exactly using n bits of precision. In this lecture, we’ll only cover the case where
ϕ can be written exactly using n bits.
Before we going about estimating the phase, let’s introduce some useful notation that is common in
quantum algorithms. The phase ϕ is going to be between zero and one, so we can write it as a decimal in
binary notation as follows:

ϕ = 0.ϕ1 ϕ2 · · · ϕn (4.3)
where each ϕi is either zero or one. What does this mean exactly? The same thing we mean when we
always write decimals, except here we’re using binary notation.

Definition 4.1 (Binary decimal notation.). The expression ϕ = 0.ϕ1 ϕ2 · · · ϕn is equivalent to


n

ϕ = 0.ϕ1 ϕ2 · · · ϕn ⇐⇒ ϕ = ϕk 2−k . (4.4)
k=1

Example 1: Some numbers as binary decimals.


The number 0.5 in decimal is 0.1 in binary, since 0.1 ≡ (1) · 2−1 = 1/2 = 0.5. Note that 0.1 is the same
as 0.100000....
The number 0.75 in decimal is 0.11 in binary, since 0.11 ≡ (1) · 2−1 + 1 · 2−2 = 1/2 + 1/4 = 3/4 = 0.75.

Exercise 33: What is the value of the infinitely repeating binary decimal 0.1111111...?
(If it needed to be proved, the above exercise proves that 0 ≤ 0.ϕ1 ϕ2 · · · ≤ 1.)

4.2 Action of Controlling an Operator on its Eigenstate


The key to understanding the phase estimation algorithm is what happens in the following circuit.

|0⟩ H •

0
|ψ⟩ U2

Figure 4.1: Action of a controlled-U 2 operation on the plus state for k = 0.


k

Here we let U be a unitary operator and |ψ⟩ an eigenstate1 with eigenvalue λ = e2πi0.ϕ1 . We first perform
a Hadamard gate on the first qubit to get the state

|+⟩ ⊗ |ψ⟩ = |0⟩|ψ⟩ + |1⟩|ψ⟩ (4.5)


1 Why are we starting with an eigenstate? Doesn’t this defeat the whole purpose? After all, we could just do U |ψ⟩ and see

what it’s effect was. Answer: here, we’re just using the eigenstate for pedagogical purposes. As we’ll see, the general phase
estimation algorithm does not require this.

28
QUIC SEMINAR 4. THE PHASE ESTIMATION ALGORITHM 29

|0⟩ H • H ✌✌✌

|0⟩ H X

Figure 4.2: Example of using the phase estimation algorithm to compute the eigenvalues of Pauli-X.


where we have intentionally omitted the normalization factor of 1/ 2 for clarity2 . We then perform a
controlled U operation, which we have written as U 2 for reasons that will become clear shortly. The action
0

of this gate is to produce the new state

|0⟩|ψ⟩ + |1⟩U |ψ⟩ = |0⟩|ψ⟩ + e2πi0.ϕ1 |1⟩|ψ⟩ (4.6)

= (|0⟩ + e2πi0.ϕ1 |1⟩) ⊗ |ψ⟩. (4.7)

Note what happened: The second qubit register containing |ψ⟩ hasn’t changed. We shouldn’t expect it
to, since |ψ⟩ is an eigenstate of U . Thus, no matter how many times we apply U to this register, nothing
happens to |ψ⟩.
That’s rather odd though—what’s the point of applying U then? The effect was that it wrote some
information about the eigenvalue into the relative phase of the first qubit. Namely, the entire effect was to
map
|0⟩ + |1⟩ 7→ |0⟩ + e2πi0.ϕ1 |1⟩ (4.8)
How can we read out this information from the quantum state? Consider the effect of applying another
Hadamard transformation on the first qubit, which will produce

H(|0⟩ + e2πi0.ϕ1 |1⟩) = (1 + e2πi0.ϕ1 )|0⟩ + (1 − e2πi0.ϕ1 )|1⟩. (4.9)


where we have again ignored the normalization factor of 1/2.

Exercise 34: Verify (4.9).


Now, ϕ1 can only be zero or one. In the case that ϕ1 = 0, e2πi0.ϕ1 = 1, hence the state is exactly |0⟩.

Exercise 35: Prove that the RHS of (4.9) becomes exactly |1⟩ up to global phase. (Recall again that
(4.9) omits the normalization factor of 1/2.)
Thus, we measure with certainty (i.e., not probabilistically) a state that tells us exactly what the phase,
and hence the eigenvalue, is.
Example 2: Phase estimation on Pauli-X.
First, prove that the eigenvalues of X are −1 and 1 with eigenvectors |−⟩ and |+⟩ respectively.
Now, let’s see how we can do this using the phase estimation algorithm. The first thing we need to do
is prepare an eigenstate, which we can do by performing the Hadamard gate on the |0⟩ state in the second
register to get the plus state. Then, we control on the first qubit in uniform superposition to implement
a controlled-X gate, otherwise known as CNOT. Finally, we implement H again on the top qubit, then
measure. The complete circuit for this state is shown in Fig. 4.2.
The complete state after applying both Hadamard gates to both qubits is given by the uniform super-
position
|+⟩ ⊗ |+⟩ = |00⟩ + |01⟩ + |10⟩ + |11⟩. (4.10)
Note that this state remains unchanged under the CNOT. After performing the second Hadamard on the
top qubit, the top qubit is in the state |0⟩. Hence, measurement always returns the outcome ϕ1 = 0, and
so we conclude that the corresponding eigenvalue is λ = e2πi·0 = 1, as we must.

29
QUIC SEMINAR 4. THE PHASE ESTIMATION ALGORITHM 30

Exercise 36: Repeat the above example but for the |−⟩ eigenstate and verify that measuring the top
qubit always yields ϕ1 = 1, thus λ = −1. (Hint: How can the circuit in Fig. 4.2 be modified to produce the
|−⟩ state?)

4.3 Controlling Higher Powers


The key idea of the phase estimation algorithm is to keep applying the same controlled-U operations, but at
successively higher powers of two. The final algorithm introduces n qubits in the top register and implements
C(U 2 ) between the kth qubit and the bottom register. Let’s build up to this with one more example where
k

n = 2.
The complete circuit for the n = 2 case is shown below. (Note that, although we’re only writing one
wire for the bottom register, this really consists of m qubits. That is, |ψ⟩ is an m-qubit state and U is an
m-qubit unitary.)

|0⟩ H •

|0⟩ H •

0 1
|ψ⟩ U2 U2

Figure 4.3: Phase estimation for n = 2 qubits in the top register.

We’ve already computed what the first control does to the top register. The wavefunction at this point
in the circuit is
(|0⟩ + e2πi0.ϕ1 ϕ2 |1⟩ ⊗ (|0⟩ + |1⟩) ⊗ |ψ⟩. (4.11)
Note that the relative phase in the first qubit now has two digits because we assumed that ϕ = 0.ϕ1 ϕ2
consists of two digits.
The same exact operation now happens on the second qubit, except for one key difference: the power of
U . In particular, U is now squared. What effect does this have?

Exercise 37: Verify that


U 2 |ψ⟩ = e2πi(2ϕ) |ψ⟩ (4.12)
by applying the unitary twice to the eigenstate.
Note an interesting thing from (4.12), namely that

2ϕ = 2 · 0.ϕ1 ϕ2 = 2(ϕ1 2−1 + ϕ2 2−2 ) = ϕ1 + 2ϕ2 2−1 = ϕ1 .ϕ2 . (4.13)

The effect is that the decimal moves one place to the right. (This should not be too surprising based
on common arithmetic in base ten.) What’s interesting and convenient, however, is what happens in the
exponent:
e2πi(2ϕ) = e2πi(ϕ1 +0.ϕ2 ) = e2πiϕ1 e2πi0.ϕ2 = e2πi0.ϕ2 . (4.14)
The last inequality follows because ϕ1 is an integer and so the exponential is unity.

Exercise 38: Prove the general case that

(4.15)
k
e2πi(2 ϕ)
= e2πi0.ϕk ϕk+1 ··· .

Thus, we have proven that the state after applying the C(U 2 ) to the wavefunction (4.11) is
2 This is a common, though probably not great, convention that many authors follow.

30
QUIC SEMINAR 4. THE PHASE ESTIMATION ALGORITHM 31

(|0⟩ + e2πi0.ϕ1 ϕ2 |1⟩ ⊗ (|0⟩ + e2πi0.ϕ2 |1⟩) ⊗ |ψ⟩. (4.16)


How do we read out this information? This time it’s not so easy as a simple Hadamard transform. The
missing ingredient is what we said we were going to assume was true in the introduction: the quantum
Fourier transform. In particular, the key fact that we’ll be using is the following:

Definition 4.2 (Quantum Fourier transform action.). The quantum Fourier transform is a unitary change
of basis with the following effect:

QFT (|ϕ1 ⟩|ϕ2 ⟩ · · · |ϕn ⟩) = 2−n/2 (|0⟩ + e2πi0.ϕ1 |1⟩) ⊗ (|0⟩ + e2πi0.ϕ1 ϕ2 |1⟩) ⊗ · · · ⊗ (|0⟩ + e2πi0.ϕ1 ϕ2 ···ϕn |1⟩).
(4.17)

The state on the right looks exactly like what we end up with from phase estimation! (Except with
the order of the bits reversed, but this is not problem.) So, what we need to apply then to read out the
information is the inverse Fourier transform QFT† . (The QFT is unitary, as every quantum algorithm must
be, therefore it has an inverse).
Thus, if we apply QFT† to the state in (4.16), we get a product state containing the information we want
about the phase:

QFT† (|0⟩ + e2πi0.ϕ1 ϕ2 |1⟩ ⊗ (|0⟩ + e2πi0.ϕ2 |1⟩) ⊗ |ψ⟩ = |ϕ2 ⟩ ⊗ |ϕ1 ⟩ ⊗ |ψ⟩. (4.18)

4.4 General Phase Estimation Algorithm


We now present the general n-qubit case for the phase estimation algorithm. The circuit follows immediately
from our work in the previous two sections:

|0⟩ H • ✌✌✌

|0⟩ H • ✌✌✌
.. QFT† ..
. .
|0⟩ H • ✌✌✌
n
|ψ⟩ U2
0
U2
1
··· U2

Figure 4.4: Full algorithm for quantum phase estimation. If the phase ϕ can be written exactly in n bits,
this circuit computes ϕ exactly. If it requires more bits, this circuit computes a “good” approximation to ϕ.

The general calculation is also an immediate generalization of our previous work. Namely, the action of
the circuit, ignoring the |ψ⟩ register that never changes, is

1
|0⟩⊗n 7−→ (|0⟩ + |1⟩) ⊗ (|0⟩ + |1⟩) ⊗ · · · ⊗ (|0⟩ + |1⟩) (after the Hadamards)
2n/2
1
7−→ (|0⟩ + e2πi0.ϕ1 ϕ2 ···ϕn |1⟩) ⊗ (|0⟩ + e2πi0.ϕ2 ϕ3 ···ϕn |1⟩) ⊗ · · · ⊗ (|0⟩ + e2πi0.ϕn |1⟩) (after the C(U )’s)
2n/2

7−→ |ϕn ⟩ ⊗ |ϕn−1 ⟩ ⊗ · · · ⊗ |ϕ1 ⟩ (after the QFT† ).

By measuring the final state, we obtain a description of the phase, and hence the eigenvalue, exactly.

31
QUIC SEMINAR 4. THE PHASE ESTIMATION ALGORITHM 32

|0� H • H

|ψ� Q

Figure 4.5: Hadamard test algorithm. This circuit can be used to compute Re [⟨ψ|Q|ψ⟩] as described in
Example 4.5.

Exercise 39: Prove that the phase estimation algorithm works even if we don’t know an eigenstate |u⟩
of U by inputting an arbitrary state |ψ⟩ and writing it as a linear combination of the eigenstates of U ,

|ψ⟩ = cu |u⟩. (4.19)
u

4.5 Closing Remarks


Throughout, we have assumed implicitly that ϕ can be written exactly with n bits. The case where ϕ
is irrational (requires infinitely many bits) is a bit more subtle and requires more work. For a complete
discussion, we refer the reader to Nielsen and Chuang Section Chapter 5.
Example 3: The Hadamard test.
The Hadamard test is an algorithm for computing the expectation value of an operator that is similar to
the phase estimation algorithm. Let |ψ⟩ be a state on m qubits and Q a unitary operator on m qubits,
and consider the algorithm described by Fig. 4.5. The action of this circuit is

|0⟩|ψ⟩ 7−→ |0⟩|ψ⟩ + |1⟩|ψ⟩ (first Hadamard)

7−→ |0⟩|ψ⟩ + |1⟩Q|ψ⟩ (controlled Q)

7−→ |0⟩|ψ⟩ + |1⟩|ψ⟩ + |0⟩Q|ψ⟩ − |1⟩Q|ψ⟩ (second Hadamard)

= |0⟩(I + Q)|ψ⟩ + |1⟩(I − Q)|ψ⟩.



Putting in the omitted factor of 1/2 (each Hadamard contributes 1/ 2), the probability of measuring
zero on the first qubit is
1 1
p(0) = ⟨ψ|(I + Q)† (I + Q)|ψ⟩ = ⟨ψ|I + Q + Q† + Q† Q|ψ⟩. (4.20)
4 4
Similarly, the probability of measuring one on the first qubit is
1 1
p(1) = ⟨ψ|(I − Q)† (I − Q)|ψ⟩ = ⟨ψ|I − Q − Q† + Q† Q|ψ⟩. (4.21)
4 4
Subtracting these yields
1
p(0) − p(1) = ⟨ψ|Q + Q† |ψ >= Re [⟨ψ|Q|ψ⟩], (4.22)
2
since if z = a + bi, z + z ∗ = (a + bi) + (a − bi) = 2a = 2Re a.

Exercise 40: Prove that implementing an S gate before the final Hadmard on the first qubit allows
one to compute the imaginary part of the expectation value Im [⟨ψ|Q|ψ⟩]. Recall, S|0⟩ = |0⟩ and S|1⟩ = i|1⟩.

32

You might also like