Skip to content

Gamma and beta functions

Gamma extends factorials; beta evaluates unit-interval integrals. See their identity turn a weight into a density, with domains, recurrences and numerical cautions.

The gamma function Γ\Gamma extends factorials to non-integer arguments; the beta function BB evaluates a family of integrals on the unit interval. In quantitative models, they often supply the constants that turn a proposed distribution's shape into a valid probability density. Recognising them can replace a fresh integration problem with an identity.

These are mathematical functions. The gamma function is distinct from an option's gamma sensitivity, and the beta function is distinct from a security's market beta.

Two integrals, with domains attached

For a positive real argument ss, the gamma function is the improper integral
Γ(s)=∫0∞ts−1e−t dt,s>0.\Gamma(s)=\int_0^\infty t^{s-1}e^{-t}\,dt,\qquad s>0.

Near zero, the power ts−1t^{s-1} is integrable precisely when s>0s>0; at infinity the exponential decay controls the power. Integration by parts gives

Γ(s+1)=sΓ(s),Γ(1)=1.\Gamma(s+1)=s\Gamma(s),\qquad \Gamma(1)=1.

Thus, for a positive integer nn,

Γ(n)=(n−1)!.\Gamma(n)=(n-1)!.
The shift matters: Γ(5)=4!=24\Gamma(5)=4!=24, not 5!5!. Non-integer inputs are legitimate too: Γ(1/2)=π\Gamma(1/2)=\sqrt{\pi}, so the recurrence gives Γ(3/2)=π/2\Gamma(3/2)=\sqrt{\pi}/2. NIST's DLMF records these special values.
The gamma function also has an extension by analytic continuation, with poles at 0,−1,−2,…0,-1,-2,\ldots. That broader function does not make the displayed integral converge for nonpositive real arguments. Positive real parameters are enough for the probability applications here.

For two positive real arguments, the beta function is

B(a,b)=∫01xa−1(1−x)b−1 dx,a>0, b>0.B(a,b)=\int_0^1 x^{a-1}(1-x)^{b-1}\,dx,\qquad a>0,\ b>0.

Each parameter controls integrability at one endpoint. The integrand can tend to infinity at an endpoint when its corresponding parameter is below one and still have finite area. Substituting 1−x1-x for xx shows the symmetry B(a,b)=B(b,a)B(a,b)=B(b,a).

Why they appear together

The key connection is the beta–gamma identity:
B(a,b)=Γ(a)Γ(b)Γ(a+b),a,b>0.B(a,b)=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)},\qquad a,b>0.

One way to see it is to multiply the two gamma integrals and change variables from two positive quantities u,vu,v to their total r=u+vr=u+v and share x=u/(u+v)x=u/(u+v). Then

u=rx,v=r(1−x),r>0,0<x<1.u=rx,\qquad v=r(1-x),\qquad r>0,\quad 0<x<1.

The absolute Jacobian determinant is rr. Including that area factor separates the double integral:

Γ(a)Γ(b)=∫0∞∫01e−rra+b−1xa−1(1−x)b−1 dx dr=Γ(a+b)B(a,b).\begin{aligned} \Gamma(a)\Gamma(b) &=\int_0^\infty\int_0^1 e^{-r}r^{a+b-1}x^{a-1}(1-x)^{b-1}\,dx\,dr\\ &=\Gamma(a+b)B(a,b). \end{aligned}
The nonnegative integrands and positive parameters justify separating these integrals. Forgetting the Jacobian would leave the wrong exponent of rr and the wrong normalising constant. The integral and identity are given together in DLMF §5.12.1.

Combining the identity with the gamma recurrence gives useful beta recurrences:

B(a+1,b)=aa+bB(a,b),B(a,b+1)=ba+bB(a,b).B(a+1,b)=\frac{a}{a+b}B(a,b),\qquad B(a,b+1)=\frac{b}{a+b}B(a,b).

