I am trying to find a clever way to compute the quotient of two gamma functions whose inputs differ by some integer. In other words, for some real value $x$ and an integer $n < x$, I want to find a way to compute

$$ \frac{\Gamma(x)}{\Gamma(x-n)} $$

For $n=1$, the quotient it is simply $(x-1)$ since by definition

$$ \Gamma(x) = (x - 1)\Gamma(x-1) $$

For $n=2$, it is also simple:

$$ \frac{\Gamma(x)}{\Gamma(x-2)} = \frac{(x-1)\Gamma(x-1)}{\Gamma(x-2)} = (x-1)(x-2)$$

If we continue this pattern out to some arbitrary $n$, we get

$$ \frac{\Gamma(x)}{\Gamma(x-n)} = \prod_i^n (x-i)$$

Obviously I am floundering a bit here. Can anyone help me find an efficient way to compute this quotient besides directly computing the two gamma functions and dividing?

I am also okay if an efficient computation can be found in log space. Currently I am using a simple approximation of the log gamma function and taking the difference. This was necessary because the gamma function gets too big to store in any primitive data type for even smallish values of $x$.

  • $\begingroup$ Taking logarithms and using Stirling's approximation? $\endgroup$ – Did Dec 7 '12 at 6:18
  • $\begingroup$ What you have does look like a falling factorial... $\endgroup$ – J. M. isn't a mathematician Apr 3 '13 at 7:28

You can write the expression in terms of the Pochhammer symbol as

$$ (x-1)_n = \frac{\Gamma(x)}{\Gamma(x-n)}. $$

| cite | improve this answer | |
  • $\begingroup$ Nifty - I hadn't heard of the Pochhammer symbol before. Now, if only I knew how to calculate it... $\endgroup$ – jlund3 Dec 7 '12 at 5:23
  • $\begingroup$ @jlund3: It is used in the hypergeometric functions and has some useful properties. $\endgroup$ – Mhenni Benghorbal Dec 7 '12 at 5:49
  • $\begingroup$ @Downvoter: What's the downvote for? $\endgroup$ – Mhenni Benghorbal Dec 7 '12 at 6:22
  • 2
    $\begingroup$ My guess is that it was downvoted because it just gave a name to the desired expression and did not help in any way with the desired evaluation. $\endgroup$ – marty cohen Dec 7 '12 at 6:50
  • 1
    $\begingroup$ So maybe it would be better as a comment than an answer. $\endgroup$ – GEdgar Dec 7 '12 at 17:01

I think you mean $$ \frac{\Gamma(x)}{\Gamma(x-n)} = \prod_{i=1}^{n} (x - i) $$ Of course this might not be very nice if $n$ is very large, in which case you might want to first compute the $\Gamma$ values and divide; but then (unless $x$ is very close to one of the integers $i$) the result will also be enormous. If you're looking for a numerical approximation rather than an exact value, you can use Stirling's approximation or its variants.

EDIT: Note also that if your $x$ or $x-n$ might be negative, you may find the reflection formula useful: $$ \Gamma(z) \Gamma(1-z) = \frac{\pi}{\sin(\pi z)} $$

For $x > n$, $$ \eqalign{\ln\left(\frac{\Gamma(x)}{\Gamma(x-n)}\right) &= n \ln x + \sum_{i=1}^n \ln(x-i)\cr &= n \ln x + \sum_{i=1}^n \left( - \frac{i}{x} - \frac{i^2}{2x^2} - \frac{i^3}{3x^3} - \frac{i^4}{4x^4} - \frac{i^5}{5x^5} - \frac{i^6}{6 x^6}\ldots \right)\cr &= n \ln x - \frac{n(n+1)}{2x} - \frac{n(n+1)(2n+1)}{12 x^2} - \frac{n^2 (n+1)^2}{12 x^3} \cr & -{\frac {n \left( n+ 1 \right) \left( 2\,n+1 \right) \left( 3\,{n}^{2}+3\,n-1 \right) }{120 { x}^{4}}}-\frac { \left( n+1 \right) ^{2}{n}^{2} \left( 2\,{n}^{2}+2\,n-1 \right) }{60 {x}^{5}} \ldots} $$ This provides excellent approximations as $x \to \infty$ for fixed $n$ (or $n$ growing much more slowly than $x$). On the other hand, for $n = tx$ with $0 < t < 1$ fixed, as $x \to \infty$ we have

$$ \eqalign{\ln\left(\frac{\Gamma(x)}{\Gamma(x-n)}\right) &=(1-t) x \ln(x) - (t \ln(t) - t + 1) x +\frac{\ln(t)}{2}\cr &+{ \frac {t-1}{12tx}}+{\frac {1-{t}^{3}}{360{t}^{3}{x}^{3}} }+{\frac {{t}^{5}-1}{1260{t}^{5}{x}^{5}}}+\frac{1-t^7}{1680 t^7 x^7} \ldots }$$

| cite | improve this answer | |
  • $\begingroup$ Thank you for the fix - I've edited my question. $\endgroup$ – jlund3 Dec 7 '12 at 4:00
  • $\begingroup$ I've edited my answer to stipulate that $n < x$, which is the case for my application. $\endgroup$ – jlund3 Dec 7 '12 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.