Our Gamma function calculator uses the best Gamma function approximations to help you find the value of the Gamma function for both real and complex arguments.

Scroll down if you are unsure what the Gamma function formula is or how to calculate the Gamma function at a particular point. We will explain the link between the Gamma function and factorials, give you the Gamma function integral formula, and, since a picture is worth a thousand words, show a few graphs of the Gamma function.

What is the Gamma function? Gamma function properties

The Gamma function is very tightly linked to the notion of factorial. Hence, before moving on to the Gamma function properties, let us first recall what the factorial is.

Factorial operator

Let n be a positive integer. The factorial of n (denoted by n!) is the product of all integers between (and including) 1 and n:

n! = 1 β‹… 2 β‹… ... β‹… (n-1) β‹… n.

For instance

5! = 1 β‹… 2 β‹… 3 β‹… 4 β‹… 5 = 120.

Factorials are essential in statistics and probability. They have many uses, too many to mention here, so let us just mention permutations & combinations, binomial coefficients along with Pascal's triangle, and the binomial probability distribution. If you want to learn more about factorials, especially their applications, visit our dedicated factorial calculator.

What is essential for us is the fact that the factorial is only defined for positive integers. Is there any way to extend the factorial to all positive numbers? How about all real (or even complex) numbers? We can think of this as the following interpolation problem:

Can we find a smooth curve that connects the points (x, y) given by y = x! at the positive integer values for x?

There have been several approaches to solve this problem, and the Gamma function is the most popular one.

Gamma function and factorials

Gamma is a function (denoted by the Greek letter πšͺ) that allows us to extend the notion of factorial well beyond positive integer numbers. Formally, the Gamma function formula is given by an integral (see the next section for more details). Most importantly, the Gamma function and factorials are linked via the relationship:

πšͺ(n) = (n - 1)!

So it is indeed a solution to the interpolation problem described above. Below you can see the graph of the Gamma function πšͺ(n + 1) = n! for all positive numbers (the red dots are the values of the factorial at each integer of x):

Gamma function plotted
Plot of the Gamma function
πŸ’‘ Do you know that... this function was defined by the Swiss mathematician Leonhard Euler in the first half of the 18th century, while the name Gamma and notation πšͺ was introduced by the French mathematician Adrien-Marie Legendre at the beginning of the 19th century.

Gamma function - integral formula

For more advanced readers, we now briefly discuss the Gamma function integral formula and show some more Gamma function properties. Namely, for a complex number z taken from the positive complex half-plane (i.e., for z with a positive real part), we define the Gamma function via the following integral:

Gamma function integral formula

This Gamma function integral is absolutely convergent. With the help of standard integration methods, we can also show that:

πšͺ(1) = 1 and πšͺ(z + 1) = z * πšͺ(z).

In consequence, we get πšͺ(n) = (n βˆ’ 1)! for any natural number n. Hence, we've extended the factorial to the positive complex half-plane.

If Re(z) ≀ 0, then the above integral is not convergent, but πšͺ has a unique analytic continuation to the negative half-plane. To find this analytic continuation, we can use the formula:

πšͺ(z) = πšͺ(z+1) / z.

However, this technique works if and only if z is a non-positive integer. Therefore, we must leave the Gamma function undefined at these integers to avoid dividing by zero. So, we've extended the factorial to the whole complex plane, except non-positive integers.

The Gamma function graph plotted over the real numbers looks like this:

Gamma plot
Alessio Damato / CC BY-SA

In the language of complex analysis, we say that Gamma is a meromorphic function in the whole complex plane. At each non-positive integer it has a simple pole and the residue at -n is equal to (-1)ⁿ/n! for n = 0, 1, 2, .... Gamma has no zeros. Here is the plot of the absolute value of Gamma over the complex plane:

Gamma abs 3D
Geek3 / CC BY-SA

How to calculate the Gamma function? Gamma function of 1/2

You now know what the Gamma function is and what the Gamma function formula looks like, but you probably still have very little idea how to determine its values. Well, we don't have good news for you: it's highly non-trivial to find the values of Gamma, apart from some very specific points, like Gamma function of 1/2.

Let's start with the simplest case. We've already seen that for positive-integer arguments we have

πšͺ(n) = (n βˆ’ 1)!

so we easily get

πšͺ(1) = 0! = 1

πšͺ(2) = 1! = 1

πšͺ(3) = 2! = 2

πšͺ(4) = 3! = 6

etc.

Next, we have a nice formula for half-integer arguments:

πšͺ(n/2) = (n-2)!! * √(Ο€/2(n-1))

where n!! is a double factorial. Recall that the double factorial is defined as the product of all integers between 1 and n with the same parity as n: if n is even, then n!! = 2 β‹… 4 β‹… ... β‹… n; and if n is odd, then n!! = 1 β‹… 3 β‹… ... β‹… n.

Using this half-integer formula, we obtain Gamma function of 1/2:

πšͺ(1/2) = βˆšΟ€,

and other fractions:

πšͺ(3/2) = 1/2 β‹… βˆšΟ€

πšͺ(5/2) = 3/4 β‹… βˆšΟ€

etc.

There are also formulas that link the values of Gamma at several points. Thanks to them, you can find the value of Gamma at some point z provided that you know its value at some other point linked to z. For instance, if z is not an integer, then πšͺ(1-z) and πšͺ(z) are linked by Euler's reflection formula:

πšͺ(1-z) β‹… πšͺ(z) = Ο€ / sin(Ο€ * z).

Thanks to this formula we find:

πšͺ(-1/2) = -2 * βˆšΟ€

πšͺ(-3/2) = 4/3 * βˆšΟ€

πšͺ(-5/2) = -8/15 * βˆšΟ€

etc.

The reflection formula allows us also to derive the following relationships:

πšͺ(1/3) β‹… πšͺ(2/3) = 2√3/3 β‹… Ο€

πšͺ(1/4) β‹… πšͺ(3/4) = √2 β‹… Ο€

etc.

Unfortunately, no simple expression for πšͺ(1/3) or πšͺ(1/4) exists.

Another interesting formula is the Legendre duplication formula. Assume that 2 * z is not equal to any non-positive integer. Then, if you know any two from πšͺ(z), πšͺ(2 * z), and πšͺ(z + 1/2), you can find the third one. The equation that links all three is of the form:

πšͺ(z) β‹… πšͺ(z + 1/2) = 21 - 2*z * βˆšΟ€ * πšͺ(2 * z)

How to use this Gamma function calculator?

Are you still wondering how to calculate the Gamma function? Well, the best answer is: use our Gamma function calculator! Here we briefly describe how to use it:

  1. Choose the type of argument you want our Gamma function calculator to use. By default, we set it to real arguments, but complex numbers are available as well.
  2. Enter the argument in the appropriate field(s).
  3. The calculator uses very precise Gamma function approximations to determine the result. It appears just beneath the argument. Enjoy!
  4. If you need to increase the precision of calculations, go to the advanced mode. By default, this Gamma function calculator uses five sig figs to display the result.

Gamma function approximations

As we have seen above, we can find precise values of the Gamma function for only very specific arguments. Fortunately, we can approximate Gamma numerically with arbitrary precision. There are several Gamma function approximations, let us mention the most popular ones:

Stirling's and Lanczos' methods allow us to compute the values of Gamma with any precision we want, but they still require quite complicated calculations. Our Gamma function calculator uses the Lanczos approximation for small values and an extended Stirling approximation for large values.

Nemes' approximation leads to the following simple formula:

Nemes approximation of Gamma function.
which is, however, a bit less precise. Feel free to use it when accuracy is not critical.
Anna Szczepanek, PhD