*This is part of a project to get people involved with quantum error correction. See here for more info.*

If you are reading this, you've probably seen the word 'quantum' before. Probably in a popular science article that called it 'weird', 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.

In this blog, which is usually about quantum error correction, I have been guilty of this exact same thing. But descriptions like this 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 (check out our own quantum game, for example).

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. If you have already been taught about vectors and complex numbers, you should probably find it quite straightforward. But for those who don't know about such things, this blog will try to give you some idea of the maths behind qubits.

**States and measurements**

First,
let’s 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__. Now that the names we are using for qubit states no longer look like numbers, we can 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. 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. I've written them in bold to help us remember that. 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 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__)

**x**

__up__

**+**(downness of

__S__)

**x**

__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__)^{2}+ (downness of__S__)^{2}
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

^{2}+ downness^{2}= 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

^{2}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)

^{2}= 1 just like 1^{2}= 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. Let's keep this possibility in mind.**Left and Right**

Now
we've made up a nice bunch of maths, let's do something with it.
Let's consider a specific superposition state, that has the same
upness as downness. We can give it a name that also lies between up
and down. Let's call it

__right__.
We
know that the upness and downness of

__right__are the same, and we know that sum of their squares must be 1. With this we can get a specific number for the upness and downness: They will both be √½. Now we can write down__right__in our mathsy way__right__= √½

**×**

__up__+ √½

**×**

__down__,

Since
we have called this

__right__, it would be nice to know if there is a__left__to go with it. Is there as state that is as different from__right__as__up__is from__down__? If there is, we must also be able to write it down in our mathsy way__left__= (upness of

__left__)

**×**

__up__+ (downness of

__left__)

**×**

__down__

The
overlap of

__left__and__right__will then be, using the equation from before for__S__and__T__,
overlap
of

__left__and__right__= (upness of__left__) × (upness of__right__)
+
(downness of

__left__) × (downness of__right__)
=
(upness of

__left__) × √½ + (downness of__left__) × √½
If

__left__and__right__are to be as different as__up__and__down__, their overlap needs to be zero. This will happen only if
(downness
of

__left__) = - (upness of__left__)
because
then we get

overlap
of

__left__and__right__= (upness of__left__) × √½ - (upness of__left__) × √½ = 0
So
one possible choice for

__left__is__left__= √½

**x**

__up__+ (-√½)

**x**

__down__

This
has an upness of √½, just as

__right__does, but it has a downness of -√½. This is a negative downness, just like the equation earlier hinted might be possible. What does this mean? Does it make any sense? Well it is rather strange. But the equation earlier also told us to only expect the squares of numbers to be completely sensible, and (-√½)2 does give us a nice sensible ½. So let's not worry too much yet.
So
far we've been thinking about everything as a superposition of

__up__and__down__. But now we have__left__and__right__, which are two states just as different as__up__and__down__. What does a superposition of these look like? Something like__S__= (leftness of

__S__)

**×**

__left__

**+**(rightness of

__S__)

**×**

__right__

As
an example, let's start with a state that has the same leftness as
rightness. So

__S__= √½

**×**

__left__

**+**√½

**×**

__right__

The
overlap of this state and

__left__is obviously √½, and the overlap for__right__is √½ too. What is the overlap for our trusty old friends__up__and__down__? Using the same sort of method as before, and calculating the overlaps of both__left__and__right__with up, we find
overlap
of

__S__and__up__= √½**×**(overlap of__left__and__up__)**+**√½**×**(overlap of__right__and__up__)
= √½ × √½ + √½ × √½ = ½
+ ½ = 1

So
the upness of this state is 1! Let's check the downness.

overlap
of

__S__and__down__= √½**×**(overlap of__left__and__down__)**+**√½**×**(overlap of__right__and__down__)
= √½ × √½ + √½ × (-√½) = ½
- ½ = 0

It
has a downness of 0! We already know a state with an upness of 1 and
a downess of 0. It's

__up__! This superposition of__left__and__right__turns out to be our good old friend__up__.__up__= √½

**×**

__left__

**+**√½

**×**

__right__

We
can similarly find a superposition for

__down__, but let's do this differently (for fun!). Let's trust that the weird**×**and**+**that we use on states really do have properties like multiplication and addition. Now let's look at the superposition__T__= (-√½)

**×**

__left__

**+**√½

**×**

__right__

Since
we have equations for

__left__and__right__as superpositions of__up__and__down__, let's stick these in.__T__= (-√½)

**×**(√½

**×**

__up__+ (-√½)

**×**

__down__)

**+**√½

**×**(√½

**×**

__up__+ √½

**×**

__down__)

Doing
a bunch of the maths from algebra lessons at school (see, it did come
in useful), we can make this into

__T__= (-√½) × (√½)

**×**

__up__+ (-√½) × (-√½)

**×**

__down__

**+**√½ × √½

**×**

__up__+ √½ × √½

**×**

__down__

=
-½

**×**__up__+ ½**×**__down__**+**½**×**__up__+ ½**×**__down__
=
(½

^{ }– ½)**×**__up__+ (½ + ½)**×**__down__
=

