Algorithm lab · reviewed 2026-08-20
Grover Search n=2
Small Grover workflow for classrooms and pilot teams that need a readable oracle, generated source, and a run trace.

- Qubits
- 2
- Operations
- 12
- Shots
- 4,096
Define
Name 11 as the marked state and make the oracle explicit.
oracle note
Amplify
Apply one oracle-plus-diffusion round for N=4.
Qiskit + OpenQASM
Simulate
Execute 4,096 seeded shots on local Aer.
complete counts + trace
Review
Separate teaching evidence from speedup or hardware claims.
reviewer note
Workflow question
What this sample is testing.
Mark the two-bit state 11 with a phase oracle, apply one Grover diffusion round, and verify that the marked state is amplified in an ideal simulator.
Route rationale
Local simulator first, provider preflight optional
Marked 11 state amplified across the complete ideal-simulator distribution
Method
Prepare an equal superposition across two qubits, use a controlled-Z operation as the oracle for 11, and apply the two-qubit diffusion sequence before measurement.
Execute one complete Grover round for 4,096 shots on Qiskit Aer with simulator and transpiler seed 2048. Preserve the oracle note, generated source, complete counts, trace, and reviewer note.
How to read the result
For a search space of four states with one marked state, one ideal Grover round amplifies 11 completely. The stored fixture therefore returns 11 for all 4,096 shots.
The page exposes the oracle choice because the output is only meaningful when a reviewer knows which state the workflow intended to mark.
Measured distribution
Complete seeded count table
4,096 shots
Complete ideal-simulator distribution. Engine Qiskit Aer 0.17.0; simulator and transpiler seed 2048. This static public fixture is not a live provider run.
Proof boundary
- 01This two-qubit teaching fixture does not demonstrate practical quantum speedup; the search space is trivially small for a classical computer.
- 02The exact ideal result will degrade on noisy hardware and can change when the oracle, marked-state count, qubit count, or iteration count changes.
- 03This is a seeded local simulation, not a live provider job or hardware benchmark.
Generated representations
Inspect the source behind the counts.
The public code is a review fixture. Provider credentials, workspace members, billing context, and private notes stay excluded.
Qiskit circuit
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.h([0, 1])
qc.cz(0, 1)
qc.h([0, 1])
qc.z([0, 1])
qc.cz(0, 1)
qc.h([0, 1])
qc.measure([0, 1], [0, 1])OpenQASM circuit
OPENQASM 3;
include "stdgates.inc";
bit[2] c;
qubit[2] q;
h q[0];
h q[1];
cz q[0], q[1];
h q[0];
h q[1];
z q[0];
z q[1];
cz q[0], q[1];
h q[0];
h q[1];
c[0] = measure q[0];
c[1] = measure q[1];Evidence manifest
{
"workflowId": "QF-SAMPLE-GROVER-N2",
"runner": "qiskit-aer",
"artifacts": [
"oracle-notes.md",
"generated-openqasm.qasm",
"counts.json",
"trace.json",
"reviewer-note.md"
],
"privateFieldsExcluded": [
"providerCredentialId",
"workspaceMembers",
"teacherPrivateNotes"
]
}What the reviewer receives
- oracle-notes.md
- generated-openqasm.qasm
- counts.json
- trace.json
- reviewer-note.md
Explicitly excluded
- providerCredentialId
- workspaceMembers
- teacherPrivateNotes
Questions this record answers
Workflow FAQ
What does the oracle do in this Grover example?
The controlled-Z oracle changes the phase of the 11 basis state. The diffusion step then increases that state's measurement probability.
Why is one Grover iteration enough here?
There are four possible two-bit states and one marked state. For this small ideal case, one oracle-and-diffusion round reaches the marked state with unit probability.
Does this sample prove a quantum advantage?
No. It is a small educational simulator example designed to make the oracle, generated source, counts, and review evidence inspectable.