The n-ball game

The area enclosed by a circle is πr2. The volume inside a sphere is 43πr3. These are formulas I learned too early in life. Having committed them to memory as a schoolboy, I ceased to ask questions about their origin or meaning. In particular, it never occurred to me to wonder how the two formulas are related, or whether they could be extended beyond the familiar world of two- and three-dimensional objects to the geometry of higher-dimensional spaces. What’s the volume bounded by a four-dimensional sphere? Is there some master formula that gives the measure of a round object in n dimensions?

The text above is the opening paragraph of my new column in American Scientist. If you’d like to know how the story comes out, by all means go read the full column in the format of your choice: HTML, PDF, or ink-on-paper at better newsstands everywhere. For those in a hurry, here’s the gist in one equation, one code snippet and one graph:

V(n,r)=\frac{\pi^\frac{n}{2} r^n}{\Gamma(\frac{n}{2}+1)}

The equation is the “master formula” mentioned above: Plug in the radius r and the number of spatial dimensions n, and you’ll get back the volume of the corresponding ball. (If the gamma function in the denominator is unfamiliar, think of it as a factorial that makes sense even when the argument is not an integer.)

        v[0, r_] := 1
        v[1, r_] := 2r
        v[n_,r_] := (2πr2/n) * v[n–2, r]

This version of the formula, given here in Mathematica notation, works only for integer n. It defines the volume of a 0-ball as 1 and the volume of a 1-ball as 2r. For larger n, the volume is calculated recursively: It’s 2πr2/n times the volume of a ball with the same radius in n–2 dimensions.

graph of the volume of a unit ball in n dimensions as a function of n from 0 to 20

Finally, the graph shows the volume of a unit n-ball (i.e., r = 1) for values of n from 0 through 20. When I first saw these data, two things took me by complete surprise. First, I was perplexed to learn that the volume of an n-ball dwindles away to nothing as n gets large. Second, I was even more surprised that the relation is not monotonic but has a peak at finite n. If we consider only integer n, the unit 5-ball has the largest volume. If we allow the spatial dimension to become a continuous variable, the maximum is at approximately n = 5.26.

These facts still seem pretty weird to me. And, although they are hardly new discoveries—the formula cited above goes back to the middle of the 19th century—they seem not to be widely known. How come nobody ever told me about this stuff?

Well, it turns out somebody did tell me, long ago. A few days after the current issue of American Scientist was sent to the press, I came upon an old Martin Gardner column with the title “Circles and spheres, and how they kiss and pack.” Writing about the n-sphere (by which he means the same object I’m calling the n-ball), Martin remarks:

And something very queer happens to its n-volume as n increases. The area of the unit circle is, of course, π. The volume of the unit sphere is 4.1+. The unit 4-sphere’s hypervolume is 4.9+. In 5-space the volume is still larger, 5.2+, then in 6-space it decreases to 5.1+ and thereafter steadily declines. Indeed, as n approaches infinity the hypervolume of a unit n-sphere approaches zero!

These words were published in the May, 1968, issue of Scientific American. I was a faithful reader in those days and surely saw the column, but I retain no shred of memory.

In the same column Martin discusses another mind-boggler that I also mention. Consider this configuration of disks in a square:

Disks in a box

The maroon disk in the middle, tangent to the four blue disks, has a radius of √2 – 1. In the analogous three-dimensional arrangement, with eight blue balls, the radius of the central maroon ball is √3 – 1; in n dimensions it is √n – 1. Now look at what happens when n = 9: The maroon ball, though still surrounded on all sides by blue balls, has expanded to a radius of 2 and thus reaches the edge of the enclosing cube. I learned of this conundrum from Barry Cipra, who gives an account of it in WHIMS I, the first volume in the AMS series What’s Happening in the Mathematical Sciences (1991). Barry wasn’t able to tell me anything about the provenance of the problem. Martin describes it as “an unpublished paradox discovered by Leo Moser,” a Canadian mathematician who died just a few years later. As far as I can tell, Moser never did publish anything about the problem. If anyone knows more about its origin, I’d be eager to hear about it.

