# Superdense Coding: The Quantum Clown Car

A qubit is bigger than a bit, and scales differently than them. This means one can use just a few qubits to store many many bits.

This protocol shows how one can encode a two bits inside one qubit, then use entanglement to transmit those bits.

## Introduction

One is the loneliest number that you'll ever do. Two can be as bad as one; it's the loneliest number since the number one.

Qubits scale differently than bits, and in such, you can fit many bits in just a few qubits. This algorithm shows how you can fit two bits in one qubit, to then transmit that qubit using entanglement. Quantum entanglement is what unlocks the power of quantum computing.

Two can be as bad as one

It's the loneliest number since the number one.

-Three Dog Night

## Protocol

The point of this protocol is to illustrate how qubits scale differently than bits. That is, you can fit an exponential number of bits inside a number of qubits. This is where the “superdense” part comes from. The “coding” part is because the classical information has to be decoded from the qubit by using some quantum gates and an auxiliary qubit for readout.

## Step 1

First, we start with two qubits, and create the entangled Bell state $\frac{\vert 00 \rangle + \vert 11 \rangle}{\sqrt{2}}$. If you want to review how this is done, check out For Whom the Bell Entangles.

One qubit will contain the information, and the other one will be to aid in the decoding.

## Step 2

This is the step where the classical information, in the form of two bits, is encoded as quantum information, in the form of one qubit.

To encode 00, do nothing to the first qubit $∣00⟩$.

To encode 01, do a Z gate to the first qubit to transform the state into $\frac{\vert 10 \rangle + \vert 01 \rangle}{\sqrt{2}}$.

To encode 10, do a Z gate to the first qubit to transform the state into. $\frac{\vert 00 \rangle - \vert 11 \rangle}{\sqrt{2}}$.

To encode 11, do an X gate then a Z gate to the first qubit to transform the state into $\frac{\vert 01 \rangle - \vert 10 \rangle}{\sqrt{2}}$.

That is it. Now two bits of information are encoded inside the first qubit. This shows that quantum information is denser, allowing to fit many qubits inside one qubit.

## Step 3

Now, to decode the classical bits, we reverse the entangling sequence from the beginning. This leaves the state as,

for 00, the state is $\lvert 00 \rangle$,

for 01, the state is $\lvert 01 \rangle$,

for 10, the state is $\lvert 10 \rangle$,

for 11, the state is $\lvert 11 \rangle$.

And measurements of each qubit reveals the bits. It is done!

## Quantum Circuit

Now, let's look at the quantum circuit that accomplishes the same protocol. For this, we wrote the circuit using QISKIT. Go ahead, look at the code, run it once. I’ll wait here.

Done? Great. We first create the Hilbert space for each of the two qubits needed. We also create two classical bits, needed to hold the outcome of the measurements. We also initialize the quantum circuit on those spaces.

q = QuantumRegister(2) c = ClassicalRegister(2) qc = QuantumCircuit(q, c)

## Step 1

We entangled the two qubits, in a similar way was we did in For Whom the Bell Entangles.

qc.h(q[0]) qc.cx(q[0], q[1])

## Step 2

Depending on what classical info you want to encode in the qubit, we need to perform a specific unitary transformation on qubit 0. In the code this is done by uncommenting one of the following.

To send 00 as the info, do nothing.

To send 01 then do a Z gate uncomment the following line:

#qc.z(q[0])

To send 10 do X gate uncomment the following line:

#qc.x(q[0])

To send 11 uncomment the following two lines:

#qc.x(q[0]) #qc.z(q[0])

## Step 3

To decode the classical info in the qubit, we carry out the entangling operation in reverse.

qc.cx(q[0], q[1]) qc.h(q[0])

And finish with Measurement gate to read out the classical bits from the qubits

qc.measure(q, c)

You can look at the histogram, and the binary values under each bar correspond to the encoded bits. This shows how it is possible to encode two bits by manipulating qubit 0.