# How to evaluate the gamma function for non-integers

1. Apr 6, 2015

### David Carroll

Hello, everyone. After my discovery some time ago of the gamma function \int_a^b x^{-n}e^{-x}dx
(where b = infinity and a = 0....sorry, haven't quite figured out LaTex yet....and actually the foregoing is the factorial function [I think it's silly that the argument has to be shifted down by one]), I've tried my darnedest to evaluate this integral for non-integer values.

I've figured out how to do it for n = 1/2 by using the u-substitution x = u^2 and then converting to polar coordinates to yield \int_a^b x^{-n}e^{-x}dx = (pi^.5)/2. But I'm stuck as far as using any other rational numbers, much less irrational numbers for n.

When I try to evaluate the function for non-integers, the only sensible thing to do, it seems, is to integrate by parts. But then I get an infinite number of parts (all of which create a pattern, but I don't know how to make numberical sense out of this pattern).

Could someone help me out here?

2. Apr 6, 2015

### David Carroll

Woah. That is one ugly post! Sorry about botching the latex, guys. And that should be a positive "n" in the integrand....not a negative "n".

3. Apr 6, 2015

### wabbit

There isn't really one way to calculate the gamma function at any point. There are however several identities one can use in special cases - you just established one with your transformation x=u^2 (but your result might be off by a factor of 2).
For half-integers for instance, you can make use of $$\Gamma(z)\Gamma(z+\frac{1}{2})=2^{1-2z}\sqrt{\pi}\Gamma(2z)$$.
Now depending on which non-integers you are interested in, such formulas may or may not be enough - in the general case, they aren't, and you will need to use a numerical solution, typically based on a series.

Have a look at http://en.wikipedia.org/wiki/Gamma_function, and if you want many more, go for Abramowitz and Stegun (a math library will have a copy) which has a wealth of formulas of all sorts related to the Gamma function - among others.

Or you could just type for instance "0.17!" in a google search bar, to get $\Gamma(1.17)$ : )

Last edited: Apr 6, 2015
4. Apr 6, 2015

Thank you.

5. Apr 6, 2015

### David Carroll

1. I did discover a way to approximate the factorial function for non-integer values. It is only useful insofar as it is taken as granted that evaluating the factorial for positive integers is straightforward whereas evaluating it for non-integers is not so straightforward.

2. Consider some real number r, where 0 < r < 1. An approximate solution for r! is [(n!)(n + 1)^r]/[(n + r)(n + r - 1)(n + r - 2)***(1 + r)], where n is a positive integer, and the limit of this "function" as n approaches infinity is equal to r! [or gamma(r + 1)].

3. I'm still trying to find a proof of this approximation, which I discovered on my own (*pats own back*....*toots own trumpet*). Up to now, I've only gotten as far as saying that the above is intuitively plausible.

4. It is intuitively plausible because of the following: Consider a tentative definition of the factorial function for non-integers to be this: (n + r)! = (n!)(n + 1)^r - where n is a positive integer and r is greater than or equal to zero but less than or equal to 1. This will ensure that the function is A) continuous throughout the positive real number line AND B) that the function is equal to what we know to be the factorial evaluated for positive integers. For example, 6! is (5 + 1)! = (5!)(5 + 1)^1.....or, equivalently, 6! is (6 + 0)! = (6!)(6 + 1)^0.

5. To approximate the ACTUAL factorial evaluated at r (i.e. in addition to having qualities A and B above, we have (C), the function is differentiable throughout the positive real number line), pick some arbitrarily large integer "n" and perform the aforementioned operation in paragraph 2 above. Intuitively, the larger n is, the smaller the error is between the actual factorial function and (n!)(n + 1)^r....and therefore performing the latter operation and dividing the result by (n + r)(n + r - 1)(n + r - 2)***(1 + r) will yield an approximate solution for r!

6. Apr 6, 2015

### David Carroll

This, incidentally, results in an interesting way to approximate pi:

Pi = lim(n approaches infinity) [4(n!)^2(n + 1)]/[(n + r)^2(n + r - 1)^2(n + r - 2)^2***(1 + r)^2]

The above identity could possibly be important as far as proving the Riemann hypothesis. I'm still toying with it.

7. Apr 6, 2015

### wabbit

