Say you have a number. If this number can be multiplied by a number, the quantum computer could 'guess' that number in one try.
Counterintuitive right?
This is the magic of the Bernstein-Vazirani algorithm.
To classical computer scientists, these algorithms completely change algorithm writing.
Let's explore a bit more.
Review of notation
∣0⟩ and ∣1⟩ qubit states correlates to vectors [10]and[01] respectively.
When we apply the Hadamard transformation, we apply a matrix multiplication that sends everything into superposition.
We apply a Hadamard transformation. This is a function a complex matrix transformation.
H⊗n∣xn⟩=2n1y∈{0,1}n∑(−1)x⋅y∣y⟩
Step 1 - Hadamard Gate
We have a quantum register of n qubits that all have an initial state of ∣0⟩.
Hence, we can represent this as ∣0⟩n
Let's apply the Hadamard gate on them using the skeleton formula above.
H⊗n∣0n⟩=2n1∑y∈{0,1}n(−1)x⋅y∣y⟩
The idea here is to start them at a defined state and throw them into a superposition so that we can take advantage of the superposition of qubits later.
This step is written concisely as:
H⊗n2n1∑x∈{0,1}n∣x⟩
Step 2 - Unitary
Uf is an oracle that transforms ∣x⟩→(−1)f(x)∣x⟩ where f(x)=s⋅x
This particular function is special, but you should think of it as a black box that tests the hidden number s against all the superimposed states of the qubits at once.