Nov 1, 2026 · science · 3min read

Understanding the Dirichlet Distribution

What Is the Dirichlet Distribution?

A sample from a Dirichlet distribution is a probability vector: its components are nonnegative and sum to one.

The vector lies in the standard simplex,

ΔK−1={x∈[0,1]K:∑i=1Kxi=1}.\Delta^{K-1}=\left\{\boldsymbol{x}\in[0,1]^K:\sum_{i=1}^K x_i=1\right\}.

Each such vector can serve as the probability parameters of a categorical or multinomial distribution. In this sense, the Dirichlet is a distribution over probability distributions on a fixed set of outcomes.

For K≥2K\geq 2 and parameters αi>0\alpha_i>0, its probability density function (PDF), evaluated in the interior of the simplex, is

f(x;α)=1B(α)∏i=1Kxiαi−1,xi>0,∑i=1Kxi=1.f(\boldsymbol{x};\boldsymbol{\alpha}) =\frac{1}{\mathrm{B}(\boldsymbol{\alpha})} \prod_{i=1}^{K}x_i^{\alpha_i-1}, \qquad x_i>0,\quad \sum_{i=1}^{K}x_i=1.

The B Function

The multivariate beta function is the integral of the unnormalized density:

B(α)=∫ΔK−1∏j=1Kxjαj−1 dx=∏j=1KΓ(αj)Γ(α0),α0=∑j=1Kαj.\mathrm{B}(\boldsymbol{\alpha}) =\int_{\Delta^{K-1}}\prod_{j=1}^{K}x_j^{\alpha_j-1}\,\mathrm{d}\boldsymbol{x} =\frac{\prod_{j=1}^{K}\Gamma(\alpha_j)}{\Gamma(\alpha_0)}, \qquad \alpha_0=\sum_{j=1}^{K}\alpha_j.

Here the integral uses the K−1K-1 free coordinates: dx=dx1⋯dxK−1\mathrm{d}\boldsymbol{x}=\mathrm{d}x_1\cdots\mathrm{d}x_{K-1}, with xK=1−∑j=1K−1xjx_K=1-\sum_{j=1}^{K-1}x_j. Dividing by B(α)\mathrm{B}(\boldsymbol{\alpha}) therefore makes the PDF integrate to one.

The gamma function Γ\Gamma is defined, for t>0t>0, by

Γ(t)=∫0∞ut−1e−u du.\Gamma(t)=\int_0^\infty u^{t-1}e^{-u}\,\mathrm{d}u.

We will use its recurrence Γ(t+1)=tΓ(t)\Gamma(t+1)=t\Gamma(t) to simplify the moments below.

Key Properties

For a given α\boldsymbol{\alpha}, B(α)\mathrm{B}(\boldsymbol{\alpha}) is a constant that makes the density integrate to one. Its shape is therefore determined by

f(x;α)∝∏i=1Kxiαi−1.f(\boldsymbol{x};\boldsymbol{\alpha})\propto \prod_{i=1}^{K}x_i^{\alpha_i-1}.

When α=(1,…,1)\boldsymbol{\alpha}=(1,\ldots,1), the product is constant, so the distribution is uniform over the simplex. A constant density need not equal one: it is 11 for K=2K=2 and 22 for K=3K=3.

Two Components

For K=2K=2, x2=1−x1x_2=1-x_1, so a line segment describes all possible vectors. The density of x1x_1 is the Beta distribution. Adjust α1\alpha_1 and α2\alpha_2 below, or choose Uniform to see the constant density.

Three Components

For K=3K=3, the simplex is a triangle. Each point represents a vector (x1,x2,x3)(x_1,x_2,x_3); the color or height shows its density. Try Uniform, then change the parameters to see how the shape changes. Density is not point probability and can exceed one.

Mean and Variance

Let X∼Dirichlet⁡(α)\boldsymbol{X}\sim\operatorname{Dirichlet}(\boldsymbol{\alpha}), with total concentration

