## Zero Factorial

Those of you have taken math classes in high school probably learned about factorials, which are written with “$!$” symbols.  The usual definition is something like the following.

Definition. For a positive integer n, we define $n!$ (read: n factorial) as the product of all the positive integers up to and including $n$.

$1! = 1$

$2! = 1\times 2 = 2$

$3! = 1 \times 2\times 3 = 6$

$4! = 1\times 2 \times 3 \times 4 = 24$

$5! = 1\times 2 \times 3\times 4\times 5 = 120$

and so forth.

The factorials can be defined by the fact that $n!$ is the number  of ways to put $n$ objects in order.  They are ubiquitous in combinatorics (read: counting) and also show up in lots of other sorts of equations and formulas.  Sooner or later, it comes up that mathematicians don’t just use factorials of positive integers, and $0!$ shows up on the chalkboard.  Then the questions start.  Because almost all students expect $0!$  to be zero.  And the exasperated teacher says something like the following.

“Okay, zero factorial is one.  It just is.  There’s doesn’t have to be a reason, there’s nothing to try to understand, it’s just a mathematical convention.  $0!=1$.”

But there are good reasons to decide that $0!=1$, not just to take some teacher’s word for it but to know that it’s the right thing.  And I have more faith in you, fair reader, than your math teacher did.  I believe that anyone who wants to understand it can.

If you keep reading, you’ll find three ways of getting at zero factorial, including shrieks, a math koan, and the nature of nothing.

### Perspective 1: On the Nature of Nothing

I am sympathetic to the idea that zero factorial ought to be zero; naively, it feels right.  You have something about zero, you have something about multiplication, that smells like zero.  I can practically hear my students now.

But Professor Cap, isn’t zero factorial just nothing?

Well, yes.  But nothing doesn’t just mean zero.  Nothing is a highly context-dependent word.  (There is an old saw that says that given the choice between omnipotence and a ham sandwich, choose the ham sandwich; nothing is better than omnipotence, and after all a ham sandwich is better than nothing.)  Zero factorial should be the context-appropriate version of nothing.

The key idea is this: not changing anything is the same as adding zero, but the same as multiplying by one.  In jargon, 0 is the additive identity but 1 is the multiplicative identity.

So an empty sum, where you take no things and add them all up, should have the value zero, the additive version of nothing.  This is why $0\times 19 = 0$, if you think of multiplication as repeated addition.

Likewise, an empty product, where you take no things and multiply them all together, should have the value 1, which is also “nothing”, just the multiplicative version of that.  This explains not only $0!=1$ but also, if you think of powers as repeated multiplication, things like $19^0=1$.

In case empty sums and products make you sick to your stomach, let me reformulate what I just said without empty sums and products.

The sum of 1, 2, 3, and 4 is 10 because $1+2+3+4+a = 10+a$ for every number $a$.  By the same token, the sum of no numbers is zero, since $a = 0+a$ for every number $a$.  The product of 1, 2, 3, and 4 is 24 because $1\times 2\times 3\times 4\times a = 24\times a$ for every number $a$.  So the product of no numbers (such as $0!$) is one, since $a = 1 \times a$ for every number $a$.

(Fun fact #1: the symbol “!” is usually read as “exclamation point” in normal writing and “factorial” when used as described here; the name for the symbol itself is “shriek” or “bang”.)

### Perspective 2: Patterns

Think for a moment about how adjacent numbers in the factorial sequence relate to one another.

$5! = 120 = 5\times (4!)\quad 4! = 24 = 4\times(3!) \quad 3! = 6 = 3\times (2!)$

There is a pattern here which shows how the factorials of adjacent numbers relate to one another, namely $n! = n \times (n-1)!$.  This tells us everything we need to compute the factorial of a number, provided we know the factorial of a neighboring number.  So if I tell you that $9! = 362880$, you can compute very fast that $10! = 3628800$.  From there we could compute $11!$, then $12!$, and so on.

We can apply this in reverse.  We know $3!=6$, so our pattern says that $2!$ is the number $a$ with the property that $3a = 6$.  So $2!=2$ (as we already knew).  We then say $1!$ is defined by the property that that $2(1!) = 2$, so that $1!=1$.

Now the moment of truth.  Following our pattern, $0! \times 1 = 1!=1$.  So what we should want is that $0!$ be the only number that gives $1$ when you multiply by $1$.  So the only choice for $0!$ that won’t spoil the pattern is $0!=1$.

So can we take this any further?  Can we exploit this pattern to define $(-1)!$, say?  Well, $(-1)!$ should be the number defined by the property $1 = 0! = 0\times (-1)!$.  But there is no number $a$ such that $1 = 0\times a$.

This suggests that we won’t be able to define $(-1)!$ in a meaningful way, in a way that preserves the way factorials work.  In fact this is a meaningful insight.  In higher mathematics, the factorial is generalized by the gamma function $\Gamma(s)$, which allows us to make sense of factorials of numbers that aren’t integers (indeed, numbers that aren’t even real!).  But as this example predicts, even this extended version of the factorial does not extend to negative integers.

(Fun fact #2: it makes my skin crawl to read sentences like “Congratulations on turning 6!” . . . though to be fair, turning 720 is worthy of congratulations.)

### Perspective 3: Because it Gives the Right Answers!

The closest thing to a justification that most math classes give for $0!=1$ is the assertion that it gives the right answer to problems, even though it doesn’t make sense.  Factorials show up in the formulas for combinations, for example.  The number of ways to choose $r$ objects from a collection of $n$ objects is given by the formula $\frac{n!}{(r!)((n-r)!)}$.  You can check that this formula will give the right answer for $r=n$ if and only if we define $0! = 1$.

I would take this further and say that $0!=1$ does make sense, in that it gives the right answer to the fundamental problem which factorials solve, the permutations problem.  This perspective may seem very confusing if you are not used to thinking about these things, so treat it is as a mathematical koan which I leave you for your later reflection.

Consider a game where I give you $n$ symbols and a piece of paper, and you have to write the symbols, using each of the symbols exactly one time, in an order of your choice.  How many possible outcomes are there?  If there are three symbols (say, A, B, and C), then there are six possible outcomes: ABC, ACB, BAC, BCA, CAB, CBA.  That is, there are $6$ permutations of three objects, and $3!=6$.  What if I give you a piece of paper and no symbols?  Then it is still possible to play the game, there is a legal thing to do with the paper, but only one—the one and only way to follow my rules is to leave the paper blank.  Thus there is exactly one permutation of zero objects.

### 6 Responses to Zero Factorial

1. Akhil Mathew says:

Moreover, the gamma function integral gives 1 when one plugs in zero.

• Cap Khoury says:

That’s almost right. The gamma function and the factorial function are offset from each other, $\Gamma(s) = (s-1)!$. So zero factorial is 1 because $\Gamma(1) = 1$.

Likewise $\Gamma(0)$ corresponds to the factorial of $-1$. In the post, we saw that we should probably not expect $(-1)!$ to exist, and indeed $\Gamma(s)$ has a pole at $s=0$.

2. Akhil Mathew says:

Ah, yes. I forgot about the offset. What I should have said was that the integral $\int_0^{\infty} t^s e^{-s} dt$, which coincides with the factorial function for $s$ a natural number and which is analytic, takes the value 1 when one plugs in zero.

• Cap Khoury says:

(The integral you meant there, presumably, is $\int_0^\infty t^s e^{-t}\/ dt$.)

3. Akhil Mathew says:

Again yes, thanks for correcting.

4. EastwoodDC says:

0! = 1 : In terms of permutations, I think of this as there being one way to to do/choose nothing.