1. Why exactly n = 2 minimizes π. The article shows this graphically, but there is no formal proof (although the Adler & Tanton paper is mentioned). It would be interesting to understand why this is the case mathematically.
2. How to calculate π for n-metrics numerically. The general idea of "divide the circle into segments and calculate the length by the metric" is explained, but the exact algorithm or formulas are not shown.
3. What happens when n → 0. It mentions that "the concept of distance breaks down," but it does not explain exactly how and why this is so.
I really suck at math, especially when continuous functions are involved (ie non-CS-y math). Usually when mathy articles are posted on HN, I quickly give up, but I just ate this article up. I'm really impressed with the clear explanation, it's quite something! Thanks for writing this!
Once you understand the math, continuous functions are much simpler than discrete maths (the CS-y things like how many strings with such and such a property are there, or how many ways can you program a Turing machine to take a long time but eventually finish work).
Especially if they are complex differentiable functions - then they are wholly determined by their values in any tiny (complex) neighborhood around 1 (complex) value. Basically just equivalent to power series at that point.
While even finding the number of ways to give change is extremely challenging.
In Math one encounters so many results that leave one with the impression that Squared Euclidean is special. One such example is Singular Value Decomposition, or equivalently the Eckart-Young theorem. Arithmetic mean also minimizes the sum of Squared Euclidean from a set of points. Squared-Euclidean's properties are also the reason why the K-means algorithm (Lloyd's algorithm) is so simple.
Note that the squared part is important in that result although the squaring destroys the metric property.
A part of beauty of Euclidean metric (now without the squaring) is it's symmetry properties. It's level set, the circle (sphere) is the most symmetric object.
This symmetry is also the reason why the circle does not change if one tilts the coordinates. The orientation of the level sets of the other metrics considered in the post, depend on the coordinate axes, they are not coordinate invariant.
Euclidean metric is also invariant under translation, rotation and reflection. It has a specific relation with notion of dot-product and orthogonality -- the Cauchy-Schwarz inequality.
A generalization of that is Holder's inequality that can be generalized beyond these Lp based metrics, to homogeneous sublinear 'distances' or levels sets that have some symmetry about the origin [0].
The Cartesian coordinate system is in some sense matched with the Euclidean metric. It would be fun to explore suitable coordinates for the other metrics and level sets, although I am not quite sure what that means.
[0] Unfortunately I couldn't find a convenient url. I thought Wikipedia had a demonstration of this result. Can't seem to find it.
Is π really a number or is it a computation? For example, fibbonaci(∞) is not a number, and π looks to be conceptually similar. Unlike fibonacci(∞), π has a limit, and we can approximate it with better and better precision, but in both cases the computation will never terminate
Spheres and hyperbolic are also interesting. On a sphere Pi can be anything from 3.14... to 4, then decreasing to zero based on how big your circle is. Not sure about hyp space but would be interesting.
What does `n` correspond to here? And why is it “ours”? (although the second I understand as euclidean space corresponds to n=2 and we seem to live in a locally euclidean space)
Surely it’s not dimensions, since all of these examples were two-dimensional (x and y). So I’m a little lost here.
Errr... a circle is a shape in Euclidean geometry. Pi is a property of that shape in that geometry system. The OP article steps outside of Euclidean geometry. It discusses "circles" that aren't really circles. Therefore, the "pi's" that it discusses also aren't really pi's.
My conclusion therefore isn't "we have the best pi", but is rather "we have the only pi", because pi is simply not applicable, as soon as you alter the rules of there being a 2-dimensional plane and there being real-world distance, that the definition of pi depends on.
Anyway, I am not a mathematician, maybe I'm just too stuck in the boring old real world to get it!
If you want to go deeper, this is a subject with an immense number of connections. But to find them you'll probably have to know what people call them.
> Civilized man is surrounded on all sides, indoors and out, by a subtle, seldom-noticed conflict between two ancient ways of shaping things: the orthogonal and the round. Cars on circular wheels, guided by hands on circular steering wheels, move along streets that intersect like the lines of a rectangular lattice. Buildings and houses are made up mostly of right angles, relieved occasionally by circular domes and windows. At rectangular or circular tables, with rectangular napkins on our laps, we eat from circular plates and drink from glasses with circular cross sections. We light cylindrical cigarettes with matches torn from rectangular packs, and we pay the rectangular bill with rectangular bank notes and circular coins.
This column is included in one of Martin Gardner's books, which is where I read it in my childhood.
Viewed as level sets of vector norms (https://en.wikipedia.org/wiki/Norm_(mathematics)) these curves are called "balls": https://en.wikipedia.org/wiki/Ball_(mathematics)#In_normed_v.... Vector norms are fundamental to approximation theory, and because people often do math on measurements from the real world [citation needed] which are always imprecise [citation needed], approximation theory is pretty widely applicable. It's often convenient to use one of the alternative norms mentioned in Michał's article for your proofs.
Can someone explain what d(3)=(|x|^3+|y|^3)^(1/3) would actually mean as the blog seems to suggest something more profound than the below?
If d=|x|+abs|y} is moving in 2 dimensions, one dimension at a time and d(2)=(x^2+y^2)^(1/2) is moving in 2 dimensions at the same time, d(3)=(|x|^3+|y|^3)^(1/3) would have to mean moving 3 dimensions at once in two dimensional space (as it is missing the 3th position z) and for all n moving n dimensions at once in two dimensional space.
Now pi comes down to the constant calculating circumference. The blog shows we can approximate it best ignoring all other dimensions but those two in two dimensional space. Seems obvious, but that has everything to do with the nature of pi, not with the math.
d=(|x|^3+|y|^3+|z|^3)^(1/3) would approximate pi better in 3 dimensional space than in any other, etc.
All of these metrics are just functions of a vector. Pop in an (x, y) pair and you get a number out. d₁, or as it's usually called, ℓ¹, |x| + |y|, gives you 7 when you pop in (3, 4). ℓ² = √[|x|² + |y|²] gives you √[3² + 4²] = 5. ℓ³ gives you ∛[|3|³ + |4|³] ≈ 4.498. None of them are moving or otherwise changing with time. They don't pertain to different numbers of dimensions; all of them are defined (in this post) as functions of two dimensions. They just assign a distance metric to every point in a two-dimensional plane.
I think where you're coming from is that the ℓ¹ metric tells you how far a taxicab would have to move, changing in one dimension at a time, while the ℓ² metric tells you how far you have to go if you go in a straight line. But the ℓ³ metric doesn't correspond to anything similar, not even in three or four or five dimensions, and neither does, for example, ℓ¹·⁵. To get to them you have to go through the formulas above.
The curves drawn are "level sets", which connect points that have the same distance metric.
The point of the post is not that "we can approximate [π] best" with a particular distance metric. Rather, it says that every metric (of this family of metrics—you can invent an infinite number of other metrics) has its own ratio of the circumference of a ball to its diameter, which we could jokingly call its "π", and that ratio is lowest for ℓ².
The ratio itself is a notion that really only makes sense in two dimensions; in three dimensions, for example, a ball has a surface rather than a circumference, and dividing the surface by the diameter gives you a length, not a number.
I am completely mystified by your remark that something "has everything to do with the nature of pi, not with the math". What is the nature of π if not math?
That was fun, unexpected, learned something. I can barely calculate a restaurant tip but the thing I noticed was that our n=2 circle is smooth and continuous, the others have abrupt angle changes. Perhaps that is a clue to why "our" pi is the smallest.
The area of the Euclidean unit disk (area of a circle with radius 1) is equal to π. However, the volume of the unit ball (ball with radius 1, one dimension more) is larger, namely 4/3π ≈ 4.18879. So how does the hypervolume for unit n-balls change in higher dimensions, where the 1-ball is a circular disk and the 2-ball an ordinary ball?
Surprisingly, it first increases but then converges to 0. The maximum is achieved for a unit 5-ball with a hypervolume of about 5.2638. For higher dimensions the value decreases again.
However: If we allow fractional dimensions, the 5-ball isn't at the peak volume. The n-ball with the largest volume is achieved for n≈5.256946404860577, with a volume of approximately 5.277768021113401, which are slightly larger numbers.
Curiously, the paper above says that the area of the hyper surface of the n-ball (rather than its volume) peaks at n≈7.2569464048, while ChatGPT calculated it as n≈6.256946404860577, so exactly one dimension less than the paper. I assume the paper is right?
Also curiously, as you can see from these numbers, that fractional dimension with the peak hyper surface area is exactly two (according to the paper) or one (according to ChatGPT) dimension larger than the fractional dimension of the peak volume.
I hate this result because it's not actually saying what it's advertized to be saying
sure, you already got the complaint about comparing values of different units - but observe HOW this question is actually sidestepped! We divide hyper-volume of n-sphere by hyper-volume of n-cube!
Now this raises the question: WHAT n-cube are we taking?
If you take hyper-cube with side-length of sphere's diameter, you'll have nice relation between cube and its inscribed sphere - and, predictably, as n goes up, number of cube's "corners" also goes up. So this ratio consistently goes down
But what about your numbers? Well that result happens when you take cube with side-length of sphere's RADIUS. That way you arbitrarily add a scaling factor 2^n - and there's nothing geometric about this behaviour
Aside: In the table relating n to pi, what’s with the baselines of the text in the second column? (“exact” and “you are here”.) Is some renderer treating the characters like mathematical symbols?
I've always found the approximation of a circle to the limit as n -> inf of a polygon of n equal sides to be interesting. I do have a question though: is it possible to extend this method of exploration to reconcile the irrational property of pi? Because I'm somewhat discomforted with being satisfied with approximating our "best pi" to 3.14.
Is there a metric for distance on the surface of a sphere? I imagine it's not one of the metrics in the family in the article, but in such a metric wouldn't Pi be less than 3.14?
[I dropped my physics major in college in favor of computer science, mostly because I couldn't handle the math, so I acknowledge that this could be a stupid/non-sensical question.]
Yes. The angle subtended by the two points at the center of the sphere. It's the angular displacement made to go from one point to the other along the great circle joining the two points on the surface.
The great circle is the one that passes through those points and has the center of the sphere as it's center.
> An example that should be familiar to many software engineers is the taxicab metric, also known as the Manhattan distance. ... There are some unnamed geometries in between, but if n approaches infinity, we get what’s called the Chebyshev distance.
I like to think of these two metrics and "rook" and "queen" distance. Manhattan distance is how far away two points are if you are traversing using a rook in chess which can only move horizontally and vertically. Chebyshev distance is how far they are if you can also move diagonally.
LOL as I'm reading the bit about the minimum (and before I get to the part linking the proof (which spawned the blog post)) my brain says "Ok, but have you done a formal proof extrapolating out to... maybe there's another dip, a pattern of dips..."
I haven't clicked the link, but I guess this is a well written blog post, since the place where I asked the question is precisely where they link to the paper. Nice.
34 comments
[ 4.8 ms ] story [ 60.7 ms ] threadAt least to me it's provocative
1. Why exactly n = 2 minimizes π. The article shows this graphically, but there is no formal proof (although the Adler & Tanton paper is mentioned). It would be interesting to understand why this is the case mathematically.
2. How to calculate π for n-metrics numerically. The general idea of "divide the circle into segments and calculate the length by the metric" is explained, but the exact algorithm or formulas are not shown.
3. What happens when n → 0. It mentions that "the concept of distance breaks down," but it does not explain exactly how and why this is so.
Especially if they are complex differentiable functions - then they are wholly determined by their values in any tiny (complex) neighborhood around 1 (complex) value. Basically just equivalent to power series at that point.
While even finding the number of ways to give change is extremely challenging.
Note that the squared part is important in that result although the squaring destroys the metric property.
A part of beauty of Euclidean metric (now without the squaring) is it's symmetry properties. It's level set, the circle (sphere) is the most symmetric object.
This symmetry is also the reason why the circle does not change if one tilts the coordinates. The orientation of the level sets of the other metrics considered in the post, depend on the coordinate axes, they are not coordinate invariant.
Euclidean metric is also invariant under translation, rotation and reflection. It has a specific relation with notion of dot-product and orthogonality -- the Cauchy-Schwarz inequality.
A generalization of that is Holder's inequality that can be generalized beyond these Lp based metrics, to homogeneous sublinear 'distances' or levels sets that have some symmetry about the origin [0].
The Cartesian coordinate system is in some sense matched with the Euclidean metric. It would be fun to explore suitable coordinates for the other metrics and level sets, although I am not quite sure what that means.
[0] Unfortunately I couldn't find a convenient url. I thought Wikipedia had a demonstration of this result. Can't seem to find it.
https://www.nytimes.com/interactive/2025/06/09/science/math-...
Surely it’s not dimensions, since all of these examples were two-dimensional (x and y). So I’m a little lost here.
0: https://en.wikipedia.org/wiki/Lp_space#The_p-norm_in_finite_...
My conclusion therefore isn't "we have the best pi", but is rather "we have the only pi", because pi is simply not applicable, as soon as you alter the rules of there being a 2-dimensional plane and there being real-world distance, that the definition of pi depends on.
Anyway, I am not a mathematician, maybe I'm just too stuck in the boring old real world to get it!
You can read more about the curves of Lamé plotted in this article at https://en.wikipedia.org/wiki/Superellipse. If you're in Sweden, the layout of https://en.wikipedia.org/wiki/Sergels_torg is a superellipse design by Piet Hein. Martin Gardner wrote a delightful column about this in the September 01965 Scientific American: https://www.scientificamerican.com/article/mathematical-game... "The superellipse: a curve that lies between the ellipse and the rectangle" which I don't have a copy of, except the slightly corrupted copy at https://piethein.com/superellipse/. It begins lyrically:
> Civilized man is surrounded on all sides, indoors and out, by a subtle, seldom-noticed conflict between two ancient ways of shaping things: the orthogonal and the round. Cars on circular wheels, guided by hands on circular steering wheels, move along streets that intersect like the lines of a rectangular lattice. Buildings and houses are made up mostly of right angles, relieved occasionally by circular domes and windows. At rectangular or circular tables, with rectangular napkins on our laps, we eat from circular plates and drink from glasses with circular cross sections. We light cylindrical cigarettes with matches torn from rectangular packs, and we pay the rectangular bill with rectangular bank notes and circular coins.
This column is included in one of Martin Gardner's books, which is where I read it in my childhood.
Superquadrics are a generalization of the three-dimensional case (see https://en.wikipedia.org/wiki/Superquadrics); Ed Mackey's 01987 "Superquadrics" screensaver is included in xscreensaver, which you can easily install if you're running Debian or Android with F-Droid: https://f-droid.org/en/packages/org.jwz.xscreensaver/
Viewed as level sets of vector norms (https://en.wikipedia.org/wiki/Norm_(mathematics)) these curves are called "balls": https://en.wikipedia.org/wiki/Ball_(mathematics)#In_normed_v.... Vector norms are fundamental to approximation theory, and because people often do math on measurements from the real world [citation needed] which are always imprecise [citation needed], approximation theory is pretty widely applicable. It's often convenient to use one of the alternative norms mentioned in Michał's article for your proofs.
As for n=0, can't you prove that pi=inf for n=0 using limits?
Can someone explain what d(3)=(|x|^3+|y|^3)^(1/3) would actually mean as the blog seems to suggest something more profound than the below?
If d=|x|+abs|y} is moving in 2 dimensions, one dimension at a time and d(2)=(x^2+y^2)^(1/2) is moving in 2 dimensions at the same time, d(3)=(|x|^3+|y|^3)^(1/3) would have to mean moving 3 dimensions at once in two dimensional space (as it is missing the 3th position z) and for all n moving n dimensions at once in two dimensional space.
Now pi comes down to the constant calculating circumference. The blog shows we can approximate it best ignoring all other dimensions but those two in two dimensional space. Seems obvious, but that has everything to do with the nature of pi, not with the math.
d=(|x|^3+|y|^3+|z|^3)^(1/3) would approximate pi better in 3 dimensional space than in any other, etc.
I think where you're coming from is that the ℓ¹ metric tells you how far a taxicab would have to move, changing in one dimension at a time, while the ℓ² metric tells you how far you have to go if you go in a straight line. But the ℓ³ metric doesn't correspond to anything similar, not even in three or four or five dimensions, and neither does, for example, ℓ¹·⁵. To get to them you have to go through the formulas above.
The curves drawn are "level sets", which connect points that have the same distance metric.
The point of the post is not that "we can approximate [π] best" with a particular distance metric. Rather, it says that every metric (of this family of metrics—you can invent an infinite number of other metrics) has its own ratio of the circumference of a ball to its diameter, which we could jokingly call its "π", and that ratio is lowest for ℓ².
The ratio itself is a notion that really only makes sense in two dimensions; in three dimensions, for example, a ball has a surface rather than a circumference, and dividing the surface by the diameter gives you a length, not a number.
I am completely mystified by your remark that something "has everything to do with the nature of pi, not with the math". What is the nature of π if not math?
The area of the Euclidean unit disk (area of a circle with radius 1) is equal to π. However, the volume of the unit ball (ball with radius 1, one dimension more) is larger, namely 4/3π ≈ 4.18879. So how does the hypervolume for unit n-balls change in higher dimensions, where the 1-ball is a circular disk and the 2-ball an ordinary ball?
Surprisingly, it first increases but then converges to 0. The maximum is achieved for a unit 5-ball with a hypervolume of about 5.2638. For higher dimensions the value decreases again.
However: If we allow fractional dimensions, the 5-ball isn't at the peak volume. The n-ball with the largest volume is achieved for n≈5.256946404860577, with a volume of approximately 5.277768021113401, which are slightly larger numbers.
These were computed by GPT-5-thinking, so take it with a grain of salt. But the fractional dimension for peak volume is also reported here on page 34: http://lib.ysu.am/disciplines_bk/8d6a1692e567ede24330d574ac3...
Curiously, the paper above says that the area of the hyper surface of the n-ball (rather than its volume) peaks at n≈7.2569464048, while ChatGPT calculated it as n≈6.256946404860577, so exactly one dimension less than the paper. I assume the paper is right?
Also curiously, as you can see from these numbers, that fractional dimension with the peak hyper surface area is exactly two (according to the paper) or one (according to ChatGPT) dimension larger than the fractional dimension of the peak volume.
sure, you already got the complaint about comparing values of different units - but observe HOW this question is actually sidestepped! We divide hyper-volume of n-sphere by hyper-volume of n-cube!
Now this raises the question: WHAT n-cube are we taking?
If you take hyper-cube with side-length of sphere's diameter, you'll have nice relation between cube and its inscribed sphere - and, predictably, as n goes up, number of cube's "corners" also goes up. So this ratio consistently goes down
But what about your numbers? Well that result happens when you take cube with side-length of sphere's RADIUS. That way you arbitrarily add a scaling factor 2^n - and there's nothing geometric about this behaviour
Memory from my Analysis 4 class in college.
[I dropped my physics major in college in favor of computer science, mostly because I couldn't handle the math, so I acknowledge that this could be a stupid/non-sensical question.]
The great circle is the one that passes through those points and has the center of the sphere as it's center.
Imagine the Earth is a sphere. You make circles centered in the north pole:
* If the circle is tiny, the Earth is almost flat and you get almost pi.
* If the circle is the equator, you have to walk 1/4 of length the circle from the pole to the equator, so the result is 4/2=2
* If the circle is so big that you walked almost to the south pole, the result is almost 0.
I like to think of these two metrics and "rook" and "queen" distance. Manhattan distance is how far away two points are if you are traversing using a rook in chess which can only move horizontally and vertically. Chebyshev distance is how far they are if you can also move diagonally.
I haven't clicked the link, but I guess this is a well written blog post, since the place where I asked the question is precisely where they link to the paper. Nice.