Why Never to Sell Mooncakes in 6 Dimensions
planted oct 15, 2026 · v1.0.1
A journey to find the “surface area” and “volume” of n-dimensional spheres.
Back in 2023, a standard was put into force in China to prevent mooncake over-packaging. The issue was that they put mooncakes in huge boxes, with giant gaps between the packaging and the actual mooncake. After this short read, you will be able to get back at these vendors with a confident and articulate denunciation:
You should go and sell your mooncakes in 6-dimensional space (or above)!!
Use with caution. This is considered offensive in some cultures.
OK, guys, this is exciting. Let’s get ready…
A circle is , a sphere is . Not the most surprising results. What about higher dimensions? Can we try to get the “volume” of higher dimensional spheres?
Boring Prerequisites: Edgy and Round
A single integral is the area under the curve.
Consider generalizing this image to the “volume” between the “surface” of the function and the “plane” formed by the axes we are integrating over.
Note that when calculating, order of the terms inside the integrals doesn’t matter, as long as the variables stay inside their corresponding integrals.
This is the area of a rectangle, however, conceptually, it is more accurate to think of it as the volume of a slab. Because this allows us to use non-constant functions, and the double integral gives the total volume under the surface (or equivalently, the accumulated value of the 2D domain that is integrated over. We can always translate the 3D image with uniform “density” to a 2D image with variable values everywhere, depending on what makes most sense in context).
We can also vary the bounds of integrals.
This is the area of a triangle.
Integrating in the Polar Coordinate
Now that we moved into integrating a 2 dimensional plane, we are naturally allowed to use polar coordinates instead of the edgy one. In Cartesian, each is an infinitesimal rectangle. In polar, we are integrating over a fan-shape thingy, which makes it slightly more complicated (but as we will see, extremely helpful at times).
The fan shape has height and the arc length is , we can approximate the area with simply since it is infinitesimally small. Notice how the arc length depends on , since the further away from the origin, the longer the arc length will be with a given .
Unit check: is .
Polar in 3D
Let’s try to generalize our results to 3D.
The easiest way is to use a cylindrical coordinate, where each point is identified by a radius, a height, and an angle. We can translate from cartesian by:
Or back:
Note that is always from positive , and represents the angle on the x-y plane. This is essentially what we had before, integrating over a height .
The metric for volume is .
Now, let’s try the spherical coordinate, where each point is identified with 2 angles and a radius.
Note on notation: For some reason we switch the angle on the x-y plane that used to be to …
Back to Cartesian:
To make a bit of sense out of this: is the angle between and . The projection of r on the x-y plane is , which makes angle with x.
Conventionally, goes from to , and goes from to . This is the same as how we locate on the Earth, where we use the whole circle for longitude and only half of the circle for latitude.
The metric for volume now would be .
Let’s use this to calculate the surface area of a sphere.
Integrate over for volume.
We often find ways to use mathematics to generalize something that works in only a limited circumstance to a bigger world. The simple example is us defining such that the square root, which only worked for non-negative numbers, now works for all real numbers. Now, this new tool gives us a method to obtain surface area and volume of “spheres” of any dimension! We can already see that they generalize to lower dimensions:
- On 2D (I am using A and V here for consistency, but in this context they mean circumference and area):
- 1D (We don’t really have a good formula for the “surface area” anymore, but we can obtain it in reverse, by taking the derivative with respect to the radius. Consider how we interpret these results. A 1D sphere is really just a line segment of length , volume here means length. What about “surface area”? Points?):
Can we similarly calculate the surface area and volume of higher dimensional spheres, whatever that means? That is not so easy! We will need two little detours into something seemingly irrelevant, but even cooler (a little teaser, they both start with a capital “G”! OK, maybe that wasn’t so informative). Soon you will see how they come together…
The Gaussian Integral: 大方无隅 (“The Great Square Has No Corners”)
Now, here is the juicy bit… Why do we need a different coordinate system? Well, other than when we may need definite integrals over a less edgy domain (like the spheres), here is a beautiful result that requires it. This is the Gaussian Integral:
It represents the area under the curve of a bell curve. It looks simple, but isn’t easy to solve at all… For instance, try the obvious u-substitution:
Ah-oh. That there is not friendly…
How can we solve this important and simple looking integral? Clever mathematicians, I believe Poisson, figured out a way.
Nothing fancy, just did the same thing with a different name.
Now we see why we are choosing a different name. Note how is nothing other than in polar coordinates. Now, since we are integrating both and from positive to negative infinity, that is essentially the whole plane. It makes no difference which way we are integrating, edgy or not. Let’s turn the integrals polar, leaving the function untouched:
Something very significant has quietly occurred. Remember that unfriendly in Cartesian? We now get to tackle it. Note how the function inside the integrals is now , which looks exactly like the original function, just with in place of (which doesn’t make a difference to the function itself) and with an additional coming from the property of the arc length.
We can now do it the peaceful way:
How pretty! This result will be used as our first component for n-dimensional spheres, although they don’t look akin at the moment. Note that although we were able to find , this method can no longer be used if we are looking at finite limits, since then the domain of becomes a square and we can no longer use polar integration.
The Gamma Function: Halfway Between 1 and 1
is 1. is also 1. If you happen to be 22-year-old Euler in 1729, you would ask: what is one-half factorial? The answer was surprising. It isn’t 1, it has a in it. That’s what sent him looking for an integral that gives the factorial, and his integral, rewritten a little, is the Gamma function (https://arxiv.org/pdf/1908.01571).
For :
First, note that this function has a certain property. Consider , use integration by parts:
Remember how we mentioned how mathematics can allow us to generalize an operation limited to a certain circumstance? When we see this property of this function, it feels like we can use it to generalize the factorial function, since it also satisfies like the factorial (more precisely, ), but can be applied to more than just natural numbers!
By induction, .
There, we showed that the Gamma function can be used in place of factorial for natural numbers, but why don’t we generalize further?
Let , and get ready for some grand reveal…
Whaaaaaat?! Is this not our beloved… Gaussian Integral?
Well, almost our Gaussian Integral, this one is from to instead from , but that can’t stop us. The function inside the Gaussian Integral is an even function, that means:
Or, if you don’t buy this, we can integrate from to on this step instead of from to , since we are covering the same domain (after we squared it we only look at the first quadrant).
With and the fact that , it is easy to obtain:
| … | … |
| … | … |
Note that from and , which is undefined, so are, therefore, all negative integers.
The Balls
We are now finally ready to make all these weird functions come together for the “surface areas” and “volumes” of the spheres.
First, let’s expand our to more dimensions.
Let’s go to a “spherical” coordinate for dimensions! Note that it is still true that the entire integral is “spherically” symmetrical, which means that we can still use an integral over to find the volume with surface area.
But what is that surface area? Well, we know from unit checking and the fact that it is a dimensional surface in a dimensional space, that it must be in the form of , where is some constant.
Think of this geometrically. What we did before is to integrate each over each , but we don’t need to deal with all that, since we know that it would just be the surface area of a “sphere”, let’s replace it:
Let .
[Giant noise in wonder and celebration] Does this now remind you of something?
The best part is, we already know what is, it is !
My friends, this is a big moment! Through n-dimensional Gaussian Integral, and the Gamma Function, we have obtained a formula for the surface area of an n-dimensional sphere!!
Which means the volume is:
Or just:
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| … | … | … |
2023 Is a Bad Year for High Dimensional Mooncake Vendors
Let’s pack a (oddly spherical) mooncake of radius into the smallest box that fits it: a cube with side . The volume of the box in dimensions is
So the fraction of the box that is actually mooncake is
:
:
:
:
:
Where did all the space go? To the corners. A corner of the box is at , so its distance from the center is
In 100 dimensions, the corners are away from the center, while the mooncake only reaches . Even the tightest box is basically all gap.
From on, even the tightest possible box is over 12 times the mooncake, more than China’s standard allows (around 10 times). Thanks to this, no evil 6-dimensional mooncake box could ever pass the standard.
Acknowledgement
Professor Noah Graham supplied most of the information in this page in his lectures and problem sets.