Quantum Computation with the simplest maths possible

I’m sure you will have seen the word ‘quantum’ before. Probably in a popular science article that called it weird and crazy, and didn’t tell you much else. Or maybe you heard it in Sci-Fi, where scientists treat equations like incantations that just need to be put it in a computer for magic to happen.

I’m sometimes guilty of this exact same thing. But such descriptions have serious drawbacks. They make everything seem intangible, beyond the understanding of mere mortals and only to be dealt with by great sages. This is not true at all. I work on quantum stuff, and I’m a bit of an idiot. So now it’s time to tell you the truth about quantum!

To do this, we are going to need some maths. But don’t be scared! Maths isn’t always scary. Puzzles are maths, and they are fun.

I’m not saying that the maths in this post will be fun, but I’ll keep it as simple and painless as I can. I’ll only use the kind of maths that people learn at school, and I’ll bear in mind that you’ve probably forgotten it all (and probably never understood it in the first place).

The basic maths of quantum mechanics isn’t all that hard. In fact, it can be a lot easier than what we have to deal with in the non-quantum world sometimes.

To keep it as easy as possible, we’ll be thinking about the simplest kinds of quantum objects. These will only be able to do two possible things. Like a coin, that can be either heads or tails. Or a bit that can be 0 or 1. But they’ll also be able to be both at once in a weird and magical quantum way.

Oops! I went all flakey again. I should have said that they can be two things at once in a perfectly understandable and mathematically precise way. Let’s check it out.

States and measurements

First, we need to give our simple little quantum objects a name. We call them quantum bits, or qubits.

Next, we need to talk about states. We use the word ‘state’ to describe what a bit, or qubit or whatever is doing. Bits are pretty simple because they only have two possible states: 0 and 1. At any time it is either in state 0 or state 1. It cannot be both and it cannot be neither. A qubit is also built around these two basic states. But it can also be one of an infinite number of superposition states, where it is some degree of 0 and some degree of 1 at the same time.

When you measure a bit, you ask it whether it is in state 0 or state 1. You can also ask the same question of qubits. If its state is not 0 or 1, but is instead in a superposition of them, the qubit will randomly choose which one to be. If the superposition is more biased towards 0, you’ll most likely get 0 and vice-versa.

It would be nice to get more information out of a qubit. It would be nice to find out exactly which of the infinite number of superposition states it is in. Unfortunately, there is no way to do this. We are limited to simply asking whether it is in one state (like 0) or a completely different state (like 1), and putting up with randomness in the result when it is neither.

Though the two basic states for a qubit are called 0 and 1, these are just labels we have chosen. They could equally be called ‘Yes’ and ‘No’, or ‘Grey’ and ‘Pineapple’, or ‘£’ and ‘%’. They are not really the actual numbers ‘0’ and ‘1’, that we can add and multiply. So it can be confusing when we start putting them into equations. To avoid this confusion, we usually write them down in a slightly strange way. For a qubit in state 0 we write |0>. For one in state 1 we write |1>. Here the | and > aren’t going to actual do anything in any equations. They are just to remind us that the 0 and 1 are names for quantum states and not actual numbers.

This notation has scared many an undergraduate physics student, so let’s avoid it here. Instead let’s use different labels for the qubit states. For the qubit state usually known as 0, let’s instead call it up. For the state usually known as 1, let’s call it down. Let’s also put up and down in bold to mark them out as special. This will all let is avoid the weirdness of | and >.

Making up some maths

Now let’s try to describe quantum states with maths. One thing you need to know about maths is that it’s perfectly fine to make the rules up as you go along. This might come as a surprise to you, since you’ve probably been taught it as a set of rigid rules and methods that must be obeyed. But these are just sets of rules that turned out to be useful for something. For quantum mechanics we’ll need some new maths*, so let’s start making it up.

Firstly, it would be useful to have some way of quantifying how similar two states are. We’ll call this the overlap. The states up and down are completely different, so these should have an overlap of 0 (this is the actual number zero this time). For states that are 100% the same, let’s say that the overlap is 1.

Now we have a new mathematical thing to calculate. We just have to make up the mathematical rules that we can use to calculate it.

For the two states up and down, there are only four possible overlaps to calculate and we know what they should be already.

overlap of up and up = 1

overlap of up and down = 0

overlap of down and up = 0

overlap of down and down = 1

Now we need to work out overlaps for superposition states. There are many different possible superpositions of up and down, which differ by how biased they are towards one or the other. This means we need two numbers, let’s call them the upness and downness, that describe how much up and down there is in a superposition

