# Why zero factorial equals one

Well, I can think about 2 more ways why we should define` 0!=1`

I.` n!=1*2*3*4*...*(n-1)*n` — this is definition of n!.
n! is multiplication of n factors starting from 1,2,… till n.

For example, `5!` is multiplication of 5 factors `1*2*3*4*5 or 5!=1*2*3*4*5`.

Similarly, `2!` multiplication of 2 factors `1*2` or `2!=1*2`.

How much is `1!`? 1! is multiplication of 1 factor 1, `1!=1` (you can ask what does multiplication of 1 factor mean? Well, there is “natural” definition. Because `n*1=n` you can think of multiplication of 1 factor n as simple multiplication n by 1, that is multiplication of 1 factor 1 is `m*1=m`)

How much is `0!`? `0!` should be multiplication of 0 factors, so called “empty product”. The value of “empty product” is 1. (Again, it is because `n*1=n`, so for any product we can just add 1 to the product. Alternatively, it can be derived from “empty sum”) as following:

Since logarithms turn products into sums:

they should map an empty product to an empty sum. If we define the empty sum to be 0, then the empty product should be `e⁰= 1`.

(Conversely, if we define the empty product to be 1, then the empty sum should be `ln ⁡ 1 = 0.`).

II. Another way.

• From the formula `n!=1*2*3*4..*(n-1)*n` we can define recursive formula as follows:

For n>2 `n!=n*(n-1)! `(note, that n-1>1>0)
For n=2 `2!=2`
(and `1!=1` by definion)

Let try it:

5!=5*4!
4!=4*3!
3!=3*2!
2!=2 (base case)

so
3!=3*2=6
4!=4*6*24
5!=5*24=120

But why we chose as base case n=2? Let put it n=1.
• For n>1 `n!=n*(n-1)!` (note, that n-1>0)
For n=1 `1!=1`

So, if from previous derivation we have` 2!=2` by definition (of the base case), now we can calculate it:
`2!={2>1}=2!=2*(2–1)!=2*1!={1!=1 by definition of the base case}=2*1*2 `that is consistent with the previous definition.

Can we go one step further? Can we define base case for `n=0`? Let’s try.
• For n>0 `n!=n*(n-1)!` (note, that n-1>-1, that is for n=0, `n-1` will be negative, and for n=1,` n-1` will be 1)
For n=0 `0!=?`

Well, let’s try to figure out what is 2!

` 2!={2>0}=2*(2–1)!=2*1! 1!={1>0}=1*(1–1)!=1*0!=0!`

In order that this definition will be consistent with previous ones above, we should define 0!=1. That is we should define:

For n>0 `n!=n*(n-1)!` (note, that n-1>-1, we can’t put n=0 to this formula, only n>0)
For n=0 `0!=1`

In this case
`1!=0!=1` as expected.

Originally published in my blog https://www.toalexsmail.com/2012/04/why-zero-factorial-equals-one-english.html

Senior Software Engineer at Pursway

## More from alex_ber

Senior Software Engineer at Pursway