## 11.1 Metrics

To begin with, let us work with pure states, and save the problem of dealing with mixed states for a later section. We will start with the second question: how do we quantify this notion of “close enough”? The central concept is one with which you are probably already somewhat familiar (we mentioned it in Sections 0.3 and 0.5), namely that of a metric, or distance.

Given a set X, a metric (or distance) on X is a function d\colon X\times X\to\mathbb{R}_{\geqslant 0} such that

• Identity of indiscernibles: d(a,b)=0 if and only if a=b
• Symmetry: d(a,b)=d(b,a) for all a,b\in X
• Triangle inequality: d(a,c)\leqslant d(a,b)+d(b,c) for all a,b,c\in X.

There are four conditions governing metrics (identity of indiscernibles is an “if and only if” statement, so we can separate it into two “if” statements). As is usually the case in mathematics, it is interesting to ask what happens if we drop one or more of these.

• If we drop d(a,b)=0\implies a=b then we get pseudometrics.
• If we drop a=b\implies d(a,b)=0 then we get metametrics, or partial metrics.
• If we drop d(a,b)=d(b,a) then we get quasimetrics. These arise “in real life”, if you think about travelling around a city that has lots of one-way streets, or travelling up or down a big hill.
• If we drop d(a,c)\leqslant d(a,b)+d(b,c) then we get semimetrics (though be careful here: lots of authors use “semimetric” to mean almost any one of these generalisations, and the terminology is very non-consistent!).

We can also consider the case of extended metrics, where the distance function is allowed to take the value \infty. For many category theorists, “the” notion of metric space is that of an extended pseudoquasimetric.

The most common norm is the Euclidean distance, that is, distance between two points in Euclidean space. Given points A=(a_1,a_2,\ldots,a_n) and B=(b_1,b_2,\ldots,b_n) in \mathbb{R}^n, their Euclidean distance is \sqrt{|b_1-a_1|^2 + |b_2-a_2|^2+\ldots +|b_n-a_n|^2}. But we already know that Euclidean space \mathbb{R}^n is more than just a set: it is a vector space. This means that we don’t just have a metric space (i.e. a set with a metric), but instead a normed vector space, where the norm \|\cdot\| of a vector is defined to be the distance of that vector from the origin: \|a\|\coloneqq d(a,0).

It turns out that this norm (and thus this metric) actually arises from a more fundamental structure, namely that of the inner product. Returning to the bra-ket notation, we recall that the norm of any vector |a\rangle is exactly \|a\|=\sqrt{\langle a|a\rangle}, and thus the distance between any two vectors |a\rangle,|b\rangle is exactly d(|a\rangle,|b\rangle)=\||b\rangle-|a\rangle\| (though for simplicity we sometimes write this as \|b-a\| instead, or even \|a-b\|, since this is equal). This norm is also called the 2-norm, or the \ell^2-norm (for reasons that we will come back to in Section 11.10.2), and is defined for any finite-dimensional Hilbert space \mathbb{C}^n using the fact that \mathbb{C}\cong\mathbb{R}^2, so that \|x+iy\|\coloneqq\|(x,y)\|=\sqrt{x^2+y^2}.

Before moving on to talk about state vectors, let us first discuss one other metric space which shows up in information theory (both classical and quantum). The space181 of binary strings (of some fixed length n) admits a metric known as the Hamming distance. This is defined quite simply as “the number of positions at which the corresponding bits are different”. For example, d(0101101011,1101110111) = 4 since these two strings differ in four bits: \begin{array}{cccccccccc} 0&1&0&1&1&0&1&0&1&1 \\1&1&0&1&1&1&0&1&1&1 \\\hline !&\checkmark&\checkmark&\checkmark&\checkmark&!&!&!&\checkmark&\checkmark \end{array}

More formally, if we define the Hamming weight of a binary string of length n as the number of bits equal to 1, then the Hamming distance between two strings is simply the Hamming weight of their difference (where subtraction is calculated in \mathbb{Z}/2\mathbb{Z}, i.e. \mod2). We leave the proof that this is indeed a metric as an exercise (Exercise 11.10.4).

1. You can think of this as just a set, but we have already seen that this is actually a vector space over \mathbb{Z}/2\mathbb{Z}, where addition corresponds to \texttt{XOR}.↩︎