Season 3 Episode 4

OOMC Season 3 episode 4. Tricks with metrics

In this episode, Immy defines distance and shows us some other weird metrics that satisfy that definition.

Further Reading

Definition of metric

In the livestream, we talked about other examples of “distance” between objects $x$ and $y$ taken from some set (maybe points in 2D space, or integers, or maybe something else). These each satisfied the following definition of what it means to be a distance function $d$;

  • $d(x,y)\geq0$ for any $x$ and $y$
  • $d(x,y)=0$ if and only if $x=y$.
  • $d(x,y)=d(y,x)$ for any $x$ and $y$
  • $d(x,z)\leq d(x,y)+d(y,z)$ for any $x$ and $y$ and $z$ (the “triangle inequality”)

Examples from the livestream

Euclidean geometry with vectors $x=(x_1,x_2,\dots,x_n)$ and $y=(y_1,y_2,\dots,y_n)$ uses $d(x,y)=\sqrt{\sum_{i=1}^n (x_i-y_i)^2}$.

The discrete metric $d(x,y)=1$ if $x\neq y$ and $d(x,y)=0$ if $x=y$. This one works on any collection of objects!

The supremum metric on $n$-dimensional vectors has $d(x,y)=\max(|x_i-y_i|)$.

The 2-adic metric defined on integers, with $d(x,y)=2^{-m}$ where $2^m$ is the largest power of 2 dividing $x-y$.

Exercise: check that these all satisfy the definition above (the triangle inequality is often the tricky bit!).

 

Other examples

While we were talking about Euclidean distance, an anonymous person in chat said "i guess raising to powers other than 2 could be a different metric?". Congratulations, you've invented the $p$-norm (Wikipedia), and that's a metric!

Another metric on two-component vectors like $x=(x_1,x_2)$ can be defined as $d(x,y)=\sqrt{x_1^2+x_2^2}+\sqrt{y_1^2+y_2^2}$ if $x\neq y$, and $d(x,y)=0$ if $x=y$. The idea is that it’s the Euclidean distance from $x$ to the origin plus the distance from the origin to $y$. The joke here is to compare this metric to the rail network in England; you often have to go via London to get from A to B (or from $x$ to $y$ I suppose). This metric imagines what would happen if you always measured distances “via London”!

Given continuous functions on [0,1], we can define a metric $d(f,g)=\int_0^1 |f-g|\,\mathrm{d}x$. This measures the “distance between functions” by finding the area between their graphs (more or less – it’s not quite area if $f$ and $g$ cross each other).

 

What are they for?

If we’ve got a metric, then we can describe which objects are “close together”. In 2D space or 3D space, we’ve got a pretty strong intuition from our everyday lives of what this should mean. Things should be close together if the straight line between them is short, measured with Pythagoras. But we can define metrics that capture other senses of what it means to be close together. 

For example, consider ten-digit numbers with the distance function $d(x,y)=$ “how many of the digits are different between $x$ and $y$?”. This says that two numbers are close together if it’s easy to type one of them when you meant the other – that could be useful if we’re thinking about automatically detecting or correcting errors in noisy data. Of course, if you draw on a number line which numbers are close together with this metric then it looks totally bizarre; all that really shows you is that this metric is not the normal $d(x,y)=|x-y|$ metric. But it still has its own importance.

This is more advanced, but for metrics that can return arbitrarily small numbers, we can set up all the machinery that we need to define limits of sequences. That’s a very important topic in mathematics, but it’s not explored very much in A-level or equivalent, so here’s a little bit about limits.

 

Limits

Here are three NRICH activities to try, in this order.

If you’ve learned about geometric series in A-level or equivalent, then you probably know about
\[1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\dots=2\]

That’s another example of a limit (here the limit is hidden in the “$\dots$”; we can think about the sequence made by taking $n$ terms of the sum for each natural number $n$). If you’re interested in the philosophy behind whether this sort of limit really works or not, see the video on our YouTube page about Infinity and Infinity Machines by James Studd.

 

The 2-adic metric

Here’s a consequence of the 2-adic metric combined with ideas about limits. Consider the sequence
\[1,\quad 1+2,\quad 1+2+4,\quad 1+2+4+8,\quad,\dots\]

If you know about geometric series then you know a general result for how to simplify sums like this. If you don’t, then work out the sums above and see if you can spot a pattern (can you prove your pattern continues to hold?). Now think about the distance of each of these numbers from the number $-1$ with the 2-adic metric. Reminder; the 2-adic metric says that $d(x,y)=2^{-m}$ where $2^m$ is the greatest power of 2 that divides $x-y$. Here, the difference between these sums and the number $-1$ is a power of 2 and as we go along the sequence that power of 2 gets largerand larger. So with the 2-adic metric, these numbers are getting closer to $-1$. In fact, we could even say that with the 2-adic metric, the number $-1$ is the limit of the infinite series that we get by continuing the sequence above! That’s very weird if you’re used to limits with the usual $d(x,y)=|x-y|$ metric, because all the sums are positive and getting bigger. But with the 2-adic metric, there's a way to assign a limit to that sum.

 

History of metrics

For some history on the maths problems that lead mathematicians to think about other metrics, you might like to learn about “Euclid’s fifth postulate”. There’s an introduction to Euclid’s postulates on this webpage then a good 3-minute video explainer on the fifth here and a discussion on Numberphile here. Rejection of the fifth postulate led to the discovery of non-Euclidean geometries. For a Wikipedia-style overview, see Wikipedia!

 

If you want to get in touch with us about any of the mathematics in the video or the further reading, feel free to email us on oomc [at] maths.ox.ac.uk.

Last updated on 29 Apr 2022, 12:07pm. Please contact us with feedback and comments about this page.