Project: Guess the Hidden Gate
Every gate has a unique fingerprint: the way it transforms states. If you are handed a black box that applies one of several known gates, you can figure out which gate it is by carefully choosing your probe state and observing how the output changes. This idea — called gate tomography in its full form — underpins quantum verification, benchmarking, and several quantum algorithms.
Why the probe state matters
Consider the gate and the identity . Their matrices are
If you probe with : both give back — completely useless for telling them apart. If you probe with : , which differs from only by a global phase (). By the Born rule, global phases are unobservable, so a computational-basis measurement still cannot distinguish them.
The winning probe is :
Now the two gates produce different states, versus — but those states are still 50/50 in a -basis measurement. To turn the phase difference into an amplitude difference you can detect, apply a second Hadamard:
The complete circuit outputs if the gate was and if it was . One measurement shot is enough to decide with certainty.
Comparing X and Z
The gate swaps and , so — is an eigenstate of with eigenvalue . Probing with cannot distinguish from . Instead, probe with : versus , which is immediately measurable. The right probe always depends on the gate set you are trying to tell apart.
| Gate | Effect on | Effect on | |-------|----------------------|----------------------| | | | | | | | | | | | | | | | |
No single probe state distinguishes all four simultaneously, but pairing and does — this is why real tomography uses multiple probe states.
Try it
Build the discrimination circuit for : prepare , apply , rotate back with . The grader checks the final statevector — it should be , confirming the hidden gate is and not .
After running, the amplitude display should show on the component. Swap the for an in your circuit and notice you get — a completely different answer, which is how you would rule out as the hidden gate.
Sign in on the full site to ask questions and join the discussion.