Hands-on lab · 1 step
Deutsch–Jozsa with one oracle query
Surround a black-box oracle with gates from so that a single query decides whether is constant or balanced. The grader runs your circuit four times, once for each of the oracles , , and , and inspects the measurement distribution of the two input qubits.
Step 1: Constant or balanced in one query
The register has three qubits, all starting in : qubits and hold the input and qubit is the ancilla . Qubit is the most significant bit, so the basis state has index .
The circuit already contains the oracle placeholder . In the circuit editor it is the statement Uf on its own line; keep it exactly once and type gates before and after it. You may use , and , at most operations in total including Uf, and no measurements.
The grader substitutes four oracles into Uf and computes the Born probabilities of the input qubits , summed over the ancilla:
- constant-cases: for () and for () you must obtain , i.e. the outcome with certainty;
- balanced-cases: for () you must obtain , and for () you must obtain .
Every probability is compared within . In general the Deutsch–Jozsa circuit returns the string with probability , which for a linear is exactly at .