Quantum phase estimation algorithm

From HandWiki
Short description: Quantum algorithm for eigenvalue estimation

In quantum computing, the quantum phase estimation algorithm is a quantum algorithm to estimate the phase corresponding to an eigenvalue of a given unitary operator. Because the eigenvalues of a unitary operator always have unit modulus, they are characterized by their phase, and therefore the algorithm can be equivalently described as retrieving either the phase or the eigenvalue itself. The algorithm was initially introduced by Alexei Kitaev in 1995.[1][2]:246

Phase estimation is frequently used as a subroutine in other quantum algorithms, such as Shor's algorithm,[2]:131 the quantum algorithm for linear systems of equations, and the quantum counting algorithm.

Formal description of the problem

Let [math]\displaystyle{ U }[/math] be a unitary operator acting on an [math]\displaystyle{ m }[/math]-qubit register. Unitarity implies that all the eigenvalues of [math]\displaystyle{ U }[/math] have unit modulus, and can therefore be characterized by their phase. Thus if [math]\displaystyle{ | \psi \rangle }[/math] is an eigenvector of [math]\displaystyle{ U }[/math], then [math]\displaystyle{ U| \psi\rangle = e^{ 2\pi i \theta}\left|\psi \right\rangle }[/math] for some [math]\displaystyle{ \theta\in\mathbb{R} }[/math]. Due to the periodicity of the complex exponential, we can always assume [math]\displaystyle{ 0 \leq \theta \lt 1 }[/math].

Our goal is to find a good approximation to [math]\displaystyle{ \theta }[/math] with a small number of gates and with high probability. The quantum phase estimation algorithm achieves this under the assumptions of having oracular access to [math]\displaystyle{ U }[/math], and having [math]\displaystyle{ |\psi\rangle }[/math] available as a quantum state.

More precisely, the algorithm returns an approximation for [math]\displaystyle{ \theta }[/math], with high probability within additive error [math]\displaystyle{ \varepsilon }[/math], using [math]\displaystyle{ O(\log(1/\varepsilon)) }[/math] qubits (without counting the ones used to encode the eigenvector state) and [math]\displaystyle{ O(1/\varepsilon) }[/math] controlled-U operations. Furthermore, we can improve the success probability to [math]\displaystyle{ 1-\Delta }[/math] for any [math]\displaystyle{ \Delta\gt 0 }[/math] by using a total of [math]\displaystyle{ O(\log(1/\Delta)/\varepsilon) }[/math] uses of controlled-U, and this is optimal.[3]

The algorithm

The circuit for quantum phase estimation.


The input consists of two registers (namely, two parts): the upper [math]\displaystyle{ n }[/math] qubits comprise the first register, and the lower [math]\displaystyle{ m }[/math] qubits are the second register.

The initial state of the system is:

[math]\displaystyle{ |0\rangle^{\otimes n}|\psi\rangle . }[/math]

After applying n-bit Hadamard gate operation [math]\displaystyle{ H^{\otimes n} }[/math] on the first register, the state becomes:

[math]\displaystyle{ \frac{1}{2^{\frac{n}{2}}}(|0\rangle + |1\rangle)^{\otimes n}|\psi\rangle = \frac{1}{2^{n/2}} \sum_{j = 0}^{2^n - 1} |j\rangle |\psi\rangle }[/math].

Let [math]\displaystyle{ U }[/math] be a unitary operator with eigenvector [math]\displaystyle{ |\psi\rangle }[/math] such that [math]\displaystyle{ U| \psi \rangle = e^{ 2\pi i \theta}|\psi \rangle }[/math]. Thus,

[math]\displaystyle{ U^{2^{j}}| \psi\rangle = e^{ 2\pi i 2^{j}\theta}|\psi \rangle }[/math].

