I'm learning about the iterative phase estimation (IPE) algorithm from the qiskit textbook. Here's a circuit I generated to implement this algorithm on a random single-qubit Hamiltonian. Instead of using the phase gate to perform time evolution as demonstrated in the textbook, I used controlled $U$ gates. From the qiskit document, the qubit $q_1$ remains in the same state $|\psi\rangle$ throughout the algorithm (here it's initialized to $|0\rangle$).

enter image description here

I don't quite understand why this should be the case, given the circuit above. I was thinking about when we perform a measurement in $q_0$, are we kind of 'projecting' the quantum state on $q_1$ onto a subspace associated with the measurement outcome? If we just look at the unitary operations on $q_1$, I still don't know why that state should be the same.

Also, should the phase corrections (controlled by the classical bits) start from the second iteration be the same for the implementation of IPE on any system? It seems like the phase we want to correct after each iteration is independent of the system we simulate, but I'm worried if there's anything else we need to take into account for a large system when we calculate the phase that needs to be corrected.

Thanks so much for the help:)


2 Answers 2


Quick answer

  1. the qubit $q_1$ remains in the same state $|\psi\rangle$ after measurement because it is not entangled with $q_0$.
  2. Yes! phase correction is the same regardless of the unitary $U$.


Assume that, $ U|\psi\rangle = e^{2 \pi i \theta}|\psi\rangle $, where $\theta$ is a fraction whose binary representation is $0.a_1a_2 \dots a_k$

Initially, the state is $|\psi\rangle|0\rangle$ (here I'm using little endian bit ordering same as Qiskit). After applying the first Hadamard gate the state becomes $\frac{1}{\sqrt{2}}(|\psi\rangle|0\rangle + |\psi\rangle|1\rangle)$. And after applying the controlled $U^{2^{k}}$ the state becomes $$\frac{1}{\sqrt{2}}(|\psi\rangle|0\rangle + U^{2^{k}}|\psi\rangle|1\rangle) = \frac{1}{\sqrt{2}}(|\psi\rangle|0\rangle + e^{2\pi i 2^{k}\theta}|\psi\rangle|1\rangle) = \frac{1}{\sqrt{2}}|\psi\rangle(|0\rangle + e^{2\pi i 2^{k}\theta}|1\rangle) $$ Based on the assumed binary representation of $\theta$, the fraction part of $2^{k}\theta$ equals $0.a_k$. Hence, $e^{2\pi i 2^{k}\theta} = e^{\pi ia_k} = (-1)^{a_k}$ (because $a_k$ equals $0$ or $1$).

So, the state equals $\frac{1}{\sqrt{2}}|\psi\rangle(|0\rangle + (-1)^{a_k} |1\rangle)$ which becomes $|\psi\rangle|a_k\rangle$ after applying the second Hadamard.

When measuring the first qubit we get $a_k$ and the second qubit remains in its initial state $|\psi\rangle$.

The purpose of phase correction step is to remove the bits we already know from $\theta$. After $m$ iterations we know the values of $a_k, a_{k-1}, \dots, a_{k-m+1}$. To remove these bits, we add a relative phase of $e^{-2 \pi i 0.00\dots0a_{k-m+1}\dots a_{k-1}a_k}$ so that when applying the controlled $U$ operations the phase becomes $e^{2 \pi i 0.a_1a_2\dots0a_{k-m}}$ then we can do the same steps as before to get the value of $a_{k-m}$.

And so on until we get all the bits in $\theta$.

  • $\begingroup$ Thanks so much, that really helps :) $\endgroup$
    – IGY
    Feb 20, 2022 at 19:02

Your $q0$ is the sum of 2 terms - 1 that makes phase rotation (the $|1>$ term) and 1 that not (the $|0>$ term). When acting on $q1$ it is kickbacking the phase that $q1$ made, to the $|1>$ part of $q0$ which is is equivalent to the fact that $q1$ left the same.

You can see it very clearly:





So virtually you can see that $q1$ did not change. You are using him just to create a phase ratio between the $|0>$ and the $|1>$. When you are looking at the subspace of $q1$, it only gets a global phase, which is not affecting it. This is why you must have a controlled version of $U$ because you can't measure things that happen with global phase, only things that change the phase between 0 and 1.

It seems that the phase correction, at every start of the iteration, depends only on $m$ which is the number of iterations, which is determined by the required accuracy of measurement. For $q1$ with more qubits, there is no reason to change the correction.

  • 1
    $\begingroup$ Thank you so much for the answer! $\endgroup$
    – IGY
    Feb 20, 2022 at 19:02
  • $\begingroup$ You are more than welcome! Feel free to click the bounty button next to my answer 😉 $\endgroup$
    – Ron Cohen
    Feb 21, 2022 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.