Understanding quantum bit notation
By: Thomas Breydo
Tags: Quantum Computing, Mathematics

Understanding quantum bit notation

Turns out it’s somewhat intuitive!

Quantum computers are going to accelerate drug discovery, change the way we encrypt our information, and much more. If you haven’t heard of quantum computing yet, here’s a video that provides a nice introduction.

This article breaks down how we mathematically express qubits (quantum bits) and explains why each notation works.

Refresher on superposition: in classical computing, bits can only take on boolean values (0 or 1 and nothing in-between). But a qubit can be in a superposition of |0⟩ and |1⟩. (For now, let the symbols “|” and “ ⟩” just be indicators that a value is related to a quantum object.) Qubits in superposition have some chance of “collapsing” to |0⟩ and some chance of collapsing to |1⟩ when measured.

Whenever a qubit is measured, it must collapse to |0 ⟩ or |1 ⟩

or |1 After a qubit collapses to |0⟩ or |1⟩, it does not go back into superposition. If it collapsed to |0⟩, it is now |0⟩.

Expressing 1 qubit

Expanded notation for 1 qubit

Let’s say we have a qubit, |φ⟩. Perhaps you have seen expanded notation:

Expanded notation. (Fig 1)

This representation uniquely describes the qubit’s superposition:

a² is the probability that |φ ⟩ will collapse to |0 ⟩ when measured

will collapse to |0 when measured b² is the probability that |φ⟩ will collapse to |1⟩ when measured

(Technically, a² and b² are relative probabilities. They’re scaled so that a² + b² = 100%. They’re squared because they could be negative.)

For example, this qubit has a 50% chance of collapsing to |0⟩ or |1⟩ when measured:

Example #1. Note that the |φ₁⟩ ‘phi one’ (left) is a variable representing the qubit. (Fig 2)

And this qubit has a 100% chance of collapsing to |1⟩ when measured:

Example #2. (Fig 3)

This helps to answer the question, what do the |1⟩ and |0⟩ represent?

Example #2 (above) shows that |1 ⟩ represents a qubit will certainly collapse to |1 ⟩ (because it already is |1 ⟩ ).

represents a qubit will certainly collapse to |1 (because it already is |1 ). By similar logic, |0⟩ represents a qubit that always collapses to (or “has collapsed to”) |0⟩.

This builds intuition about expanded notation. Some qubit,

(Fig 4)

is a combination of the fundamental |0⟩ and |1⟩ states, with some chance of becoming |0⟩ or |1⟩ (collapsing upon measurement).

Vector notation for 1 qubit

There exists another way to express qubits, which involves vectors. If you’ve never seen vectors or matrices, you should check out this introduction.

To start, let’s define |0⟩ and |1⟩ in terms of vectors:

(Fig 5)

We will get back to why these definitions make sense. For now, let’s see how they let us rewrite a qubit:

(Fig 6)

So the qubit |φ⟩ can be expressed as just one vector of two numbers:

Vector notation. (Fig 7)

And note that a and b still represent the coefficients of |0⟩ and |1⟩ (all we did was mathematically simplify the expression).

a² is still the probability that the qubit will collapse to |0 ⟩ when measured

when measured b² is still the probability that the qubit will collapse to |1⟩ when measured

For example, this qubit has a 50% chance of collapsing to |0⟩ or |1⟩ when measured:

Example #3. This is the vector notation of Example #1. (Fig 8)

This qubit has a 100% chance of collapsing to |1⟩ when measured:

Example #4. This is the vector notation of Example #2. (Fig 9)

But a qubit that has a 100% chance of collapsing to |1⟩ is just the qubit |1⟩. So Example #4 (above) shows us the following:

Example #4: |φ₄⟩ has a 100% chance of collapsing to |1⟩ when measured, so it is |1⟩. (Fig 10)

Similarly, the vector below represents a qubit with a 100% chance of collapsing to |0⟩ when measured, so it is |0⟩:

Example #5. (Fig 11)

And these are the two definitions that we began with:

Note, it just happens that (1)² = 100% and (0)² = 0%, so it seems the values weren’t squared. (Fig 12)

Now you see how the initial definitions of |0⟩ and |1⟩ as vectors in Fig 5 make sense — they uphold the following rule:

(top number)² = probability the qubit collapses to |0 ⟩ when measured

when measured (bottom number)² = probability the qubit collapses to |1⟩ when measured

But what if |φ⟩ were comprised of more than one qubit?

Expressing 2+ qubits

Expanded notation for 2+ qubits

We can use expanded notation in a very similar manner. Note, though, that each additional qubit doubles the number of fundamental states:

1 qubit, 2 states. (Fig 13)

2 qubits, 4 states. (Fig 14)

3 qubits, 8 states. (Fig 15)

(In general, an n-qubit system can be in a superposition of 2ⁿ states.)

So, for example, a 4-qubit system could be written in expanded notation as follows (note, 2⁴ states need to be represented):

