Factorial Calculation for Non-Integers?

I was playing with numbers on calculator and to my amaze i could see that calculator calculated $(4.5)!$ or any real numbers but factorial is defined for integers how is this done any advanced function. (Note I am grade $11$ student)

• en.wikipedia.org/wiki/Gamma_function – 5xum Feb 22 '16 at 12:53
• Did your calculator give $4.5!=\frac{945}{32}\sqrt{\pi}\approx 29.53125$? Knowing the value your calculator gave will definitely make it easier for us to appropriately answer your question. – vrugtehagel Feb 22 '16 at 12:59
• – true blue anil Feb 22 '16 at 13:00
• No it gave $53.09.....$ – Archis Welankar Feb 22 '16 at 13:01
• Excuse me. I made a mistake in my calculation, actually $\Gamma(5.5)=\frac{945}{32}\sqrt{\pi}\approx 52.3427777845535$ – vrugtehagel Feb 22 '16 at 13:08

In general, $~n!~=~\displaystyle\int_0^\infty\exp\Big(-\sqrt[n]x\Big)~dx,~$ which for $~n=\dfrac12~$ yields $~\Big(\tfrac12\Big)!~=~\displaystyle\int_0^\infty e^{-x^2}~dx.~$

But the value of the Gaussian integral is known to be $\sqrt\pi~,~$ implying that $~\Big(\tfrac12\Big)!~=~\dfrac{\sqrt\pi}2,~$

since the integrand is even. Now all that's left to do is to repeatedly employ the well-known

factorial property $(n+1)!=(n+1)~n!~$ for $~n+1=4+\dfrac12,~$ and the result follows.

• Nice, so 4.5! = 4.5 * 3.5 * 2.5 * 1.5 * 0.5! = 59.0625 * (pi^0.5)/2 = 52.34277 .... – sav Feb 22 '16 at 14:16
• Of course, the integral one usually sees is $n! = \int_0^\infty x^n e^{-x} dx$ but I guess they are related through a simple substitution. It is implicit in your answer that it is "obvious" to use the same integral for an $n$ that is not an integer. It is also implicit in the answer that the integral definition obeys the same "factorial property" $(n+1)!=(n+1)n!$ for non-integer $n$ as it does for integers. It is not too hard to prove, of course. A justification for using this integral as a generalization of the factorial functions comes from the characterization by H. Bohr and J. Mollerup. – Jeppe Stig Nielsen Feb 22 '16 at 19:19
• You should probably explain how you got the first equality... – Mehrdad Feb 23 '16 at 8:31
• @Mehrdad: Well, if you insist... :-$)$ – Lucian Feb 23 '16 at 8:37
• @Lucian: lol holy cow thanks. – Mehrdad Feb 23 '16 at 9:58

There is a function called the Gamma function. It is similar to the factorial as the factorial could be thought of as a special case of the gamma function.

$\Gamma(n) = (n-1)!$

or rather, when you shift it by one, as shown in the above equation.

The gamma function happens to be

$\Gamma(t) = \int_0^\infty x^{t-1} e^{-x} dx$

Calculators often use the gamma function to calculate factorials of non-natural values.

The generalization is useful when you need to extend the definition of the factorial beyond the natural numbers. For example, some probability distributions use the factorial, and the gamma function can be used to generalize them.

The factorial and gamma function both have some interesting properties in common.

For example, the factorial function can be defined recursively.

$0!=1$

$(n+1)! = (n+1) \times n!$

The gamma function also has this property

$\Gamma (1) = 1$

$\Gamma(x+1) = (x+1) \times \Gamma(x)$

• That wasnt really helpful as 5xum already included it in my link – Archis Welankar Feb 22 '16 at 13:19
• hmm ... Does any part need more explanation? – sav Feb 22 '16 at 13:25
• But still thanks and $(+1)$ – Archis Welankar Feb 22 '16 at 13:25
• Realistically functions like this are hard to compute and the calculator probably does it numerically math.stackexchange.com/questions/19236/… – sav Feb 22 '16 at 13:42

It's possible the calculator gave you the value of $\Gamma(5.5)$.

The $\Gamma$ function is a sort of generalization of the factorial in the sense that for every $n\in\mathbb N$, you have that $\Gamma(n) = (n-1)!$. So if you ever want to calculate $m!$, that's the same as calculating $\Gamma(m+1)$.

• But what calculation and how $(4.5)(3.5)...(0.5).1$ – Archis Welankar Feb 22 '16 at 12:57
• @ArchisWelankar It's not $4.5\cdot 3.5\cdots 0.5$. It's a lot more complicated than that. en.wikipedia.org/wiki/Gamma_function – 5xum Feb 22 '16 at 13:03
• So what would be $x$ in my question?? – Archis Welankar Feb 22 '16 at 13:08
• @ArchisWelankar Did you even read my answer? I said: it is possible the calculater gave the value of $\Gamma(5.5)$ – 5xum Feb 22 '16 at 13:09
• Yes thus i asked how – Archis Welankar Feb 22 '16 at 13:18

Along with the gamma function, it is much easier to approximate to good accuracy using Stirling's approximation.

It is defined as:

$$n!\approx \sqrt{2\pi n}\left(\frac ne\right)^n$$

• Note that "good accuracy" is for larger values of $n$. The relative error is about $1/(12n)$, so the number of correct digits will be roughly equal to the number of digits in $n$. When $n=4.5$ it means you should only expect the first 1 or 2 digits to be accurate. – Erick Wong May 6 '16 at 6:57

The Gamma function works for all real numbers. It gives the factorial of n-1 for integers, and an analytic continuation, ie. Smooth graph for in between inputs.

There is an easy introduction here:http://www.sosmath.com/calculus/improper/gamma/gamma.html