Path: blob/main/notebooks/ch-algorithms/superdense-coding.ipynb
3855 views
Superdense Coding
This notebook demonstrates the Superdense Coding (SDC) protocol. We first use Qiskit's simulator to test our quantum circuit, and then try it out on a real quantum computer.
Contents
The Process 2.1 Step 1 2.2 Step 2 2.3 Step 3
Simulating the Superdense Coding Protocol 3.1 3.1 Visualizing Our Measurements
1. The Difference between Superdense Coding and Quantum Teleportation
Quantum teleportation and superdense coding are closely related, to avoid confusion we need to clarify the difference.
Quantum teleportation is a process by which the state of qubit () can be transmitted from one location to another, using two bits of classical communication and a Bell pair. In other words, we can say it is a protocol that destroys the quantum state of a qubit in one location and recreates it on a qubit at a distant location, with the help of shared entanglement. Superdense coding is a procedure that allows someone to send two classical bits to another party using just a single qubit of communication.
| Teleportation | Superdense Coding |
|---|---|
| Transmit one qubit using two classical bits | Transmit two classical bits using one qubit |
The teleportation protocol can be thought of as a flipped version of the superdense coding protocol, in the sense that Alice and Bob merely “swap their equipment.”
2. The Process

2.1 Step 1
The process starts with a third party, who we'll call Charlie. Two qubits are prepared by Charlie in an entangled state. He initially starts the 2 qubits in the basis state . He applies Hadamard gate () to the first qubit to create superposition. He then applies CNOT gate () using the first qubit as a control and the second as the target. This is the entangled state (Bell pair) we mentioned earlier.
Outcome States
We start in the state:
where the qubit to be sent to Alice is labeled with and the qubit to be sent to Bob is labeled . Charlie first applies a Hadamard gate to the first qubit, which creates superposition and we get the state:
Then Charlie applies the CNOT gate. The CNOT gate entangles both qubits, i.e. it flips the target if the control is . Note that the control qubit is our leftmost qubit.
2.2 Step 2
Charlie sends the first qubit to Alice and the second qubit to Bob. The goal of the protocol is for Alice to send 2 classical bits of information to Bob using her qubit. But before she does, she needs to apply a set of quantum gates to her qubit depending on the 2 bits of information she wants to send:
Encoding Rules for Superdense Coding (Alice protocol):
| Intended Message | Applied Gate | Resulting State () |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Thus if she wants to send a 00, she does nothing to her qubit (apply the identity () gate). If she wants to send a 01, then she applies the gate. Depending on what she wants to send, she applies the appropriate gate, then sends her qubit to Bob for the final step in the process.
2.3 Step 3
Bob receives Alice's qubit (leftmost qubit) and uses his qubit to decode Alice's message. Notice that he does not need to have knowledge of the state in order to decode it — he simply uses the restoration operation.
Bob applies a CNOT gate using the leftmost qubit as control and the rightmost as target. Then he applies a Hadamard gate and finally performs a measurement on both qubits to extract Alice's message.
| Bob Receives () | After CNOT-gate () | After H-gate |
|---|---|---|
3. Simulating the Superdense Coding Protocol
We saw that to create an entangled pair, we needed to do a H-gate followed by a CNOT. Let's create a function that takes a QuantumCircuit and entangles the qubits with indices a and b:
Next we need to encode our message. We saw that there were four possible messages we could send: 00, 10, 01 or 11. Let's create a function that takes this message and applies the appropriate gates for us:
Finally, we need to decode our message, we saw we could do this using a CNOT followed by a H-gate. Let's create a function that does this for us too:
Finally, we can put this together to complete our protocol.
Our simulator simulates a perfect quantum computer. We can see that, without errors, we get a 100% chance of measuring the correct message.
As we see that there are a few results from the other three states when run in a real quantum computer. These are due to errors in the gates and qubit decoherence. We will learn more about these errors in later sections.