3
$\begingroup$

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.

  1. apply the x gate to the first and third qubits to make the input as $|101\rangle$
  2. apply the Hadamard gate to the first qubit
  3. apply the CNOT gate to (q0,q1) and (q1, q2) enter image description here enter image description here

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?

$\endgroup$
4
  • 1
    $\begingroup$ This appears to be an issue with qubit ordering convention. Qiskit uses the "little endian" ordering convention where the least significant bit is listed first in a quantum state. Several other software frameworks and textbooks use the opposite "big endian" convention. Try using QuantumCircuit.reverse_bits() and you should get the expected answer. If this comment is unclear I can expand on it in an answer. $\endgroup$
    – Callum
    Commented Aug 26, 2023 at 22:22
  • 1
    $\begingroup$ qiskit.org/documentation/explanation/endianness.html $\endgroup$
    – Callum
    Commented Aug 26, 2023 at 23:17
  • $\begingroup$ @Callum Do you mean I should apply (I x I x H) |101> (x represents tensor product)? I still couldn't get the expected answer. Do you mind to expand on it and explain a bit more in an answer? Thank you very much! $\endgroup$
    – molan li
    Commented Aug 27, 2023 at 1:34
  • $\begingroup$ @Callum I try to change the input to |110> and use qc.revser_bits(). Then I can get the expected state and match my calculation (I updated my post a bit). However, I'm still not really understand how ordering take in play here. Since the original input state |101> is symmetric, which bit is the first bit seems not real significant to me. $\endgroup$
    – molan li
    Commented Aug 27, 2023 at 2:19

1 Answer 1

3
$\begingroup$

As @Callum said, your ordering of qubit is wrong. Qiskit keeps the 0th qubit at the rightmost space in a ket representation or for measurement.

If you have, say 3 qubits, qubit#1, qubit#2, qubit#3, in state $|-\rangle_1$,$|1\rangle_2$ and $|+\rangle_3$, respectively, then their joint state is written as $|+_31_2-_1\rangle$ i.e, $|+1-\rangle_{3,2,1}$, where subscript denotes the qubit number for the corresponding state.

For your circuit, state progression will go as follows:

  • Your initial state will be $|000\rangle_{3,2,1}$

  • Applying $X_1$ will get you $|001\rangle_{3,2,1}$

  • Applying $X_3$ to that state will get you $|101\rangle_{3,2,1}$.

I hope the qubit ordering is clear now.


As you have asked in your comment, yes, even if $|101\rangle$ is a "symmetric state" as you have said, Applying $H_3$ will give you $|001\rangle - |101\rangle$ and applying $H_1$ will give you $|100\rangle - |101\rangle$.


Now, for your circuit, the state will evolve as follows:

$$|000\rangle \xrightarrow{X_1X_3} |101\rangle \xrightarrow{H_1} \frac{|100\rangle-|101\rangle}{\sqrt{2}} \xrightarrow{CNOT_{1\rightarrow2}}\frac{|100\rangle-|111\rangle}{\sqrt{2}} \xrightarrow{CNOT_{2\rightarrow3}}\frac{|100\rangle-|011\rangle}{\sqrt{2}}\,,$$

thus, giving you the histogram you have pasted in the question.

$\endgroup$

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.