Overall, the transformation implemented on the two registers by the controlled gates applying [math]\displaystyle{ U, U^{2}, U^{2^2}, \ldots, U^{2^{n - 1}} }[/math] is[math]\displaystyle{ |k\rangle|\psi\rangle \mapsto |k\rangle U^{k}|\psi\rangle }[/math]This can be seen by the decomposition of [math]\displaystyle{ k }[/math] into its bitstring [math]\displaystyle{ k_{n - 1}k_{n - 2}\ldots k_1 k_0 }[/math] and binary representation [math]\displaystyle{ 2^{n - 1}k_{n - 1} + 2^{n - 2}k_{n - 2} + \ldots + 2 k_1 + k_0 }[/math], where [math]\displaystyle{ k_{n - 1}, \ldots, k_1, k_0 \in \{0, 1\} }[/math]. Clearly, [math]\displaystyle{ U^k }[/math] becomes[math]\displaystyle{ U^{2^{n - 1}k_{n - 1} + \ldots + 2^2 k_2 + 2 k_1 + k_0} = U^{2^{n - 1}k_{n - 1}}\ldots U^{2^2 k_2} U^{2 k_1} U^{k_0} }[/math]Each [math]\displaystyle{ U^{2^{j}k_j} }[/math] will only apply if the qubit [math]\displaystyle{ k_j }[/math] is [math]\displaystyle{ 1 }[/math], implying that it is controlled by that bit. Therefore the overall transformation to [math]\displaystyle{ |k\rangle U^k |\psi\rangle }[/math] is equivalent to the controlled [math]\displaystyle{ U^{2^j} }[/math] gates from each [math]\displaystyle{ j }[/math]-th qubit.

Therefore, the state will be transformed by the controlled [math]\displaystyle{ U^{2^j} }[/math] gates like so:[math]\displaystyle{ \frac{1}{\sqrt{2^n}} \sum_{j = 0}^{2^n - 1} |j\rangle |\psi\rangle \mapsto \frac{1}{\sqrt{2^n}} \sum_{j = 0}^{2^n - 1} e^{2\pi i j \theta}|j\rangle|\psi\rangle }[/math]At this point, the second register with the eigenvector is not needed. It can be reused again in another run of phase estimation. The state without [math]\displaystyle{ |\psi\rangle }[/math] is

[math]\displaystyle{ \frac{1}{\sqrt{2^n}} \sum_{j = 0}^{2^n - 1} e^{2\pi i j \theta}|j\rangle }[/math]

Apply inverse quantum Fourier transform

Applying the inverse quantum Fourier transform on

[math]\displaystyle{ \frac{1}{2^{\frac{n}{2}}}\sum_{k=0}^{2^n - 1} e^{2\pi i \theta k} |k\rangle }[/math]


[math]\displaystyle{ \frac{1}{2^{\frac{n}{2}}}\sum_{k=0}^{2^n - 1} e^{2\pi i \theta k} \left( \frac{1}{2^{\frac{n}{2}}}\sum_{x=0}^{2^n - 1} e^{\frac{-2\pi i kx}{2^n}}|x\rangle \right) = \frac{1}{2^{n}}\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1}e^{-\frac{2\pi i k}{2^n} \left ( x - 2^n \theta \right )} |x\rangle. }[/math]

We can approximate the value of [math]\displaystyle{ \theta \in [0, 1] }[/math] by rounding [math]\displaystyle{ 2^n \theta }[/math] to the nearest integer. This means that [math]\displaystyle{ 2^n \theta = a + 2^n \delta, }[/math] where [math]\displaystyle{ a }[/math] is the nearest integer to [math]\displaystyle{ 2^n \theta, }[/math] and the difference [math]\displaystyle{ 2^n\delta }[/math] satisfies [math]\displaystyle{ 0 \leqslant |2^n\delta| \leqslant \tfrac{1}{2} }[/math].

Using this decomposition we can rewrite the state as [math]\displaystyle{ \sum_{x=0}^{2^n-1} c_x |x\rangle, }[/math] where

