smartyfy.mrindigi.com

Quantum Computing Master Course — 083. Grover Rotation Analysis

Lesson 083: Grover Rotation Analysis

Smartyfy Quantum Computing Master Course

Prerequisites and objectives

The two Grover reflections preserve a two-dimensional subspace when the initial state is uniform. This makes the success probability exactly calculable. You will derive the rotation matrix, choose an iteration count near its first success peak, and see why additional iterations can undo an improvement.

Assume 0<K<N. Define |g⟩ as the normalized uniform superposition of the K marked labels and |b⟩ as the normalized uniform superposition of the N−K unmarked labels. Their supports are disjoint, so they are orthogonal.

Express the starting state in two coordinates

Let θ satisfy sin²θ=K/N, with 0<θ<π/2. The uniform state is |s⟩=cos θ|b⟩+sin θ|g⟩. Its initial marked probability is sin²θ, as expected from uniform sampling.

Use coordinate order [bad,good], so the state vector in this plane is [cos θ,sin θ]. Geometrically, put the bad direction on the horizontal axis and the good direction on the vertical axis. The initial vector makes angle θ above the bad axis.

This coordinate vector summarizes equal amplitudes within each group. The actual amplitude of one marked label is sin θ/√K, while one unmarked label has amplitude cos θ/√(N−K). Confusing a group amplitude with an individual-label amplitude would give incorrect probabilities.

Multiply the two reflections

In this basis, marking is Sg=[[1,0],[0,−1]]. The reflection about |s⟩ is D=[[cos(2θ),sin(2θ)],[sin(2θ),−cos(2θ)]], obtained by expanding 2|s⟩⟨s|−I.

The chronological marking-then-diffusion product is G=DSg=[[cos(2θ),−sin(2θ)],[sin(2θ),cos(2θ)]]. This is the ordinary real rotation matrix through angle 2θ in the stated plane.

Applying it once to [cos θ,sin θ] gives [cos(3θ),sin(3θ)]. By induction, after t iterations the state is cos((2t+1)θ)|b⟩+sin((2t+1)θ)|g⟩.

The total success probability is therefore Pt=sin²((2t+1)θ). The formula includes t=0 and remains valid even after an amplitude changes sign. Negative amplitudes are allowed; their squares remain nonnegative probabilities.

Worked example with eight candidates

Take N=8 and K=1. Then sin θ=1/√8 and θ is approximately 0.361367 radians. The first few probabilities follow directly from the rotation formula.

Ideal marked probability for N=8, K=1
Iterations t Exact probability Decimal
0 1/8 0.125
1 25/32 0.78125
2 121/128 0.9453125
3 169/512 0.330078125

One algebraic check uses sin(3θ)=3sin θ−4sin³θ=(5/2)/√8, giving probability 25/32. The next peak is better, but the third iteration has already rotated past the good direction and substantially reduced success.

This is not hardware noise or failed normalization. It is the intended ideal unitary trajectory. Repeating a coherent amplification step indefinitely is not the same as independently retrying a probabilistic experiment.

Choose a first-peak iteration count

The first ideal maximum occurs when (2t+1)θ=π/2, giving the real-valued target t*=π/(4θ)−1/2. Actual circuits need a nonnegative integer t, so inspect nearby integers and choose one giving a larger success probability.

Rounding to the nearest integer puts the final angle within θ of π/2, which guarantees success at least cos²θ=1−K/N near that first peak. The bound is especially strong when the marked fraction is small.

For N=8,K=1, t* is approximately 1.673, so t=2 is the natural first-peak choice. For N=4,K=1, θ=π/6 and t*=1 exactly, explaining the perfect one-iteration example.

This rule targets a high first-run success probability with a short sequence. It does not necessarily minimize expected total cost when verification, preparation, or early stopping are included. Those optimization criteria can prefer a different strategy.

Recover the square-root scaling

When K/N is small, θ=arcsin√(K/N) is approximately √(K/N). Therefore t* is approximately (π/4)√(N/K)−1/2.

The approximation explains the square-root query scaling but is not the exact probability formula. For large marked fractions, use the actual angle and include t=0 as a candidate rather than applying a small-angle approximation outside its range.

Each iteration uses one phase-marking query under the standard oracle convention, plus the diffusion operation. State preparation, final measurement, and candidate verification are additional resources. The geometric formula alone does not establish a physical runtime.

What the rotation does not reveal

The success probability depends on K, but a single measured label does not provide an exact count of marked states. Nor does it list every solution. Conditional on success in this symmetric uniform construction, each marked label has equal probability.

The two-dimensional derivation assumes the initial state and reflections have the specified symmetry. A nonuniform preparation leads to the more general amplitude-amplification framework, where the relevant parameter is its initial good-subspace weight rather than simply K/N.

Noise or inaccurate reflections can move the actual state away from this ideal trajectory. Compare data with the model carefully, but do not mistake the model’s own oscillations for implementation errors.

Four exercises with worked solutions

  1. For K/N=1/4, find θ and P1.

    Solution. sin θ=1/2, so θ=π/6. After one iteration the angle is 3θ=π/2, giving P1=1.

  2. For K/N=1/2, calculate Pt for integer t.

    Solution. θ=π/4, so the angle is an odd multiple of π/4. Its squared sine is always one half. Standard iterations do not improve this particular success probability.

  3. For N=8,K=1, why is t=3 worse than t=2?

    Solution. The angle advances from 5θ near the good axis to 7θ beyond it. Squaring the good component gives 121/128 at t=2 but only 169/512 at t=3.

  4. If total good probability is P and there are K equally weighted marked labels, what is each marked label’s probability?

    Solution. It is P/K. The normalized |g⟩ distributes its group weight uniformly across the K marked basis states.

Five explained multiple-choice questions

  1. The initial angle satisfies: A. sin²θ=K/N. B. θ=πK. C. θ=K/N exactly. D. cos²θ=K/N.

    Answer: A. The good-subspace amplitude is the square root of the marked fraction.

  2. One Grover iteration rotates by: A. θ/2. B. π always. C. 2θ. D. A random angle.

    Answer: C. It is the product of the two specified reflections.

  3. After t iterations success is: A. Always increasing. B. cos²(tθ) only. C. tK/N without limit. D. sin²((2t+1)θ).

    Answer: D. The initial angle θ precedes t rotations of 2θ.

  4. The N=8,K=1 first-peak choice is: A. Any number gives certainty. B. Two iterations. C. Zero iterations. D. Eight iterations exactly.

    Answer: B. The real-valued target is approximately 1.673, and two gives success 121/128.

  5. More ideal iterations can reduce success because: A. Measurement necessarily occurs each time. B. The initial uniform state is automatically re-prepared after each iteration. C. Diffusion changes which labels satisfy the predicate. D. The coherent rotation overshoots.

    Answer: D. The trajectory continues past the good direction rather than stopping there automatically.

Pitfalls and summary

Fix the bad-good coordinate order, distinguish group amplitudes from individual labels, and use the exact rotation formula before approximating. Grover amplification is periodic, so an appropriate stopping rule is part of the algorithm rather than an optional implementation detail.

Primary sources and further study

These sources support the definitions and context. The numerical examples, exercises, and explanations here were prepared for this lesson. Research papers are optional advanced reading.