Last time, we discussed the quantum teleportation protocol, which relies on the phenomenon of quantum entanglement to move an arbitrary quantum state from one qubit to another, even if they are spatially separated. Today, we shall continue exploring the scenarios enabled by entanglement, by looking at the concept called “superdense coding”. It allows sending two classical bits of information by physically moving only a single qubit around, and is sometimes referred to as a conceptual inverse of teleportation.

### Superdense coding

The protocol was first proposed by Charles Bennett and Stephen Wiesner in their 1992 paper Communication via one- and two-particle operators on Einstein-Podolsky-Rosen states. Just like in the case of quantum teleportation, superdense coding starts of with two actors, Alice and Bob, sharing an entangled pair (EPR pair) of qubits. Once the entanglement is established, they can go their separate ways. Later on, Alice decides that she wants to send Bob a classical two-bit message – $00$, $01$, $10$ or $11$. It turns out, that thanks to superdense coding, she can convey these two bits of classical information using a single qubit that is currently in her possession. Of course at first glance this doesn't seem particularly exciting, after all, as we already know, a single qubit quantum state is continuous – the coefficients $\alpha$ and $\beta$ could be any values as long $\alpha^2 + \beta^2 = 1$ so there should be plenty of room to encode two classical bits there and send that over to Bob. The problem is of course that this information cannot be extracted out of the qubit – Bob would need to measure the qubit and receive one of the orthogonal computational basis states $\ket{0}$ or $\ket{1}$.

The clever solution to this problem proposed by Bennett and Wiesner was to use a Bell state, or more specifically, one of the four orthogonal Bell states representing the basis for two-qubit systems. As we learnt earlier, the Hilbert space spanned by these orthogonal states is four dimensional. Based on the message that she wants to send, Alice will encode the classical bits into the entangled pair by applying a relevant unitary transformation to her qubit and send it over to Bob using a quantum channel (e.g. and optical link them). Upon a joint measurement in the Bell basis, Bob will decode the two classical bits from the two qubits now in his possession – exactly those that Alice planned.

Ultimately, as Bennett and Wiesner point out, we still had to leverage two qubits to send two classical bits of information, which is not much different from having two classical bits sent over between the two parties in a classical way. However, in the quantum case, one of these qubits could be shared upfront and the communication protocol is later completed by physically moving only one of them.

The communication of two bits via two particles, one of which remains fixed while the other makes a round trip, is no more efficient in number of particles or number of transmissions than the obvious scheme of directly encoding each bit in one transmitted particle. Nevertheless, the EPR scheme has the advantage of allowing some of the particle transmissions to take place before the message has been decided upon, perhaps at cheaper “off'-peak” rates.

Superdense coding protocol is an important theoretical construct in the quantum information science. At the same time, currently, its practical benefits as a “lower bandwith” type of solution, as suggested in the original paper are still rather questionable, especially given the infant state of quantum hardware. Generally speaking using bits wherever possible is still dramatically cheaper and preferred over using the precious qubits. On top of that, in the field of quantum communications, there are still a lot of complexities related to stably moving and storing entangled particles over long distances. This was highlighted by David Mermin in his book Quantum Computer Science: An Introduction:

Like dense coding, many tricks of quantum information theory, including (…) teleportation, rely on two or more people sharing entangled Qbits, prepared some time ago, carefully stored in their remote locations awaiting an occasion for their use. While the preparation of entangled Qbits (in the form of photons) and their transmission to distant places has been achieved, putting them into entanglement-preserving, local, long-term storage remains a difficult challenge.

Despite these difficulties, there are additional application scenarios for superdense coding protocol – for example it is now clear that the field of quantum security can benefit greatly. The prerequisite of physically requiring both qubits to decode the encoded message makes superdense coding a very attractive tool for secure communications – it means that even if the qubit in transit is intercepted by an eavesdropper, it alone cannot be used to recover the initial message. One such approach was suggested by a group of Chinese researches back in 2005 in their paper Quantum secure direct communication with high-dimension quantum superdense coding.

Superdense coding was experimentally confirmed using a pair of entangled photos by K. Mattle, H. Weinfurter, P. Kwiat and A. Zeilinger from the University of Innsbruck in their 1996 paper Dense Coding in Experimental Quantum Communication. A diligent reader would at this point notice that, as we learnt in the previous part, the first realization of the teleportation protocol also happened at University of Innsbruck under the leadership of Anton Zeilinger.

### Mathematics of superdense coding

How does it actually work? It all becomes quite obvious very quickly, once we realize that the reason why superdense coding is often referred to as the inverse of quantum teleportation is because the decoding step that Bob needs to apply in the teleportation protocol, is actually identical to the encoding step Alice has to apply in superdense coding protocol.

