- Published on

# Quantum Telepathy: Send More with Less Using Superdense Coding

- Authors
- Name
- Galih Laras Prakoso
- @galihlprakoso

I'll start this blog post with an illustration about information. When we talk about information, our intuition leads us to almost everything in our lives right now. Powered by Information Technology, we are flooded with information every minute of our lives from social media, online news, and more.

Most of our Information Technology today is driven by the immense power of Classical Computing (electronic devices that only understand 0 and 1). If our classical computers only understand 0 and 1, how can they be so powerful and become the backbone of modern Information Technology?

0 and 1 might seem simple, but imagine you have `24`

slots that can store just 0 and 1 information. You could do a lot of things. For example, we can describe the 🔴 (Red) color using these slots just like how our Classical Computing understands the red color:

```
11111111 00000000 00000000
```

What's that? That's the binary representation of the red color using the RGB (Red, Green, Blue) system. In decimal, we see it as `255 0 0`

. We know that we can get "all" possible colors by only using these fundamental colors. So `11111111 00000000 00000000`

or `255 0 0`

represents that the Red value is set to the maximum while the others (Green and Blue) are zero.

With 24 slots, we can describe $2^{24}$ different kinds of information. Wow, that's a lot. 🤔 So our Classical Computing, which might seem simple, can become powerful and solve many real-world problems using these very basic fundamentals (0 and 1).

## Sending Information using Classical Computing

In a classical computer, we call that slot in the previous section a bit. To send those bits using Classical Computing, we need exactly the $n$ number of bits we want to send. Let's say you want to send 8 bits of information; you will need 8 bits to send that information. It makes sense because a single bit can only be in one state at a time (either 0 or 1).

So, what do we do when we want to send a large amount of data, and our computer doesn't have enough bits to send or process? Chill, we can still process or send those large amounts of data chunk by chunk. It might sound lame, but it satisfies our needs right now; nobody is really complaining about that.

What's this blog post about? It seems that we don't have any interesting problem with how our Classical Computing works. Yeah, that might be true for our daily personal lives. But our Classical Computing will struggle when we need to use it to solve more complex problems, like finding new kinds of drugs to cure diseases, modeling how natural events work, etc.

Luckily, we have Quantum Computing. Using Quantum Computers, we can send 2 bits of information using only 1 qubit. A qubit is the atomic representation of information in Quantum Computing, analogous to a bit in Classical Computing.

## Superposition

In Classical Computing, a bit is the atomic part of its information and can only be in one state at a time (0 or 1). In Quantum Computing, 1 qubit can represent both states at the same time; it can be 0 and 1 simultaneously. This is what we call superposition in Quantum Computing.

$\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})$

So, it can be half zero and half one probabilistically at the same time. Don't worry about the mathematical syntax right now—nothing fancy there; it's just a way to describe a state in Quantum Computing. For now, you only need to know about:

**Bra-Ket notation**: As you can see, we define a qubit state using this weird syntax $\ket{0}$. This is just another representation of a vector: $\begin{pmatrix} 1\\ 0 \end{pmatrix}$, while $\ket{1}$ is another representation of a vector: $\begin{pmatrix} 0\\ 1 \end{pmatrix}$.**Scalar**: The scalar represents the probability of each state or the probability amplitude: $\frac{1}{\sqrt{2}}$. Why are we using a square root here? To calculate the actual probability, we need to get the squared absolute value of the scalars $|\frac{1}{\sqrt{2}}|^{2} = \frac{1}{2}$. So when the state is in superposition in this case, it means that it's in a state represented by a linear combination of half 0 and half 1.

## Entanglement

Superposition is only one of the several strange capabilities of Quantum Computing. There's another one for you: Entanglement. Entanglement means that our qubits in quantum computing can become entangled. Once entangled, the qubits are somehow connected in a very strange way. Even if we bring these entangled qubits far apart, they remain entangled.

$\frac{1}{\sqrt{2}}(\ket{00} + \ket{11})$

When the first qubit is measured as 0, the second qubit will automatically become 0, and vice versa. We can imagine this mathematically using the syntax above.

## Quantum Circuits and Gates

In Quantum Computing, we can manipulate qubits using Quantum Circuits and Quantum Gates. As you can see in the thumbnail of this blog post, that’s a picture of Quantum Circuits and Quantum Gates. If this is your first time seeing them, don’t worry. Quantum Circuits are just like race circuits where qubits go in one direction while also being manipulated by gates. At a high level, it’s pretty simple, though the process might be quite challenging to understand.

Using these concepts, we’re going to learn about an awesome concept in Quantum Computing, which is...

## Superdense Coding

You can think of Superdense Coding as a method or protocol that enables the capability of sending two classical bits using a single qubit. This method or protocol has huge potential to improve many aspects of information technology, including networking, cybersecurity, IoT, satellite communication, and more.

