Google Quantum AI: Grover's Search & QFT

A bridge between Classical Hashing and Quantum Amplitude Amplification (Grover's Algorithm). Includes interactive QFT canvas for Google Cirq.

Grover's Algorithm: Amplitude Amplification

Target Hash:

Current Step: Start

State Vector Amplitudes (Real-time)

Initialization: 3 Hadamards (\(H^{\otimes 3}\)) create a uniform superposition. The probability amplitude \(\alpha\) is identical for all states:

\( |\psi\rangle = H^{\otimes 3} |\color{#dc2626}{\mathit{000}}\rangle \)

\( |\psi\rangle = \left(\frac{|\color{#dc2626}{\mathit{0}}\rangle + |\color{#2563eb}{\mathit{1}}\rangle}{\sqrt{2}}\right) \otimes \left(\frac{|\color{#dc2626}{\mathit{0}}\rangle + |\color{#2563eb}{\mathit{1}}\rangle}{\sqrt{2}}\right) \otimes \left(\frac{|\color{#dc2626}{\mathit{0}}\rangle + |\color{#2563eb}{\mathit{1}}\rangle}{\sqrt{2}}\right) \)

\( |\psi\rangle = \frac{1}{\sqrt{8}} \Big( |\mathit{000}\rangle + |\mathit{001}\rangle + \dots + |\mathit{111}\rangle \Big) \)

\( \alpha = \frac{1}{\sqrt{8}} \approx 0.353 \)

Concept Bridge: Hacking Baby-Bitcoin

Classical Hashing (Brute Force)

In Baby-Bitcoin, you must hash inputs one by one. Finding the target out of 8 possibilities takes an average of \(N/2 = 4\) steps, and up to \(N = 8\) steps.

Linear Scan: \(O(N)\)

Quantum Hashing (Grover's Algorithm)

Grover's Algorithm flips the amplitude of the target state, then reflects all amplitudes around the mean. The target state's probability spikes instantly!

Amplitude Amplification: \(O(\sqrt{N})\)

Google Cirq Export

Python

Run this Grover search circuit on a simulated (or real) QPU.

Hardware Reality: The Microwave Pulse Sequence

A quantum circuit doesn't use physical wiring to execute code; instead, it fires a precise chronological sequence of microwave pulses at stationary qubits to manipulate their quantum waves.

Here is the "sheet music" the hardware plays to run a 3-qubit Grover search for the target \(|\mathit{101}\rangle\):

  • Pulses 1-3 (Superposition): Fire three \(\pi/2\) (Hadamard) pulses. The physical machine now holds all 8 possible inputs in a massive superposition wave.
  • Pulses 4-6 (The Oracle): We need to mathematically flag \(|\mathit{101}\rangle\) with a negative phase. Fire a \(\pi\) (NOT) pulse at Qubit 1 to align it to \(|\mathit{111}\rangle\). Next, fire a Controlled-Controlled-Phase (CCP) pulse across all 3 qubits.
    What is a CCP pulse? A CCP (also known as CCZ) is a 3-qubit logic gate that applies a phase shift of \(\pi\) (multiplying the amplitude by \(-1\)) only if all participating qubits are in the \(|\mathit{1}\rangle\) state. Because it strictly triggers on \(|\mathit{111}\rangle\), it acts like a laser scalpel, flipping the sign of our target state while leaving the other 7 states in the superposition completely untouched!
    Finally, fire another \(\pi\) pulse to revert Qubit 1 back to its original state.
  • Pulses 7-19 (Diffusion): A barrage of 13 \(\pi\) and \(\pi/2\) pulses that reflects the wave around its mean. This shrinks the wrong answers and amplifies the negative target.
  • Pulse 20 (Measurement): Fire the Readout Resonators. This forces the quantum wave to physically collapse, spitting out 1, 0, and 1 with near 100% certainty!