α0=∑j=1Kαj.\alpha_0=\sum_{j=1}^{K}\alpha_j.

For each component, the mean and variance are

E[Xi]=αiα0,Var⁡(Xi)=αi(α0−αi)α02(α0+1).\begin{aligned} \mathbb{E}[X_i]&=\frac{\alpha_i}{\alpha_0},\\ \operatorname{Var}(X_i)&= \frac{\alpha_i(\alpha_0-\alpha_i)}{\alpha_0^2(\alpha_0+1)}. \end{aligned}

The proofs use parameter shifts in the B function.

Deriving the Mean

Let ei\boldsymbol{e}_i be the vector whose iith component is one and whose other components are zero. Multiplying by xix_i raises its exponent from αi−1\alpha_i-1 to αi\alpha_i, which replaces α\boldsymbol{\alpha} with α+ei\boldsymbol{\alpha}+\boldsymbol{e}_i:

E[Xi]=1B(α)∫ΔK−1xi∏j=1Kxjαj−1 dx=B(α+ei)B(α)=Γ(αi+1)Γ(αi)Γ(α0)Γ(α0+1)=αiα0.\begin{aligned} \mathbb{E}[X_i] &=\frac{1}{\mathrm{B}(\boldsymbol{\alpha})} \int_{\Delta^{K-1}}x_i\prod_{j=1}^{K}x_j^{\alpha_j-1}\,\mathrm{d}\boldsymbol{x}\\ &=\frac{\mathrm{B}(\boldsymbol{\alpha}+\boldsymbol{e}_i)}{\mathrm{B}(\boldsymbol{\alpha})}\\ &=\frac{\Gamma(\alpha_i+1)}{\Gamma(\alpha_i)} \frac{\Gamma(\alpha_0)}{\Gamma(\alpha_0+1)}\\ &=\frac{\alpha_i}{\alpha_0}. \end{aligned}

All other gamma factors cancel; the last step uses Γ(t+1)=tΓ(t)\Gamma(t+1)=t\Gamma(t).

Deriving the Variance

First compute the second moment. Multiplying by xi2x_i^2 similarly increases αi\alpha_i by two:

E[Xi2]=B(α+2ei)B(α)=Γ(αi+2)Γ(αi)Γ(α0)Γ(α0+2)=αi(αi+1)α0(α0+1).\begin{aligned} \mathbb{E}[X_i^2] &=\frac{\mathrm{B}(\boldsymbol{\alpha}+2\boldsymbol{e}_i)}{\mathrm{B}(\boldsymbol{\alpha})}\\ &=\frac{\Gamma(\alpha_i+2)}{\Gamma(\alpha_i)} \frac{\Gamma(\alpha_0)}{\Gamma(\alpha_0+2)}\\ &=\frac{\alpha_i(\alpha_i+1)}{\alpha_0(\alpha_0+1)}. \end{aligned}

Now subtract the square of the mean:

Var⁡(Xi)=E[Xi2]−(E[Xi])2=αi(αi+1)α0(α0+1)−αi2α02=αi(α0−αi)α02(α0+1).\begin{aligned} \operatorname{Var}(X_i) &=\mathbb{E}[X_i^2]-\bigl(\mathbb{E}[X_i]\bigr)^2\\ &=\frac{\alpha_i(\alpha_i+1)}{\alpha_0(\alpha_0+1)} -\frac{\alpha_i^2}{\alpha_0^2}\\ &=\frac{\alpha_i(\alpha_0-\alpha_i)}{\alpha_0^2(\alpha_0+1)}. \end{aligned}

Interpreting the Parameters

The relative sizes of the parameters determine the mean probability vector. If their proportions stay fixed, increasing their sum α0\alpha_0 reduces the variance and concentrates the distribution around that mean.

References: SciPy: Dirichlet distribution · Probability Distribution Explorer: moments.

Comments

Sign in — Sign in to join the conversation.

  1. …