3
$\begingroup$

Attached please find two circuits for the IBM quantum composer, that show the outcome of Grover's algorithm with 3 QuBits after 2 iterations for the situation, where the solution is at address 111 and for the situation, where the solution is at address 101.

I am astonished, that the probabilities differ so much.

Is that possible, that finding the solution at 111 is so much clearly than finding the solution at 101 ?enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

There is a missing CNOT gate from your oracle. It should be:

enter image description here

And the whole circuit should be:

enter image description here

This is because you want to add a phase when the state is $|101\rangle$. The first CNOT will change this state to $|111\rangle$ so you can apply the same oracle used in your other circuit. Then apply CNOT again to undo the effect of the first CNOT.

$\endgroup$
2
  • $\begingroup$ Wow ! You are right ! That works ! Thank you so much ! $\endgroup$ Mar 4, 2023 at 6:34
  • $\begingroup$ Dear Egretta.Thula: When I run this circuit on the IBM composer, then after one oracle and one reflection I get the following result: 0.177 0.177 0.177 0.177 0.177 0.884 0.177 0.177 but all state vectors are painted in red, so that means negative amplitude, right ? However, they should all be positive. What am I missing here ? $\endgroup$ Mar 28, 2023 at 5:29

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.