Quantum Computing Asked by Robinbux on March 16, 2021
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(vert01rangle + vert10rangleright)$$
Technically it should be achived by applying a Hadamard, followed by a CNOT gate on the initial state $vert01rangle$, 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(vert11rangle – vert00rangleright)$$ 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!
If you want to create $frac{|01rangle + |01rangle }{sqrt{2}} $, you actually need to start from the state $|10rangle$, not $|01rangle$. Quickly written, the calculation is:
$$ |10rangle xrightarrow{Iotimes H} frac{1}{sqrt{2}}|1rangle (|0rangle + |1rangle) xrightarrow{CX} frac{1}{sqrt{2}}(|10rangle + |01rangle) $$
and
$$ |01rangle xrightarrow{Iotimes H} frac{1}{sqrt{2}}|0rangle (|0rangle - |1rangle) xrightarrow{CX} frac{1}{sqrt{2}}(|00rangle - |11rangle) $$
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 :)
Correct answer by Lena on March 16, 2021
The circuit you shown is to create the state $ dfrac{|00rangle + |11rangle}{sqrt{2}}$ have you started from the state $|00rangle = |0rangle otimes |0rangle$. Now to get this state to the state $|psi rangle = dfrac{|01rangle + |10rangle}{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{|00rangle + |11rangle}{sqrt{2}}$. Explicitly, we have:
$$ (X otimes I)dfrac{|00rangle + |11rangle}{sqrt{2}} = dfrac{X|0rangle otimes I |0rangle + X|1rangle otimes I|1rangle}{sqrt{2}} = dfrac{|1rangle otimes |0rangle + |0rangle otimes |1rangle }{sqrt{2} } = dfrac{|1 0rangle + |01rangle }{sqrt{2} }= dfrac{|01rangle + |10 rangle }{sqrt{2} } $$
Answered by KAJ226 on March 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP