Tutorials › Statistical Theory I - Probability and Distribution Theory › The Gamma Function and Its Recurrence

Uniform, Beta, and Gamma Laws · Tutorial 152 of 994

The Gamma Function and Its Recurrence

Learn how the gamma integral converges, why integration by parts gives its recurrence, and how to evaluate it at integers and half-integers.

Beginner 8 min read

What You'll Learn

  • Define the gamma function for positive real arguments using an improper integral
  • Check convergence at zero and infinity
  • Prove the gamma recurrence with integration by parts and justified boundary limits
  • Derive the factorial formula at positive integers
  • Evaluate the gamma function at one-half using the Gaussian integral
  • Extend the half-integer evaluations using the recurrence

Why the Gamma Function Matters

The factorial is a central quantity in probability, but its familiar definition applies only to nonnegative integers. The gamma function provides a closely related integral for every positive real argument. Its recurrence reproduces factorials at integer inputs and, together with one Gaussian integral, gives exact values at half-integers. These facts will provide useful constants in later distribution theory.

The defining integral is improper at both zero and infinity, so it is important to check that it exists before using it. We will do that first, then derive the recurrence and the two families of special values.

Definition and Convergence

Definition: For a real number \(x>0\), the gamma function is $$ \Gamma(x)=\int_0^\infty t^{x-1}e^{-t}\,dt, $$ provided the improper integral converges. The integration variable \(t\) is positive; \(x\) is the argument of the function.

To verify convergence, split the integral at \(1\). On \((0,1)\), \(e^{-t}\leq 1\), so $$ 0\leq \int_0^1 t^{x-1}e^{-t}\,dt \leq \int_0^1 t^{x-1}\,dt =\frac{1}{x}<\infty. $$ This is where the condition \(x>0\) is essential.

For the tail, choose a nonnegative integer \(m\) such that \(m\geq x-1\). For \(t\geq1\), \(t^{x-1}\leq t^m\). The function \(t^m e^{-t/2}\) is bounded on \([1,\infty)\): for \(m>0\), its derivative is \(t^{m-1}e^{-t/2}(m-t/2)\), so it decreases once \(t>2m\); the case \(m=0\) is immediate. Thus there is a finite constant \(C\) such that \(t^m e^{-t}\leq C e^{-t/2}\) for \(t\geq1\). Since \(\int_1^\infty e^{-t/2}\,dt<\infty\), the tail converges. Therefore \(\Gamma(x)\) is finite for every \(x>0\).

The integrand is positive for \(t>0\), so \(\Gamma(x)>0\). The definition does not include \(x=0\) or negative arguments: the integral near zero would not converge there.

Worked Example: Checking the Definition at \(x=1\)

At \(x=1\), the power of \(t\) is \(t^0=1\), so the improper integral is particularly direct: $$ \Gamma(1)=\int_0^\infty e^{-t}\,dt =\lim_{R\to\infty}\left[-e^{-t}\right]_0^R =\lim_{R\to\infty}(1-e^{-R})=1. $$ This value will serve as the starting point for evaluating the function at positive integers.

The Recurrence Relation

Theorem: For every \(x>0\), $$ \Gamma(x+1)=x\Gamma(x). $$

To prove the identity, first integrate over a finite interval \([\varepsilon,R]\), where \(0<\varepsilon<R\). Integration by parts with \(u=t^x\) and \(dv=e^{-t}\,dt\) gives $$ \int_\varepsilon^R t^x e^{-t}\,dt =\left[-t^x e^{-t}\right]_\varepsilon^R +x\int_\varepsilon^R t^{x-1}e^{-t}\,dt. $$ We must check that the boundary term vanishes as \(\varepsilon\downarrow0\) and \(R\to\infty\). At zero, \(\varepsilon^x e^{-\varepsilon}\to0\) because \(x>0\) and \(e^{-\varepsilon}\leq1\). At infinity, choose an integer \(m>x\). The exponential series gives \(e^R\geq R^m/m!\) for \(R>0\), and hence $$ 0\leq R^x e^{-R}\leq m!R^{x-m}\longrightarrow0. $$ Both integrals in the finite-interval identity converge to their defining improper integrals, as established above for the positive arguments \(x+1\) and \(x\). Taking the limits therefore yields \(\Gamma(x+1)=x\Gamma(x)\). \(\square\)

