Blog

Factorials and circles

Jun 30, 2024

opinion
math

Back in highschool, I discovered the magic of the Desmos graphing calculator. Being the nerdy tinkerer I was, 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 math class, one of the first things I did was plug it into Desmos to see what it looked like.

I was very suprised 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! Beyond that, when I plugged it into a calculator I found

Woah! Why is pi there? What does this factorial have to do with circles?? I asked the 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

The reason we define as instead of 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

From principles, we know the product rule for derivatives is

So, integrating both sides, we get

Giving us the familiar integration by parts formula

We can apply this to our gamma function, to see that

And furthermore

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

The volume of an n-sphere

The volume of an -ball of radius is intuitively porportional to (not shown, you can think of it as scaling a ball in each of -dimensions), so we’ll write

Here’s the trick, we’ll consider this weird integral

You can think of it as covering the space by summing over shells of -dimensional spheres, instead of by integrating over each point individually. This works because our function 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.

Now substitute the ,

and use a change-of-variables

Hey look! The gamma function! So, this is

Now the right side. We can break it up into

And so, combining these we can derive the formula for the volume of an n-ball

Specific examples

Now that we have a closed-form formula for our volume, we can work it out for specific dimensions

And is undefined, because is undefined