These ratios are especially useful for moments: multiplying a beta-shaped integrand by xx simply increments its first parameter.

From a weight to a density

Suppose an illustrative model for a dimensionless fraction XX assigns relative weight

h(x)=x(1−x)2,0<x<1.h(x)=x(1-x)^2,\qquad 0<x<1.
It is nonnegative, but a probability density function must integrate to one. Matching the exponents to a−1a-1 and b−1b-1 identifies a=2a=2 and b=3b=3, so
∫01h(x) dx=B(2,3)=Γ(2)Γ(3)Γ(5)=1×224=112.\int_0^1 h(x)\,dx=B(2,3) =\frac{\Gamma(2)\Gamma(3)}{\Gamma(5)} =\frac{1\times2}{24}=\frac1{12}.

Dividing by that area gives

fX(x)=12x(1−x)2,0<x<1,f_X(x)=12x(1-x)^2,\qquad 0<x<1,
with density zero outside the interval. This is a beta distribution with parameters (2,3)(2,3). The beta function B(2,3)B(2,3) is a number; the beta distribution is the probability law that uses its reciprocal as a normalising multiplier.
Two analytic curves on zero to one: the kernel x(1−x)² has area 1/12; the density 12x(1−x)² has area 1 and mean 0.4. Their vertical axis scales differ by twelve.
Two analytic curves on zero to one: the kernel x(1−x)² has area 1/12; the density 12x(1−x)² has area 1 and mean 0.4. Their vertical axis scales differ by twelve.
Original analytic example. Normalisation changes vertical scale, not relative shape; each panel uses its own labelled vertical scale.
The expected value follows from a ratio rather than another polynomial expansion:
E[X]=∫01x2(1−x)2 dxB(2,3)=B(3,3)B(2,3)=22+3=0.4.\mathbb E[X]=\frac{\int_0^1 x^{2}(1-x)^2\,dx}{B(2,3)} =\frac{B(3,3)}{B(2,3)}=\frac{2}{2+3}=0.4.
More generally, this argument gives the beta mean a/(a+b)a/(a+b). A density height above one is allowed: probabilities are areas, not heights. The normalized curve above peaks at 16/9≈1.77816/9\approx1.778, while its total area is exactly one.

Where a quant encounters them

A bounded recovery fraction or an uncertain event probability can lead to a beta model. Choosing that model remains a modelling decision; computing B(a,b)B(a,b) only makes the chosen density integrate correctly. Bayesian Reasoning develops beta–binomial updating for a default probability. Its public page is a preview; the full lesson requires membership.
The gamma distribution uses the other integral. With shape k>0k>0 and rate λ>0\lambda>0, its density is
fY(y)=λkΓ(k)yk−1e−λy,y>0.f_Y(y)=\frac{\lambda^k}{\Gamma(k)}y^{k-1}e^{-\lambda y},\qquad y>0.
Substituting t=λyt=\lambda y shows that the unnormalised integral is Γ(k)/λk\Gamma(k)/\lambda^k. If YY is a waiting time, λ\lambda has inverse-time units; a scale parameter would instead be 1/λ1/\lambda. Mixing up rate and scale changes the distribution even if the gamma-function calculation is correct. The NIST gamma reference uses the scale convention.

In numerical work, the identity need not be evaluated as three enormous gamma values. For positive parameters,

log⁡B(a,b)=log⁡Γ(a)+log⁡Γ(b)−log⁡Γ(a+b).\log B(a,b)=\log\Gamma(a)+\log\Gamma(b)-\log\Gamma(a+b).
Use dedicated log-gamma or log-beta routines when forming log densities or likelihoods; direct products and ratios can overflow or underflow. SciPy's betaln documentation demonstrates why a finite log-beta value can remain available even after the beta value underflows. Evaluating the special function stably is separate from checking whether the statistical model fits the data.

Sources

Last updated
  • special functions
  • gamma function
  • beta function
  • distribution normalisation
  • integral calculus
← Back to the glossaryBack to top ↑