We use cookies to give you a better experience, if that’s ok you can close this message and carry on browsing. For more info read our cookies policy.
1.25

# Quantum Registers

All of our important quantum algorithms will use more than one qubit.

We call the set of our qubits our quantum register. In this article, we will explore how multi-qubit registers behave.

## State Space

The set of possible states for our register is our state space. For a register with $n$ qubits, there are a total of $2^n$ possible states. We need a total of $2^n$ of our dials to represent our state. Our state vector requires $2^n$ entries.

For example, our 000, 001, 010 and 111 states we would write as $|000\rangle = \left( \begin{array}{c} 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{array} \right), |001\rangle = \left( \begin{array}{c} 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{array} \right), |010\rangle = \left( \begin{array}{c} 0 \\ 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{array} \right), \mbox{ and } |111\rangle = \left( \begin{array}{c} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right)$.

Fortunately, much of the time, most of those are zero, and so we don’t have to explicitly draw them or write them down – that’s why the Dirac ket notation (on the left) is so much more compact. When we have a superposition, you only need to write down the kets for elements that aren’t zero. For example, the 50/50 superposition of $|000\rangle$ and $|111\rangle$ is $\frac{1}{\sqrt{2}}\left( \begin{array}{c} 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{array} \right)$ written using the full vector, and the much easier to read $\frac{|000\rangle + |111\rangle}{\sqrt{2}}$ in the ket notation. If it’s not 50/50, we might write $\left( \begin{array}{c} \alpha \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \beta \end{array} \right) = \alpha|000\rangle + \beta|111\rangle$ since only the $|000\rangle$ (first) and $|111\rangle$ (last) entries in the state vector aren’t zero.

This set of states is called a Hilbert space (named after the mathematician David Hilbert). We are used to dealing with two or three dimensions in our everyday lives, but this Hilbert space is $2^n$ dimensions. This doesn’t mean that our qubits are accessing some fourth or higher spatial dimension, like in a science fiction movie, just that completely describing their behavior requires us to use more elements in our state vector: 8 dials or numbers for three qubits, 16 for four qubits, and so on.

You can think of the set of entries as separate vectors, if you like, but in reality this set forms a single vector of length 1 in the Hilbert space.

## Normalization Condition

We saw with one qubit that the probability of being in the zero state plus the probability of being in the one state must sum to one. We can write that down as $P(|0\rangle) + P(|1\rangle) = 1$.

The same is true with our multi-qubit states, but the number of states is larger so calculating it is a little bit more complicated. If we have a register with three qubits, there are $2^3 = 8$ possible states. If $P(|000\rangle)$ is the probability that we will find the state $|000\rangle$ when we measure the register, then $P(|000\rangle) + P(|001\rangle) + P(|010\rangle) + P(|011\rangle)$ $+ P(|100\rangle) + P(|101\rangle) + P(|110\rangle) + P(|111\rangle) = 1$.

We always get something when we measure our register!

This is known as the normalization condition, and it holds for quantum probabilities the same as it does for classical probabilities. The only difference is that calculating the quantum probabilities involves taking the absolute value of the square of the probability amplitude. If our three-qubit state is $\alpha|000\rangle + \beta|001\rangle + \gamma|010\rangle + \delta|011\rangle + a|100\rangle + b|101\rangle + c|110\rangle + d|111\rangle$, then the probability of finding 000 is $|\alpha|^2$, the probability of finding 001 is $|\beta|^2$, the probability of finding 010 is $|\gamma|^2$, etc., and so $|\alpha|^2 + |\beta|^2 + |\gamma|^2 + |\delta|^2 + |a|^2 + |b|^2 + |c|^2 + |d|^2 = 1$.

## Measuring multi-qubit states

The multiple dials view of a quantum state can be a little confusing, but it’s a help when thinking about measurement. If we measure all of the qubits in a register, the probability of finding each state is calculated by taking each vector and squaring its length, just as we did for a single qubit.

To measure only one qubit in a multi-qubit state, calculate the probability of each state, and sum up all of the states with zero in the appropriate position to get the probability of finding zero.

But what happens to the state afterwards? Completely measuring a register results in the state completely collapsing, but if we measure part of the register, it may partially collapse. Consider the state $\frac{|000\rangle + |011\rangle + |101\rangle}{\sqrt{3}}$. If we measure the whole register, there is a 1/3 probability of finding each of the states 000, 011, and 101.

But if we measure only the qubit on the left, we have a 2/3 probability of finding it is zero, and a 1/3 probability of finding that it is one. Interestingly, if we find 1, then the state of the other two qubits is definitely $|01\rangle$, but if we find 0, then the other two qubits are still left in the state $|00\rangle + |11\rangle$.

Measuring a qubit also results in the destruction of quantum entanglement for that qubit, a topic we will take up next.

## Programming a Quantum Computer

The effects of the gates described earlier are similar to the logic gates we use to build a classical computer, like AND and OR. These days, few people bother designing their own programs using those gates; instead we program computers using programming languages that humans can read, which are then turned into instructions for the computer, like ADD or MULTIPLY. When we construct quantum algorithms, we will use gates, but we will treat them something like low-level computer instructions. Each gate will operate on one, two or three qubits, and we will apply a sequence of gates to our register to form a complete algorithm.