010 Deutsch's One Question Trick
SimulatorTell a constant box from a balanced box. Ask two ordinary questions, or one quantum question.
Simulator running in your browser. Real hardware: coming soon (planned provider: IBM Quantum).
What's happening?
A simulator of Deutsch's algorithm: decide whether a hidden function is constant or balanced with one quantum question instead of two ordinary ones, and see interference make it work. Simulator only.
You will learn: Interference used to answer a question with fewer queries.
The circuit
Two coins, A (the input) and B (a helper). Start with A as Heads and B as Tails (a Flip it over on B). Spin both coins. Ask the box once: it flips B depending on what A is, using the hidden function. Spin A again and look at A. The circuit is X on B, H on A, H on B, box, H on A, measure A.
Why one question is enough
After the first spins, A is in a mix of 0 and 1, so the box is asked about both inputs at once. If the box is constant, both paths treat B the same, the paths for A add up and the second spin returns Heads. If the box is balanced, the two paths differ by a sign, so the second spin gives Tails. Never are both inputs revealed individually: you learn only the relationship between f(0) and f(1). It is the same add-or-cancel idea as the interference maze.
Honest notes
- It saves one question out of two on a problem designed for this purpose, first described by David Deutsch in 1985. It is not a practical speedup.
- The box must be written as a quantum circuit, which is a real condition. If the box is a black box that can only be asked classically, the trick does not apply.
- The later Deutsch-Jozsa algorithm extends the idea to many inputs, where the gap between classical and quantum queries is bigger. See Quantum Algorithms Explained for Beginners.
Run on real hardware: coming soon. The planned provider is IBM Quantum. It is not connected yet. Every result on this page comes from a simulator running in your browser, not from a quantum computer.
How it works: the simulator keeps the exact quantum state of the qubits as a list of complex numbers, applies each gate to it, and draws random samples from the resulting probabilities. The random numbers are ordinary pseudo random numbers from your browser, and a real device would add noise. No QNT, wallet or account is needed.
Sources
- Wikipedia: Deutsch-Jozsa algorithm
- Deutsch (1985), Proceedings of the Royal Society A 400, 97: Quantum theory, the Church-Turing principle and the universal quantum computer
- Wikipedia: Quantum logic gate
This is an educational simulator, not financial advice. QUANTUM (QNT) is an independent community token on Solana and does not perform quantum computation.