Bernstein-Vazirani Algorithm in Qiskit
Md. Zubair
Posted on March 25, 2024
To understand it first there is a prerequisities to understand,
Phase Kickback:
Suppose we have a system of two qubits , two qubits are in differetn state, now we want to get the phase of one qubit to another, there comes phase kickback.
Let a system of two qubits q1q0 . Here Taking q0 as |-> state and q1 as |+> state. Now we want q1 also as |-> . here we can apply a cx gate where control is q1 and target is q0,
So now we can jump into the main algorithm.
Problem Statement: Suppose we have a blackbox which contain a secret number and our goal is to get the secret number by giving query to the blackbox.
- Classical Approach: In classical approach for a n bit secret number we have to give n query . This works as follows,
- Quantum Approach": In this approach we only need 1 query to get the secret key.
Here |x> is our query and |y> is auxiliary as this is reversible. For |y> we will use |1> state for using the phase kickback technique.
Now what oracle does here ? The oracle is basically put cx gate where the secret key has 1. Now let's think about why we need to put cx gate here. First off all all qubits in |x> is in superposition of |+> state and the auxiliary is in |-> state. If we know if we again apply H gate on |-> state and then if we measure if we will get |1> which is our requirement.
Now let's see the implementation part of this algorithm ,
If we want to see how our circuit looks like,
Now let's see whether it has sucessfully generated the secret key or not .
Posted on March 25, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024