A further note: The new American Scientist had not been out more than a day or two before I began getting letters arguing that the whole tale I’m telling is nonsensical because balls (or other shapes) that differ in dimension have volumes measured in different units. A unit 3-ball is neither larger nor smaller than a unit 2-ball, because one kind of volume is measured in cubic units and the other in square units. This issue is addressed in my column, though evidently not to the satisfaction of all readers. In retrospect, I think my discussion would have been clearer (and less controversial) if I had stated everything in terms of volume ratios rather than volumes. In other words, the numbers labeling the ordinate of the graph above should be understood as measuring the ratio of the volume of a unit n-ball to the volume of a unit n-cube. All measurements involve some such comparison, but in this case it’s really helpful to make it explicit.

I do believe that the curve in that graph is trying to tell us something important about geometry in higher-dimensional spaces. I have no clear idea what. Wisdom and insight are always welcome in the comments.

This entry was posted in featured, mathematics.

13 Responses to The n-ball game

  1. Doug says:

    In machine learning this comes up a lot. One way of thinking of it is that in higher dimensions, almost all of the volume of a unit cube is in the corners, none of it in the ball at the center. This also means that almost all random 100-dimensional vectors are nearly the same distance away from each other.

  2. Mathnerd314 says:

    You should’ve used τ. (τ/2)^(n/2)/Π(n/2) is consistent in dividing by 2, and all the other formulas have that annoying factor of two removed entirely.

  3. Markk says:

    I always thought about this the reverse way when I heard about it - what you are really talking about is the ratio of the unit sphere to the cube that surrounds it. That cube grows (super?) exponentially as the number of dimensions grows, and the sphere doesn’t, so the ratio goes to zero.

    To get a different feel, think about this - consider the smallest sphere that contains the unit cube. What does this ratio look like as the dimensions increase? How about the ratio of the unit sphere to the largest cube contained inside of it?

    This is really showing that area and volumes are really ratios when considered across dimensions.

  4. Iain says:

    I agree with Doug: what’s going on here is that the volume of a hyper-cube is all near its corners, so an inscribed sphere picks up very little of that volume.

    If one instead looks at the sequence of n-spheres that contain a unit cube, the relative volume of the sphere grows large. A high-dimensional cube covers very little of a surrounding sphere, as most of the sphere’s volume is rammed up in a thin layer near its surface.

    A related blog post, with a couple of references:

  5. The problem of the hyperspheres in hypercubes was also discussed by R. W. Hamming in pp. 168-171 of his 1980 book Coding and Information Theory (Englewood Cliffs, New Jersey: Prentice Hall).

    If I’m not mistaken, Hamming shows that the volume of the extra hypersphere becomes bigger than the volume of the hypercube as the number of dimensions increases. I don’t think he cited any references for this result.

  6. In case it wasn’t clear in my previous comment, Hamming is saying that the volume of the maroon hypersphere in the center (in between the blue hyperspheres) becomes bigger than the volume of the hypercube as the number of dimensions increases.

  7. JK says:

    I’m slightly confused by the second example (with the maroon disc): what happens for n > 9? Does the maroon ball extend beyond the cube?

  8. @JK, for n>9 the radius of the maroon hypersphere is greater than the length of the side of the hypercube. But since for large enough n, the volume of the maroon hypersphere is greater than the volume of the hypercube, it seems that the maroon hypersphere does extend beyond the hypercube.

  9. brian says:

    In case anyone else missed the point of the comment by Mathnerd314 (as I did), see The Tau Manifesto. By the way, shouldn’t that be Mathnerd628?

  10. brian says:

    @JK: The arithmetic is clear: Beyond n = 9, the radius of the central maroon ball is greater than the distance from the center of the cube to any face of the cube, and thus the maroon ball must protrude through the surface of the cube. Even so, it is still nestled in the central cleft formed by the 2^n blue balls. Trying to visualize this is another matter.

  11. (Oops, I made a mistake in my previous comment. I meant to say “diameter” instead of “radius.”)

  12. kaas says:

    re: the first comment, so does that mean that Machine Learning problems of five dimensions suffer the least from the “curse of dimensionality”? (of course 5 dimensions is a bit low for most ML problems, but still)

Leave a Reply

Your email address will not be published. Required fields are marked *


In addition to the basic HTML formatting options offered by the buttons above, you can also enter LaTeX math commands. Enclose LaTeX content in \( ... \) for inline mode or \[ ... \] for display mode.