Why Factorial 0 is Defined as 0!=1
Definition
For the factorial of , it is defined as follows .
Explanation
Why is not but ? Originally, since is a definition, there is no need for proof, and the process of understanding why such a definition is valid is close to a request to ‘accept why this definition was made.’ Let’s understand it step by step according to the level.
Middle School Level
For a natural number , can be defined as follows. Simply put, the factorial is not so difficult as it is the product of subtracting from , and it is soon understood why this is necessary. (If advancing a bit ahead of the curriculum) You can encounter factorials from middle school through permutations and combinations, and they appear immediately in permutations and binomial coefficients . To say that means calculating permutations and combinations by picking all items out of items, is the same as the number of ways to arrange items in order, and should also be the same as the number of ways to pick all items. At this point, must be a number that satisfies the following equation formally. There’s no reason it has to be a system of linear equations, but anyway, the solution that simultaneously satisfies both equations is . Assuming that and are validly defined as factorials, it has shown that it is mathematically neat and convenient to define as . Even if we may not understand the meaning of factorials in the vast and deep world of mathematics, it seems clear that this is a practical definition for now.
High School Level 1
As high school students, they learn how the power of extends to negative numbers when learning about exponential functions. Firstly, the power of for natural numbers logically unfolds as follows. As you see, increases by times for each line, with increasing by . This is the concept of exponentiation that can be understood immediately, even for those who are weak in mathematics. On the other hand, generalizing this to all integers is easier to understand by seeing the pattern in books. Again, decreases by times for each line, with decreasing by . This shows a formally plausible pattern, beyond whether the expression is correct or such a thing is possible. The lesson from the example of is that the expression brilliantly shows that when increases, it doubles, and when it decreases, it halves.
Now, let’s return to the factorial. unfolds in the following way by multiplying to . As with the example of the exponential function, let’s ‘flip’ this in a way that ‘makes sense.’ Since increased by multiplying , now it should be divided as decreases. So dividing it by to get is ’logically’ . A notable point here is that such persuasion does not inform at all about how is useful. It’s pushing this definition purely on mathematical intuition, for its beauty alone.
College Level
When students reach college, they learn about integrals with unbounded range bound, and various specialized textbooks introduce something called a Gamma function.
Gamma function as a generalization of the factorial: For a natural number , holds.
For the factorial to be a special case of the Gamma function, it must be . The Gamma function is defined as follows and by substituting into it and since , to extend for , it makes sense to define it as .
Joke
Originally, in programming, 0!=1
should be true, so is correct.