Bernstein–Vazirani algorithm
{{Short description|Quantum algorithm}}
The Bernstein–Vazirani algorithm, which solves the Bernstein–Vazirani problem, is a quantum algorithm invented by Ethan Bernstein and Umesh Vazirani in 1997.
{{cite journal
| author = Ethan Bernstein and Umesh Vazirani
| title = Quantum Complexity Theory
| journal = SIAM Journal on Computing
| volume = 26
| issue = 5
| pages = 1411–1473
| year = 1997
| doi = 10.1137/S0097539796300921
}}
It is a restricted version of the Deutsch–Jozsa algorithm where instead of distinguishing between two different classes of functions, it tries to learn a string encoded in a function. The Bernstein–Vazirani algorithm was designed to prove an oracle separation between complexity classes BQP and BPP.
Problem statement
Given an oracle that implements a function in which is promised to be the dot product between and a secret string modulo 2, , find .
Algorithm
Classically, the most efficient method to find the secret string is by evaluating the function times with the input values for all :
{{cite journal
| author = S D Fallek, C D Herold, B J McMahon, K M Maller, K R Brown, and J M Amini
| title = Transport implementation of the Bernstein–Vazirani algorithm with ion qubits
| journal = New Journal of Physics
| volume = 18
| year = 2016
| doi = 10.1088/1367-2630/aab341
| doi-access = free
| arxiv = 1710.01378
}}
:
f(1000\cdots0_n) & = s_1 \\
f(0100\cdots0_n) & = s_2 \\
f(0010\cdots0_n) & = s_3 \\
& \,\,\,\vdots \\
f(0000\cdots1_n) & = s_n \\
\end{align}
In contrast to the classical solution which needs at least queries of the function to find , only one query is needed using quantum computing. The quantum algorithm is as follows:
Apply a Hadamard transform to the qubit state to get
:
Next, apply the oracle which transforms . This can be simulated through the standard oracle that transforms by applying this oracle to . ( denotes addition mod two.) This transforms the superposition into
:
Another Hadamard transform is applied to each qubit which makes it so that for qubits where , its state is converted from to and for qubits where , its state is converted from to . To obtain , a measurement in the standard basis () is performed on the qubits.
Graphically, the algorithm may be represented by the following diagram, where denotes the Hadamard transform on qubits:
:
|0\rangle^n \xrightarrow{H^{\otimes n }} \frac{1}{\sqrt{2^n}} \sum_{x \in \{0,1\}^n} |x\rangle \xrightarrow{U_f} \frac{1}{\sqrt{2^n}}\sum_{x \in \{0,1\}^n}(-1)^{f(x)}|x\rangle \xrightarrow{H^{\otimes n}} \frac{1}{2^n} \sum_{x,y \in \{0,1\}^n}(-1)^{f(x) + x\cdot y}|y\rangle = |s\rangle
The reason that the last state is is because, for a particular ,
:
\frac{1}{2^n}\sum_{x \in \{0,1\}^n}(-1)^{f(x) + x\cdot y}
= \frac{1}{2^n}\sum_{x \in \{0,1\}^n}(-1)^{x\cdot s + x\cdot y}
= \frac{1}{2^n}\sum_{x \in \{0,1\}^n}(-1)^{x\cdot (s \oplus y)}
= 1 \text{ if } s \oplus y = \vec{0},\, 0 \text{ otherwise}.
Since is only true when , this means that the only non-zero amplitude is on . So, measuring the output of the circuit in the computational basis yields the secret string .
A generalization of Bernstein–Vazirani problem has been proposed that involves finding one or more secret keys using a probabilistic oracle.
{{cite journal
| author = Alok Shukla and Prakash Vedula
| title = A generalization of Bernstein--Vazirani algorithm with multiple secret keys and a probabilistic oracle
| journal = Quantum Information Processing
| volume = 22:244
| issue = 6
| pages = 1-18
| year = 2023
| doi = 10.1007/s11128-023-03978-3
| arxiv = 2301.10014
}}
This is an interesting problem for which a quantum algorithm can provide efficient solutions with certainty or with a high degree of confidence, while classical algorithms completely fail to solve the problem in the general case.
Classical ''vs.'' quantum complexity
The Bernstein-Vazirani problem is usually stated in its non-decision version. In this form, it is an example of a problem solvable by a Quantum Turing machine (QTM) with queries to the problem's oracle, but for which any Probabilistic Turing machine (PTM) algorithm must make queries.
To provide a separation between BQP and BPP, the problem must be reshaped into a decision problem (as these complexity classes refer to decision problems). This is accomplished with a recursive construction and the inclusion of a second, random oracle.{{cite web
| url = https://courses.cs.washington.edu/courses/cse599d/06wi/lecturenotes7.pdf
| archive-url = https://web.archive.org/web/20241201172704/https://courses.cs.washington.edu/courses/cse599d/06wi/lecturenotes7.pdf
| archive-date = 2024-12-01
| title = CSE 599d - Quantum Computing The Recursive and Nonrecursive Bernstein-Vazirani Algorithm
| last = Bacon
| first = Dave
| date = 2006
| access-date = 2025-01-17}}
The resulting decision problem is solvable by a QTM with queries to the problem's oracle, while a PTM must make queries to solve the same problem. Therefore, Bernstein-Vazirani provides a super-polynomial separation between BPP and BQP.
Bernstein-Vazirani algorithm Qiskit implementation
The quantum circuit shown here is from [https://learning.quantum.ibm.com/course/fundamentals-of-quantum-algorithms/quantum-query-algorithms#the-bernstein-vazirani-problem a simple example of how the Bernstein-Vazirani algorithm can be implemented in Python] using Qiskit, an open-source quantum computing software development framework by IBM.
See also
References
{{reflist}}
{{Quantum computing}}
{{DEFAULTSORT:Bernstein-Vazirani algorithm}}