Multivariable calculus: Volume of the n-sphere

Volume of the \(n\)-sphere #

written and developed by Thomas Pietraho

Background #

In class we noticed that even though we may not be able to visualize objects in more than three dimensions, we can still talk about their volumes. Using integration, if \(\mathcal{R}\) is a region in some dimension perhaps larger than three, then

\[ \text{Volume of } \mathcal{R} = \int_\mathcal{R} 1 \; dV \]

The right hand side can be computed as an iterated integral using \(n\) single-variable integrals whose limits are determined by the region \(\mathcal{R}\).

At first glance, this seems like a frivolous endeavor: why should we compute volumes of regions we cannot visualize? But there are numerous applications, from measuring the sizes of opportunity sets in economics to computing probabilities in statistics. At the end of this lab, we will discuss an application to the classification problem in machine learning.

Spheres in higher dimensions #

The following is an artist’s rendering of a unit sphere in four dimensions. Honestly, I am not sure what is going on in this picture, but if we are willing to forgo trying to visualize, we can make some mathematical sense of this notion. Read on!

An artist's take on the 3-sphere. Hmmmm.
Image from Pinterest

The unit circle and the unit sphere can both be thought of as sets of points whose distance from the origin equals one. The only difference is that the former lives in two dimensional space, or \(\mathbb{R}^2\), while the latter lives in three dimensional space, or \(\mathbb{R}^3\). If we replace the usual names of the axes \(x\), \(y\), and \(z\) by \(x_1\), \(x_2\), and \(x_3\), then the unit circle and the unit sphere can be described as the following sets:

\[ \{(x_1,x_2) \; | \; x_1^2+x_2^2 = 1 \}\]

\[ \{(x_1,x_2,x_3) \; | \; x_1^2+x_2^2 +x_3^2= 1 \}\]

But note that there is nothing stopping us from defining similar concepts in higher dimensions! For instance, we could look at the set of points whose distance from the origin in \(\mathbb{R}^4\) equals one: \[ \{(x_1, x_2, x_3, x_4) \; | \; x_1^2+x_2^2 +x_3^2 +x_4^2= 1 \}\]

or in fact, we could even look at the set of points whose distance from the origin in \(\mathbb{R}^n\) is one:

\[ \{(x_1,x_2,\ldots,x_4) \; | \; x_1^2+x_2^2 + \ldots + x_n^2= 1 \}\]

We are ready to formalize this and make the following definition:

Definition: The unit \(n\)-sphere of is the set of points in \(\mathbb{R}^{n+1}\) whose distance from the origin equals one. When in need of a shorthand notation for the \(n\)-sphere, we will write \(S^n\).

This notation is a little surprising: the \(n\)-sphere lives in \(\mathbb{R}^{n+1}\), so the circle is a “1-sphere” and the usual sphere in three dimensions is called a “2-sphere.” The reason for this slight incongruity is that although the sphere lives in three dimensions, mathematicians view its surface as essentially two-dimensional: an ant living on the surface of a sphere cannot readily distinguish its habitat from a two-dimensional plane.

Volume in higher dimensions #

To compute area of a two-dimensional region \(\mathcal{R}\), we set up a double integral whose limits of integration describe \(\mathcal{R}\) and integrate the function \(f(x,y) = 1.\) As a brief refresher, complete the following exercise:

Exercise: Using Cartesian coordinates, set up but do not evaluate, a double integral which computes the area of a unit circle.
Solution
\[ \int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} 1 \; dy \; dx \]

In a similar vein, to compute volume of a three-dimensional region \(\mathcal{R}\), we set up a triple integral whose limits of integration describe \(\mathcal{R}\) and integrate the function \(f(x,y,z) = 1.\) Continuing our brief refresher, complete the following exercise:

Exercise: Using Cartesian coordinates, set up but do not evaluate, a triple integral which computes the area of a unit sphere.
Solution
\[\int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} \int_{-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}}1 \; dz \; dy \; dx\]

There are many applications where we need to measure the sizes of regions in higher dimensions. We can extend the notion of volume and again compute it using multiple integrals. For example the volume of a region in four-dimensions is computed using a quadruple integral; the integrand is just the function \(f(x,y,z,w) = 1.\)

Exercise: Using Cartesian coordinates, set up but do not evaluate, a quadruple integral which computes the volume of a unit 3-sphere in \(\mathbb{R}^4\). Do as much of this as you can by mimicking the answers in two and three dimensions.
Solution
\[\int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} \int_{-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}} \int_{-\sqrt{1-x^2-y^2-z^2}}^{\sqrt{1-x^2-y^2-z^2}} 1 \; dw \; dz \; dy \; dx\]

