# 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 (**qu**antum **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**⟩** - After a qubit collapses to |0
**⟩**or**⟩**, 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:

This representation uniquely describes the qubit’s superposition:

*a*² is the probability that |*φ***⟩**will collapse to |0**⟩**when measured*b*² is the probability that |*φ***⟩****⟩**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:

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

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**⟩**). - By similar logic, |0
**⟩**represents a qubit that always collapses to (or “has collapsed to”) |0**⟩**.

This builds intuition about expanded notation. Some qubit,

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:

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

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

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

*a*²**⟩**when measured*b*²**⟩**when measured

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

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

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:

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

And these are the two definitions that we began with:

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 - (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:

(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):

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):

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):

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:

*x*² = probability that*qubit 1*collapses to |0**⟩**when measured*y*²*=*probability that*qubit 1*collapses to |1**⟩**when measured*z*²*=*probability that*qubit 2*collapses to |0**⟩**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
by definition. (Remember, |*a*²*φ*₆**⟩**=*a*|00**⟩**+ ⋅ ⋅ ⋅ ) - It is also
since collapsing to |00*x*²*z*²**⟩**means:

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

So it turns out that:

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

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

This yields

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

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

So we have

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:

Here are the steps in Fig 25 broken down:

**(2)**replace*qubit 1*and*qubit 2*with their vector notations from Fig 19**(3)**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:

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:

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:

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:

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

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:

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.

Thanks for reading! Consider giving me some claps if this article was helpful to you.