# Q-Sphere representation of Bell States

I'm currently going through Lab1 of the Qiskit Quantum Computing Course, where one task is to create the Bell State $$\frac{1}{\sqrt{2}}\left(\vert01\rangle + \vert10\rangle\right)$$ Technically it should be achived by applying a Hadamard, followed by a CNOT gate on the initial state $$\vert01\rangle$$, if I understand it correctly. My Qiskit implementation is the following:

sv = Statevector.from_label('01')
mycircuit = QuantumCircuit(2)
mycircuit.h(0)
mycircuit.cx(0,1)
new_sv = sv.evolve(mycircuit)
plot_state_qsphere(new_sv.data)


I'm only confused about the resulting Q-Sphere image:

The way I understood the Q-Sphere, this image should correspond to the state $$\frac{1}{\sqrt{2}}\left(\vert11\rangle - \vert00\rangle\right)$$ and not to the requested one. Was my creation of the asked Bell State wrong, or my interpretation of the Q-Sphere? Thanks for any help!

## 2 Answers

If you want to create $$\frac{|01\rangle + |01\rangle }{\sqrt{2}}$$, you actually need to start from the state $$|10\rangle$$, not $$|01\rangle$$. Quickly written, the calculation is:

$$|10\rangle \xrightarrow{I\otimes H} \frac{1}{\sqrt{2}}|1\rangle (|0\rangle + |1\rangle) \xrightarrow{CX} \frac{1}{\sqrt{2}}(|10\rangle + |01\rangle)$$

and

$$|01\rangle \xrightarrow{I\otimes H} \frac{1}{\sqrt{2}}|0\rangle (|0\rangle - |1\rangle) \xrightarrow{CX} \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$$

So change this

sv = Statevector.from_label('10')


should be enough to solve your issue, I tried and it worked! ;)

I hope this is clear enough, please tell me if not :)

• That's it, thanks a lot! Would you mind explaining why the Q-Sphere looks like in the image above, if the state is $\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$? Blue indicates the state $\phi$ of $e^{i\phi}$, so if $\phi = \pi$ shouldn't the term be negative? Feb 8, 2021 at 16:40
• I have to admit that I don't know, this might be a bug from the visualization function, because when I tried to create the exact same circuit on the circuit composer on the IBM Quantum Experience website to get $1/\sqrt{2}( |00\rangle - |11\rangle )$, the phase was correct, and even with your code when we look at the statevector we created, we have the right value for the statevector (meaning the minus being in front of $|11\rangle$). Anyway, mostly a bug from the visualization I think
– Lena
Feb 8, 2021 at 16:47
• Ah ok, so then my understanding of how to read the Q-Sphere is still correct, thanks a lot. That one really bugged me :) Feb 8, 2021 at 16:50

The circuit you shown is to create the state $$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$$ have you started from the state $$|00\rangle = |0\rangle \otimes |0\rangle$$. Now to get this state to the state $$|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}}$$ you need to apply another $$X$$ gate to any of the two qubits in addition to what you had before. The circuit is as follows:

         ┌───┐
q_0:|0>  ┤ H ├──■───────
└───┘┌─┴─┐┌───┐
q_1:|0>  ─────┤ X ├┤ X ├
└───┘└───┘


If you want to generate this circuit with qiskit you can do it as follows:

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit

qreg_q = QuantumRegister(2, 'q')
creg_c = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)

circuit.h(qreg_q[0])
circuit.cx(qreg_q[0], qreg_q[1])
circuit.x(qreg_q[1])


The reason for this is because upon applying the operator $$X$$ to the first qubit and do nothing to the second is the same as applying the operator $$X \otimes I$$ (note I am writing the tensor product in term of qiskit's standard where they used little endian) to the state $$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$$. Explicitly, we have:

$$(X \otimes I)\dfrac{|00\rangle + |11\rangle}{\sqrt{2}} = \dfrac{X|0\rangle \otimes I |0\rangle + X|1\rangle \otimes I|1\rangle}{\sqrt{2}} = \dfrac{|1\rangle \otimes |0\rangle + |0\rangle \otimes |1\rangle }{\sqrt{2} } = \dfrac{|1 0\rangle + |01\rangle }{\sqrt{2} }= \dfrac{|01\rangle + |10 \rangle }{\sqrt{2} }$$

• Thanks for the explanation! Is there any particular reason why you would want to start with $|00\rangle$? I think as @Lena explained in her answer, if we use different starting qubits we can achieve the same end state, using one gate less, right? Feb 8, 2021 at 16:45
• The reason why I start with the state $|00\rangle$ is because that is the initialize state on a quantum computer (most of them anyway). Most quantum computers start their qubits in the $|0\rangle$ state. You can do operation on them to change them to a different state but the initial state of the circuit (the state when you just create a circuit without doing anything) is the state $|00\cdots 0 \rangle$. In this case, you can start in the state $|01\rangle$ by applying the $X$ gate to the top qubit. Feb 8, 2021 at 16:51
• I should rephrase the last sentence: In this case, if you have a certain circuit in mind that you want to apply to a particular state, for instance, you want to apply the operation $CNOT\cdot (I \otimes H)$ to the state $|01\rangle$ then what you can do is to apply the $X$ gate to the top qubit to change the initial state of the system to the initial state you want to start in which is the $|01\rangle$ state. Hope that helps. Feb 8, 2021 at 17:08
• Yea, that explains it. Maybe it's just an abstraction, that you can simply initialize the vector with Statevector.from_label('10') and under the hood they use 00 and apply an $X$ gate Feb 8, 2021 at 17:26