The recurrence steps the argument upward by one and multiplies by the current argument. It is the key link between the integral definition and factorial arithmetic.

Worked Example: Evaluating \(\Gamma(6)\)

Apply the recurrence repeatedly until the argument reaches \(1\): $$ \begin{aligned} \Gamma(6) &=5\Gamma(5)\\ &=5\cdot4\Gamma(4)\\ &=5\cdot4\cdot3\Gamma(3)\\ &=5\cdot4\cdot3\cdot2\Gamma(2)\\ &=5\cdot4\cdot3\cdot2\cdot1\Gamma(1)\\ &=5\cdot4\cdot3\cdot2\cdot1=120. \end{aligned} $$ Here \(\Gamma(1)=1\), as computed above. The result is \(5!\), not \(6!\): each recurrence step reduces the argument by one, and the process ends at \(\Gamma(1)\).

Values at Positive Integers

Theorem: For every positive integer \(n\), $$ \Gamma(n)=(n-1)!. $$ Here \(0!=1\), and for an integer \(k\geq1\), \(k!=1\cdot2\cdots k\).

For \(n=1\), the formula states \(\Gamma(1)=0!=1\), already established. Suppose it holds for a positive integer \(n\). The recurrence then gives $$ \Gamma(n+1)=n\Gamma(n)=n(n-1)!=n!. $$ Thus the formula holds for \(n+1\) whenever it holds for \(n\). By induction, it is true for every positive integer \(n\). \(\square\)

This identity explains the one-unit shift that often causes errors: the gamma function at \(n\) equals the factorial of \(n-1\). Equivalently, \(k!=\Gamma(k+1)\) for every nonnegative integer \(k\).

The First Half-Integer Value

The recurrence alone cannot determine values at half-integers from integer values. We first need \(\Gamma(1/2)\), which is connected to the Gaussian integral. Substituting \(t=u^2\), so \(dt=2u\,du\), gives $$ \Gamma\left(\frac12\right) =\int_0^\infty t^{-1/2}e^{-t}\,dt =2\int_0^\infty e^{-u^2}\,du. $$ To evaluate the last integral, set \(I=\int_0^\infty e^{-u^2}\,du\). It is finite: on \([0,1]\) the integrand is at most \(1\), while for \(u\geq1\), \(e^{-u^2}\leq e^{-u}\), whose tail integral is finite. Since the integrand is nonnegative, Tonelli's theorem allows the product integral to be written as an integral over the first quadrant: $$ I^2=\int_0^\infty\int_0^\infty e^{-(u^2+v^2)}\,du\,dv. $$ Use polar coordinates \(u=r\cos\theta,\ v=r\sin\theta\) on this quadrant, where \(r\geq0\), \(0\leq\theta\leq\pi/2\), and the area element is \(r\,dr\,d\theta\). Then $$ I^2 =\int_0^{\pi/2}\int_0^\infty e^{-r^2}r\,dr\,d\theta =\frac{\pi}{2}\left[-\frac12 e^{-r^2}\right]_{0}^{\infty} =\frac{\pi}{4}. $$ Because \(I>0\), \(I=\sqrt{\pi}/2\). Substitution into the expression for \(\Gamma(1/2)\) proves the value below.

Result: $$ \Gamma\left(\frac12\right)=\sqrt{\pi}. $$

Worked Example: Evaluating \(\Gamma(3/2)\)

Use the recurrence with \(x=1/2\), then insert the half-integer base value: $$ \Gamma\left(\frac32\right) =\frac12\Gamma\left(\frac12\right) =\frac12\sqrt{\pi} =\frac{\sqrt{\pi}}{2}. $$ The factor is \(1/2\), the argument before the recurrence step. Replacing it by \(3/2\) would apply the recurrence in the wrong direction.