Well done. As far as I can tell, your approximation is indeed correct, it is very close (up to a factor that is fairly close to one in your case, and converges to one) to a formula due to Gauss which does converge to Gamma(r+1), so it looks like you're on the right track.

8. Apr 7, 2015

### David Carroll

Actually, I was wrong about the reason why it works. An infinite number of possible functions could have all three of the above quoted characteristics and yet only one of these is the gamma function(...+ 1).

For example, imagine a sine-wavey sort of function which has a derivative of zero twice between each integer.

So, to tell you the truth I don't know why my "function" converges correctly.

9. Apr 7, 2015

### wabbit

Well, it was a good move coming up with the formula already. There's a proof using Stirling's formula (here) but otherwise I don't know either. Maybe someone else on the forum can tell us more.

10. Apr 8, 2015

### David Carroll

I suppose it has something to do with minimizing arc length. I tried to do this by using the arc-length formula Integral(0 to x) sqrt(1 + {[t!]'}^2)dt, then differentiating that via the Second Fundamental Theorem of Calculus and equating the result to zero, obtaining sqrt(1 + {[x!]'}) = 0, but then I realized several mistakes:

a) the arc-length is not minimized for just any value of x!, but only throughout the entire positive real number line in total. Otherwise, if we chose x = 1, we'd simply get a straight line from 0! to 1! to minimize that particular section of the arc length.

b) Even if we minimized the arc length, it doesn't follow that the derivative of the arc length formula would equal to zero. If that were the case, we'd get x! = x*(imaginary unit), which is patently false.

c) We're assuming that (x!)' is defined. And since the whole purpose of this excursion is to define f(x) = x!, it would be silly to assume we've already defined f'(x) = (x!)'.

So, I'm at an utter loss.

11. Apr 8, 2015

### wabbit

Why would it have to do with minimizing arclength ? That would be true if the Gamma function satisfied a specific second order differential equation - maybe it does, but I'm not aware of it.

12. Apr 8, 2015

### wabbit

I don't find the proof from Stirling's formula satisfying here because it seems this just moves the substance of the proof, which becomes proving Stirling's formula. But maybe you could start from there though, look at Stirling's formula's existing proofs of try doing one from scratch.

13. Apr 8, 2015

### David Carroll

Well, I don't know how to prove it, but it seems to me that the gamma function (again, with the argument shifted up one: Gamma(r + 1)) satisfies the following three conditions:

Define the factorial function such that:

1) it is continuous throughout the entire positive real number line
2) it is differentiable throughout the entire positive real number line
3) the arc length throughout the entire positive real number line is minimized

14. Apr 8, 2015

### wabbit

I don't know about condition 3. As far as I know it's not part of the definition and I don't have a reason to think it holds true.

What is part of the definition, or at least does hold true, is that the Gamma function is analytic over the complex plane (minus it's poles). This is I think what defines it uniquely as an extension of the factorial over integers, together with the relation between its values at z and z+1.

15. Apr 9, 2015

### pwsnafu

No, the conditions for uniqueness are given in the Bohr-Mollerup theorem.

16. Apr 9, 2015

### sshai45

Does the gamma function minimize not the arc length, but the "bending energy" of its curve (for x > 0)? I.e. is it the only solution to its iterative functional equation ($\Gamma(x+1) = x \Gamma(x)$) with the minimal bending energy? (The bending energy is the integral of the squared _curvature_ with respect to the arc-length _parameterization_)

17. Apr 10, 2015

### wabbit

Oops, yes, thanks for the correction.

18. Apr 16, 2015

### David Carroll

I'll have to brush up on my formulas for curvature, but it sounds promising, sshai45.

What I was trying to hit on is based on the following intuitive notion:

Define the factorial function so that it is differentiable and continuous throughout the entire positive real number line. Now, given those stipulations, imagine a string that is tied at one end to 0! and that approaches infinity at the other "end" (paradoxical as that may sound). Draw and tighten this string until it is completely taut and such that the resulting function that this string represents is still differentiable throughout the entire positive real number line.

This, I believe, is the minimization of arc length that I was trying to grasp at. I also believe that everything else (analytic continuation, function values for negative numbers, etc.) will follow. For example, given that (n-1)! is equal to n!/n, we should know immediately that the function will diverge at negative integers. I.e. 0!/0 diverges, therefore (-1)! diverges and so does (-2)!, etc.