1
$\begingroup$

in Nielsen and Chuang's book in Box 6.1 (page 256 for 10th edition) there is a example of Grover's search algorithm for 3 qubits (2 as search space + 1 for oracle).

I am currently trying to implement that in qiskit however it seems like I do not understand something. In "Quantum Computation and Quantum Information" control (multi qubit) X is used, however it seems like control (multi qubit) Z should be in that place (for oracle).

When control X is used I find myself having the results that are roughly the same probability (on simulator) with some small variations, while running control Z pinpoints the correct qubit. Qiskit tutorial also suggests control Z and it seems consistent with the (-1)^f(x) part of Grover's algorithm

what am I missing?

$\endgroup$

2 Answers 2

1
$\begingroup$

Maybe provide a picture of the reference. But anyway, a key point in Grover is that one can implement phase flip to the ancilla (which is kickbacking the whole phase) using an X gate (CNOT if you look at the whole picture, I am talking about the part of the $|1>$ in control qubit) on ancilla that initialized to $|->=|0>-|1>$ state.

You can see that: $X(|0>-|1>)=|1>-|0> = -(|0>-|1>)$

Where $|->$ is created using $H(X(|0>)) $

$\endgroup$
1
$\begingroup$

I think the key is the state used for the bottom qubit. In Nielson & Chuang, $|-\rangle$ is used (see Equation 6.2) and the oracle is defined as $|x\rangle|q\otimes f(x)\rangle$ (see Equation 6.1). If you use control Z as the oracle, the bottom qubit should be $|1\rangle$.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.