Skip to main content

Plain-Language Intuition

Mode: Simple / School
Someone has locked a 3-digit binary code inside a black box. You may hand the box any 3-bit number, and it only answers with a single bit: 0 or 1. Classically, the best strategy is to probe one digit at a time (ask 001, then 010, then 100). A code with n digits always costs n questions. The Bernstein-Vazirani algorithm gets the whole code with ONE question: 1. Put all input qubits into superposition, so the box is asked every possible number at once. 2. A helper qubit prepared in a special "minus" state makes the box write its answer as a sign flip (phase) instead of a bit. 3. A final layer of Hadamard gates turns that pattern of sign flips straight back into the secret code. Measure the input qubits and the secret appears with 100% certainty.

Oracle Algorithms

Bernstein-Vazirani Algorithm: quick reference

Reveals an entire hidden bit string s from the function f(x) = s·x with a single oracle query, where any classical method needs n queries.

Topic
Oracle Algorithms
Level
Beginner
Circuit size
4 Qubits
Key result
1 query vs n classical queries

Concepts covered: Bernstein-Vazirani Algorithm, Phase Kickback, Quantum Oracles, Hadamard Transform

Frequently asked questions

What is Bernstein-Vazirani Algorithm?

Reveals an entire hidden bit string s from the function f(x) = s·x with a single oracle query, where any classical method needs n queries. It is a beginner-level topic in oracle algorithms.

How many qubits does the Bernstein-Vazirani circuit use?

The QuanBit tutorial uses a 4 qubits circuit. Key result: 1 query vs n classical queries.

Can I simulate Bernstein-Vazirani online for free?

Yes. The interactive Bernstein-Vazirani tutorial at https://www.quanbit.tech/learn/bernstein-vazirani runs free in the browser with nothing to install. You can step through the circuit gate by gate, watch the probabilities, statevector and Bloch spheres update, build the circuit yourself and take a short quiz.