I am very new to quantum computing and I have recently started to experiment with qiskit
module in python, by following tutorials and implementing simple algorithms.
I constructed the quantum circuit described on this page: Qiskit teleportation And got same results that were expected:
my circuit:
my results:
Which are apparently expected results, since
"we will always measure 0 from Bob's qubit because we started off with |0⟩"
However, if I apply NOT Gate at the start of q0, I still get the exact same results. Is my understanding of algorithm wrong? Shouldnt I be getting q2 as 1 after applying the NOT gate at start?
code:
import qiskit as q
from qiskit.visualization import plot_histogram
circuit = q.QuantumCircuit(3, 3)
# entangle cubit 1 & 2
circuit.h(1)
circuit.cx(1, 2)
# apply CNOT to qubit we want to send
circuit.cx(0, 1)
circuit.h(0)
circuit.measure([0,1], [0,1])
circuit.cx(1, 2)
circuit.cz(0, 2)
print(circuit)
backend = q.Aer.get_backend('qasm_simulator')
job = q.execute(circuit, backend, shots=1024)
result = job.result()
counts = result.get_counts(circuit)
plot_histogram(counts)
Outcomes when NOT gate is inserted at the start of q0:
circuit.draw(output='mpl')
so it is the description of what my code is doing $\endgroup$