I have recently started with quantum computing and created a quantum teleportation circuit to transmit a qubit state from q_0 to q_2 using Qiskit.

I understand that I can transmit any state information from q_0 to q_2. Is it then fair to expect that I can also transmit a morse code like string of 0s and 1s (say 1001)? This is the circuit I built after watching/reading Qiskit tutorials.enter image description here

  • 3
    $\begingroup$ If you can transmit any state from q_0 to q_2, what do you think prevents you from teleporting |0> and |1>? If you can transmit a single classical bit, then you can do the same for many bits. But really there is no need to use teleportation for classical information and also in the circuit above (a swap gate would suffice). $\endgroup$
    – M. Stern
    Commented Nov 29, 2020 at 14:54
  • $\begingroup$ Thank you @M.Stern for your response. I worked out the SWAP gate too. qc.x(0) qc.h(1) qc.swap(0,1) qc.measure([0,1],[0,1]) $\endgroup$ Commented Nov 30, 2020 at 4:27

1 Answer 1


As you noticed, the first thing you do is to put the $q_0$ to the state you want to teleport to $q_2$. For instance, if you want to transport $|1\rangle$ to $q_2$ then you would first apply the $X$ gate to flip $q_0$ to the state $|1\rangle$.

enter image description here

This is because the initial state of a quantum computer is usually starts in the state $|000\cdots0\rangle$. Thus, if you want to teleport $1$ then apply $X$ gate to $q_0$ in the beginning, if you want to teleport $0$ then do nothing.

So if you insist to design a program in Qiskit to generate a quantum circuit to teleport a morse code of some sort, you can do it as follow:

%matplotlib inline
from qiskit import QuantumCircuit, execute, BasicAer, IBMQ
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from numpy import pi

def teleported_circuit(code):
    qreg_q = QuantumRegister(3, 'q')
    creg_c = ClassicalRegister(1, 'c')
    circuit = QuantumCircuit(qreg_q, creg_c)
    if code == 1:
    circuit.cx(qreg_q[1], qreg_q[2])
    circuit.cx(qreg_q[0], qreg_q[1])
    circuit.cx(qreg_q[1], qreg_q[2])
    circuit.cz(qreg_q[0], qreg_q[2])
    circuit.measure(qreg_q[2], creg_c[0])
    backend = BasicAer.get_backend('statevector_simulator')
    job = execute(circuit, backend, shots = 1)
    return job.result().get_counts()

#### Example #### 
code_string = [1,0,0,1,1,1]
teleported_code = [ teleported_circuit(code_string[i]) for i in range(len(code_string)) ]
print('Here is your telported code:', teleported_code)

The output would be:

Here is your telported code: [{'1': 1}, {'0': 1}, {'0': 1}, {'1': 1}, {'1': 1}, {'1': 1}]
  • 1
    $\begingroup$ Thank you for sharing the code. $\endgroup$ Commented Nov 30, 2020 at 4:23

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.