So, in my opinion, it’s totally worth investing our time to dive a little deeper to understand how it works. Let’s start with a simple problem illustration.

In this illustration, Alice wants to send the information `01`

to Bob. Using classical computing, she would need to send both bits to Bob because classical computing only allows one state at a time per bit. In this illustration, she sends the first bit with the state `0`

and the second bit with the state `1`

.

### Quantum Telepathy

This is one sample use case proving that Quantum Computing can outperform Classical Computing. Using Quantum Computing, Alice only needs to send one qubit instead of two. I will explain step by step what we need to do in Quantum Computing to help Alice improve her communication with Bob.

Let’s start with this initial Quantum Circuit:

Imagine that Alice and Bob are each holding one qubit, so there are two qubits in this circuit. Did I lie? I said we would only use one qubit, but here we should use two qubits? Yeah, that’s actually what I questioned when I first learned about Superdense Coding.

But no, I didn’t lie. What I mean by only using one qubit is when we’re talking about sending. We will see that Alice is not sending two qubits like she would in classical computing. Instead, she will only need to send her single qubit to Bob to convey her information.

So right now, the state of the two qubits that Alice and Bob hold would be:

$\ket{\psi} = \ket{00}$

Nothing special here, it's only static zero qubits. We name the combined state of the qubits of Alice and Bob as $\ket{\psi}$

### Entangle their Qubits

This step is where the first magic of "Telepathy" happens. We can entangle the qubits that Alice and Bob hold by using these two Quantum Gates:

- $H$ (Hadamard Gate)
- $CNOT$ (Controlled Not) Gate

The Hadamard gate evolves the state of a qubit into superposition. The CNOT gate simply inverts the target qubit's state if and only if the control qubit is 1. Let’s see it in action:

Applying the Hadamard gate to Alice’s qubit will transform her qubit into this state:

$H\ket{0} = \frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1}$

So, any Quantum Gate has its matrix representation. What I mean by applying a quantum gate to a quantum state is simply matrix-vector multiplication.

$\begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt{2}} + 0 \\ \frac{1}{\sqrt{2}} + 0 \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix}$

So far, it's just high school math 😮💨, nothing to worry about. Next, we need to apply the $CNOT$ gate where Alice's qubit is the control and Bob's qubit is the target. This means that whenever Alice's qubit is `1`

, Bob's qubit will be inverted. Before applying the $CNOT$ gate, the combined state of Alice and Bob’s qubits ($\ket{\psi}$) is:

$\ket{\psi} = (\frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1}) \otimes \ket{0}$

Or:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{00} + \frac{1}{\sqrt{2}}\ket{10}$

After applying the $CNOT$ gate:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{00} + \frac{1}{\sqrt{2}}\ket{11}$

Whenever Alice's qubit is `1`

, Bob's qubit will be inverted (`0 -> 1`

). This means that their qubits are now entangled. The state of Bob's qubit will now depend on Alice's qubit.

After their qubits are entangled, they can go as far as they want. Scientists even say that the qubits would still be entangled no matter how far apart they are. When Alice is on Earth and Bob is on Mars, their qubits will still be entangled. Einstein called this event "Spooky Action at a Distance."

Now, let's imagine that Alice and Bob are separated:

Let's focus on Alice now. As you can see in the image above, Alice has some kind of interface with controlled operations connected to it. The first is the $CZ$ (Controlled Z) gate and the $CNOT$ gate. This means that before sending her qubit to Bob, she will apply one or two operations depending on the information she wants to send.

- If Alice wants to send
`00`

, she will not perform any operation on her qubit. - If Alice wants to send
`01`

, she will perform a $NOT$ operation on her qubit. - If Alice wants to send
`10`

, she will perform a $Z$ operation on her qubit. - If Alice wants to send
`11`

, she will perform both $NOT$ and $Z$ operations on her qubit.

Let's break down the mathematical representation of each possible case.

#### Alice Wants to Send 00

In this case, Alice is not doing any operations on her qubit. So, the state of her qubit will be the same, nothing's changed.

#### Alice Wants to Send 01

Applying the $NOT$ gate on Alice's qubit, will transform the state from:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{00} + \frac{1}{\sqrt{2}}\ket{11}$

Become:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{10} + \frac{1}{\sqrt{2}}\ket{01}$

We just simply invert the state on Alice's qubit.

#### Alice Wants to Send 10

Applying the $Z$ gate on Alice's qubit will simply transform the state from:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{00} + \frac{1}{\sqrt{2}}\ket{11}$

Become:

$\ket{\psi} = \frac{1}{\sqrt{2}}\ket{00} - \frac{1}{\sqrt{2}}\ket{11}$

The sign changed from `+`

into `-`

. How it happens? To understand it completely. We need to start from our very initial state. First, Alice qubit in the state:

$\ket{0} = \begin{pmatrix}1 \\ 0 \end{pmatrix}$