Expanded notation of a 4-qubit system. (Fig 16)

As you can see, expanded notation becomes tedious to write. But there exists a more compact way to represent qubits!

Vector notation for 2+ qubits

A multi-qubit system can also be represented as a vector. For simplicity, let’s consider a 2-qubit system (we write |00⟩ to |11⟩ in ascending binary order):

Example #6: φ₆ is made of 2 qubits. (Fig 17)

Let’s name the two qubits in our 2-qubit system, qubit 1 and qubit 2. Coloring the equation will help visualize this (qubit 1 is in red, qubit 2 is in blue):

Example #6. (Fig 18)

For example, the state |01⟩ is equivalent to

qubit 1 (red) in state |0 ⟩

qubit 2 (blue) in state |1⟩

We already know how to write the two qubits of |φ₆⟩ in vector notation:

(Fig 19)

x² = probability that qubit 1 collapses to |0 ⟩ when measured

when measured y² = probability that qubit 1 collapses to |1 ⟩ when measured

when measured z² = probability that qubit 2 collapses to |0 ⟩ when measured

when measured w² = probability that qubit 2 collapses to |1⟩ when measured

While the coefficients here are not a, b, c, and d, they’re related to a, b, c, and d, as we will now show. Note that the probability that |φ₆⟩ collapses to |00⟩ when measured can be represented in two ways:

It is a² by definition. (Remember, |φ₆⟩ = a|00⟩ + ⋅ ⋅ ⋅ ) It is also x² ⋅ z² since collapsing to |00⟩ means:

qubit 1 collapses to|0 ⟩ (with probability x²) and

(with probability x²) and qubit 2 collapses to |0⟩ (with probability z²)

So it turns out that:

(Fig 20)

Similarly, the probability that |φ₆⟩ collapses to |01⟩ when measured can be represented in two ways:

b² (remember, |φ₆ ⟩ = ⋅ ⋅ ⋅ + b|01 ⟩ + ⋅ ⋅ ⋅ )

(remember, |φ₆ = ⋅ ⋅ ⋅ + b|01 + ⋅ ⋅ ⋅ ) x² ⋅ w² (qubit 1 collapses to |0⟩ and qubit 2 collapses to |1⟩)

This yields

(Fig 21)

And the same can be done for |φ₆⟩ collapsing to |10⟩ to show

(Fig 22)

or |φ₆⟩ collapsing to|11⟩ to show

(Fig 23)

So we have

(Fig 24)

This relationship between a, b, c, d and x, y, z, w in Fig 24 will soon help us to understand the intuition behind the vector representation of |φ₆⟩.

To represent a system of 2+ qubits in vector notation, we take the tensor product ‘⊗’ of all of the qubits (we’ll understand why further down). For now, let’s just see what happens:

Vector notation for 2 qubits. (Fig 25)

Here are the steps in Fig 25 broken down:

(2) replace qubit 1 and qubit 2 with their vector notations from Fig 19

replace qubit 1 and qubit 2 with their vector notations from Fig 19 (3) compute the tensor product

compute the tensor product (4) rewrite in terms of a, b, c, d using the equations from Fig 24

Look at that! We’ve simplified a 2-qubit system to just one vector:

(Fig 26)

There’s something special about this vector! Notice that if you square the values of the vector from top-to-bottom, you get, a², b², c², and d². Those are the probabilities that |φ₆⟩ will collapse to |00⟩, |01⟩, |10⟩, or |11⟩ when measured.

That’s why we take the tensor product of the qubits —it makes the result contain all the coefficients defining the superposition. And because of the way a tensor product is calculated, the coefficients will be in the same order as they were in expanded notation!

For example, we could find the probability that |φ₆⟩ will collapse to |01⟩ when measured by squaring the second item in its vector representation, shown in green:

Notice that there is no |01⟩ in the vector representation because it is implied. (Fig 27)

Say we are told that a 2-qubit system, |φ₇⟩, has a 50% chance of collapsing to |00⟩ or |11⟩ when measured. We can write it in vector notation as follows:

(Fig 28)

Again, the values in the vector correspond to the fundamental states in descending order (e.g., |00⟩, |01⟩, |10⟩, |11⟩ for 2 qubits). The expanded notation is no longer needed:

Remember, the values are squared to find the coefficients. (Fig 29)

Finally, here is what the generic 4-qubit system from Fig 16 would look like in vector notation:

(Fig 30)

While that’s a very tall vector, at least you don’t need to write out all the states from |0000⟩ to |1111⟩. If you really wanted to, you could rewrite the vector as a transpose of a row vector to save space:

(Fig 31)

That’s it! Hopefully, you now have a better grasp of the notation.

What next?

Understanding qubits in vector notation becomes very helpful when you begin to work with quantum logic gates. The gates can be represented as matrices so that their interactions with qubits become matrix multiplications. If you’re interested in how that works, check out this lecture about the mathematical representation of quantum computing.