5 Analyze quantum operations
This chapter shifts from analyzing quantum states to learning properties of quantum operations themselves. It establishes a reusable pattern for such tasks: prepare a suitable initial state, apply the target unitary (and possibly its controlled or adjoint variants) interleaved with helper gates, then measure and, when needed, repeat to collect statistics. The chapter motivates why “operations as input data” matter (for example, in phase estimation subroutines used by major algorithms) and uses small, concrete problems and implementations in Q# and Qiskit to build up practical techniques.
The first set of problems focuses on identifying unknown gates from a small set. The core idea is to choose an input state and a short gate sequence so that each candidate unitary maps the system to distinguishable (ideally orthogonal) states. Simple examples include distinguishing X from Z in one shot using the |0⟩ state, converting the “X vs H” task into “X vs Z” by sandwiching with H and using the unknown gate twice, and exposing the otherwise unobservable global phase in “X vs −X” via a controlled application and phase kickback from a |++⟩ input, read out on the control qubit. When perfect single-shot separation is impossible, the chapter advocates designing states that maximize distinguishability and using multiple repetitions. Building on these ideas, it then shows how to reconstruct a real single-qubit unitary: estimate the first column by tomography of U|0⟩, then decide between diagonal and anti-diagonal structure by applying U again to that state and discriminating the two resulting possibilities, with practical sign handling and statistical refinement.
The final and largest part develops phase estimation: given a unitary and one of its eigenstates, infer the corresponding eigenphase. After defining eigenvectors, eigenvalues, and eigenphases, the chapter introduces phase kickback as the unifying trick that transfers eigenphase information to control qubits. Three complementary algorithms are presented: iterative phase estimation (a minimal, noise-robust circuit repeated many times, yielding a cosine-squared dependence for inference), adaptive phase estimation (learns phase bits from least to most significant using powers of the unitary and conditional phase corrections), and quantum phase estimation (encodes phase across multiple controls, then applies inverse quantum Fourier transform to convert phase to amplitudes and read out the bits in one shot). The trade-offs are clear: iterative uses the simplest circuits but many shots; adaptive reduces repetitions with modest circuits; quantum phase estimation minimizes repetitions but uses deeper, more noise-sensitive circuits. Throughout, compact Q# and Qiskit implementations and tests illustrate the methods on gates such as Z, INC, and T.
To learn a property of a given unitary operation, we choose an initial state, apply one or several quantum operations, including the operation we’re analyzing or its variants, and measure the resulting state. Depending on the problem we’re solving, we might have to repeat this sequence of steps multiple times to gather statistics about the measurement outcomes, and/or vary the initial state and the unitaries applied.
To distinguish two unitaries in one experiment, we need to choose an initial state that can be converted to different orthogonal states by applying each of these two unitaries, possibly as part of a longer sequence of unitaries. We then run the experiment by preparing that initial state, applying that sequence of unitaries, and identifying which of the orthogonal states we got using measurements.
Reconstructing a single-qubit unitary from multiple experiments. We start by running a series of experiments to estimate the coefficients in the first column of the matrix, and then a second series of different experiments to figure out the relative signs of the coefficients in the second column.
An eigenvector of a unitary is a vector that is multiplied by a scalar when this unitary is applied to it. This scalar is called the eigenvalue. An eigenvalue of a unitary can only be a complex number with absolute value 1, so it can be represented as an exponent using the real-valued eigenphase.
To use the phase kickback trick for phase estimation, we need a control qubit in a superposition state (the \(\ket{+}\) state is commonly used) and a target register of qubits in the state that is an eigenvector of the unitary we’re exploring. When we apply the controlled variant of this unitary, the target register remains unchanged, but the control qubit acquires a relative phase on the basis state \(\ket{1}\). This relative phase can be analyzed to extract information about the eigenphase that corresponds to the eigenvector.
In iterative phase estimation, we come up with a fixed quantum circuit that produces measurement outcomes with probabilities that are a function of the eigenphase. The circuit starts with the qubits in a specific state, applies a controlled variant of the unitary to get the information about the eigenphase into the phase of the control qubit, and then performs a specific measurement. We run this circuit multiple times, gather enough statistics about the measurement outcomes to estimate the probabilities of measurement outcomes, and calculate the eigenphase from them.
In adaptive phase estimation, we learn the phase one binary digit at a time. We start by running a circuit that allows us to learn the least significant binary digit. After this, we use a different circuit, parts of which depend on the information we’ve discovered so far, to learn the second least significant binary digit. If there are more digits to learn, the process is repeated, with different circuits for each digit.
In quantum phase estimation algorithm, we use multiple control qubits to encode the information about the eigenphase in phases of their states. Then, we use inverse quantum Fourier transform to convert that information from phase encoding to amplitude encoding, increasing the amplitude of the basis state that encodes the eigenphase compared to the amplitudes of other states. Finally, we measure the control qubits, reading out the bits of the phase as measurement results with high probability.
Summary
- We can use measurements to learn information not only about quantum states but also about quantum operations.
- To learn a property of a given quantum operation, we use it as a part of a larger quantum experiment that chooses and prepares a certain initial state, applies a sequence of operations to it, and measures the result. After we run enough experiments, we analyze their results to extract the information we’re looking for.
- Similarly to how we can distinguish quantum states using measurements, we can figure out which of the list of possible gates we are given by applying the given gate to a carefully selected initial state and analyzing the resulting state.
- Quantum process tomography allows us to learn detailed information about an unknown unitary or a noisy process, similar to how quantum state tomography allows us to learn information about an unknown quantum state.
- Phase estimation task focuses on finding the eigenvalue and eigenphase of the given unitary that correspond to its given eigenstate. It is an important building block of many quantum algorithms, most prominently Shor’s algorithm for integer factorization, quantum counting algorithm, and HHL algorithm for solving systems of linear equations.
- The phase kickback trick relies on the fact that applying a controlled version of a unitary with the target qubit(s) in a special state can “kick” a relative phase back to the control qubit(s) instead of changing the state of the target. Phase kickback is broadly used in quantum algorithms, and all phase estimation algorithms rely on it.
- There are multiple ways to approach solving phase estimation task. In this chapter, we considered three solutions that illustrated different classes of algorithms, each of them with their own advantages and disadvantages, depending on whether they will be executed on small noisy devices or on large fault-tolerant ones.
- Iterative phase estimation algorithm constructs a very simple circuit and runs it a lot of times to estimate a function of the eigenphase. It uses the smallest circuit of all phase estimation algorithms but has to run it the most times to get a reasonable precision on the results.
- Adaptive phase estimation algorithms construct a series of different small circuits that each learn a fragment of information we’re looking for, and run them one after another, tweaking the later circuits based on the information learned from the previous ones. These algorithms use fewer circuit runs compared to the iterative algorithm, but the circuits themselves are more complicated.
- Quantum Fourier transform is a common primitive in quantum algorithms. It is used to convert information between amplitude encoding, in which the information is encoded in the absolute values of the amplitudes of the basis states, and phase encoding, in which the information is encoded in the phases of the complex numbers that represent the amplitudes.
- Quantum phase estimation algorithm runs a single circuit that encodes the information about the eigenphase in relative phases of multiple control qubits and then applies inverse quantum Fourier transform to make sure that the basis states that are the closest to the binary representation of the eigenphase have the largest amplitudes and the highest probabilities of being measured. Quantum phase estimation uses the fewest circuit runs of all phase estimation algorithms, but it requires the most qubits and the most complicated circuit.
Quantum Programming in Depth ebook for free