The combination of both qubits owned by Alice and Bob is represented by the tensor products of their qubit state:

$\ket{\psi} = \ket{0} \otimes \ket{0} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \cdot 1 \\ 1 \cdot 0 \\ 0 \cdot 1 \\ 0 \cdot 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}$

Applying $H$ Hadamard operation on multiple systems (tensor products of two qubits in this case) is quite different. Before we could apply $H$ operation on state vector, we should multiply $H$ operation with $I$ (Identity Matrix). Because we can't apply 2 by 2 matrix to 1 by 4 matrix.

$H \otimes I = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{pmatrix}$

As you can see that by doing this, we get the 4 by 4 matrix. Now we could apply this $H \otimes I$ operation into our multi-qubit state.

$(H \otimes I)\ket{00} = \begin{pmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}}(\ket{00} + \ket{10})$

As you remember that to create entanglement, we need to apply the $CNOT$ gate with Alice's qubit as control and Bob's qubit as target. $CNOT$ matrix is having this matrix representation:

CNOT = \begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{ pmatrix }

It's similar with $I$ matrix but as you can see in the third row, column 3 and 4 the $I$ matrix seems to be swapped. So what we need to do is just multiply this matrix with our qubit state in vector representation"

$\ket{\psi} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix}$

Or in Bra-ket notation would look like this:

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

Now as you can see, you see how two qubits are entangled in their matrix representations. How about $Z$ gate?

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

It's similar with $I$ matrix but the $1$ in the bottom right is $-1$ instead of $1$. Similar to the previous $H$ operation that we need to do the tensor product of $Z$ and $I$.

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

Then we could apply this to our entangled qubits:

$(Z \otimes I) \ket{\psi} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \\ -1 \end{pmatrix}$

In Bra-ket notation:

$\ket{\psi} = \frac{1}{\sqrt{2}}(\ket{00} - \ket{11})$

#### Alice Wants to Send 01

In this case, Alice will apply $NOT$ gate to her qubit so the state becomes:

$\ket{\psi} = \frac{1}{\sqrt{2}}(\ket{01} + \ket{10})$

#### Alice Wants to Send 11

In this case, Alice will apply both the $Z$ gate and $NOT$ gate to her qubit. So the state will simply becomes:

$\ket{\psi} = \frac{1}{\sqrt{2}}(\ket{01} - \ket{10})$

### Alice Sends her Qubit to Bob

Now, Alice already applied a certain operation on her qubit based on information she wants to send. Next, Alice just need to give her qubit to Bob.

After Alice sends her qubit to Bob, the spotlight is on Bob. After Bob receives Alice's qubit, he cannot directly know what classical information Alice sent. He needs to perform some operations on the qubits (now he has two qubits).

First, he needs to perform a CNOT operation, followed by an $H$ operation on Alice's qubit before he finally measures those two qubits to get the classical information.

For the sake of simplification, I'll provide one example based on one of the use cases we've seen in the previous section. Let's say the classical information that Alice sent is `11`

. First, Alice and Bob share entangled qubits:

$\ket{\psi} = \frac{1}{\sqrt{2}}(\ket{00} + \ket{11})$

Applying $XZ$ operation to the state could be represented by the result of multiplication of those two operations:

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

As usual, before we could apply this operation matrix to our state vector, we need to do the tensor product with matrix $I$:

$XZ \otimes I = \begin{pmatrix}0 & 1 \\ -1 & 0 \end{pmatrix} \otimes \begin{pmatrix}1 & 0 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix}0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \end {pmatrix}$

Performing the $(XZ \otimes I)$ to the entangled qubits produced this matrix:

$\begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \end{pmatrix} \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 0 \\ 1 \\ -1 \\ 0 \end{pmatrix}$

In Bra-ket notation:

$\ket{\psi} = \frac{1}{\sqrt{2}}(\ket{01} - \ket{10})$

#### Bob Applies the CNOT Operation

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

In matrix representation:

$\frac{1}{\sqrt{2}} \begin{pmatrix} 0 \\ 1 \\ 0 \\ -1 \end{pmatrix}$

#### Bob Applies the H Operation

Last step is applying the $H$ operation to Alice's qubit.

$(H \otimes I) \frac{1}{\sqrt{2}} \begin{pmatrix} 0 \\ 1 \\ 0 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}} \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \\ 0 \\ -1 \end{pmatrix} = \frac{1}{2} \begin{pmatrix} 0 \\ 0 \\ 0 \\ 2 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix}$

The resulting state is:

Ooh, ooh, ooh, it's magic! You knooow.. ♫♪... Yes, it's true! With Quantum Computing, we can transfer two classical bits by sending just one qubit. Isn't that amazing? This is just one example of how Quantum Computing surpasses Classical Computing.

Understanding Superdense Coding opens the door to many more "magical" powers of Quantum Computing. There's so much more waiting for us to explore! Share your thoughts in the comments below! 🍻