liveBook · Manning

Inversion operator

As explained in Building Quantum Software with Python

An inversion operator is a quantum transformation that reflects amplitudes about their average value, equivalently the inversion-by-the-mean operation used in Grover search.

The inversion operator is the amplitude-reflection step in Grover search. After a quantum oracle tags good outcomes by multiplying their amplitudes by −1, inversion increases the magnitudes of tagged outcomes and decreases those of untagged outcomes. Repeating oracle plus inversion raises the probability of measuring a desired result. section 6.0 section 6.3

Geometrically, inversion reflects the current state vector relative to the state used as the reference. For each outcome k, compute the inner product of the original and current state vectors, multiply it by original[k], then reflect current[k] about that point. The inner product is a complex similarity measure whose magnitude is at most 1. section 6.1.3

Figure 6.8 The value new [k] is the inversion of current [k] around the point ⟨original,current⟩original[k].
figure

This vector view shows the per-amplitude reflection: new[k] is the mirror image of current[k] around ⟨original,current⟩original[k]. section 6.1.3

Uniform three-qubit state

Start with eight equal amplitudes, save that state as the reference, and let an oracle tag outcome 3. For this equal-superposition setup, the reflection can be expressed as `state[k] = 2*amplitude_mean - state[k]`. The tagged amplitude grows after inversion, while the other amplitudes are reduced. section 6.1.3

With state preparation operator A, the same reflection can be implemented as M = AM0A−1. First apply A−1 to return to the computational basis, apply M0, then apply A again. In the circuit-oriented form, an efficient sign-flip variant of M0 changes the amplitude of outcome 0 while leaving the others unchanged; this choice preserves Grover-iteration outcome probabilities. section 6.1.5 section 6.2.2

Figure 6.22 Circuit diagram for the magnitude amplification procedure GjA, where the operator g consists of an oracle O and the inversion operator M = AM0A–1
figure

The circuit diagram places inversion as AM0A−1 inside magnitude amplification, following the oracle within each Grover iterate. section 6.1.5

The reusable pattern is a Grover iterate: apply oracle O, then inversion M, and repeat. If A prepares the starting state, the overall amplification procedure has the form GjA. Each iteration changes the combined probabilities of good and bad outcomes, so the iteration count matters. section 6.1.4

How Building Quantum Software with Python covers it

How deep it goes
Explains geometric reflection, classical state-vector code, AM0A−1 decomposition, and quantum-circuit construction.
Examples
Uses equal-superposition and random three-qubit states with single tagged outcomes 3 or 5.
What it assumes
Assumes quantum oracles and state vectors while explaining inversion through vectors, amplitudes, and inner products.
What you can do after
Build it from scratch as classical amplitude reflection and as an AM0A−1 quantum circuit.
How it connects
Connects inversion to quantum oracles, inner products, state preparation, amplitude amplification, and Grover’s algorithm.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.