1
$\begingroup$

I want to make a three qubit system that marks the states where the last qubit is 0. I have made an oracle function but when I try to run the reflection the amplitudes are only higher than the others by around 15%. Is there something I'm missing out on the second reflection/diffusion operator, I'm kinda new to this field so don't know much. I have attached a picture of the second reflection as well as the probabilities:

Reflection: enter image description here

Probabilities:

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

It seems that $\mathrm{CNOT}$ gates should not be in your circuit. Here is Grover algorithm for 3 qubits:

Grover algorithm - 3 qubits

Put your Oracle instead of dashed line. The Oracle should have three inputs $q_0$, $q_1$ and $q_2$, output should be on qubit $q_3$ after $\mathrm{H}$ gate.

$\endgroup$
7
  • 1
    $\begingroup$ What is the output qubit used for? I always thought in the oracle you change the state of 3 qubits to 1 and use CZ to change the sign from + to -, and then reverse the operation. $\endgroup$
    – At2005
    Commented Jan 14, 2020 at 15:37
  • $\begingroup$ @At2005: Yes, you are right that you read marked state on input qubits. But you have to somehow tell to Grover operator ($\mathrm{CZ}$ is part of it) that this state is the right one. The output is used for doing so. Although it can seems that the output is not connected to the Grover operator, it acually is because of entanglement between oracle and output qubit. When the oracle returns one on the output, phase of whole state defined by all qubits is reversed. This reversal is captured by Grover operator and after that the probability of this state is amplified. $\endgroup$ Commented Jan 14, 2020 at 22:26
  • $\begingroup$ So for my oracle should I just change it to have a CZ on the output qubit controlled by the state of the last qubit? I'm trying to mark 1/2 of all possible states. So, e.g. if the last qubit is 0 it'll mark, otherwise nothing $\endgroup$
    – At2005
    Commented Jan 16, 2020 at 13:12
  • $\begingroup$ @At2005: The oracle output is not connected to Grover operator, $CZ$ gate acts on last qubit of input. $\endgroup$ Commented Jan 16, 2020 at 13:38
  • $\begingroup$ So right now for my oracle I've got an X gate applied before the last qubit. Then I'm doing CZ with that as a control and output qubit as a target, but it just doesn't seem to work, and I'm getting equal probabilities. I'm just a beginner so I don't have much experience with Oracles. $\endgroup$
    – At2005
    Commented Jan 16, 2020 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.