Defining zero factorial

Things are defined the way they are for good reasons. This seems blatantly obvious now, but it was eye-opening when I learned this my first year in college. Our professor, Mike Starbird, asked us to go home and think about how convergence of a series should be defined. Not how it is defined, but how it should be defined. We were not to look up the definition but to think about what it should be. The next day we proposed our definitions. In good Socratic fashion Starbird showed us the flaws of each and lead us to arrive at the standard definition.

This exercise gave me confidence that mathematical definitions were created by ordinary mortals like myself. It also began my habit of examining definitions carefully to understand what motivated them.

One question that comes up frequently is why zero factorial equals 1. The pedantic answer is “Because it is defined that way.” This answer alone is not very helpful, but it does lead to the more refined question: Why is 0! defined to be 1?

The answer to the revised question is that many formulas are simpler if we define 0! to be 1. If we defined 0! to be 0, for example, countless formulas would have to add disqualifiers such as “except when n is zero.”

For example, the binomial coefficients are defined by

C(n, k) = n! / k!(nk)!.

The binomial coefficient C(n, k) tells us how many ways one can draw take a set of n things and select k of them. For example, the number of ways to deal a hand of five cards from a deck of 52 is C(52, 5) = 52! / 5! 47! = 2,598,960.

How many ways are there to deal a hand of 52 cards from a deck of 52 cards? Obviously one: the deck is the hand. But our formula says the answer is

C(52, 52) = 52! / 52! 0!,

and the formula is only correct if 0! = 1. If 0! were defined to be anything else, we’d have to say “The number of ways to deal a hand of k cards from a deck of n cards is C(n, k), except when k = 0 or k = n, in which case the answer is 1.” (See [1] below for picky details.)

The example above is certainly not the only one where it is convenient to define 0! to be 1. Countless theorems would be more awkward to state if 0! were defined any other way.

Sometimes people appeal to the gamma function for justification that 0! should be defined to be 1. The gamma function extends factorial to real numbers, and the gamma function value associated with 0! is 1. (In detail, n! = Γ(n+1) for positive integers n and Γ(1) = 1.) This is reassuring, but it raises another question: Why should the gamma function be authoritative?

Indeed, there are many ways to extend factorial to non-integer values, and historically many ways were proposed. However, the gamma function won and its competitors have faded into obscurity. So why did it win? Analogous to the discussion above, we could say that the gamma function won because more formulas work out simply with this definition than with others. That is, you can very often replace n! with Γ(n + 1) in a formula true for positive integer values of n and get a new formula valid for real or even complex values of n.

There is another reason why gamma won, and that’s the Bohr–Mollerup theorem. It says that if you’re looking for a function f(x) defined for x > 0 that satisfies f(1) = 1 and f(x+1) = x f(x), then the gamma function is the only log-convex solution. Why should we look for log-convex functions? Because factorial is log-convex, and so this is a natural property to require of its extension.

Update: Occasionally I hear someone say that the gamma function (shifting its argument by 1) is the only analytic function that extends factorial to the complex plane, but this isn’t true. For example, if you add sin(πx) to the gamma function, you get another analytic function that takes on the same values as gamma for positive integer arguments.

Related posts:

* * *

[1] Theorems about binomial coefficients have to make some restrictions on the arguments. See these notes for full details. But in the case of dealing cards, the only necessary constraints are the natural ones: we assume the number of cards in the deck and the number we want in a hand are non-negative integers, and that we’re not trying to draw more cards for a hand than there are in a deck. Defining 0! as 1 keeps us from having to make any unnatural qualifications such as “unless you’re dealing the entire deck.”

