Monday, 7 March 2011

The Volume of an n-sphere

Here I present a (fairly common) derivation for the volume of an n sphere.
Where an n-sphere is defined by
$S^n=\left\{x \epsilon \mathbb{R}^{n+1}: ||x||)=r\right\}$

We first start by calling on what we already know;

$V_{1}=2 \pi r$ for $S^0$ $V=\pi r^2$ for $S^{1}$ and $V=\frac{4}{3} \pi r^3$ for $S^2$ These can both be obtained most easily via usual methods of integrating in polar and spherical coordinates, respectively.

By inspection - and intuition - we should think that the volume is proportional to $r^{n+1}$ i.e some constant times r to the power of the dimension we are in.
Therefore we should expect that the formula for the volume of a sphere in m-dimensions looks a little like
$V_{m}=\nu_{m} r^m$
where $\nu_{m}$ is the constant of proportionality that we are after.
Hence the volume element (in m-dimensions and spherical coordinates) is given by; $dV_{m}= m \nu_{m} r^{m-1} dr$

Now this seems like a leap of faith, or unjustified - but let's take a look at some Gaussian Integrals;

$$I_m=\int \! e^{-\left(x_{1}^2+...+x_m^{2}\right)} dx_1....dx_m=$$ where the integral is over all of  $\mathbb{R}^m$
From our knowledge of a standard Gaussian Integral;
$I=\int_{- \infty}^{\infty} \! e^{-x^2} dx=\sqrt{\pi}$
and recognising the fact that the $x_i$ are independent, we can factorise the integral;
$$I_m=\int \! e^{-x_1^2} dx_1...\int \! e^{-x_m^2} dx_m = I^m $$
Therefore $$I_m=\sqrt{\pi}^m = \pi^\frac{m}{2}$$

Now, transforming into m-dimensional spherical coordinates so that;
Which gives $$I_m=\int \! e^{-r^2} dV_{m} $$
and using our definition for the spherical volume element we got before;
$$\int_{0}^{\infty} \! e^{-r^2} m\nu_m r^{m-1} dr=\pi^\frac{m}{2}$$
Taking out the variables which aren't dependent on r from the integrand we get;
$$I_m=m\nu_m \int_{0}^{\infty} \! e^{-r^2} r^{m-1} dr =\pi^\frac{m}{2}$$

You math geeks out there should recognise the form of the integral as somewhat close to the gamma function;
$$\Gamma(z+1)= \int_{0}^{\infty} u^{z}e^{-u} du $$
Now, substituting $$u=r^2$$ then $$\frac{du}{dr}=2r$$ or in terms of u; $$\frac{du}{dr}=2\sqrt{u}$$
$$V_m=\nu_m m \int_{0}^{\infty} e^{-u}\left(\sqrt{u}\right)^{m-1}\frac{1}{2\sqrt{u}} du$$

$$\pi^{\frac{m}{2}}=\frac{\nu_m m}{2} \int_{0}^{\infty}e^{-u} \left(\sqrt{u}\right)^{m-2} du$$
$$=\frac{\nu_m m}{2} \int_{0}^{\infty}e^{-u} u^{\frac{m}{2}-1} du$$
Which we can almost assimilate with the above form of the Gamma function;

A simple substitution provides us with;
$$\frac{m}{2}-1=z \rightarrow \frac{m}{2}=z+1$$
Hence $$\Gamma(z+1)= \int_{0}^{\infty} u^{z}e^{-u} du $$ becomes;
$$\Gamma(\frac{m}{2})=\int_{0}^{\infty} u^{\frac{m}{2}-1} e^{-u} du$$

Therefore; $$\pi^{\frac{m}{2}}=\frac{ \nu_m m \Gamma(\frac{m}{2}) }{2}$$

So putting it all together, we recover our unknown coefficient $\nu_m$;
$$\nu_m= \frac{\pi^\frac{m}{2}}{\frac{m}{2}\Gamma(\frac{m}{2})}$$

Or you can obtain an equivalent formula by looking at $$\Gamma(\frac{m}{2}+1)= \int_{0}^{\infty} u^{\frac{n}{2}} e^{-u} du $$ and integrating by parts to recognise that;
Hence putting it all together, we recover the Volume of an n-dimensional sphere of radius r as;

$$V_m=\frac{\pi^{\frac{m}{2}} r^m}{\frac{m}{2} \Gamma(\frac{m}{2})}$$

= $$\frac{\pi^\frac{m}{2} r^m}{\Gamma(\frac{m}{2}+1)}$$

Having done all that, it could be an interesting idea to see how the volume of the unit n-sphere changes as we increase the number of dimensions;
In dimension 2; $$V=\pi$$
In dimension 3; $$V=\frac{4}{3}\pi$$
and so on.
Below is a plot of volume vs dimension for the unit sphere - constructed using the volume formula we obtained above;

I find it quite amazing that there is a maximum! That is that there is a point (around n=5) that when you start adding dimensions to the sphere; its volume decreases!

Final Word:
It may not seem like there are any real world applications for the use of n-dimensional spheres, but there actually are! In statistical mechanics, a system of N independent particles may be confined to the surface or within a volume of an N dimensional sphere in phase space (due to energy considerations)- where here we don't think of N as spatial dimensions, but degrees of freedom. So when N becomes large (as it does in the thermodynamic limit) we are required to use the above formula and it is just as well that the volume decreases to zero as N becomes large, otherwise it would be indicating that the thermodynamic properties (which in general depend on the statistical behaviour of the particles) of our ensemble have would become infinite - which is an indication that something has gone wrong in the math!


  1. I would never be able to do that. I am so bad at math

  2. Have you thought about using this space as a translational medium? Your 'final word' section seems pretty lucid, so perhaps more of a 50-50 split between derivation and application could be interesting. Just a thought!

  3. wow this is amazing e___e!
    does this have anything to do with the space growing exponentially?

  4. I will not break my head on that but thx for info and stuff anyway

  5. like "the criticizer" said...
    But I can understand what you're doing.

  6. i have been coding a graphic game, sure this will help a lot. thanks!

  7. Well that's pretty simple and straightforward.
    Haha seriously though that's some complex stuff.
    Awesome blog!

  8. This is probably the most interest blog I've ever seen. Followed with a lot of eagerness to see the next posts.

  9. @Matt, I completely agree. I would like to see more about application, that's the exciting part!

  10. Just finished my 1st semester of college, managed to understand all of this.
    The Gamma function is pretty cool. I've seen it once (and didn't understand it, I was 16) and have been looking for it for quite some time. Thanks to you, I found it!

  11. mind = blown hahah keep up the posts, very interesting formulas :)

  12. That was about ten feet over my head.

  13. This shit is all going over my head. But hopefully this will make me become better at maths. Through highschool i was great, all A's, but this stuff is just on an entirely new level. I'd love to know if there is any kind of background reading that could help me understand these concepts more effectively.

    Keep on posting.