Computer Science

Characteristics of Qubits & Quantum Processing

In my previous post, I took a look at classical bits and how they’re used to create the gates and circuits that classical computers run on. Now we can start talking about quantum computation, which uses qubits. Where classical computers use transistors to signal either a high-voltage 1 state or a low-voltage 0 state, quantum computers use quantum objects which behave according to quantum mechanics.

These quantum objects include microscopic particles like photons and electrons. The particles have properties (like the direction of their spin or the charge they hold) that can be used to represent a 0 or a 1 state, similar to a classical bit. Except because we’re talking about quantum states, not classical ones, we need to use different notation:

$$\ket{0}$$ $$\ket{1}$$

This notation for writing quantum states is referred to as kets.

This is the part where bits and qubits start behaving differently: unlike bits, which only exist in a state of either 0 or 1, a qubit can exist in a superposition of the two states. However, it is really important to note that measuring a qubit modifies the state - when we measure the quantum object, we lose all the information about the superposition it was in just a moment earlier and are only able to measure either a 0 or a 1. Furthermore, we don’t know for sure what state the qubit will be in until we measure it, and while it is in that quantum state its nature is considered probabilistic.

Expressing Superposition

While a qubit is still in a superposition of the two computational states, we can express that superposition like so:

$$\ket{ψ} = a_1\ket{0}+a_2\ket{1}$$

In this equation, a1 and a2 are coefficients and they can be any complex numbers. Their relative magnitudes to each other indicate how much of a chance each state has of being measured compared to the other state. These coefficients can be turned into probabilities using the following formulas:

$$P(\ket{0}) = \frac{|a_1|^2}{|a_1|^2+|a_2|^2}$$ $$P(\ket{1}) = \frac{|a_2|^2}{|a_1|^2+|a_2|^2}$$

Also, we can use normalization in order to make sure the qubit is in a valid state. To do this, take the denominator from those equations (which represents the probability of the first state plus the probability of the second state) and set it equal to 1:

$$|a_1|^2 + |a_2|^2 = 1$$

This can further be generalized like so:

$$\sum_{i} |a_i∣^2 = 1$$

Regardless of the value of i above (aka the number of coefficients/states involved), we can still use normalization in the same way. And this makes sense, because all of the probabilities need to add up to 1 (similar to how if you represented the state with percentages, they would need to add up to 100%).

It’s important to note that the magnitude of the coefficients is not really what is important, instead what matters is how big the magnitudes are relative to each other. If you were to multiply all the coefficients by the same common multiple, you would still be describing the same quantum state and nothing about the probabilities would change.

UNIFORM States

Let’s take a look at an example that illustrates the formulas above in action:

$$\frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1} = \ket{ψ}$$ $$|\frac{1}{\sqrt{2}}|^2 + |\frac{1}{\sqrt{2}}|^2 = 1$$ $$P(\ket{0}) = \frac{|\frac{1}{\sqrt{2}}|^2}{|\frac{1}{\sqrt{2}}|^2+|\frac{1}{\sqrt{2}}|^2} = 0.5 = 50\%$$ $$P(\ket{1}) = \frac{|\frac{1}{\sqrt{2}}|^2}{|\frac{1}{\sqrt{2}}|^2+|\frac{1}{\sqrt{2}}|^2} = 0.5 = 50\%$$

So in this case, each state has a 50% chance of being the state the qubit is in when we measure it. This uniformity makes this case special, and we refer to it as a state with uniform or equal superposition. There is one other state like this, which is:

$$\frac{1}{\sqrt{2}}\ket{0} - \frac{1}{\sqrt{2}}\ket{1} = \ket{ψ}$$

In this case, again, the probabilities would be 50/50. These two states are frequently used in calculations, and they are also behind the Hadamard (H) Gate. This is a quantum gate which takes a computational state, and turns it into a state of uniform superposition. Which of the two uniform states the qubit takes as a result of having the gate applied will depend on what computational state the qubit starts in:

