Gamma extends factorials; beta evaluates unit-interval integrals. See their identity turn a weight into a density, with domains, recurrences and numerical cautions.
Gamma and beta functions
The gamma functionΓ extends factorials to non-integer arguments; the beta functionB 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 s, the gamma function is the improper integral
Γ(s)=∫0∞ts−1e−tdt,s>0.
Near zero, the power ts−1 is integrable precisely when s>0; at infinity the exponential decay controls the power. Integration by parts gives
Γ(s+1)=sΓ(s),Γ(1)=1.
Thus, for a positive integer n,
Γ(n)=(n−1)!.
The shift matters: Γ(5)=4!=24, not 5!. Non-integer inputs are legitimate too: Γ(1/2)=π, so the recurrence gives Γ(3/2)=π/2. NIST's DLMF records these special values.
The gamma function also has an extension by analytic continuation, with poles at 0,−1,−2,…. 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−1dx,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−x for x shows the symmetry 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.
One way to see it is to multiply the two gamma integrals and change variables from two positive quantities u,v to their total r=u+v and share x=u/(u+v). Then
u=rx,v=r(1−x),r>0,0<x<1.
The absolute Jacobian determinant is r. Including that area factor separates the double integral:
The nonnegative integrands and positive parameters justify separating these integrals. Forgetting the Jacobian would leave the wrong exponent of r 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)=a+baB(a,b),B(a,b+1)=a+bbB(a,b).
These ratios are especially useful for moments: multiplying a beta-shaped integrand by x simply increments its first parameter.
From a weight to a density
Suppose an illustrative model for a dimensionless fraction X assigns relative weight
h(x)=x(1−x)2,0<x<1.
It is nonnegative, but a probability density function must integrate to one. Matching the exponents to a−1 and b−1 identifies a=2 and b=3, so
∫01h(x)dx=B(2,3)=Γ(5)Γ(2)Γ(3)=241×2=121.
Dividing by that area gives
fX(x)=12x(1−x)2,0<x<1,
with density zero outside the interval. This is a beta distribution with parameters (2,3). The beta function 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.
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:
More generally, this argument gives the beta mean a/(a+b). A density height above one is allowed: probabilities are areas, not heights. The normalized curve above peaks at 16/9≈1.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) 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>0 and rateλ>0, its density is
fY(y)=Γ(k)λkyk−1e−λy,y>0.
Substituting t=λy shows that the unnormalised integral is Γ(k)/λk. If Y is a waiting time, λ has inverse-time units; a scale parameter would instead be 1/λ. 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,
logB(a,b)=logΓ(a)+logΓ(b)−logΓ(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.