All Positive Half-Integer Values

Theorem: For every integer \(n\geq0\), $$ \Gamma\left(n+\frac12\right) =\frac{(2n)!}{4^n n!}\sqrt{\pi}. $$

Repeated application of the recurrence gives $$ \Gamma\left(n+\frac12\right) =\left(n-\frac12\right)\left(n-\frac32\right)\cdots\left(\frac12\right) \Gamma\left(\frac12\right), $$ with an empty product interpreted as \(1\) when \(n=0\). Each factor in the product can be written as an odd integer divided by \(2\), so $$ \left(n-\frac12\right)\left(n-\frac32\right)\cdots\left(\frac12\right) =\frac{1\cdot3\cdot5\cdots(2n-1)}{2^n}. $$ The even factors in \((2n)!\) have product \(2\cdot4\cdots(2n)=2^n n!\). Therefore $$ (2n)! =\bigl(1\cdot3\cdot5\cdots(2n-1)\bigr)2^n n!, $$ which rearranges the odd product to \((2n)!/(4^n n!)\). Multiplying by \(\Gamma(1/2)=\sqrt{\pi}\) proves the formula, including \(n=0\). \(\square\)

Worked Example: Evaluating \(\Gamma(7/2)\)

There are two useful checks. Using the recurrence step by step, $$ \begin{aligned} \Gamma\left(\frac72\right) &=\frac52\Gamma\left(\frac52\right)\\ &=\frac52\cdot\frac32\Gamma\left(\frac32\right)\\ &=\frac52\cdot\frac32\cdot\frac12\sqrt{\pi}\\ &=\frac{15\sqrt{\pi}}{8}. \end{aligned} $$ The closed formula gives the same value with \(n=3\): $$ \frac{(2\cdot3)!}{4^3 3!}\sqrt{\pi} =\frac{6!}{64\cdot6}\sqrt{\pi} =\frac{720}{384}\sqrt{\pi} =\frac{15\sqrt{\pi}}{8}. $$ The agreement checks both the recurrence calculation and the factorial form.

Common Pitfalls and Why the Values Matter

These evaluations give exact constants without requiring numerical integration. They are especially useful when expressions involving gamma functions appear in distribution theory: integer and half-integer arguments can be simplified to factorials and powers of \(\pi\). The recurrence also provides a reliable way to check whether a proposed simplification is consistent.

  • Using \(n!\) instead of \((n-1)!\). The recurrence ends at \(\Gamma(1)=1\), so \(\Gamma(n)=(n-1)!\). For example, \(\Gamma(6)=120\), not \(720\).
  • Applying the recurrence with the wrong factor. The identity is \(\Gamma(x+1)=x\Gamma(x)\), so the multiplier is the lower argument \(x\).
  • Ignoring the domain. The defining integral requires \(x>0\); its behavior near zero cannot be omitted when deciding whether the integral exists.
  • Assuming the recurrence supplies every value by itself. It relates arguments one unit apart, but the half-integer sequence needs the separate starting value \(\Gamma(1/2)=\sqrt{\pi}\).

A compact check is to substitute a computed value back into the recurrence. For example, \(\Gamma(7/2)\) must equal \((5/2)\Gamma(5/2)\). If the claimed values fail this identity, a factor or argument shift has been mishandled.

Check Your Understanding

Use the integral definition, the recurrence, and the special values derived above.

  1. Why does the defining integral converge near zero when \(x>0\), and what part of the argument would fail for \(x=0\)?
  2. Evaluate \(\Gamma(4)\), showing each recurrence step and the final factorial comparison.
  3. Use the recurrence to find \(\Gamma(5/2)\) in terms of \(\sqrt{\pi}\).
  4. For which integer \(n\geq0\) does the formula for \(\Gamma(n+1/2)\) give \(\Gamma(1/2)\)? Verify the result.
  5. Explain why \(\Gamma(6)\) is \(5!\), rather than \(6!\).