In highschool, I discovered the magic of the Desmos graphing calculator. Being a nerdy tinkerer, I pushed this tool to its limits, making lots of fun graphs, even including a fully-playable version of pong.
So when we learned about factorials in my grade 11 math class, one of the first things I did was plug it into Desmos to see what it looked like.
I was shocked at what I got. I was expecting a pointwise function on every positive integer, but not only did I get rational numbers, the graph went crazy in the negatives! Furthermore, when I plugged it into a calculator I found
0.5!=2π
Woah! Why is pi there? What does this factorial have to do with circles?? I asked my poor substitute teacher what was happening, and they gave a confused attempt at an answer; but a quick Google search pointed me towards the gamma function, defined as follows
n!:=Γ(n+1)=∫0∞tne−tdt
The reason we define n! as Γ(n+1) instead of Γ(n) is, as 19th-century mathematician Cornelius Lanczos puts it “void of any rationality”.
Why the gamma function works
In order for our new definition of the factorial to make any sense, we’d like it to at least satisfy the same properties that our normal factorial function has. That being
n!=n⋅(n−1)!
0!=1
From principles, we know the product rule for derivatives is
(uv)′=uv′+u′v
So, integrating both sides, we get
uv=∫vdu+∫udv
Giving us the familiar integration by parts formula
∫vdu=uv−∫udv
We can apply this to our gamma function, to see that
So our choice of Gamma function is at least somewhat justified. In fact, if we add constraints that our function must be log convex we get that the gamma function must be unique (not shown).
Lets work through a few values of the gamma function that will help us later
Γ(1.5)=0.5Γ(0.5)=21∫0∞t1e−tdt
u=t
du=2t1dt
=∫0∞e−u2du
=π/2
Γ(0.5)=π
The volume of an n-sphere
The volume of an n-ball of radius R is intuitively porportional to Rn (not shown, you can think of it as scaling a ball in each of n-dimensions), so we’ll write
V=CRn
dV=nCRn−1dR
Here’s the trick, we’ll consider this weird integral
You can think of it as covering the space by summing over shells of n-dimensional spheres, instead of by integrating over each point individually. This works because our function e−(x12+x22+⋯+xn2) has radial symmetry in all axis. For example, in two-dimensions instead of integrating over small rectangles, we cover the space by integrating over the difference in area of all radii of circles.