[math]\displaystyle{ c_x \equiv \frac{1}{2^n} \sum_{k=0}^{2^n-1} e^{-\frac{2\pi ik}{2^n}(x-2^n \theta) } = \frac{1}{2^{n}} \sum_{k=0}^{2^n - 1} e^{-\frac{2\pi i k}{2^n} \left ( x-a \right )} e^{2 \pi i \delta k}. }[/math]


Performing a measurement in the computational basis on the first register yields the outcome [math]\displaystyle{ |y\rangle }[/math] with probability[math]\displaystyle{ \Pr(y) = |c_y|^2 = \left| \frac{1}{2^{n}} \sum_{k=0}^{2^n-1} e^{\frac{-2\pi i k}{2^n}(y-a)} e^{2 \pi i \delta k} \right |^2. }[/math]It follows that [math]\displaystyle{ \operatorname{Pr}(a)=1 }[/math] if [math]\displaystyle{ \delta=0 }[/math], that is, when [math]\displaystyle{ \theta }[/math] can be written as [math]\displaystyle{ \theta=a/2^n }[/math], one always finds the outcome [math]\displaystyle{ y=a }[/math]. On the other hand, if [math]\displaystyle{ \delta\neq0 }[/math], the probability reads[math]\displaystyle{ \operatorname{Pr}(a)=\frac{1}{2^{2n}} \left | \sum_{k=0}^{2^n-1} e^{2 \pi i \delta k} \right |^2 = \frac{1}{2^{2n}} \left | \frac{1- {e^{2 \pi i 2^n \delta}}}{1-{e^{2 \pi i \delta}}} \right|^2. }[/math]From this expression we can see that [math]\displaystyle{ \Pr(a) \geqslant \frac{4}{\pi^2} \approx 0.405 }[/math] when [math]\displaystyle{ \delta\neq0 }[/math]. To see this, we observe that from the definition of [math]\displaystyle{ \delta }[/math] we have the inequality [math]\displaystyle{ |\delta| \leqslant \tfrac{1}{2^{n+1}} }[/math], and thus:[4]:157[5]:348[math]\displaystyle{ \begin{align} \Pr(a) &= \frac{1}{2^{2n}} \left | \frac{1- {e^{2 \pi i 2^n \delta}}}{1-{e^{2 \pi i \delta}}} \right |^2 && \text{for } \delta \neq 0 \\ [6pt] &= \frac{1}{2^{2n}} \left | \frac{2 \sin \left ( \pi 2^n \delta\right)}{ 2\sin( \pi \delta)} \right |^2 && \left| 1-e^{2ix}\right|^2 = 4\left| \sin (x)\right|^2 \\ [6pt] &= \frac{1}{2^{2n}} \frac {\left | \sin\left(\pi 2^n \delta\right) \right |^2}{| \sin( \pi \delta) |^2} \\ [6pt] &\geqslant \frac{1}{2^{2n}} \frac {\left | \sin\left(\pi 2^n \delta\right) \right |^2}{| \pi \delta |^2} && | \sin(\pi \delta) | \leqslant | \pi \delta | \\ [6pt] &\geqslant \frac{1}{2^{2n}} \frac {|2 \cdot 2^n \delta|^2}{| \pi \delta |^2} && | 2\cdot2^n \delta | \leqslant | \sin(\pi 2^n\delta) | \text{ for } |\delta| \leqslant \frac{1}{2^{n+1}} \\ [6pt] &\geqslant \frac {4}{\pi^2} .\end{align} }[/math]

We conclude that the algorithm provides the best [math]\displaystyle{ n }[/math]-bit estimate (i.e., one that is within [math]\displaystyle{ 1/2^n }[/math] of the correct answer) of [math]\displaystyle{ \theta }[/math] with probability at least [math]\displaystyle{ 4/\pi^2 }[/math]. By adding a number of extra qubits on the order of [math]\displaystyle{ O(\log(1/\epsilon)) }[/math] and truncating the extra qubits the probability can increase to [math]\displaystyle{ 1 - \epsilon }[/math].[5]

