Episode: 3101
Title: HPR3101: Metrics
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3101/hpr3101.mp3
Transcribed: 2025-10-24 16:45:56

---

This is Hacker Public Radio Episode 3101 for Monday, 22 June 2020. Today's show is entitled
Metrics. It is the 10th anniversary show of Andrew Conway
and is about 26 minutes long, and carries a clean flag. The summary is
Ileman's explanation of the mathematical concept of metric.
This episode of HPR is brought to you by Ananasthost.com.
Get 15% discount on all shared hosting with the offer code
HPR15. That's HPR15.
Better web hosting that's honest and fair at Ananasthost.com.
Music
Hello HPR folks.
This is McNalloo here. My real name is Andrew, and I want to talk to you about metrics.
Now before telling you exactly what metric is, I'll tell you why I'm recording it.
Now I play a game called Elite Dangerous, which some of you will be familiar with.
And a friend of mine who also plays it, asked me, knowing that I had some interest
in things astronomical, about something called an Alcubier drive,
and could that be equivalent to the frame shift drive, which is sort of like the work drive that you use in that game?
Now the interesting thing, and I'll confess, I didn't know very much about it.
Alcubier, I think, was a Spanish physicist who had come up with this rigorous solution
to Einstein's field equations in general relativity, that give you a solution
which is probably the closest theoretical description we have to something that we call a work drive.
So it's an absolute bona fide thing.
Now maybe in a future episode, I might get into that, but that led me to a slight obsession
with a rabbit hole that I went down, and revising what I understood about metrics
because I did the full pencil calculus treatment as an undergraduate when I did my degree 30 years ago,
and I absolutely loved it, I thought it was brilliant.
Yeah, okay, so I might be a bit weird.
So I went back during the lockdown and dug out my old books and notes,
and I had a good read over it at all.
I linked what the book I read, which actually has a non-tensor calculus version approach to general relativity,
which I think some people might appreciate if you've got some level of mass ability,
but not necessarily a tensor calculus.
So I read that, and then just what happened, I was playing the HPR Dungeons and Dragons
that Clatu has been kind enough to organise, and he mentioned when we were talking about moving
through Dungeons and Dragons space, that Dungeons and Dragons space is non-uclidean,
and he said, oh, I think he said something along the lines,
I'd like to hear a sure about that, or something which I interpreted as meaning that.
Anyway, so here it is, here is that show.
So first of all, what is a metric?
Well, in the context that I'm talking about, I'm talking about the strict mathematical definition of it,
it's essentially the generalized definition of a ruler,
you know, a ruler as in the thing that you use to measure the distance between two points,
or a tape measure, a ruler is better, because something fixed and small about a ruler,
which, as you'll see, is important.
So if a metric is just a ruler, why not just use a ruler?
Why do we need a metric? Well, more specifically, if all you want to do is measure a distance,
then you can use some form of distance measuring device like a ruler or a laser range or whatever it is,
or take a hand on. If that's what you want to do, just measure a distance in the real world.
But really a metric comes into its own when you want to turn sets of coordinates into a distance.
So let's say you've got point A with some coordinates x, y, and you've got some other point B with coordinates,
let's say w, z, and you want to count the distance between these two points using those coordinates.
That is when you would call up the help of a metric.
So a metric is a mathematical ruler that works on coordinates, two sets of coordinates, and gives you the distance.
Well, it isn't just that either, but we'll come to that.
But essentially a metric turns coordinates into distances.
So, okay, enough of this being general. What's the simplest example of a metric?
Well, in one dimension, the difference in x coordinate is equal to the distance.
So, if you like, distance s between two points, x1 and x2 is, guess what, s equals x2 minus x1.
In fact, it is the modulus of that absolute value because you don't, for distance, must be positive.
So, or you could define it as s squared equals x2 minus x1 all squared, where you always take the positive rootless of the way to look at it.
Anyway, the point is, yeah, if you just, in one dimension, you only have one coordinate, therefore your distance is just a change in that coordinate.
Well, actually, you could do some wacky stuff, even in one dimension, but I don't see any point in discussing that any further.
That is a rather dull example, so let's go on to something slightly more interesting.
Two dimensions, a surface, but let's assume it's a flat surface, so the top of a table, we page of a book, a flat surface.
Now, the distance, so the metric in this case, well, certainly not the metric, but something very close to the metric is,
the distance between two points, the distance squared, let's call it s, so s squared is equal to the difference in x squared plus the difference in y squared.
So that's the distance squared between two points.
And so if you want to measure, say, the distance of a point from the origin, the point zero zero, and the point is at coordinates x, y, then the distance s is simply the square root of x squared plus y squared, or s squared equals x squared plus y squared.
Now, you might be thinking, isn't that just Pythagoras' theorem? And the answer is yes, yes it is, that is Pythagoras' theorem.
And it comes about, because usually when we define our coordinates, we say that x and y are perpendicular, or orthogonal, that is the x-axis, is it right angle to the y-axis?
And do that, we might choose two axes that are not orthogonal, that are a different angle in 90 degrees.
As long as that isn't zero, it will work perfectly well, you know, if you define two x-axis, then you can, it will be one dimensional again, obviously.
So yes, but it will be a bit wacky, so we don't, and Pythagoras wouldn't work.
So apart from wacky, non-author, or orthogonal coordinates, as you might call them, which would generate a rather bizarre metric, we would have to multiply x and y coordinates together.
Is there any other useful coordinates in two dimensions? Well, there are, I mean, in fact, to take a small digression, the two-dimensional coordinate system we use for household, well,
business or any addresses in real life, if you want to send mail to somebody or find somebody's address, physical address, is the two coordinates we give, is the first coordinate is the number of the building or the house in the road, and the second coordinate is the name of the road.
Now, of course, you can't easily define a metric with a name, so it's not a numerical coordinate system, but it is a coordinate system of a kind.
So that, you can think of as a two-dimensional, there's two bits of information that together should uniquely identify which place you're supposed to go.
Of course, you may have two roads with the same name in different cities, so it's not quite as simple as that, but you take my point.
Point is, that's a coordinate system where you really can't generate a metric very easily.
So, is there a more useful one where there might be useful in a flat two-dimensional surface?
And the answer is yes. Now, the one we've just made is x and y, with our organizational axis, we call that Cartesian system.
But there are occasions when that isn't the best one to use, and instead we want to use something called a polar coordinates.
And in that, instead of x and y, you define the radius, so you choose a point which is, again, origin, or zero point, and there you see the radius coordinate is zero.
And then you measure the distance between that point and any other point of interest, and you assign one coordinate called the radius, which is r, just the distance from the center.
And then, of course, you need a second coordinate, and the second coordinate is an angle.
So, I'd like you to imagine on the page in front of you, if you have, imagine there is a page in front of you, a bit of paper, and imagine you draw a vertical line on it.
And that is the reference axis. And so, and you put a point somewhere on that line, and call that the origin.
And then you draw a point p, which is a distance r from that origin, and then you imagine the line connecting the origin o and the point p.
And then you measure an angle from that, upper part of that vertical line, going clockwise, down to the line, and we call this angle phi, sometimes called it as a with the angle phi.
And so, in polar coordinates, if you're given the radius on that angle phi, you've precisely identified the point.
And it's called, let's say that's called polar or flat polar coordinates. Now, why we might you want to use that? Well, one example might be on a dartboard.
On a dartboard, if you get a different score, depending on the radius that you are from the center, if it's r equals 0, you scored the bullseye, 50 points.
And then, if you go up from the radius, there's an outer bullseye layer, and then there's squaring regions, the triple squaring regions, and a small band, what halfway out, and then around the edge, there's a double squaring region.
So, the radius coordinate will tell you which one of those you're in, but also is divided up into 20 sectors.
For example, if you, the sector that goes straight up, if like a slice of a pie from the middle, with centered and angle phi equals 0, that is a score of 20 points.
So, if you're writing a computer game darts simulation of which there were many, I remember growing up in the 1980s, then you would determine r and phi.
And once you've got those, it's a simple matter to turn to determine what the score is. So x and y generated on the screen, calculate from that r and phi, then you can quite quickly calculate from that your score for the dart and that virtual game of darts.
So, that's one reason why you might want to use spherical pullers, and sorry, spherical flat pullers, spherical pullers will be in our future.
The other more common reason I can think of is for finding your way upon the earth. So, let's see, your home is the origin.
And this is a system that you might use, for example, if you were orienting a fun hallway where you're trying to get from one point to another.
And your home is the origin, and you need to get to a point p, and you're told that it's a distance of 1 kilometer away at a compass bearing of 90 degrees.
So, that's your r and phi, r equals 1 kilometer, phi equals 90 degrees, which translates on the compass wheel to due east.
So, you can see that distance and bearing are actually a form of puller coordinates.
So, with that, you might wonder, well Pythagoras works for distance when we've got x and y, we just say distance squared equals x squared plus y squared, as I said before.
So, does it work for puller coordinates? Is distance squared equals r squared plus phi squared?
Well, this is where we run into problems, because that isn't true Pythagoras doesn't hold.
For starters, you can't, if you're into physics at all, you can only add quantities of the same units.
You can't add apples and oranges. You can't add meters and degrees or radians or any other measure of angle. You can't do that.
So, how do we do Pythagoras in two dimensions? Well, of course, there's a reason I'm saying this, because what I'm really after is not a version of Pythagoras in two-dimensional puller coordinates, but I'm really after what's called Dmitric, which is what we're really after.
Well, let's think about how you would measure distance. Now, if somebody said to you walk north to the point, r equals 1 kilometer, phi equals 0, and you're starting to origin, so that's obvious.
You'd be walking north. Well, clearly, the distance that you travel in doing that would be just the change in radial coordinates, which goes from 0 to 1.
If you then were told to walk, continue walking with phi-held constant at 0 degrees as walking north from 1 kilometer to 2 kilometer.
Well, that would be another change in radial coordinate of 1 kilometer, a distance, another distance traveled of 1 kilometer, total distance, total change in radial coordinate, again, the same.
So it's clear that there's a fairly direct link if you're walking in a straight line, at least, between distance and radial coordinate, but what happens if we change phi?
Well, let's imagine we've walked out to 1 kilometer, and then we walk around a little bit of the circle.
Well, if we walked around the whole circle of radius 1 kilometer, we'd have covered a distance of 2 pi times the radius r, 2 pi r, the whole circumference of a circle.
So if we only walk along, say, a quarter of it, then it would be a quarter of 2 pi r, that is pi r divided by 2.
And you can see where I'm going with this. It's just the change in phi divided by 360 degrees, or if you prefer to work in radians, you divide it by 2 times pi.
Anyway, if you're holding r constant and changing phi, then you just work out what fraction the change in phi is of the full circle of 360 degrees.
But you'll see the problem here, depending on your starting r coordinate, whether it's 1 kilometer or 2 kilometer, whatever, the circles will be of different sizes.
So for r equals 1, the circumference of the circle would be 2 pi, for r equals 2, it would be double pi, it would be a circle of 4 pi.
So the same change in phi is going to scale with your radius. In other words, if you walk around the bigger circle, you're going to go a bigger distance.
So your change in phi is going to depend on the radius. That should be clear. Now that's introduced a bit of a problem for our metric.
But nevertheless, we can introduce a metric for our two-dimensional polar coordinates. And it goes like this.
The change in distance squared, or we can say the distance squared due to a small change in coordinates, is equal to the small change in the radius squared plus radius squared times the small change in the phi coordinate squared.
So you'll see now we're adding a distance to a distance. But why am I saying a small change? Well, because the concept of distance that we have now is complicated by the fact that one of our coordinates phi,
so this, since we travel when we change phi, depends on what radius we're adding. Or in the metric that I just spoke it, you'll notice that r squared multiplies on the change in phi.
This is quite unlike the case in Cartesian coordinates where the change in x and y don't get multiplied by what x or y actually is.
It's, you know, the metric works everywhere, no matter what your x and y. But now in flat polar coordinates, we lose that.
And that means that we can only talk about very small journeys with the metric, very small changing in coordinates. It will hold, but only if we talk about very, very small distances.
Now, it takes a bit of a main bending to understand this, but what we need to introduce here is something called infinitesimals. Now, just as we can think about infinity, which is very, very, very, very big, but also at the same time, not actually a number.
It's just bigger than any other number. We can also talk about the opposite of infinity in a sense and infinitesimal, which a number which is very, very, very, very small, but not a number, but not so small that it's you.
So this is a bit of a main bending. And in calculus, we said of saying a change in distance, for example, we would say distance s, we would denote that by ds, which we were written together.
It's a little bit confusing because it doesn't mean d multiplied by s. It means the infinitesimal associated with a small change in s.
So to restate the metric in those terms, ds squared equals dr squared plus r squared times d phi squared.
And if we go in a journey, we now have to say how we get from point literally, we have to say how we get from point A to B.
And then we add up lots of little tiny infinitesimal steps along that route.
So that's why if you remember at the beginning, I said a metric is a is really like defining a ruler, a very, very infinite infinitesimally small ruler that allows you to follow any curve as detailed as you like.
Disclaimer, this doesn't work in fractals, but it's another HPR episode.
So the metric allows you, if you specify a path between two points, this metric, and indeed the Cartesian one would work as well, it was so much simpler, you don't notice it.
You would be able to add up all the little changes in dr and d phi according to that metric to work a distance traveled.
So that is the proper definition of a metric, as I've just given it to you, where you get away from the idea of the Cartesian metric, which is deceptively simple.
In fact, the Cartesian metric is a very special case of a metric, where like I said before, where you are in the space relative to your origin.
Your actual values are x and y coordinate, do not change the form of the metric.
And that's why Pythagoras works with those coordinates, but it doesn't work in general. Pythagoras is only part of the fact that is a consequence of the fact that Cartesian coordinates are very special kind of coordinate.
The unique in fact.
So, next question that I'd like to address, can we use Cartesian or polar coordinates, as I've just described them on the surface of the earth?
Well, the answer is yes and no. Yes, you can use them over small distances.
In other words, as long as you're not using a piece of paper so big that it starts to have to fold over the curvature of the earth, as long as you're using a small flat piece of paper, as long as you're working on a small distance across the earth, then yes, Cartesian or polar coordinates, you know, a simple compass painting in a distance will work fine.
But because the radius of the earth is roughly 6400 kilometers, once you start getting to distances much above sea, you know, will thumb 100 kilometers, depending on your application, you'll need to start worrying about the fact you're in a curved surface.
So, for example, if I was to drive from where I am in Glasgow to London, I wouldn't really give two hoots about the fact that I'm driving across a spherical earth.
It's just not that important. In fact, the wiggles of the roads and the motorways and, you know, all of that is more important than that scale than the fact that I'm traveling was about 600-700 kilometers.
But if I was flying a plane from, say, London to Singapore, I'd very much want to be taking the fastest route to save fuel if I was in airline.
And to do that, we would want to fly not in a straight line, but along the shortest distance over the surface of a sphere, which is what the earth is.
In other words, we can't pretend that the earth surface is flat once we're traveling thousands of kilometers.
If the any flat earth earth is listening to this, I suggest you probably stop listening to me now, because I think you probably know me like anything I'm about to see.
I'm moving as I move into the topic of two-dimensional curve surfaces, or maybe you like fantasy. In which case, if you like fantasy, then you can stick with it.
So, why? What's the problem going on here? Well, it's, like I said earlier, that the earth's surface may look locally flat, but once you get the large distances, you start to notice that it's curved.
And this means that you're dealing with something that's intrinsically curved. It's intrinsically non-uclidean, meaning you can't.
And non-uclidean means really is the same as saying you can't use a Cartesian coordinate system. It's just not going to work. You can't use a two-dimensional one.
You could use a three-dimensional one, actually, but you can't use a two-dimensional Cartesian coordinate system on a two-dimensional curved surface, like the surface of the earth.
The earth is a three-dimensional object, but we're only talking about its surface, assuming that it's a sphere at the moment.
What also means, if you're dealing with non-uclidean geometry, Pythagoras will not hold in general. It will hold locally, and of course you can use Cartesian coordinates locally, and much shorter distances than the radius of curvature that you're dealing with, but not generally.
And I think, at that point, I shall pause, if I shall stop this episode, and in my next episode, I'm going to talk about a curved two-dimensional surface embedded in a three-dimensional space.
And then, I don't know if in that episode, but if I get requests, I might do some more, and I start talking about curved three-dimensional spaces, and maybe after that, curved four-dimensional spaces and space-time in general relativity.
I don't know. Well, if I get the equivalent in the comments of a load of rotten tomatoes on, and oh my god, my brains exploded, maybe I won't do those shows, but I think I'll probably do the next one.
So until then, thank you very much for listening, and if I've got anything wrong, please do let me know in the show notes, or indeed, by recording an HPR show that explains this topic better than I can do it. Thanks very much.
You've been listening to Hacker Public Radio at Hacker Public Radio.org. We are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by an HPR listener like yourself. If you ever thought of recording a podcast, then click on our contributing to find out how easy it really is.
Hacker Public Radio was founded by the Digital Dove Pound and the Infonomicon Computer Club, and is part of the binary revolution at binrev.com. If you have comments on today's show, please email the host directly, leave a comment on the website, or record a follow-up episode yourself.
On this otherwise status, today's show is released under Creative Commons, Attribution, Share a Life, 3.0 license.
