The Volume of the n-ball
Introduction
This post is an extension of my Medium article: The Math Behind “The Curse of Dimensionality”. If you have any questions or feedback, feel free to leave a comment below or reach out on LinkedIn.
Here, I derive the formula for the volume of the n-ball using integral calculus and Wallis integrals.
An n-ball is a generalization of the ordinary “ball” to arbitrary dimensions. It is defined as the set of points in the n-dimensional Euclidean space that are at a fixed distance from a central point (we will condider 0, the origin). The n-ball has important applications, particulary in machine learning and data analysis.
The equation of an n-ball is given by:
where
Derivation of the volume formula
One of the most important properties of the n-ball is its volume. The volume of an n-ball of radius
where
We define the unit (radius equal to 1) n-ball as the following space:
We note
First, note that the volume of the n-ball of radius
Now, let’s simplify
We can now replace the expression of the volume of the
We use the change of variable
We note
Note that
Using our recursive relation, we know that:
We are going to make use of a very useful property:
We will also need the Gamma function. All you need to know is these 2 expressions:
and
Now, we can easily compute the volume
If
If
So we obtained a single formula for the volume of the n-ball, regardless of the parity of
And by extension, the volume of the n-ball of radius
Note that there is a very easy way to derive the area of the surface of n-ball using this expression. We simply need to derive the volume of the n-ball of radius
Paricularly, the surface area of the n-ball of radius
Appendix: Derivation of the Wallis integrals
The Wallis integrals are defined as:
We will derive a recursive formula using integration by parts.
We conclude that:
We can now distinguish 2 cases depending on the parity of
- If
, we have:
We obtained the last equality by multiplying the denominator and the numerator by
- Similarly, if
, we have:
We conclude that
and