We’re going to need a little bit of modular arithmetic. In both classical and quantum computer science, much of the mathematics is concerned with manipulating binary numbers, so in particular we’ll need arithmetic modulo 2. For those of you coming from a physics rather than mathematical background, modular arithmetic is likely to be unfamiliar, but the following statement sums up the core concept:

The statement “\(a \textrm{ mod } n\)” asks “what is the remainder of \(a\) divided by \(n\)?”

For example, we can say 5 mod 4 = 1, or 17 mod 3 = 2. That is to say, the remainder on division of 5 by 4 is equal to 1, and the remainder on division of 17 by 3 is equal to 2. In practice this often boils down to repeated subtractions of the modulus until you cannot subtract any more without reaching negative numbers, and the remainder is the answer. The most common introduction to modular arithmetic is often called clock arithmetic, which is arithmetic modulo 12. We know that 9 am plus four hours gives 1 pm, and this fact is contained in the statement (9+4) mod 12 = 1. Modular arithmetic just generalizes this concept to numbers other than 12.

Since we will be concerned exclusively with binary arithmetic, we will introduce the \(\oplus\) notation, which can be taken to mean “mod 2”. So

\((a+b)\textrm{ mod }2\) means the same as \(a \oplus b\).

The rub of all this is that any time you see a sum in this notation, the answer can only be either 0 or 1, and we manipulate strings of these numbers. In other sources you may see the notation \(a +_2 b\), again meaning the same thing. Computer scientists will probably be familiar with the use of the % symbol for the modulo operation, as in 7 % 2 = 1.

Speaking of binary numbers, I think it’s safe to assume that all of you are at least vaguely familiar them. However, if your background is not in mathematics or computer science it is unlikely that you have much recent experience converting between base 2 and base 10, which is going to be a very important skill later on. A decimal number is represented by a string of the digits from 0 to 9, where the \(n\)th digit from the right, \(d\), has the value \(d\cdot 10^n\) for \(n\in\{0,1,2,\dots\}\), and we sum over the digits to get the value of the number. So$$7456=7\cdot 10^3+ 4\cdot 10^2+5\cdot 10^1+6\cdot 10^0.$$ Entirely similarly, a binary number is represented by a string of 0s and 1s, where the \(n\)th digit from the right represents the value \(d\cdot 2^n\), and we sum over the digits to get the total, so$$11101=1\cdot 2^4+1\cdot 2^3+1\cdot 2^2+0\cdot2^1+1\cdot 2^0=29\textrm{ in decimal}.$$For convenience (and other good reasons) we will represent quantum-mechanical state vectors variously by binary or decimal notation, and it is important that you understand how to interpret them.