According to the Grover's algorithm section in the IBM Quantum Experience, if I have two qubits in the "one" state (vectors (0,1) and (0,1)), and I apply a Hadamard gate to each of them, and then input the tensor product output to a CZ gate, my resulting amplitudes should be (.5, .5, .5, and -.5). However, no matter how I fiddle with the matrices, my resulting amplitudes are (.5, -.5, -.5, and -.5) Am I screwing up the product of the results of the two Hadamards? enter image description here

  • $\begingroup$ What do you mean by "two qubits in the one state"? If you have two qubits in the state $\vert 01\rangle$ then these two qubits together may correspond to binary $1$. It's not clear to me wny you refer to "two qubits in the one state" as vectors $(0,1)$ and $(0,1)$... $\endgroup$ – Mark S Jun 9 at 0:52
  • $\begingroup$ I should have said, "... if I have tow qubits each in the "one" state ..." Each (and both) qubits start in the "one" state. $\endgroup$ – James Arneberg Jun 10 at 12:47

Could you point to the source? Your calculations seem correct, in Dirac notation:

  • start with $|1\rangle \otimes |1\rangle$
  • apply H to each qubit: $|-\rangle \otimes |-\rangle = \frac12(|00\rangle - |01\rangle - |10\rangle + |11\rangle)$
  • Apply CZ: the sign of $|11\rangle$ changes, for the final result $\frac12(|00\rangle - |01\rangle - |10\rangle - |11\rangle)$

Could it be that the source starts with qubits in $|0\rangle \otimes |0\rangle$ state? In that case the resulting amplitudes will indeed be $\frac12(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$.

| improve this answer | |
  • $\begingroup$ Thank you for responding. This is the source. Scroll down about 3/4 the way to the section "Oracles". medium.com/swlh/… $\endgroup$ – James Arneberg Jun 5 at 23:54
  • $\begingroup$ Do you mean "Oracle for |w⟩=|11⟩"? It doesn't start in |11⟩ state indeed; the whole circuit starts in |00⟩ state. The fact that this oracle marks |11⟩ state doesn't mean that the circuit starts in |00⟩, it means that the oracle CZ, when given a superposition of all possible inputs, flips the phase of just |11⟩. $\endgroup$ – Mariia Mykhailova Jun 6 at 0:05
  • $\begingroup$ Thank you for your reply. I appreciate it. I have to give this some additional study because I am frankly missing the point. I thought this oracle would detect an |11> if the |11> lurked among the choices. $\endgroup$ – James Arneberg Jun 6 at 2:21
  • 1
    $\begingroup$ It does detect 11, sort of - by means of flipping its phase. To convert this effect into a "detection" that results in the actual 11 state, you need the full Grover's algorithm, the oracle alone doesn't do it. $\endgroup$ – Mariia Mykhailova Jun 6 at 2:27
  • 1
    $\begingroup$ Grover's search algorithm is not really suited for database search. The examples that use hardcoded values that we search for don't do it justice for the precise reason you pointed out. Tag "grovers-algorithm" on this site has a lot of great questions and answers on this, starting with quantumcomputing.stackexchange.com/questions/6325/… $\endgroup$ – Mariia Mykhailova Jun 7 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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