1
$\begingroup$

I want to generate the Bell state $(|01\rangle+|10\rangle)/\sqrt{2}$ from the state $|00\rangle$ in qiskit, applying the Hadamard gate followed by the $\text{CNOT}$ gate.

But it generates $(|11\rangle-|00\rangle)/\sqrt{2}$. What is the problem?

sv1 = Statevector.from_label('01')
mycircuit1 = QuantumCircuit(2)
mycircuit1.h(0)
mycircuit1.cx(0,1)
new_sv1 = sv1.evolve(mycircuit1)
print(new_sv1)
plot_state_qsphere(new_sv1.data)
$\endgroup$

2 Answers 2

2
$\begingroup$

Qiskit uses little-endian ordering for both classical bits and qubits. So, the least significant bit (LSB) is the rightmost bit in the binary representation of numbers. That means, you should use

sv1 = Statevector.from_label('10')

instead of

sv1 = Statevector.from_label('01')

For more details, see the documentation.

$\endgroup$
2
$\begingroup$

The Bell state $\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$ can be generated from $|00\rangle$ in Qiskit as follows:

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

sv1 = Statevector.from_label('00') # start with |00>

mycircuit1 = QuantumCircuit(2)
mycircuit1.h(0)
mycircuit1.cx(0,1)

mycircuit1.x(0) # apply x gate after CNOT

new_sv1 = sv1.evolve(mycircuit1)
display(mycircuit1.draw('mpl'))
display(new_sv1.draw('latex'))

enter image description here

Regarding your code, I see two possible issues for which I included in-line comments in my code. The first issue is that you are starting with $|01\rangle$ instead of $|00\rangle$. The second issue is that if you start with $|00\rangle$, then the $H$ and $CX$ gates are not enough. You also need an $X$ gate at the end.

$\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.