Bernstein-Vazirani
Supercharging Deutsch-like algorithms
Last updated
Supercharging Deutsch-like algorithms
Last updated
The Bernstein-Vazirani (BV) algorithm can be considered an extension of the algorithm, and is in some ways even simpler to implement. However, the output of the BV algorithm is much more useful in practical applications and therefore important to understand.
Similar to algorithm, we have a oracle that implements a black box function f that maps , where is a bitstring of length n i.e.
We know more about the function now, we know that , where s is a unknown bitstring. We want to find s.
The only way to identify s with classical bit is to query the oracle n times, with n different inputs. The simplest set of such inputs is.
Using quantum interference and phase kickback, we can solve this problem exactly using just 1 query to the oracle.
Prepare n input qubits in state. Prepare the output qubit in state.
Apply Hadamard gates to all input qubits. This create a equiprobable superposition of all possible input combinations, i.e. up to some normalization constant.
Query the oracle with input qubits. The oracle effectively acts on all possible input combinations at the same time.
The trick is how the oracle writes the result of its calculation : using a CNOT on the output qubit. Just like in the Deutsch algorithm, this kicks out the results of the computation and stores it in the phase of the input state.
Apply Hadamard gates to the input qubits. This destructively interferes for all , except when . therefore now .
Measure all input qubits, the result is the bitsting s.
The key difference between Deutsch and BV algorithms is that we have reduced our undefined function to a well defined function of an unknown bitstring s. While this reduces the space of functions, it makes the algorithm much more powerful in this restricted space.
The algorithm works for any length of string s, which means in principle we can read any s, (even say millions of bits long), with just 1 single query to the function.
However it suffers from the same problem as Deutsch, does such a specific problem ever arise in practice for us to solve?