18 thoughts on “Defining zero factorial

  1. The binomial coefficient as a counting function is derived from the definition of n! as the number of permutations of n distinct items. With that, you just need to believe that there is 1 permutation of 0 items.

    This makes sense as a very precise set theory definition. n! = card({(a1, …, an) | a1, …, an ∈ Zn and card({a1, …, an}) = n}) (the number of n tuples where each element of the n tuple is distinct, or, another way, the number of distinct elements in the tuple is equal to n). For n = 2, it’s card({(1, 2), (2, 1)}) for instance. For n = 1 it’s card({(1)}), and for n = 0, it’s card({()}) (the cardinality of the set containing the empty tuple).

    There is a very similar argument for why 0^0 has to be defined as 1 using n^m as the number of functions from a set with m elements to a set with n elements.

  2. >Occasionally I hear someone say that the gamma function (shifting its argument by 1) is the only analytic function that extends factorial to the complex plane, but this isn’t true. For example, if you add sin(πx) to the gamma function, you get another analytic function that takes on the same values as gamma for positive integer arguments.

    Your argument for why this isn’t true is completely wrong. The gamma function is not an analytic function on the complex plane, it’s meromorphic, so it cannot be “the only analytic function that extends factorial to the complex plane”. For the same reason, adding sin(πx) to the gamma function will not give you an analytic function.

  3. Another argument is one from the general principle that an empty product is 1 (in a similar way an empty sum is zero). This can be motivated by the property that product of ai for i in the union of two disjoint sets A and B is the product of the products of ai for i in A and that for i in B. This helpfully answers the related question of why a^0 also equals 1.

  4. Nick: Yes, you could say “n! is the product of the natural numbers <= n." By this definition 0! is an empty product because there are no natural numbers <= 0.However, this same reasoning would say (-1)! = 1, (-2)! = 1, etc. And while you could define negative factorials that way, it's better in practice to leave negative factorials undefined.

  5. Richard: The argument isn’t “completely wrong.” I was simply being informal by saying “analytic” rather than being more precise and saying “analytic except at 0 and the negative integers.”

  6. This doesn’t fully answer the question though. Is there a benefit to defining 0! another way? A lot of maths can be done by using another definition, with the Axiom of Choice and non Euclidean geometry being examples.

    I think 0! should be undefined. That makes mathematics consistent, after all division is undefined already.

  7. 5! = 120
    4! = 24
    3! = 6
    2! = 2
    1! = 1
    0! = ??
    Working down through this list, to get from 5! To 4!, we divide by 5. (Of course we do. 5! = 4!*5.)
    To get from 4! To 3!, we divide by 4. From 3! To 2!, we divide by 3. From 2! To 1!, we divide by 2. From 1! To 0!, we divide by 1. (What else could we possibly to to extend the clear pattern?)

    I also give my students the reason you gave, but I start with the pattern.

  8. The “ah-ha” moment I had with this was when a prof off-handedly said “It’s 1 because you’re still taking the factorial of one number: zero”

  9. Another way to rationalize 0! = 1 is the pattern:
    3!/2! = 3, 2!/1! = 2, 1!/0! = 1
    If the last one is to be true, 0! must be 1. In fact, we could guess what (-1)! should be:
    0 = 0!/(-1)! = 1/(-1)! is true only if (-1)! is plus or minus infinity.

  10. Your update “if you add sin(πx) to the gamma function, you get another analytic function that takes on the same values as gamma for positive integer arguments.” is indeed a very good point. However I think the argument can still be saved somehow. I think it is because Γ(z) is the still only function of 1/z that is analytic at the accumulation point at the inverse of the accumution points 1/1, 1/2, 1/3, … (0). sin(z) is not an analytic function in this sense.

  11. @Raahul: Since you’re going against well-established convention, the burden of proof is on you. Please give examples where formulas are simpler if 0! is defined to be something other than 1 or left undefined.

  12. It seems to me there’s a simpler argument, based on the definition of n! rather than on convenience for how it’s used.

    n! = (n-1)! * n


    (n-1)! = n! / n

    1! = 1, therefore 0! = 1 (and -1! is 1/0, which is undefined).

    It’s easy to miss that if you define the factorial function in English, as “the product of the integers from 1 to n”; what is the product of no numbers? If you define it using a more rigorous mathematical formula, it’s easier to reason about it.

  13. @alfC, I think that is the key point. I remember learning that analytic continuations only require a discrete set of points with an accumulation point to be unique (I don’t remember the details on this, so I could be wrong). Analytic again really probably meaning meromorphic. For factorial, the accumulation is at infinity, so you have to analytically continue the inverted function. I’m a little fuzzy on this stuff, though, because I haven’t done it in a few years, so maybe someone else can give a more rigorous explanation.

  14. Keith, Larry, and I all have shared the same way of continuing the pattern backwards to 0!. I see no other way to sensibly define 0! (quite apart from the fact that the usual definition of the binomial coefficients requires that 0! = 1).

    I know of nowhere that a DIFFERENT definition for 0! makes sense, and I see no reason to leave 0! as undefined. This isn’t the same sort of thing as 0^0 where there are competing patterns (0^n = 0 and n^0 = 1) that can’t both be extended to the 0^0 case. There’s a perfectly good definition for 0! that not only makes combinatorial formulas work but also continue the pattern defined by the other factorials.

    Does anyone have a competing definition that can be justified?

  15. I suppose a competing definition would be to leave it undefined, as with the negative integers.

  16. Sure, but then there should be some justification for leaving it undefined, and I don’t know of any justification for doing so. (Except for the improper definition of n! = 1*2*3*…*n.)

Leave a Reply

Your email address will not be published. Required fields are marked *