The zero factorial
Today I’m doing some stats homework and was reminded of an odd quark in math, the zero factorial. It’s not very intuitive and I absolutely love weird math, so I thought I would share the fun. I never said I was normal… Anyway today we’re going to go over why 0! (zero factorial) is so interesting!
Well I’ve decided to take a break from talking about grant writing, you were all pretty bored with that anyway… right? For those who missed out on the fun and are just finding me, I’m a third year PhD candidate in neuroengineering. I’m studying how spinal cord injury changes communication to the brain and ways to leverage that change for rehabilitation purposes. Lately I’ve been writing several grants (more here) because I need funding to finish my work so I can graduate and move on to bigger things (ideally). Today we’re talking math, because I need a break and I’m sure my followers are tired of hearing the same things about grant writing (it’s awful, I don’t recommend it). With the intro out of the way let’s talk about 0!
First, for those of you who are not familiar with factorials, we write them like this n! where n is any whole number and as an example 3! written out looks like this
3! = 3*2*1
Now we can actually write out the formula for this, but first we should talk about the zero factorial or 0! using the formula above you may think the answer would look like this
0! = 0… but it doesn’t!
In reality 0! solves to be…
0! = 1
That’s right, when we take the factorial of zero we get one! Isn’t that weird!? It’s like trying to deposit zero dollars into a bank and they give you one dollar for every zero you put in. It just doesn’t make any sense! But don’t worry, we can actually make sense of why this is, just not in a nice satisfying way (not all math is satisfying kids). Let’s start with the fully expanded form of the general formula of factorial. Let n be any positive integer number (whole number 1, 2, 3, … etc) then the formula becomes
n! = n * (n-1) * (n-2) * … * 3 * 2 * 1
where those last bits are already solved since we hit a point where y in n–y is going to equal n. The trick is to look at the partially expanded form, which is a little neater to write out and I think makes more sense intuitively than the fully expanded version that looks like this…
n! = n * (n-1)!
It’s partially expanded because we use the fatorial to define the formula, but that’s why we defined how it works above, so this form should make sense to you now and you know that it expands out to something that looks like the fully expanded form. Now with that out of the way let’s talk about how we get 0! = 1 out of all of this, it’s wild.
So say we want to find 1! so we plug it into our formula, well we know that
1! = 1
We know this for sure, it’s pretty intuitive, it shouldn’t be anything else… right? Here’s where the magic happens, let’s solve 1! using the partially expanded form of n!, that looks like this
n! = n * (n-1)!
1! = 1 * (1-1)!
1! = 1 * (0)!
1! = 1 * 0!
See what just happened? We end up with the 0! in our equation. We know the equation is correct and we know for certain that 1! = 1, for that reason this is proof that
0! = 1
Now a bit of fine print here… you can actually take the factorial of negative numbers, the math works out, but for practical purposes the n! lives in the natural numbers (including zero). If you’re a huge math nerd — which why else would you be reading this if you weren’t… — you can read more than you would ever want to know about factorials of real negative and imaginary numbers here.
One parting note, you can think of the factorial as how many different ways you can arrange something. If I have 3 objects I can arrange them 6 different ways:
You’ll notice that 1,2,3 and 3,2,1 are the same order, but reversed. That’s because when we use the factorial order matters, sort of like words. If I write the word, “word” it’s not the same as writing “odrw” even though it uses the same letters. When order matters it’s called a permutation. When order doesn’t matter it’s called a combination and that’s a different formula, which looks like this
You’ll have to excuse the formatting, wordpress isn’t kind to math (that I can find anyway). In this case in this formula there n is the number of things to choose from,and we choose r of them, no repetition, order doesn’t matter. Basically if we had a bag of 20 marbles of different colors, the formula would let us find all the combinations (order doesn’t matter here!) we could draw r marbles from the bag up to r = n or 20 in the marbles example. For that reason, when talking about the formula we normally say n choose r.
But now we’re getting down the rabbit hole of combination/permutations when really I just wanted to share my excitement over 0! which let’s face it is pretty interesting. I bring up the differences because order matters with factorial and it’s the different ways we could arrange something, so what the formula is saying is that 0! = 1 because there’s only one way to arrange selecting nothing.
One parting note, because order matters when dealing with permutations (the factorial), it’s super easy to remember the difference between permutations and combinations. The easiest way is just by remembering that a combination lock should really be called a permutation lock. At least that’s what sticks in my head, your mileage may vary.