Toy examples

Consider the simplest possible instance of the algorithm, where only [math]\displaystyle{ n=1 }[/math] qubit, on top of the qubits required to encode [math]\displaystyle{ |\psi\rangle }[/math], is involved. Suppose the eigenvalue of [math]\displaystyle{ |\psi\rangle }[/math] reads [math]\displaystyle{ \lambda=e^{2\pi i \theta} }[/math]. The first part of the algorithm generates the one-qubit state [math]\displaystyle{ |\phi\rangle\equiv \frac{1}{\sqrt2}(|0\rangle+\lambda |1\rangle) }[/math]. Applying the inverse QFT amounts in this case to applying a Hadamard gate. The final outcome probabilities are thus [math]\displaystyle{ p_\pm = |\langle\pm|\phi\rangle|^2 }[/math] where [math]\displaystyle{ |\pm\rangle\equiv\frac{1}{\sqrt2}(|0\rangle\pm|1\rangle) }[/math], or more explicitly,[math]\displaystyle{ p_\pm = \frac{|1\pm\lambda|^2}{4} =\frac{1 \pm \cos(2\pi \theta)}{2}. }[/math]Suppose [math]\displaystyle{ \lambda=1 }[/math], meaning [math]\displaystyle{ |\phi\rangle=|+\rangle }[/math]. Then [math]\displaystyle{ p_+=1 }[/math], [math]\displaystyle{ p_-=0 }[/math], and we recover deterministically the precise value of [math]\displaystyle{ \lambda }[/math] from the measurement outcomes. The same applies if [math]\displaystyle{ \lambda=-1 }[/math].

If on the other hand [math]\displaystyle{ \lambda=e^{2\pi i/3} }[/math], then [math]\displaystyle{ p_\pm = [1 \pm \cos(2\pi/3)]/2 }[/math], that is, [math]\displaystyle{ p_+=1/4 }[/math] and [math]\displaystyle{ p_-=3/4 }[/math]. In this case the result is not deterministic, but we still find the outcome [math]\displaystyle{ |-\rangle }[/math] as more likely, compatibly with the fact that [math]\displaystyle{ 2/3 }[/math] is close to 1 than to 0.

More generally, if [math]\displaystyle{ \lambda=e^{2\pi i\theta} }[/math], then [math]\displaystyle{ p_+\ge 1/2 }[/math] if and only if [math]\displaystyle{ |\theta|\le 1/4 }[/math]. This is consistent with the results above because in the cases [math]\displaystyle{ \lambda=\pm1 }[/math], corresponding to [math]\displaystyle{ \theta=0,1/2 }[/math], the phase is retrieved deterministically, and the other phases are retrieved with higher accuracy the closer they are to these two.

See also


  1. Kitaev, A. Yu (1995-11-20). "Quantum measurements and the Abelian Stabilizer Problem". arXiv:quant-ph/9511026.
  2. 2.0 2.1 Nielsen, Michael A. & Isaac L. Chuang (2001). Quantum computation and quantum information (Repr. ed.). Cambridge [u.a.]: Cambridge Univ. Press. ISBN 978-0521635035. 
  3. Mande, Nikhil S.; Ronald de Wolf (2023). "Tight Bounds for Quantum Phase Estimation and Related Problems". arXiv:2305.04908 [quant-ph].
  4. Benenti, Guiliano; Casati, Giulio; Strini, Giuliano (2004). Principles of quantum computation and information (Reprinted. ed.). New Jersey [u.a.]: World Scientific. ISBN 978-9812388582. 
  5. 5.0 5.1 Cleve, R.; Ekert, A.; Macchiavello, C.; Mosca, M. (8 January 1998). "Quantum algorithms revisited". Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 454 (1969): 339–354. doi:10.1098/rspa.1998.0164. Bibcode1998RSPSA.454..339C.