I want to create the GHZ-like state, $|\Psi\rangle = \frac{1}{\sqrt{2}} \left(|011\rangle - |100 \rangle \right)$. I build my circuit in the following way.
- apply the x gate to the first and third qubits to make the input as $|101\rangle$
- apply the Hadamard gate to the first qubit
- apply the CNOT gate to (q0,q1) and (q1, q2)
I run the simulation to make sure that I get the right reult. However, I failed to get the expected state mathematically. Here is how I do the calculation:
$(H\otimes I \otimes I)|101\rangle = H|1\rangle \otimes I|0\rangle \otimes I|1\rangle = \frac{1}{\sqrt 2} (|0\rangle - |1\rangle) \otimes |0\rangle \otimes|1\rangle = \frac{1}{\sqrt 2} (|001\rangle - |101\rangle)$
Apply CNOT gates: $\frac{1}{\sqrt 2} (|001\rangle - |101\rangle) \rightarrow \frac{1}{\sqrt 2} (|001\rangle - |111\rangle) \frac{1}{\sqrt 2} (|001\rangle - |110\rangle)$
My calculation tells me I should input $|110\rangle$ instead : $(H\otimes I \otimes I)|110\rangle = H|1\rangle \otimes I|1\rangle \otimes I|0\rangle = \frac{1}{\sqrt 2} (|0\rangle - |1\rangle) \otimes |1\rangle \otimes0\rangle = \frac{1}{\sqrt 2} (|010\rangle - |110\rangle)$
Apply CNOT gates: $\frac{1}{\sqrt 2} (|010\rangle - |110\rangle) \rightarrow \frac{1}{\sqrt 2} (|010\rangle - |100\rangle) \frac{1}{\sqrt 2} (|011\rangle - |100\rangle)$
Could anyone tell me what's wrong with my calculation?
QuantumCircuit.reverse_bits()
and you should get the expected answer. If this comment is unclear I can expand on it in an answer. $\endgroup$