__down__
The

__up__part disappears and the__down__part gets strengthened. This is exactly the sort of thing that we call an*interference effect*, and which causes the strange quantumness in the double slit experiment.**All states are created equal**

With

__left__and__right__we have another pair of states that are completely different from each other, just as different as__up__and__down__. We saw that__left__and__right__are both superpositions of__up__and__down__, but__up__and__down__can also be thought of superpositions of__left__and__right__.
This
shows us an important fact about the states of quantum things, like
qubits. There are no states that can claim to be the 'proper' states,
with everything else just being their superpositions. Any state is as
important as any other. Any state can be thought of as a
superposition of other states.

This
fact often gets obscured when we are talking about quantum
computation. We like to think of this as a quantum version of a
normal computer, so the stories we tell ourselves have to be full of
0's and 1's. But the qubit states we choose to call 0 and 1 are not
really any more special than any other.

This
fact also gets obscured by the intuition we get from the real world.
For a cat in a box, as in Schrödingers famous thought experiment,
the states 'alive' and 'dead' do seem more sensible than all the
possible superposition states. This is just because big and
complicated objects, like cats, are constantly interacting with other
big and complicated things. These interactions, like getting looked
at or and having light and the air bashing into you all the time,
tend to be easier to describe using some states rather than others.
When and how things bash into into you, for example, depends on where
you are. So the interaction is much easier to describe using states
for which you have a definite position than ones for which you are a
superposition of being in different places. But for tiny things like
electrons, which haven't had all the quantumness bashed out of them,
superpositions of different positions are perfectly fine. And that's
what we see in the double slit experiment.

Since

__left__and__right__are just as important as up and down, it means we can also use them for measurements. When ask a qubit what state its in, we can ask it whether it is__up__or__down__, and a qubit in state__left__will have to randomly decide one or the other. But we could also ask it whether it is__left__or__right__, and an__up__qubit would need to randomly decide. In fact we can do an infinite number of possible measurements, where we ask if it is some state__S__or another state__S'__. The only restriction is that__S__and__S'__must always be completely different from each other: they must have an overlap of 0.**What did we just calculate?**

The
maths we just did involved a bunch of numbers, like overlaps and the
upness and downess. But what do these numbers actually mean? Do they
correspond to something that we can measure in an actual experiment,
to check that our maths is actually describing qubits
correctly? Fortunately, the answer is yes. And experiments have
conclusively shown that we are indeed doing it right.

Basically,
if we have a qubit in a state that can be written

__S__= (upness of

__S__)

**×**

__up__

**+**(downness of

__S__)

**×**

__down__

and
we measure whether it is

__up__or__down__, it will randomly choose to be one or the other. The probability that it chooses__up__is (upness of__S)__^{2}. The probability of down is (downess of__S)__^{2}. This shows us why upness2 + downness2 = 1, as we discovered earlier. We must always get one of the two possible options,__up__or__down__. Since it is certain to get one or the other, the probability for this must be 1.All other overlaps are similarly probabilities. If we have some state

__S__and some other state

__T__, the number

(overlap
of S and T

__)__^{2}is the probability that you will get the result

__S__if you are asking a qubit in state

__T__if it is

__S__or

__S__'. It is also the probability that you will get the result

__T__if you are asking a qubit in state

__S__if it is

__T__or

__T__'. Here

__S__' is the state that has no overlap with

__S__, and

__T__' is the state with no overlap with

__T__.

With this extra information we can start to wonder what it means when an overlap becomes negative. For example, say we have the state

(-1)

**×**__up__This has an upness of (-1). The condition upness2 + downness2 = 1 means that its downness must be zero, which is why it has no downness.

How does this new state

__d__iffer from

__up__? If we measure whether it is

__up__or

__down,__the probability of

__up__is (-1

__)__

^{2 }= 1. So it will definitely come out to be

__up__. If we measure anything else we will also get the same probabilities as if it were just

__up__. The fact that its upness is (-1) rather than 1 has no effect on what we actually see in the real world. So what does a negative upness mean? Not much, it seems. The difference between any state

__S__and the corresponding state (-1)

**×**

__S__is not something we can ever measure. So they are basically the same thing. Only when the difference between positive and negative happens in a superposition, as we saw for

__left__and

__right__, does it matter at all.

As we said before, it is the squares of the overlap that seem to have the job of being sensible. So the best way of measuring how similar two states are is to use the overlap squared, rather than the overlap itself. The overlap squared will give a value of 1 if the states are the same, 0 if they are different and something in between for something in between. It won't ever give a negative value. But the overlap itself retains the freedom be a bit crazy. It can be negative, at that lets it have some quantum fun.

**What can we do now?**

We now have enough maths to actually show how quantum systems can do things that would otherwise be impossible. But this post has already run on much longer than my usual 1000-1500 word limit. We probably all need to go and lie down for a week. So come back some other times and we'll look at entanglement, and how Bell's inequalities show us that it can do things more awesome than even Einstein could easily believe.

*
The maths we need is called linear algebra. It’s not unique to
quantum mechanics. You can use it for loads of stuff in your normal
everyday life too.