Why is 0! equal to 1?

İbrahim Akalın

2024/01/08

Answers we take for granted

Most people don’t ask questions about why mathematics is the way it is. This is ironic because mathematics could be the purest of sciences in terms of explaining why something is in a particular way. In my experience, the silliest questions in math usually have the most interesting answers. Yet we don’t ask those questions and not only that, we try not to ask those questions. Why? I think the reasons vary quite a bit, and many of them lead to rabbit holes, so I’ll skip this one for now. It’s a good question, though.

Here is a “silly” question: Why is 1+1=2? Or is it? If it is, is it so every time? For example, we might not have 2 liters of water if we add 1 liter of water to 1 liter of water. The resulting volume may vary depending on the temperatures. So if you interpret the 1’s and the 2 here this way, maybe the equality won’t hold1. If we’re doing the addition in unary, it should be 1+1=11 and in binary, it should be 1+1=10. Indeed, when we say 1+1=2, it’s implicit that we’re talking about addition over integers in base 10 but still, why? The answer lies in axioms and definitions, mainly Peano arithmetic. There is a formal proof as well.

Here is another “silly” question: Why is the full angle 360 degrees? Why not 400, or 1000? I remember seeing this question on the thumbnail of a YouTube video and telling myself “Seriously, why? Never thought about it”. This time it’s about convenience. The number 360 is “highly divisible”, it has been chosen by some civilizations in the past, and we continue to use it for convenience. Up to 360, 360 has the most divisors, a total of 24. For the range (360, 720), there are a bunch of other numbers with 24 divisors but still none with more than 24 divisors. 720 has 30 divisors, 840 has 32, 900 has 27, and 960 has 28. Up to 1000, there are only 20 numbers with 24 or more divisors. All things considered, 360 looks like a pretty good choice, doesn’t it?

Before this becomes a “did you know it?” collection, let’s talk about the point here. The point is not to know the answers or what lies beneath. It’s the attitude of seeking for the reason(ing), which we’re not taught well in schools. Whether it can be taught or not is debatable, too. I get that not everyone can have fun with this attitude and from a practical perspective, it’s not needed most of the time. But I love it and can easily claim that it taught me much more than the schools ever could.

Now let’s move to the main subject, one of those “silly” questions I wondered about and wanted to talk about in detail in this post: why is 0!=1?

Factorial

We learn about factorials at relatively early stages of education. At the first step, we’re usually told to take a number, start writing down from that number until you reach 1, then multiply all, and you get the factorial of the initial number:

$$ n! = n \cdot (n - 1) \cdot (n - 2) \cdot \ldots \cdot 1 $$

Then the recursive representation follows (but without teaching the concept of recursion):

$$ n! = n \cdot (n - 1)! $$

Then we were told some “facts” (but without teaching these are actually the base cases of the recursion):

$$ 1! = 1 \newline 0! = 1 $$

The equality \( 1! = 1 \) is very intuitive because we can start with 1 and end with 1, so we have only 1, then the result being 1 makes sense. However, the other equality, \( 0! = 1 \), is not as friendly. But no worries, we can just accept it as an exception and move on with our business. This is practical and it indeed works but it doesn’t mean there isn’t a reason behind and doesn’t mean learning it is useless.

We now have the following compact definition of the factorial, for non-negative integers only:

$$ n!= \begin{cases} n \cdot (n-1)! & \text{if $n>0$}, \newline 1 & \text{if $n=0$}. \end{cases} $$

It can also be defined with product notation:

$$ n! = \prod_{i=1}^{n} i. $$

To delve into \( 0! \), let’s begin with sums and products. These are two of the basic operations of arithmetic and they both have identities. For addition, we have 0 as the additive identity and for multiplication, we have 1. To represent these operations in a compact way, we have sum notation (\( \sum \), capital sigma) and product notation(\( \prod \), capital pi), with \( n \) being the number of terms in the sequence:

