So I've been recently arguing with my teacher about factorials. My teacher says that factorials can only be calculated for integers, because the definition of factorials is as follows:

the product of an integer and all the integers below it

But I've seen many different calculators where you can find the factorials of real numbers, like $5!$, $1.1!$, $-5.7!$, $\sqrt 2!$ or $(\tan 85)!$ and so on...

How do calculators do this? What formula do they use? It's obviously not $(n) \times (n-1) \times \cdots \times 1$ where $n$ is some integer. (In this case it's any real number)

  • 4
    $\begingroup$ en.wikipedia.org/wiki/Gamma_function $\endgroup$
    – James
    Commented Mar 18, 2015 at 16:34
  • $\begingroup$ "The gamma function is defined for all complex numbers except the negative integers and zero" But I can take factorials of negitive numbers and zeros too! $\endgroup$ Commented Mar 18, 2015 at 16:35
  • $\begingroup$ @CaptCoonoor It is the "nice" extension of the factorial on the nonnegative integers. It turns out there is not such a "nice" extension which also goes to the negative integers. $\endgroup$
    – Ian
    Commented Mar 18, 2015 at 16:38
  • $\begingroup$ Oh thanks btw, I need to learn integrals first to learn this function till now we have been only taught differential calculus $\endgroup$ Commented Mar 18, 2015 at 16:39
  • $\begingroup$ @CaptCoonoor: $\Gamma(0)=(-1)!\neq0!=1$. $\endgroup$
    – Lucian
    Commented Mar 18, 2015 at 16:47

1 Answer 1


The calculator is using the gamma function, that satisfies for natural numbers $n$ $$\Gamma(n) = (n-1)!$$ and it is given by $$\Gamma(t) = \int_0^\infty x^{t-1}e^{-x}\,\mathrm{d}x.$$ However, note that when you say $-5.7!$, that means $-(5.7!),$ not $(-5.7)!$.

  • $\begingroup$ Wait a second, does (-5.7)! and -(5.7)! makes any difference? $\endgroup$ Commented Mar 18, 2015 at 16:44
  • 6
    $\begingroup$ Of course. The first one would be $\Gamma(-5.7+1)$, and the second would be $-\Gamma(5.7+1)$. Just like if $f(x) = x^2$ then $f(-2) = 4$, but $-f(2) = -4.$ $\endgroup$
    – Eff
    Commented Mar 18, 2015 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .