Bernstein–Vazirani algorithm: Difference between revisions

From testwiki
Jump to navigation Jump to search
imported>JavaFXpert
 
(No difference)

Latest revision as of 20:26, 20 February 2025

Template:Short description

The Bernstein–Vazirani algorithm, which solves the Bernstein–Vazirani problem, is a quantum algorithm invented by Ethan Bernstein and Umesh Vazirani in 1997.[1] 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.[2] The Bernstein–Vazirani algorithm was designed to prove an oracle separation between complexity classes BQP and BPP.[1]

Problem statement

Given an oracle that implements a function f:{0,1}n{0,1} in which f(x) is promised to be the dot product between x and a secret string s{0,1}n modulo 2, f(x)=xs=x1s1x2s2xnsn, find s.

Algorithm

Classically, the most efficient method to find the secret string is by evaluating the function n times with the input values x=2i for all i{0,1,,n1}:[2]

f(10000n)=s1f(01000n)=s2f(00100n)=s3f(00001n)=sn

In contrast to the classical solution which needs at least n queries of the function to find s, only one query is needed using quantum computing. The quantum algorithm is as follows: [2]

Apply a Hadamard transform to the n qubit state |0n to get

12nx=02n1|x.

Next, apply the oracle Uf which transforms |x(1)f(x)|x. This can be simulated through the standard oracle that transforms |b|x|bf(x)|x by applying this oracle to |0|12|x. ( denotes addition mod two.) This transforms the superposition into

12nx=02n1(1)f(x)|x.

Another Hadamard transform is applied to each qubit which makes it so that for qubits where si=1, its state is converted from | to |1 and for qubits where si=0, its state is converted from |+ to |0. To obtain s, a measurement in the standard basis ({|0,|1}) is performed on the qubits.

Graphically, the algorithm may be represented by the following diagram, where Hn denotes the Hadamard transform on n qubits:

|0nHn12nx{0,1}n|xUf12nx{0,1}n(1)f(x)|xHn12nx,y{0,1}n(1)f(x)+xy|y=|s

The reason that the last state is |s is because, for a particular y,

12nx{0,1}n(1)f(x)+xy=12nx{0,1}n(1)xs+xy=12nx{0,1}n(1)x(sy)=1 if sy=0,0 otherwise.

Since sy=0 is only true when s=y, this means that the only non-zero amplitude is on |s. So, measuring the output of the circuit in the computational basis yields the secret string s.

A generalization of Bernstein–Vazirani problem has been proposed that involves finding one or more secret keys using a probabilistic oracle. [3] 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 O(1) queries to the problem's oracle, but for which any Probabilistic Turing machine (PTM) algorithm must make Ω(n) 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.[1][4] The resulting decision problem is solvable by a QTM with O(n) queries to the problem's oracle, while a PTM must make Ω(nlogn) 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 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.

File:Bernstein-Vazirani algorithm circuit in Qiskit.png
Bernstein-Vazirani quantum circuit

See also

References

Template:Reflist

Template:Quantum computing