$$ \begin{align*} \sum_{i=1}^{n} i &= 1 + 2 + 3 + \ldots + n. \newline \prod_{i=1}^{n} i &= 1 \cdot 2 \cdot 3 \cdot \ldots \cdot n. \newline \end{align*} $$

What if we have \( n=0 \) here? It means we’re summing/multiplying 0 terms. When there is no term to sum or multiply, it makes sense that these statements resolve to identities of the corresponding operations, called empty sum and empty product:

$$ \sum_{i=1}^{0} i = 0, \text{ } \prod_{i=1}^{0} i = 1. $$

With factorials, product notation is more relevant for us. Taking the factorial definition with product notation and considering the empty product, \( 0!=1 \) makes a bit more sense.

Interpretations

The recursive definition of the factorial makes it a bit hard to be satisfied with \( 0!=1 \) because it might make it seem like the equality is just made up or it’s been agreed upon because it’d be convenient. If you look it up, there are such explanations on the internet and I can’t say I’d be satisfied with such reasonings. Don’t get me wrong, I’m in no position to reject a definition but I’d like to dive deeper and see alternative (and possibly better) explanations. With this perspective, I think the definition with product notation provides a better explanation.

There are some more definitions and interpretations that are well worth going through.

The one I like the most is the combinatorics approach. If we let \( S \) be a set with cardinality \( n \) and define \( n! \) as the number of permutations of \( S \), then it follows that for \( n=0 \), i.e. an empty set, there is only one way to permute, hence \( 0!=1 \).

What would happen if we put \( n=1 \) into the recursive relation \( n! = n \cdot (n-1)! \) while keeping \( 0! \) as an unknown? Then \( 1! = 1 \cdot 0! \) would imply \( 0!=1 \) since we know \( 1! = 1 \). I know this is vague (I beg your pardon, rigorous mathematicians) but bear with me on this. What would happen if we put \( n=0 \)? The equation would be \( 0! = 0 \cdot (-1)! \), which is wild. Is there such a number where multiplication with \( 0 \) would yield \( 1 \)?

Stumbling upon something like this is a sign that something is wrong. With this procedure, any value we could have assigned to \( 0! \) would be problematic. So it’s good that the factorial is defined for only non-negative values. Why? Now we moved from a question regarding the value of \( 0! \) to a question regarding the domain of the factorial.

Euler’s gamma function

There is a function that is closely related to the factorial, called Euler’s gamma function.

Euler’s gamma function, \(\Gamma \left( n \right)\), is defined as:

$$ \Gamma \left( n \right) = \int \limits_0^\infty { e^{-x} x^{n-1} \mathrm{d}x } $$

where \(n > 0\)3. If we put \(n = 1\), then this integral becomes the following and rather easy to evaluate:

$$ \Gamma \left( 1 \right) = \int \limits_0^\infty { e^{-x} \mathrm{d}x } = \lbrace -e^{-x} \rbrace \bigg\rvert_0^\infty = 1. $$

If we substitute \(n\) with \(n + 1\), we have the following integral:

$$ \Gamma \left( n + 1 \right) = \int \limits_0^\infty { e^{-x} x^{n} \mathrm{d}x } $$

Now, to evaluate this integral, we can use integration by parts4. We will define \( u = x^n \) and \( \mathrm{d}v = e^{-x}\mathrm{d}x \) so we will also have \( v = -e^{-x} \) and \( \mathrm{d}u = n x^{n-1} \mathrm{d}x \). Then the integral will be:

$$ \Gamma \left( n + 1 \right) = \lbrace -x^n e^{-x} \rbrace \bigg\rvert_0^\infty - \int \limits_0^\infty -e^{-x} n x^{n-1} \mathrm{d}x $$

Here, first part evaluates to zero5 and we will rearrange the second part by taking \( -n \) out of the integral:

$$ \Gamma \left( n + 1 \right) = n \int \limits_0^\infty e^{-x} x^{n-1} \mathrm{d}x $$

