Deriving the Volume and Surface Area of an n-dimensional Sphere
If you are in any of the STEM fields, you should be familiar with the formulae for the "volumes" and "surface areas" of "spheres" in 2D and 3D spaces. As you know, in 3D,
\[\text{volume} = \frac{4\pi}{3} r^3 ~ \text{ and } ~ \text{ surface area}=4\pi r^2\]
and in 2D, a circle of radius $r$ has
\[\text{"volume"} = \pi r^2 ~ \text{ and } ~ \text{"surface area"} = 2\pi r\]
As you can guess, what I mean by "volume" is the area and "surface area" is the circumference. Conventionally, we use the term "volume" for the size of the interior, and "surface area" for the size of the boundary of solid objects in all dimensions. In mathematics, an $n$-dimensional solid sphere is called an $n$-ball and its surface or boundary, i.e., a hollow shell, has a dimension $n-1$, so it is called an $(n-1)$-sphere. Thus, a 2-ball is a 2-dimensional solid circular disk, and its surface or boundary is a 1-sphere, i.e., the the circumference of a circle.
Let us denote the area of an $(n-1)$-sphere of radius $r$ as $S_{n-1}(r)$ and its interior volume as $V_n(r)$ hereafter. There is an interesting relationship between $S_{n-1}(r)$ and $V_n(r)$:
\[\frac{d}{dr}V_n(r) = S_{n-1}(r)
~ \text{ or equivalently } ~
\int S_{n-1}(r)dr = V_n(r) \hspace{3em} \text{(Eq:V-S\_relation)}\]
Since these two expressions are equivalent, let me explain the one with the integral. The integral says that the volume of a sphere $V_n(r)$ is obtained by summing the volumes of concentric thin spherical shells with infinitesimal thickness $S_{n-1}(r)dr$, for radii ranging from zero to the radius of the sphere $r$.
The surface area of an $(n-1)$-sphere
We will use the $n$-dimensional Gaussian function, which has spherical symmetry. Recall that the multivariate normal distribution is spherically symmetric.
\[\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\cdots\int_{-\infty}^{\infty} e ^{-(x_1^ 2 +x_2 ^ 2 + \cdots x_n ^ 2)/2} dx_1 dx_2\cdots dx_n = \int_0 ^{\infty} e ^ {-r ^2/2} S_{n-1}(r) dr \hspace{2em}\text{(Eq:Gaussian)}\]
The right hand side of the equality is the same integral expressed in spherical coordinates. Since the Gaussian function is spherically symmetric, it becomes a single-variable integral in the spherical coordinate system.
Since $\displaystyle\int_{-\infty} ^ {\infty}e ^ {-x ^ 2/2}dx = \sqrt{2\pi}$, [See my (future) post on the Gaussian integral for a proof],
\[\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\cdots\int_{-\infty}^{\infty} e ^{-(x_1^ 2 +x_2 ^ 2 + \cdots x_n ^ 2)/2} dx_1 dx_2\cdots dx_n =(2\pi) ^ {n/2}\]
Thus, (Eq:Gaussian) gives
\[\int_0 ^{\infty} e ^ {-r ^2/2} S_{n-1}(r) dr = (2\pi) ^ {n/2}\]
Writing $S_{n-1}(r) = S_{n-1}r^{n-1}$, where $S_{n-1} = S_{n-1}(1)$, i.e., the surface area of a sphere of radius 1, we have
\[S_{n-1} = (2\pi) ^ {n/2}\left(\int_0 ^{\infty} e ^ {-r ^2/2} r ^ {n-1} dr\right) ^ {-1}\]
This gives us a way to numerically compute $S_{n-1}$, but it can be compactly expressed using the gamma function $\Gamma(x)$.
Letting $t =r ^ 2/2$, so $r = (2t)^{1/2}$ and $dt = r dr$, we have
\[
\int_0 ^{\infty} e ^ {-r ^2/2} r ^ {n-1} dr = \int_0 ^ {\infty} e^{-t} (2t)^{\frac{n-1}{2}} \frac{dt}{(2t) ^ {1/2}}
= 2 ^ {\frac{n}{2} - 1} \int_0 ^ {\infty} e^{-t}\ t ^ {\frac{n}{2} - 1}dt
\]
The last integral is simply the gamma function $\Gamma(n/2)$ [See my (future) post on the gamma function]. Thus,
\[S_{n-1} = (2\pi) ^ {n/2}2 ^ {-\frac{n}{2} +1}\frac{1}{\Gamma(n/2)} = \frac{2\pi^{n/2}}{\Gamma(n/2)}\]
Finally,
\[S_{n-1}(r) =\frac{2\pi^{n/2}}{\Gamma(n/2)} r ^ {n-1}\]
Noting that $\Gamma(1) = 1$ and $\Gamma(3/2) = \sqrt{\pi}/2$, this does indeed reproduce the familiar formulae for $n=2$ and $3$:
\[ S_1 = 2\pi r ~\text{ and } ~ S_2 = \frac{2\pi^{3/2}}{\sqrt{\pi}/2} r ^ 2 = 4\pi r ^ 2\]
The volume of an n-ball
Using the relationship (Eq:V-S_relation) between $V_n(r)$ and $S_{n-1}(r)$, we have
\[V_n(r) = \int _ 0 ^ {r} S_{n-1}(\tilde{r})\, d\tilde{r}, \]
where $\tilde{r}$ is the radius of each thin shell. Thus,
\[V_n(r) = \frac{2\pi^{n/2}}{\Gamma(n/2)} \int_0 ^ r \tilde{r} ^ {n-1}\, d\tilde{r} = \frac{2\pi^{n/2}}{n\Gamma(n/2)} r ^ n = \frac{\pi^{n/2}}{\Gamma(\frac{n}{2}+1)} r ^ n\]
The last expression follows from a property of the gamma function $z\Gamma(z) = \Gamma(z+1)$. For $n=2$ and $3$, we have $\Gamma(2)=1$ and $\Gamma(5/2) = \frac{3\sqrt{\pi}}{4}$, thus we recover the familiar formulae;
\[V_2(r) = \pi r ^ 2 ~ \text{ and } ~ V_3(r) = \frac{4\pi}{3}r ^ 3\]
Higher dimensional spheres
Let us tabulate the values of $S_{n-1}$ and $V_n$. Using the fact that
\[\Gamma(1)=1, ~ ~ \Gamma(1/2)=\sqrt{\pi}, ~ \text{and} ~ \Gamma(\nu + 1) = \nu\Gamma(\nu),\]
we obtain the following values.
| $n$ | $\displaystyle S_{n-1}=\frac{2\pi^ {n/2}}{\Gamma(\frac{n}{2})}$ | $\displaystyle V_n=\frac{\pi^ {n/2}}{\Gamma(\frac{n}{2}+1)}$ |
|---|---|---|
| 0 | 0 | 1 |
| 1 | 2 | 2 |
| 2 | $2\pi\approx 6.283$ | $\pi\approx 3.142$ |
| 3 | $4\pi\approx 12.57$ | $\frac{4}{3}\pi\approx 4.189$ |
| 4 | $2\pi^2\approx 19.74$ | $\frac{1}{2}\pi^2\approx 4.935$ |
| 5 | $\frac{8}{3}\pi^2\approx 26.32$ | $\frac{8}{15}\pi^2\approx 5.264$ |
| 6 | $\pi^3\approx 31.01$ | $\frac{1}{6}\pi^3\approx 5.168$ |
| 7 | $\frac{16}{15}\pi^3\approx 33.07$ | $\frac{16}{105}\pi^3\approx 4.725$ |
| 8 | $\frac{1}{3}\pi^4\approx 32.47$ | $\frac{1}{24}\pi^4\approx 4.059$ |
| 9 | $\frac{32}{105}\pi^4\approx 29.69$ | $\frac{32}{945}\pi^4\approx 3.299$ |
| 10 | $\frac{1}{12}\pi^5\approx 25.50$ | $\frac{1}{120}\pi^5\approx 2.550$ |
| 20 | $\frac{1}{181440}\pi^{10}\approx 0.5162$ | $\frac{1}{3628800}\pi^{10}\approx 0.02581$ |
| 30 | $\frac{1}{43589145600}\pi^{15}\approx 0.0006575$ | $\frac{1}{1307674368000}\pi^{15}\approx 0.00002192$ |
Note that both $S_{n-1}$ and $V_n$ appear to attain their maxima at $n=7$ and 5, respectively. It is also worth noting that the $S_{n-1}$ and $V_n$ become vanishingly small as $n$ increases. What does all this mean?
Although we cannot directly compare volumes or areas across different dimensions, e.g., it seems meaningless to say $11\,\text{m}^3$ is larger than $10\,\text{m}^ 2$, this behaviour of $S_{n-1}$ and $V_n$ as functions of $n$ has significant consequences in the field of statistics/data science. We will explore that in a future post. In the mean time, you might enjoy this video by 3Blue1Brown https://www.3blue1brown.com/?search=higher+imensions&lesson=spheres-talk.