It would also be nice to have a shortened name for the superposition state that we are trying to describe. Let’s just call it S. Now we need to write down the fact that S is a superposition of up and down and also what its upness and downness are, in a way that looks mathsy. How about

S = (upness of S) × up + (downness of S) × down

This nicely puts all the required information on one line. It even has has an + and some ×’s in to make it look like maths. These look suspiciously like addition and multiplication. But what does it even mean to multiply a state by a number? Or to add two states? These aren’t the addition and multiplication that we are used to. It will turn out that they will follow similar rules to the normal ones, though. So that’s why we use these symbols.

Now, what is the overlap between our superposition state S and the state up? We still haven’t made up enough rules to actually calculate this, so we have to choose something. We have just introduced the notion of upness, which is how much up there is in S. This seems to be pretty much the same thing as the overlap between S and up, and it wouldn’t contradict any of the rules we have already if they were the same thing. So let’s just make up the rule that says they are the same thing.

overlap of S and up = upness of S

There’s a more complicated way we can write this, that can help us understand a little more about what is going on.

overlap of S and up = (upness of S) × (overlap of up and up)

+ (downness of S) × (overlap of down and up)

Here the overlap of S and up is a sum of two things. The first is the contribution from the up part of S

(upness of S) × (overlap of up and up) = (upness of S) × 1 = upness of S

This tells us that the up part of S contributes the upness (obviously), and it contributes it fully because the overlap between the up part of S and up is 1.

The second contribution is from the down part of S

(downness of S) × (overlap of down and up) = (downness of S) × 0 = 0

This tells us that the down part of S would contribute the downness if it contributed anything. But it doesn’t actually contribute it because the overlap between the down part of S and up is 0.

We get a similar equation for the overlap of S and down.

overlap of S and down = (upness of S) × (overlap of up and down)

+ (downness of S) × (overlap of down and down)

This time the overlaps of up and down ensure that the downess contributes fully, and the upness doesn’t contribute at all.

What about the overlap with something else? If we look at the overlap between S and down, and the overlap for S and up, the only difference is that one has up in and the other has down. So maybe we can just replace that with anything else too. Let’s invent a new state and call it T, for no other reason but it coming after S in the alphabet. The overlap of S and T is then

overlap of S and T = (upness of S) × (overlap of up and T)

+ (downness of S) × (overlap of down and T)

In these equations we have × and +, multiplying and adding normal numbers. These are indeed the multiplication and addition that we are used to. From these equations you can maybe see why I used × and + before. Compare the equation for S with the equation for its overlap with T

S = (upness of S) × up + (downness of S) × down

overlap of S and T = (upness of S) × (overlap of up and T)

+ (downness of S) × (overlap of down and T)

These are pretty much the same. The only difference is that each state in the first one has been replaced by the overlap of that state and T in the second. This means that the second one just has normal numbers in. So the weird multiplication and addition in the first one become normal in the second. So, whatever x and + are, they must be some version of multiplication and addition that work with the states of qubits, and just become normal multiplication and addition once we just start calculating with numbers. We won’t need to think much more about this, though.

Let’s think more about the overlap between S and our new state T. Firstly, just like S we should be able to write T as

T = (upness of T) × up + (downness of T) × down

Earlier we made a rule that the upness of a state is the same thing as its overlap with up. This rule lets us write the equation for the overlap of S and T in a simpler way.

overlap of S and T = (upness of S) × (upness of T) + (downness of S) × (downness of T)

This lets us work out the overlap of S and T using their upness and downess, which are just numbers that we know.

Now let’s ask a question for which we already know the answer. What is the overlap between S and itself? Using the maths above

overlap of S and S = (upness of S) × (upness of S) + (downness of S) × (downness of S)

= (upness of S)² + (downness of S

Since we are looking at the overlap between two states that are exactly the same, the answer should come out to be 1. So now we know something about the relationship between the upness and downness for any quantum superposition

upness² + downness² = 1

This makes a lot of sense. The more a state is biased towards up, the less it must be biased towards down. For example, a state with an upness of 1 (and so with an upness² of 1 too) is completely up, and so has no downness. The first concrete fact that our quantum maths has told us isn’t weird at all. See, quantum mechanics isn’t so strange.

Well, maybe it is a little bit strange. Note that we don’t just add upness and downness here. Instead we square them first. One thing we know from school is that negative numbers square to the same value as positive ones. (-1)² = 1 just like 1² = 1, for example. So maybe this equation is telling us that its okay for the upness and downness to be negative, even though this would be a bit weird, because these numbers only need to be sensible after we’ve squared them.

The possibility of these negative numbers is what all quantum awesomness is based on. But let’s leave some of that fun for another day.

Wrangler of qubits. Drinker of tea. Father.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store