Looks familiar? We get the integral for \( \Gamma \left( n \right) \) back! Ultimately, we reached out to the following relation:

$$ \Gamma \left( n + 1 \right) = n \cdot \Gamma \left( n \right) $$

Remember we had \( \Gamma \left( 1 \right) = 1 \). If we put \( n = 1 \), we get \( \Gamma \left( 2 \right) = 1 \cdot \Gamma \left( 1 \right) = 1\). Similarly:

$$ \begin{align*} \Gamma \left( 3 \right) &= 2 \cdot \Gamma \left( 2 \right) = 2 \newline \Gamma \left( 4 \right) &= 3 \cdot \Gamma \left( 3 \right) = 6 \newline \Gamma \left( 5 \right) &= 4 \cdot \Gamma \left( 4 \right) = 24 \newline \end{align*} $$

and so on. You can see the pattern here:

$$ \Gamma \left( n + 1 \right) = n! $$

With some arrangements, this equality becomes:

$$ \Gamma \left( n \right) = \left( n - 1 \right)! $$

If we put \( n = 1 \) here (yes we can, since \( \Gamma \left( 1 \right) \) is defined), we will have:

$$ \Gamma \left( 1 \right) = 1 = 0! $$

If we use the full domain of Euler’s gamma function, we can extend factorials to many other numbers that we normally can’t with the factorial definition. For example, \( \Gamma \left( \frac{1}{2} \right) = \left( -\frac{1}{2} \right)! = \sqrt{\pi} \).

Euler’s gamma function is an interesting subject that is also related to many other interesting subjects. For interested readers, I suggest checking out Paul J. Nahin’s Inside Interesting Integrals book. It was the book from which I learned the relation between factorial and Euler’s gamma function years ago.

Remember what happened when we tried to evaluate \( (-1)! \) using the recursive definition of the factorial? We got the equation \( 0! = 1 = 0 \cdot (-1)! \) which raised questions regarding the domain. Plotting the graph of \( \Gamma \left( n + 1 \right) \) (substituting \( n \) with \( x \)) may shed some light here:

Graph of Euler's Gamma function (shifted to left by 1), taken from Wikipedia.

We can observe that \( \Gamma \left( 0 \right) = (-1)! = \pm\infty \) which means it’s undefined. Not only that, along with \( 0 \), Euler’s gamma function is also undefined for all negative integers.

Conclusion

I don’t claim to have provided any proof in this post. In conclusion, I’m just hoping some readers have a little bit of insight into \( 0! \) and maybe get curious about some facts we took for granted. It’s been a good exercise for me and I wrapped up some of what I know in an organized manner.

Cheers!


  1. Another good example is adding speeds. Let’s say you’re moving with a speed of 50 kilometers per hour and someone else is also moving with a speed of 50 kilometers per hour but in the opposite direction. So at what speed do you see the other person is moving? 50+50=100 kilometers per hour? That’s about correct but not for long. It turns out that as you get closer to the speed of light, you can’t just add the speeds to calculate the relative speed. See special relativity section here↩︎

  2. A relation between two sets where each element in both sets is related to exactly one element in the other set. See here for more. ↩︎

  3. In fact, Euler’s gamma function \( \Gamma \left( n \right) \)’s domain is all complex numbers except for those whose real parts are non-positive integers \( \left( \dots, -3, -2, -1, 0 \right) \). Here, for the sake of simplicity, \( n > 0 \) is preferred. ↩︎

  4. For those who are rusty with integrals, here is the integration by parts formula: \( \int { u \mathrm{d}v } = uv - \int { v \mathrm{d}u } \) ↩︎

  5. Why? If you take the \( \lim_{x \to \infty} \frac{x^n}{e^x} \) and evaluate it, you will see the limit approaches to \( 0 \) (Hint: You can apply L’Hôpital’s rule n times). ↩︎

Table of Contents