MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is an analysis question I remember thinking about in high school. Reading some of the other topics here reminded me of this, and I'd like to hear other people's solutions to this.

We have the gamma function, which has a fairly elementary form as we all know,

$\Gamma(z) = \int_0^\infty e^{-t} t^{z-1} dt = \int_0^1 \left[ \ln(t^{-1}) \right]^{z-1}$

Which satisfies of course, $\Gamma(n) = (n-1)!$, $n\in \mathbb{N}$, and the various recurrence relations and other identities that we can all look up on wikipedia or mathwolrd or wherever. We note that the gamma function is increasing on the interval $[a,\infty]$ where $a\approx 1.46163$.

The question is--can we come up with an explicit inverse function to the gamma function on this interval which looks similarly simple?

My techniques at the time were to write down a differential equation that the inverse would satisfy, and solve it, which I could do in terms of a power series expansion (being in high school, ignoring the issues of convergence) to get an approximate solution. But I was never able to get a very nice looking or exact solution. I have a few more sophisticated tricks now to do this, but I would be interested to see how people with more experience with these kinds of questions would go about answering this.

The gamma function also satisfies a reasonable number of somewhat interesting looking functional relations like $\Gamma(z)\Gamma(1-z)=\pi/\sin(\pi z)$. Does the inverse function satisfy any similar relations?

share|cite|improve this question

David Cantrell gives a good approximation of $\Gamma^{-1}(n)$ on this page.

I'll copy the result here in case that page ever goes down:

$k$ = the positive zero of the digamma function, approximately $1.461632$
$c$ = $\sqrt{2\pi}/e - \Gamma(k)$, approximately $0.036534$
$L(x)$ = $\ln(\frac{x+c}{\sqrt{2\pi}})$
$W(x)$ = Lambert W function
$ApproxInvGamma(x)$ = $L(x)/W(\frac{L(x)}{e}) + \frac{1}{2}$

share|cite|improve this answer

For the benefit of generations to come I add here the python code I wrote after reading the above answers.

import numpy as np
import math
import scipy.special

def _lambert_w(z):
  Lambert W function, principal branch.
  Code taken from
  assert z>=-em1, ' bad argument %g, exiting.'%z
  if 0.0==z: 
      return 0.0
  if z<-em1+1e-4:
  if z<1.0:
  if z>3.0: 
  for i in xrange(10):
      if abs(t)<eps*(1.0+abs(w)): 
          return w
  raise AssertionError, 'Unhandled value %1.2f'%z

def _gamma_inverse(x):
  Inverse the gamma function.
  k=1.461632 # the positive zero of the digamma function, scipy.special.psi
  assert x>=k, 'gamma(x) is strictly increasing for x >= k, k=%1.2f, x=%1.2f' % (k, x)
  C=math.sqrt(2*np.pi)/np.e - scipy.special.gamma(k) # approximately 0.036534
  gamma_inv = 0.5+L/_lambert_w(L/np.e)
  return gamma_inv
share|cite|improve this answer

Mathematica has an inverse gamma function. It is on the web page on special functions. This would suggest that the problem is at least simple enough for computer implementation.

I have just found more material on the inverse of the regularized incomplete gamma function from Mathematica. There are downloads on the site with information as well. Some of them are Mathematica notebooks and need the player which is free to be opened.

The information includes differential equations, representations through equivalent functions and series representations among other things.

share|cite|improve this answer
Of course the implementation could be as simple as "solve the equation $\Gamma(z) = x$ using, e.g., Newton's method." It doesn't necessarily mean they have a good analytic understanding of the function. – Nate Eldredge Jun 21 '10 at 19:29
How do you get the inverse gamma function from the inverse regularized gamma function? It's not clear to me. – Charles Jun 4 '12 at 17:36

This should work for Mathematica:

c = 0.036534
l[x_] = Log[(x + c)/Sqrt[2*Pi]]
aig[x_] = l[x]/(ProductLog[l[x]/E]) + 1/2
share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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