Alice and Bob start off with a shared pair of entangled qubits. We shall refer to it as $\ket{\varphi_{ab}}$ but it is actually one of the four Bell states, the maximally entangled $\ket{\Phi^+}$.

$$\ket{\varphi_{ab}} = \frac{1}{\sqrt{2}}(\ket{00} + \ket{11}) = \ket{\Phi^+}$$

Alice and Bob can then set off in their separate directions, each one with a qubit of their own in their possession. Alice would then like to encode two bits of classical information into this shared entangled pair – and she can do it, by applying a single-qubit unitary transformation to her qubit only.

- to encode a classical $00$, she applies the no-op $I$ transformation
- to encode a classical $01$, she applies the $X$ transformation
- to encode a classical $10$, she applies the $Z$ transformation
- to encode a classical $11$, she applies the $Y$ transformation

By doing so, she may end up transforming the state of the entangled pair to one of the three other Bell states $\ket{\Psi^+}$, $\ket{\Phi^-}$ or $\ket{\Psi^-}$. This is summarized algebraically below:

$$(I \otimes I)\ket{\varphi_{ab}} = \frac{1}{\sqrt{2}}(\ket{00} + \ket{11}) = \ket{\Phi^+}$$

$$(X \otimes I)\ket{\varphi_{ab}} = \frac{1}{\sqrt{2}}(\ket{10} + \ket{01}) = \ket{\Psi^+}$$

$$(Z \otimes I)\ket{\varphi_{ab}} = \frac{1}{\sqrt{2}}(\ket{00} – \ket{11}) = \ket{\Phi^-}$$

$$(Y \otimes I)\ket{\varphi_{ab}} = \frac{1}{\sqrt{2}}(\ket{01} – \ket{10}) = \ket{\Psi^-}$$

At that point Alice sends off her qubit to Bob using a quantum communications channel. Bob can decode the two bits of information using a reverse Bell circuit – a $CNOT$ on both qubits, followed by an $H$ transformation on the qubit he received. As explained in the last post, this allows Bob to decompose a joint measurement in the Bell basis into standard single qubit measurements in the computational basis.

Depending on the encoding operation applied by Alice, as soon as Bob runs the qubits through a $CNOT$ gate, he recevies one of the following states:

$$CNOT(\frac{1}{\sqrt{2}}(\ket{00} + \ket{11})) = \\ \frac{1}{\sqrt{2}}(\ket{00} + \ket{10}) = \frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \otimes \ket{0}$$

$$CNOT(\frac{1}{\sqrt{2}}(\ket{10} + \ket{01})) = \\ \frac{1}{\sqrt{2}}(\ket{11} + \ket{01}) = \frac{1}{\sqrt{2}}(\ket{1} + \ket{0}) \otimes \ket{1}$$

$$CNOT(\frac{1}{\sqrt{2}}(\ket{00} – \ket{11})) = \\ \frac{1}{\sqrt{2}}(\ket{00} – \ket{10}) = \frac{1}{\sqrt{2}}(\ket{0} – \ket{1}) \otimes \ket{0}$$

$$CNOT(\frac{1}{\sqrt{2}}(\ket{01} – \ket{10})) = \\ \frac{1}{\sqrt{2}}(\ket{01} – \ket{11}) = \frac{1}{\sqrt{2}}(\ket{0} – \ket{1}) \otimes \ket{1}$$

The $H$ will then modify the overall state accordingly (for each of the four cases):

$$(H \otimes I) \frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \otimes \ket{0} = \ket{00}$$

$$(H \otimes I) \frac{1}{\sqrt{2}}(\ket{1} + \ket{0}) \otimes \ket{1} = \ket{01}$$

$$(H \otimes I) \frac{1}{\sqrt{2}}(\ket{0} – \ket{1}) \otimes \ket{0} = \ket{10}$$

$$(H \otimes I) \frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \otimes \ket{1} = \ket{11}$$

In other words, Bob now has 2 qubits that will, upon measurement, with 100% probability yield the two classical bits that Alice encoded – $00$, $01$, $10$ or $11$. This completes the protocol. The overall schematics of it are shown on the circuit below. It illustrates the case for encoding $01$ – so using the Pauli $X$ gate, but, as we discussed moments ago, all other three would look identical, with the only difference being that particular gate.

### Q# implementation of superdense coding

Let's now shift our attention to Q# code, and try to implement the protocol using that language. Of course the protocol itself is predominantly relevant in quantum communications – where a qubit is physically transferred from one location to another. Doing it in a single Q# application process does not bring a lot of value, but it is nevertheless a useful experiment to run, to try to confirm our understanding of the foundations of quantum information theory.

