2.4

# Working with larger quantum registers

Working with multi-qubit registers allows the number of possible states to grow exponentially. It requires us to keep track of the weight (or amplitude) and phase of each possible state.

## Weights and measures

Let’s say we have two quantum registers, which we will call $A$ and $B$, and we add them together and put the result in register $C$, so that $C = A + B$. (These registers would each have more than one qubit, but for our purposes here we can treat them as a single numeric value.)

Let’s assume we begin with $A$ in a superposition of all of the numbers 0 to 3. We can write this using our dial representation, but in this case a simple table will do. Our values for $A$:

A
0
1
2
3

and $B$ the same:

B
0
1
2
3

Then when we add them together, obviously $C$ will be the superposition of the numbers 0 to 6. But it’s not quite as simple as that.

Since there are more different ways to get 3 when you add two numbers (0+3, 1+2, 2+1, 3+0) than to get 6 (only 3+3), there will be a different weight in the register set for the value $C=3$ than for the value $C=6$.

Moreover, our $A$, $B$ and $C$ registers are now entangled, so we can no longer write down their values independently. There are four possible values for $A$, four for $B$, and seven for $C$, so we might need as many as $4 \times 4 \times 7 = 142$ different clock dial vectors! This shows the amazing growth in the classical resources necessary to represent the state of a quantum computer; although we are using only a few quantum values here, it is already impractical to write down the entire state. Fortunately, out of the 142 possibilities, only sixteen of them are non-zero. Let’s list them:

A B C
0 0 0
0 1 1
0 2 2
0 3 3
1 0 1
1 1 2
1 2 3
1 3 4
2 0 2
2 1 3
2 2 4
2 3 5
3 0 3
3 1 4
3 2 5
3 3 6

If we reorganize our list, sorting according to the values of $C$, we get this:

A B C
0 0 0
0 1 1
1 0 1
0 2 2
1 1 2
2 0 2
0 3 3
1 2 3
2 1 3
3 0 3
1 3 4
2 2 4
3 1 4
2 3 5
3 2 5
3 3 6

It’s now obvious that $C=3$ has four times the weight of $C=6$ or $C=0$. When we measure $C$, with some probability we will find each of the possible outcomes. The probability of finding 3 is $1/4$, four times the probability of finding 0, which is only $1/16$.

Let us assume that we do, in fact, find $C=3$. When this happens, the superposition collapses, and we are left with only the terms that included a value of 3 for $C$:

A B C
0 3 3
1 2 3
2 1 3
3 0 3

After measuring $C$, it is no longer entangled with $A$ and $B$, but in this case $A$ and $B$ are still entangled with each other.

## The ket notation

Of course, writing down tables this way is relatively clear but clumsy, which is why we use the ket notation. We can also track the weights a little more clearly. The initial superpositions for $|A\rangle$ and $|B\rangle$ would be

To write down the combination of $|A\rangle$ and $|B\rangle$, we can put them together inside one ket, separated by a comma. For example, $|1,3\rangle$ would be $A=1, B=3$. Since our two registers are independent and each has four terms, it’s now obvious that we have sixteen values to write down, one corresponding to each line in the table above.

Let’s skip forward a couple of steps and write down all three of our registers after measuring $C$ and finding 3:

Since all of the values for $C$ are the same here, now we can factor $|C\rangle$ out:

Since $C$ is no longer entangled with $A$ and $B$, we can ignore it if it’s convenient, and just write $A$ and $B$. Of course, the vector lengths are adjusted at every step in this process so that the whole set remains normalized, but as long as all of the terms are the same weight and we mentally keep track, we can simplify it and just write down

This kind of partial collapse of the entire state, leaving some terms and entanglement, is a key to the way quantum algorithms work, and we will see its use in the upcoming Steps.