Over a million developers have joined DZone.

An Incomplete Post About Sphere Volumes

DZone's Guide to

An Incomplete Post About Sphere Volumes

· Big Data Zone ·
Free Resource

The Architect’s Guide to Big Data Application Performance. Get the Guide.

This is an incomplete blog post. Maybe you can help finish it.

One of the formulas I’ve looked up the most is the volume of a ball in n dimensions. I needed it often enough to be aware of it, but not often enough to remember it. Here’s the formula:

\frac{\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2} + 1\right)}r^n

The factor of rn is no surprise: of course the volume as a function of radius has to be proportional to rn. So we can make the formula a little simpler by just remembering the formula for the volume of a unit ball.

Next, we can make the formula a simpler still by using factorials instead of the gamma function. If n is a non-negative integer, n! = Γ(n+1). We can use that to define factorial for non-integers. Then the volume of a unit ball is


That’s easier to remember.

It’s also curious. The nth term in the series for ex is xn/n!, so the volumes of unit balls look like series for eπ except compressed, with each index n cut in half. The volumes are not the coefficients in the series for ex, but could they be the coefficients in the series for another familiar function? To find out, let’s stick back in the factor of rn and sum.

\sum_{n=0}^\infty \frac{\pi^{\frac{n}{2}}}{\frac{n}{2}!} \,r^n

This is the sum of the volumes of balls of radius r in all dimensions. That doesn’t make sense by itself, but you could also think of this as the generating function for the volumes ofunit balls. So can we find a closed-form expression for the generating function? Yes:

\sum_{n=0}^\infty \frac{\pi^{\frac{n}{2}}}{\frac{n}{2}!} \,r^n = \sqrt{\pi} r \exp(\pi r^2) (\mbox{erf}(\sqrt{\pi} r) + 1)

If you work with probability, you probably find Φ more familiar than the error function (see notes relating these) and find exp(x2/2) more familiar than exp(x2). So you could rewrite the generating function as f(√(2π)r) where

f(x) = \sqrt{2} x\exp(x^2/2) \Phi(x)

That looks familiar, but I don’t know what to do with it.

I warned you this would an incomplete post. I feel like there’s an interesting connection to be made, but I’m not quite there. Any suggestions?

Learn how taking a DataOps approach will help you speed up processes and increase data quality by providing streamlined analytics pipelines via automation and testing. Learn More.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}