Qubit notation can be pretty tricky to pick up, but it is extremely useful once you understand it.
Here is the mathematical representation of a bit:
Let’s deconstruct this.
Since a bit is a two-state system it can either ever be a or a . The numbers represent the probability that the bit is measured in the or the state. The symbol is the generic term for a bit, which could be in either state.
When we measure a bit it will either be in the state or the state – like an on/off switch (which is also a two-state system!) that when measured will be in either the Off state or the On state.
A bit, however, can never be in both states at the same time – this simply doesn’t make sense logically (and, I guess physically). An On/Off switch is only ever turned On or Off. Thus, we have a few restrictions on probabilities . In particular, they can only ever take values 0 or 1 (representing 0% and 100%). Furthermore, whenever (which is when the bit is measured to be in state) must equal 0, and vice versa.
A qubit, on the other hand, has exactly the same mathematical representation, but the constraints on the probabilities are lifted! They can now take on any value between 0% and 100%, so long as the following condition is satisfied:
So, for a bit, we could have:
But for a qubit, we could have:
which works because it satsifies the constraint:
is a perfectly good representation of either a bit or a qubit, just with different restrictions on what the and the parameters can and cannot do.
Figure 1 – Graphical representation of the extra pockets that qubits have. These can hold more information, but also require more physical degrees of freedom. However, upon measurement, both qubit and classical bit still only return a single bit of information!
There is another name, a purely mathematical one, which describes a quantity which can be representated as – a linear combination. Thus, the quantity , a qubit state, can always be written as a linear combination of its two measureable states. A classical bit cannot be written as a general linear combination because, as highlighted above, either one of or must always be zero.
The terms superposition and linear combination are used almost synonymously when it comes to qubits. However, the term superposition should be reserved for a particular linear combination: the one where and are both equal to .
Now, why is that?
Well, as we shall see, with coefficients , the probability (which is the norm-squared of these numbers) turns out to equal exactly , which is 50%. So such a linear combination represents the possibility of measuring either the 0 state, or the 1 state, 50% of the time.
Keep in mind that this is not something which can be achieved with a classical bit.
We are about to see why this is so important!
The Hadamard Gate
Any qubit state can be put in to such a superposition by applying the so-called Hadamard Gate. The Hadamard Gate is a square matrix that looks like this:
and we have already seen it’s truth table in a previous blog, which also goes to show just how interesting this gate is, and how we just don’t have anything like it classically.
Let’s see what happens when we apply this gate to the state:
A similar calculation on the states shows:
We can actually construct the Hadamard Gate matrix using outer products (this method of constructing gate matrices was also discussed in my previous blog post here):
which is cool, and shows an alternative methods for coming up with the matrix itself, although guessing the exact combination for the outer product is not generally intuitive.
The Inner Product
The Inner Product (as opposed to the matrix-generating outer product discussed above) measures the angle between two vectors. It is a machine for combining two things and producing a real number. Symbolically, such a machine is written like this:
The two qubit states and can also have an angle-analogue between them. To compute them, we simply calculate their inner products:
Since this equals zero the two qubit states must be orthogonal to each other.
A similar calculation shows that the two states and are also orthogonal to each other:
And since their lengths are also 1 (as discussed earlier), we say that both of these form an orthonormal basis. Such things are extremely important for bridging the gap between pure mathematical analysis (which doesn’t use numbers, but uses symbols) and applied physics (which use numbers).
Thus any quantum state can be expressed as a linear combination (or superposition) of either of these pairs of basis states:
where again .
To understand entanglement we must first understand two (-or more) qubit systems. In general, we would have one qubit and a second qubit together. We would write this like so:
This might be called in some contexts a quantum register. An example of a two qubit system might be the explicit all-zeroes state: indicating that both qubits are in the 0 state. This two-qubit state can always be expanded as:
For a two-qubit system there can only ever be four outcomes:
Just two of these states are interesting. Can you guess which ones?
Consider these two states . What are these two states?
Well, if you were to measure the first qubit in either of these states you would immediately know the state of the other!
For example, in , the first qubit is in the 0 state, and the second is also in the 0 state. They match! They don’t so much equal one another as they are correlated with one another. Measurement of a 0 in one means the other must be a 0, and similarly for a 1.
These states , and equivalently , are so special and peculiar that they are given a special name: Bell states.
Bell states (and, in general, entangled states) are extremely powerful and could be said is the main reason why quantum computers are so powerful. Essentially, with a Bell state, you can make 1 measurement and obtain 2 bits of information, because once you measure the first qubit you gain knowledge of the second qubit because it’s 100% correlated.
Essentially, with a Bell state, you can make 1 measurement and obtain 2 bits of information!
Now, there isn’t anything particularly crazy going on here, after all, regular classical bits can also be in a similar situation. The problem is, for classical bits, there is just no way to get rid of the other two states . They’re always there.
If we could remove those from existence then our entire universe would consist of the just two states and knowing the first qubit would mean knowing the second. As it stands for regular bits, knowing the state of the first qubit gives you no knowledge of the second because the probability of it being 0 or 1 remains to be 50% each.
Is there a way that deletes those pesky states and just leaves the interesting states?
Yes there is! We can use destructive interference.
And it is only possible with qubits, you can’t do this with classical bits.
The CNOT Gate
So how does a CNOT Gate use the power of destructive interference to produce these highly correlated qubit states where essentially we are able to obtain 2 bits of information for 1?
As before, we begin with the truth table for a CNOT gate.
It’s easy to read this gate: If qubit A is a 0 then do nothing; else, if qubit A is 1 then switch B around.
The great thing about this is that it really makes it clear why the 0 state is so special and often employed along with the CNOT gate: If you CNOT anything with 0 you end up with anything … twice!
Don’t believe me? Well, what if I gave you 0? Then, from the above truth table, we have . Cool, OK. So what if I now gave you 1? Then we have .
See how both outputs are and ? We have essentially copied the input state on to the 0 state (in the computational basis). *whispers: we don’t get this if we use a different basis…
The CNOT gate essentially gives you the intriguing property that ! I.e. the first state is copied on to the second, zero state.
OK, sounds like a legitimate logic gate. So why is this so special?
Let’s go a little further. Repeating what we did in a previous blog post, we can employ our general formula to create the matrix representation of this logic gate:
but this isn’t really helping us because we want to be able to see this gate as performing this map:
where is addition modulo 2. But clearly, looking at not only the truth table above, but also thinking about the bottom-right corner of the CNOT matrix itself, the ordering of the last two qubit combinations (the and the combinations) are switched around.
This switching around of qubit combinations is not universal, however, as this operation does absolutely nothing to the first two combinations (the and the $|01\rangle$ ones).
Specifically targeting the last two combinations is like a controlled NOT operation. It’s basically saying, if the first qubit state is a 1 then perform a NOT, i.e. if the second qubit state is a 0 then switch it to a 1, and vice versa.
This is why sometimes you see the CNOT gate written like this:
But now we have replace one question with another: why is the XOR gate like addition modulo 2?
XOR & Addition Modulo 2
This is an easy question to answer: so long as you are thinking in base 2.
What is in base-2?
Well, in base-10 the answer is 2. But in base-2 there is no 2. 2 is 0. So .
Continuing in this fashion we get:
So that’s addition modulo 2, what happens if we try replacing something with the NOT gate?
Right, now going back to the list of 4 operations above, can we find the XOR pattern anywhere?
Yes we can:
So we can just replace that with
We almost got there. Problem is, the NOT gate doesn’t cover the first two situations.
What can we do?
Well, we can try the exclusive-OR, or XOR gate. This will be controlled by the first qubit and the target qubit will be second qubit:
And now, can we find this pattern in modulo 2 arithmetic? Yes:
So we can just replace it:
And now it should be clear that the addition modulo 2 of two qubits has the same truth table as a controlled-XOR, thus:
Finally, since we already know that
we must also have that
where I have, admittedly, exchanged notation of qubits from to .
In this post we covered off qubit notation and explored a little bit of the CNOT gate and how it is used to entangle qubits – something which classical bits cannot do. The CNOT gate is an extremely important gate in quantum information theory, not just because it is one of the universal quantum gates but also because of how it is able to somehow react to the values of qubit states and alter underlying probability distributions without making a single, irreversible measurement. Yet, the CNOT gate has a classical, deterministic truth table! It is beyond my current understanding, however, how a CNOT gate is physically implemented as it appears to me to be quite a technical challenge due to its sensitivity to decoherence: you are essentially copying (without really copying) the state of the control qubit onto the state of the target qubit.
This act can be understood as performing a controlled XOR on the target qubit depending on the observed state of the first qubit – but this observation is done coherently.
Never-the-less, we can see that the CNOT gate has a matrix representation and it also can be represented as both an XOR gate and as addition modulo 2 (only because the computational basis is made up of 1’s and 0’s which just happen to be the only elements of base-2! Things get a tad more complicated in the +,- basis).
 Nielsen, N. & Chuang, I. L. – Quantum Computation and Quantum Information, Cambridge University Press, (2010).