# Teleporting a quantum state

This post explores the results of trying quantum teleportation on an actual quantum computer™.

Suppose Alice has a quantum state she would like to send to Bob,

$$|\mathit{Alice\ state}\rangle = \alpha|0\rangle + \beta|1\rangle$$,

and they both hold entangled qubits, $$|\mathit{Alice\ tangle}\rangle$$ and $$|\mathit{Bob\ tangle}\rangle$$. It’s possible to teleport $$|\mathit{Alice\ state}\rangle$$ to Bob via the entanglement, even if they are millions of miles apart! I’m going for teleportation within a computer so not quite so far.

One step of the process, after some operators are applied, is that Alice measures her qubits and tells Bob what the outcomes were. These measurements – one of $$|0\rangle|0\rangle$$, $$|0\rangle|1\rangle$$, $$|1\rangle|0\rangle$$, or $$|1\rangle|1\rangle$$ at random – don’t reveal the qubit state being teleported. In fact Alice doesn’t even need to know the state, so could be relaying a private message. The communication of these two measurement outcomes can’t happen faster than light speed, so the teleportation doesn’t break relativity.

Here’s a picture of the process, in lieu of a proper explanation (built and simulated using IBM Quantum Composer):

The pink bit over on the right hand size follows the rules below (lightly reordered from Flarend and Hilborn, 2022, p. 156) to recover the state depending on the outcomes of Alice’s measurements:

alice_tangle alice_state Gate to apply to bob_tangle
0 0 $$I$$
0 1 $$Z$$
1 0 $$X$$
1 1 $$Y$$

Here are the Pauli matrices referred to above:

$$X = \begin{pmatrix} 0&1\\ 1&0 \end{pmatrix}$$

$$Y = i\begin{pmatrix} 0&-1\\ 1&0 \end{pmatrix}$$

$$Z = \begin{pmatrix} 1&0\\ 0&-1 \end{pmatrix}$$

($$i = \sqrt{-1}$$.)

$$I$$ is the $$2 \times 2$$ identity matrix that does nothing, so there’s a chance that the correct state magics its way to Bob without him applying any transformation. Alice just needs to tell him when she measured her qubits.

It works in the simulator, but annoyingly doesn’t run on IBM’s quantum computers because of the way I encoded the conditionals (Error: Instruction bfunc is not supported [7001]). I’ve used a classical computing conditional to choose which of the four gates to apply, which requires a sort of dynamic quantum circuit that’s not supported.

But there’s another way! Since $$Y = iXZ$$, we get the following:

alice_tangle alice_state Gate to apply to bob_tangle
0 0 $$I$$
0 1 $$Z$$
1 0 $$X$$
1 1 $$iXZ$$

It’s possible to control $$Z$$ and $$X$$ with a qubit – the latter is just a controlled NOT (CNOT). So it looks easy to get the combinations. Apart from the $$i$$. Mermin (2007, p. 154) ignores it for reasons I don’t yet follow (is the $$Y$$ really needed after all?). He also has the gates in the order

which seems to me back to front. I’ll ignore $$i$$ too but order the gates to match the arithmetic. Here’s a circuit, second attempt:

The state circled in purple is what Alice is sending to Bob. Since we know the correct answer, I (or Bob) will make the quantum tomography easier by inverting the RX and RY gates Alice used to setup the state. This means we can look out for an easier basis state, $$|0\rangle$$ (the states circled in green show where the $$|0\rangle$$ came from and where it is measured).

If the teleportation worked, the 3rd classical bit (most significant bit, leftmost) will always be a 0. It is in the simulations:

Now let’s try on the quantum computer. Off it goes to ibm_nairobi. Let’s see what happens…

It was actually on the queue for 40 minutes in the end.

And here are the results – not quite as nice as the simulation:

Did it work? Well, given what I expected to happen, it did on 68.2% of the 1,000 runs (95% CI = [65.1%, 71.0%]). Here’s a table:

Measurement outcome Frequency
000 136
001 201
010 188
011 157
100 106
101 102
110 60
111 50

I was hoping for something a bit closer to 99%, but whatever happened it’s definitely not just a coin flip!

Let’s give it another go with a simpler circuit:

This will only work when Alice’s measurements are $$|0\rangle|0\rangle$$, so for this setup they both keep trying with fresh entangled pairs until Alice gets the desired measurements. Again she needs to tell him when she has measured and what she got. I’ve undone the superposition again Bob’s side, so by “work” I mean Bob’s measurement is also $$|0\rangle$$. Looks good in the simulator:

Fingers crossed. Here’s what happens when it’s run on the actual™  computer (ibmq_belem).

That looks a lot better (we’re just interested in the two bars pointed to above). Though it’s still a bit suspicious that Bob’s qubit is mostly $$|0\rangle$$, irrespective of what Alice’s qubits are.

I think I’ve found the problem (emphasis original):

“The IBM quantum computers currently do not support instructions after measurements, meaning we cannot run the quantum teleportation in its current form on real hardware. Fortunately, this does not limit our ability to perform any computations due to the deferred measurement principle… The principle states that any measurement can be postponed until the end of the circuit, i.e. we can move all the measurements to the end, and we should see the same results…”

Third time lucky – this time only measuring as a final step:

This looks a little more convincing since Bob gets about the same number of $$|1\rangle$$s and $$|0\rangle$$s when Alice’s qubits are wrong. He still mostly gets $$|0\rangle$$ when Alice’s qubits align (i.e., she measures $$|0\rangle|0\rangle$$).

### References

Flarend, A., & Hilborn, B. (2022). Quantum computing: from Alice to Bob. Oxford University Press.

Mermin, N. D. (2007). Quantum computer science: an introduction. Cambridge University Press.