$$\ket{0} \xrightarrow{\text{H}} \frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1}$$ $$\ket{1} \xrightarrow{\text{H}} \frac{1}{\sqrt{2}}\ket{0} - \frac{1}{\sqrt{2}}\ket{1}$$

However, remember that we can’t measure superposition and get all the coefficients we’re curious about. Measurements cause the quantum state to collapse, so we need a way to get the qubit back into a computational state first. To do this, we can just apply the H gate one more time:

$$\frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1} \xrightarrow{\text{H}} \ket{0}$$ $$\frac{1}{\sqrt{2}}\ket{0} - \frac{1}{\sqrt{2}}\ket{1} \xrightarrow{\text{H}} \ket{1}$$

“What’s the point?”

So far in this post, we’ve talked about the fact that superposition exists and that it makes qubits different from classical bits - but we haven’t really talked about why that’s important or helpful.

One thing you may have already deduced is that qubits are not particularly useful for storing information. You can store the same amount of information in one qubit as you can in one classical bit. This is true despite the fact that the qubit can be in a quantum state which we would need complex numbers to describe. Once the measurement happens, the qubit is in a computational state and we only need 1 bit to describe that.

So the area where quantum computing really has superpowers is in processing information. That processing can happen while the qubit is still in superposition and while we aren’t constrained to a state that has to be described in 1 bit (such as is the case with classical computing). We can also operate on all possible states of superposition at once, which greatly speeds up computing time.

Examples of Quantum Processing

Imagine that you work in a lab that has 4 light dimmers that let you gradually turn the light between completely off and completely on programmatically. Some of the lights are pink, and some of the lights are blue, but only when they’re in their in-between state. You aren’t allowed to be in the room with the lights when they’re in their in-between state - only when they’re totally off or on, so you never get to see the pink or the blue. You start with all of the lights off, which is a situation we could describe with these 4 bits of information:

$$\ket{0000}$$

Then, in a single operation, imagine that you programmatically turn each of the dimmers to an in-between state while you are out of the room (the door to the room with the lights locks - no peeking!). Now, you can no longer describe the situation in 4 bits. You know that each light is in some mixed state of brightness, there are multiple colors involved, but you’re not actually there to see any of it. If you were to try to describe each possible configuration the dimmers could be in as well as how likely that particular scenario is, you’d need a lot more bits.

You decide that in order to extract some information out of the situation but still be able to explain it in 4 bits, you will run another single operation that will turn the lights that are pink all the way off and the lights that are blue all the way on.

You run that operation, and now you’re allowed back in the room. You notice that the first and the third lights are on, and the second and fourth are off. Now you can describe the situation like this:

$$\ket{1010}$$

So even though you were never in the room while the lights were pink or blue and you could never explain that situation in 4 bits while it was happening, you now know that the first and third lights are blue, and the second and fourth are pink when they’re turned on to an in-between state. And, you were able to do this in just two operations, each of which ran on all the dimmers simultaneously.

This is roughly how quantum computing works, where you can think of every light dimmer as a qubit. Although you can only read the dimmer when it’s in its off or on state, it does go through many other interesting states that would be complicated to describe with classical bits.

The video below describes another quantum processing example, in which a quantum computer outsmarts a casino game:

Historically up until now, computing has been like being back in the lab situation, except we’ve been sitting in the room with the lights (they’re regular on/off switches now, not dimmers and not colorful), only able to flick them one way or the other, and using that to take readings and make calculations. Now, with quantum computing, we’re taking advantage of being able to turn the room with the lights into a disco nightclub lighting situation…even though it unfortunately means we can’t be there to witness the party.


A special thanks to Sarah Kaiser (LinkedIn, Website) and Andrea Sharpless (LinkedIn) for the wonderful discussions and suggestions regarding this post, many of which were incorporated into the final version.