We start off by allocating two qubits and entangling them, creating the Bell state $\ket{\Phi^+}$. We showed already in the earlier posts that while it is possible to manually invoke the necessary gates, we can also use the helper operation $PrepareEntangledState$ from the $Microsoft.Quantum.Preparation$ namespace.

1 2 3 4 5 6 7 8 |
operation TestDenseCoding(val0 : Bool, val1 : Bool) : Unit { using ((q0, q1) = (Qubit(), Qubit())) { // prepare the maximally entangled state |Φ⁺⟩ between qubits PrepareEntangledState([q0], [q1]); Encode(val0, val1, q0); Decode(q0, q1); } } |

We'd like to test the dense coding protocol for all four cases – encoding of $00$, $01$, $10$ and $11$, so it makes sense to parameterize our operation with two input bits, represented by two $Booleans$. What follows, are two operations that are not defined yet – $Encode$, which will mimic what Alice did in our theoretical example from earlier on, and $Decode$, which will pretend to be Bob and his process of decoding of the two classical bits out of the two qubits.

The code to encode the two classical bits is shown next. As explained before, depending on what two-bit message we (or Alice) would like to convey, we would choose a no-op $I$ transformation or one of the three Pauli gates – $X$, $Z$ or $Y$. This way, the initial Bell state $\ket{\Phi^+}$ might be transformed into $\ket{\Psi^+}$, $\ket{\Phi^-}$ or $\ket{\Psi^-}$, or might stay the same.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
operation Encode(val0 : Bool, val1 : Bool, qubit : Qubit) : Unit { mutable encoded = ""; // if we encode 00, use Pauli I to keep |Φ⁺⟩ if (not val0 and not val1) { I(qubit); set encoded = "00"; } // if we encode 01, use Pauli X to create |Ψ⁺⟩ if (not val0 and val1) { X(qubit); set encoded = "01"; } // if we encode 10, use Pauli Z to create |Φ⁻⟩ if (val0 and not val1) { Z(qubit); set encoded = "10"; } // if we encode 11, use Pauli Y to create |Ψ⁻⟩ if (val0 and val1) { Y(qubit); set encoded = "11"; } Message("Encoded: " + encoded); } |

For the sake of tracking what we really end up encoding, we use a local mutable variable, that we can use to print out the encoded state. Finally, the decoding operation is shown below. It consists of a reverse Bell circuit and a measurement, with reset, on both qubits in the Pauli Z basis.

1 2 3 4 5 6 7 8 9 10 |
operation Decode(q0 : Qubit, q1 : Qubit) : Unit { // apply reverse Bell circuit CNOT(q0, q1); H(q0); // measure both qubits let result0 = MResetZ(q0); let result1 = MResetZ(q1); Message("Decoded: " + (result0 == One ? "1" | "0") + (result1 == One ? "1" | "0")); } |

To round things off, we need to add an entry point for our application that will invoke the $TestDenseCoding$ operation with various classical bit configurations.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
namespace SuperdenseCoding { open Microsoft.Quantum.Canon; open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Convert; open Microsoft.Quantum.Preparation; @EntryPoint() operation Start() : Unit { // encode 00 TestDenseCoding(false, false); Message("***************"); // encode 01 TestDenseCoding(false, true); Message("***************"); // encode 10 TestDenseCoding(true, false); Message("***************"); // encode 11 TestDenseCoding(true, true); Message("***************"); } // rest of the code omitted for brevity } |

Equipped with such a Q# program, we can now execute it to verify the correctness of the superdense coding protocol. We run four variants, corresponding to classical bits $00$, $01$, $10$ and $11$ being encoded, and we expect the decoded output to be the same. And this is exactly what we should see as the output of our program.

1 2 3 4 5 6 7 8 9 10 11 12 |
Encoded: 00 Decoded: 00 *************** Encoded: 01 Decoded: 01 *************** Encoded: 10 Decoded: 10 *************** Encoded: 11 Decoded: 11 *************** |

Once again, we are thrilled with the result and the opportunities that quantum computing presents us with. Something that not that long ago required a complex experimental setup and some of the greatest experimental physicists on the planet, can now be achieved and verified with several lines of Q# code, and (soon) executed on quantum hardware in the cloud using Azure Quantum.

### Summary

In today's post we discussed the historical background, as well as the mathematical foundations of the superdense coding protocol. We then proceed to implement it in Q#, verifying that our algebraic reasoning was indeed correct. Similarly to teleportation, we can think of superdense coding as requiring entanglement as a resource that gets consumed when the protocol is used.

In the next parts of this series we will move towards discussing quantum security and cryptography concepts.