Lab objective #

The goal of this lab is to compute the volumes of spheres in different higher dimensions and ultimately derive a formula for the volume of the unit \(n\)-sphere. The computations become tricky because of the integrals involved, but a Mathematica notebook contains a guide to useful commands that will simplify your task. Follow the outline below as you work. To complete the lab, summarize your findings by answering the two questions in the final section.

Procedure #

Use the following steps to guide you through this lab:

  1. Our first task is to compute the volumes of unit spheres in a number of small dimensions. As a warm up, use the Mathematica notebook to compute the area of a unit circle (a 1-sphere) and a unit sphere (a 2-sphere). What is the volume of a 3-sphere in four dimensions?

  2. Keeping track of your results, continue your computations by compiling a list of the volumes of spheres of higher and higher dimensions. Our objective is to derive a formula the the volume of the \(n\)-sphere. If we have enough data points, we may be able to observe a pattern and guess the formula.

  3. If at some point your computations become slow before you observe a pattern, complete the following exercise and read the “hack” which follows.

Exercise:

Suppose that we have a region \(\mathcal{R}\) with volume \(V\) and we scale it by a factor of 2, that is, all of its dimensions are doubled.

  • What is the volume of the scaled region?
  • What happens if \(\mathcal{R}\) is a four-dimensional region?
  • A five-dimensional region?
  • What happens to the volume if we scale everything by a factor of \(r\)?
Solution
It is easiest to think about what happens to a cube. In three dimensions, doubling each edge increases the volume by a factor of \(2^3 = 8\). If there are four-dimensions, there is one more dimension to double and volume will increase by a factor of \(2^4 = 16\). In five-dimensions, this is \(2^5\). Finally, if we scale everything by a factor of \(r\) and we are in \(n\) dimensions, volume will scale by a factor of \(r^n\).
Useful hack

In certain circumstances, this hack allows you to convert a multiple integral into a single integral, making something that is hard to compute into something that may be simple. Suppose we are trying to compute something like:

\[V = \int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} \int_{-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}}1 \; dz \; dy \; dx\]

To make things look a little simpler, we will make a substitution. Let \(R = \sqrt{1-x^2}\) so that \(R^2 = 1-x^2\). We can replace each occurrence of \(\sqrt{1-x^2}\) in our original integral with \(R\) and obtain:

\[V= \int_{-1}^{1} \int_{-R}^{R} \int_{-\sqrt{R^2-y^2}}^{\sqrt{R^2-y^2}}1 \; dz \; dy \; dx\]

So far so good, but it looks like we have not really achieved anything. But we have! Focus on the innermost two integrals:

\[\int_{-R}^{R} \int_{-\sqrt{R^2-y^2}}^{\sqrt{R^2-y^2}}1 \; dz \; dy \]

This is exactly the double integral you would set up if you wanted to compute the area of a circle of radius \(R\). But we know the formula for this already: it is \(\pi R^2\). Or since \(R^2 = 1-x^2\), it equals \(\pi (1-x^2)\). Armed with this observation, we have

\[ \begin{aligned} V & = \int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} \int_{-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}}1 \; dz \; dy \; dx \\ & = \int_{-1}^{1} \pi (1-x^2) \; dx \end{aligned}\]

The latter is easy to compute.

Can you use a similar hack to turn

\[\int_{-1}^{1} \int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}} \int_{-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}} \int_{-\sqrt{1-x^2-y^2-z^2}}^{\sqrt{1-x^2-y^2-z^2}} 1 \; dw \; dz \; dy \; dx\]

into a single integral? You will need to know a formula for the volume of a 2-sphere or radius \(R\), which you do.

  1. Use the hack described above to compute the volumes of a 3-sphere, a 4-sphere, and so on through the 10-sphere each time using just a single integral. If you set things up correctly, you will encounter no difficulty from Mathematica and the computations should be quick.

  2. Now examine the list of volumes you have computed and identify a pattern. The double factorial will come in handy. With some skill and luck, you should be able to write down a formula for the volume of a 17-sphere and a 42-sphere.

Summarize your findings #

To summarize your findings, answer the following two questions:

Homework exercise:
  1. What is the formula for the volume of an \(n\)-sphere of radius \(r\)?
  2. What happens to the volume of the \(n\)-sphere of radius one as \(n\) gets large? You can plot the volumes of the various spheres using the command ListPlot.