Here is a picture of a tiger and a bear overlaid on to one another. Though there are many ways one might try to achieve this effect, I used a rather exotic one: I created a quantum superposition of them on a quantum computer.

Before we get onto what quantum computers are, let’s have a quick primer on the more familiar ones. Normal computers are built of bits: tiny chunks of information that can take the value 0 or 1 .

Bits can also be combined to make bit strings, like 0001 or 0010 . These are a powerful way to encode pretty much any information. The simplest example is using them for numbers: 1 is 1, 10 is 2, 100 is 4 and so on for all the powers of 2 and everything in between.

Quantum computers are instead made of qubits. Like bits, these can take the values 0 and 1 , and we can combine them to make strings too. If we wanted, we could just use qubits as an alternative type of bit.

This would be a pretty expensive thing to do, as qubits need a lot more care and attention than bits. But since IBM offers prototype quantum processors for free on the cloud, it is not us that will have to pay the expense.

So let’s write some things with qubits!

The easiest thing to write are numbers, but they are a bit boring. So let’s go for text instead. The ASCII standard provides a way of assigning strings of letters, numbers and punctuation into strings of bits. This means we can use IBM’s 16 qubit cloud device to encode some emoticons.

Here’s a couple of emoticon bit strings we could use.

;) = 00111011 00101001

8) = 00111000 00101001

We are obviously not getting the full advantages of qubits when we just use them for emoticons. This comes not from how we encode information, but how we manipulate it. Rather than being restricted to the standard logic gates at the heart of normal computers, we can do more intricate quantum operations as well.

In some sense, these operations can allow a qubit to be both 0 and 1 at once: a quantum superposition. Quantum computers can then use these superpositions to create interference effects, just as we see when waves superpose. These effects can then be harnessed in our quantum programs, allowing us to find shorter routes between input and output.

But if we go back to just messing around with emoticons, we can use this functionality to create a superposition of ;) and 8) .

When we do this, we extract the output directly from the superposition. Because of this, we don’t see any of the subtlety of the interference. Instead, it just serves as a generator of random bit strings for ;) and 8) . These random outputs, combined with Matplotlib, can then be used to construct an image to represent the superposition.

Now let’s use the same principle, but do something more complex than just emoticons. Let’s superpose photos!

To do this, we need to give the photos a binary encoding. For a given set of binary strings, we assign each a certain image. This basically just means that we’ll take a bunch of image files, and give them binary strings as file names.