[Math] Formula for factorial

factorial

I need an equation that defines factorial without using factorial, that also works for $0$.
I have seen factorial defined like this:
$$n! = 1\cdot2\cdot3\cdot4\cdots n$$
But if we plug $0$ into that, we end up with $0$, which doesn't work.
So what would be the correct way to put it?

Best Answer

In your definition, if we plug $0$ into that we don't get $0$. Because your definition starts with $1$, so the case for $n = 0$ simply isn't defined. Usually it is defined $0! = 1$.

You can therefore define factorial like this: $$n! = \begin{cases}1 & n = 0\\ 1\cdot2\cdots n & n > 0 \end{cases}$$

Alternatively, if you don't like the above definition, you could use the Gamma function definition: $$\Gamma(t) = \int_0^\infty x^{t - 1}e^{-x}\,\mathrm dx$$ and the put $$n! = \Gamma(n + 1).$$

Note that the Gamma function is defined for real values, whereas the factorial only for natural numbers.

Related Question