# 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. Feb 22 '16 at 12:59
• Feb 22 '16 at 13:00
• No it gave $53.09.....$ 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$ 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. Feb 22 '16 at 19:19
• You should probably explain how you got the first equality... Feb 23 '16 at 8:31
• @Mehrdad: Well, if you insist... :-$)$ Feb 23 '16 at 8:37
• @Lucian: lol holy cow thanks. 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 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)$ 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$ 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?? 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 Feb 22 '16 at 13:18

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

An answer was never accepted so I’d like to take a stab at it. In particular the OP mentioned being grade 11, and I think “what is going on here” is an excellent question.

Faced with a function like x! -which is defined for positive integers- which we want to extend to other numbers, the most important question we can ask is:

Q: What are its properties?
A factorial is pretty simple. For any integer n > 1
(1). (n+1)! = (n+1) n!
In other words, to get (n+1)! we don’t have to start over from scratch. We just multiply n! by the next integer. For example 6! = 6 • 5!. Hopefully this just sounds like a restatement of what “factorial” means.

Continuation
The factorial for non integers is called a continuation of the factorial for integers: we seek a function that obeys the known properties of the factorial, at all values of x. In math, we need (1) to be satisfied for any number x, not just the integers:
1’. (x+1)! = (x+1) x!
One way to visualize this question is to plot the integer factorial values on a graph. The continuous function x! will be a smooth curve passing through these points. Now, you can draw an infinite number of curves that do this. The curve we seek, is the one that satisfies 1’ everywhere on the curve. So we now have a new question:

Q: but what is this mystery function?
I didn’t take the op as looking for a proof. However, a word about how to solve problems of this kind:
The definition 1’ is nice but as written it does not tell us how to draw the curve. If I put my pencil on 3! = 6 and begin to draw upward toward 4! = 24, the first thing I need to know is what direction to start drawing — the slope of the curve. But also the curve is not a straight line, so I can’t keep drawing in that same direction. The curve changes continuously. In a nutshell, to draw it, we need to understand how the function changes as x varies.

The tools to answer this kind of problem —to identify how it changes; and how to assemble this information into a formula for practical calculation — come from the Calculus.

I hope that helps.

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. May 6 '16 at 6:57