Dirichlet Distribution Calculator
What this calculator measures
The Dirichlet distribution is the standard probability model for a three-part composition. If you need to describe quantities like market-share splits, vote shares across three options, topic proportions in a document, portfolio weights, mixture fractions in chemistry, or any other triple of positive numbers that must add to 1, this is the right family of distributions. Instead of treating the three parts independently, the Dirichlet distribution respects the fact that increasing one component automatically leaves less room for the other two. Geometrically, every valid point lies inside a triangle called the simplex.
This calculator evaluates the probability density function, or PDF, of a three-variable Dirichlet distribution at a specific point x = (x1, x2, x3). It also reports the mean composition and, when all three concentration parameters exceed 1, the interior mode. That combination is useful because the PDF tells you how strongly the distribution supports one exact composition relative to nearby compositions, while the mean and mode help you summarize the overall shape. The page is built for learning as well as calculation, so the sections below explain the inputs, the constraints, and the common interpretation mistakes that trip people up.
A key idea to keep in mind from the start is that the PDF is not the same thing as a probability of a single exact point. For continuous distributions, exact-point probabilities are zero. The density instead measures how concentrated the distribution is around that point. High density means nearby mixtures are relatively plausible under the chosen parameters. Low density means the point sits in a region the model does not favor.
How to read the inputs
The first three inputs, α1, α2, and α3, are the Dirichlet concentration parameters. They must each be strictly positive. Their relative sizes determine the average composition. If α1 is large compared with α2 and α3, then the distribution tends to place more mass on points where x1 is larger. If all three α values are equal, the distribution is symmetric: it does not prefer one component over another, although it may still prefer the middle of the simplex or the corners depending on how large or small the shared value is.
The sum α0 = α1 + α2 + α3 controls concentration. Large totals make the distribution tightly clustered around its mean. Small totals make it diffuse. In particular, when the α values are below 1, the distribution tends to pile up near edges or corners, meaning extreme compositions become more likely. When the α values are all above 1, the mass is pulled inward and an interior mode exists. This is why the calculator only displays a mode in that case: otherwise, the peak is on the boundary rather than at a point strictly inside the triangle.
The next three inputs, x1, x2, and x3, are the composition point where you want to evaluate the density. These are unitless proportions, not counts. They must be positive and must sum to exactly 1. Enter 0.2 for 20%, 0.35 for 35%, and so on. If your source data are percentages, divide by 100 before entering them. If your source data are counts, first convert them to shares of the total. For example, counts of 20, 30, and 50 become proportions 0.2, 0.3, and 0.5.
The current calculator intentionally works only with interior points where all three x values are strictly greater than 0. Some Dirichlet models can be interpreted at the boundary by limits, but the formula becomes more delicate there, especially when α values are below 1 and the density can blow up near edges. Requiring positive interior values keeps the evaluation consistent with the calculator's implementation and avoids ambiguous edge handling.
The formula behind the result
For three variables, the Dirichlet PDF is
where α0 = α1 + α2 + α3. The gamma function Γ generalizes the factorial, so the formula works for non-integer α values as well as whole numbers. The calculator uses the same structure shown above: it computes the normalization constant from the gamma terms, multiplies by the three power terms, and then displays the resulting density.
The mean of each component is especially simple:
So the mean composition is just the α vector divided by its total. That makes the α values easy to interpret: double every α and the mean stays the same, but the distribution becomes more concentrated around that mean. When all α values are greater than 1, the interior mode is
At a more abstract level, the page still follows the same pattern as many scientific calculators: take inputs, apply a function, and summarize the output. The generic view below is preserved because it is a useful mental model for how any calculator turns parameters into a result.
For the Dirichlet distribution, the specific function is the PDF above, and the weights are replaced by gamma-based normalization and exponent terms. The output is therefore sensitive not just to the size of the x values, but to whether they align with the shape implied by the α parameters.
Worked example
Suppose you want to evaluate the density at the composition (x1, x2, x3) = (0.2, 0.3, 0.5) with α = (2, 3, 5). This is a clean example because the mean of the distribution matches the point you are evaluating, so it also illustrates the difference between the mean and the mode. First compute the total concentration:
α0 = 2 + 3 + 5 = 10
Next compute the gamma-based coefficient. Since Γ(2) = 1, Γ(3) = 2, Γ(5) = 24, and Γ(10) = 362880, the coefficient becomes
Γ(10) / [Γ(2)Γ(3)Γ(5)] = 362880 / 48 = 7560
Now apply the three power terms:
0.21 × 0.32 × 0.54 = 0.2 × 0.09 × 0.0625 = 0.001125
Multiplying everything together gives the density:
PDF = 7560 × 0.001125 = 8.505
The mean is simply α divided by α0, so the calculator reports
mean = (0.2000, 0.3000, 0.5000)
Because every α value is greater than 1, the interior mode also exists. Using the mode formula, you get
mode = ((2 - 1) / 7, (3 - 1) / 7, (5 - 1) / 7) = (0.1429, 0.2857, 0.5714)
This example shows an important point: the mean and mode do not have to be the same. The mean is the expected composition. The mode is the most dense interior point when that point exists. With asymmetric α values, the mode is pulled toward the larger component more strongly than the mean.
How to interpret the result panel
After you click Evaluate, the result panel shows the PDF first, followed by the mean, and sometimes the mode. Start by checking the constraint before thinking about the answer: the calculator only accepts positive α values and positive x values that sum to 1. If your proportions do not add exactly to 1 because of rounding, fix that upstream or adjust one entry so the total is exact. Otherwise the Dirichlet formula is being applied to an invalid point.
Next, interpret the PDF carefully. A larger PDF means the chosen point sits in a region the distribution favors more strongly. It does not mean there is more than 100% probability at that point, and it is normal for a density to exceed 1. Compare density values only as a way to judge relative support across nearby points or across different parameter choices. If the density changes sharply when you move slightly inside the simplex, that indicates a concentrated distribution. If the density changes gently, the distribution is more diffuse.
The mean is usually the easiest summary for communication. If you are using a Dirichlet prior or posterior in Bayesian work, the mean tells you the expected share of each category. The mode, when present, tells you where the interior peak lies. If the mode is omitted, that is not a software error. It means at least one α value is not above 1, so the highest density occurs on the boundary rather than at a clean interior point.
Common parameter patterns
These examples give a quick feel for how changing α changes the distribution even before you calculate a PDF at one specific point.
| Parameters α | Mean | Interior mode? | What the shape looks like |
|---|---|---|---|
| (1, 1, 1) | (0.3333, 0.3333, 0.3333) | No unique interior mode | Uniform over the simplex; no composition is preferred over another. |
| (4, 4, 4) | (0.3333, 0.3333, 0.3333) | Yes, at the center | Symmetric and strongly concentrated around balanced mixtures. |
| (0.5, 0.5, 0.5) | (0.3333, 0.3333, 0.3333) | No | Mass is pushed toward corners and edges, so extreme compositions dominate. |
| (6, 2, 2) | (0.6000, 0.2000, 0.2000) | Yes, at (0.7143, 0.1429, 0.1429) | Biased toward large x1, with moderate concentration away from the edges. |
If you are fitting a Bayesian model, these patterns are often read as pseudo-count intuition. A symmetric α = (1, 1, 1) acts like a flat prior over compositions. Larger equal values like (10, 10, 10) express confidence that the shares are probably close to one another. Unequal values like (8, 2, 1) encode a prior belief that the first component should usually dominate.
Assumptions and practical limits
This page is a focused calculator, not a full symbolic statistics package. It assumes a three-variable Dirichlet distribution, strictly positive inputs, and an interior evaluation point. It does not attempt to integrate probabilities over custom regions of the simplex, fit α from data, or handle higher-dimensional Dirichlet models. Those are natural extensions, but they require different interfaces and more advanced numerical routines.
There are also numerical realities worth remembering. Very large α values or points extremely close to the boundary can create densities that vary over many orders of magnitude. The calculator still follows the correct formula, but displayed rounding may hide very fine distinctions. If you are performing research-grade work, treat the result here as a quick check and then confirm in a statistical environment where you can control precision, log densities, and boundary conventions explicitly.
For most practical uses, though, the output is exactly what you need: a fast way to test whether a proposed composition is favored by a chosen Dirichlet model, together with the mean and interior mode so you can connect the numeric result to the shape of the distribution. That is especially valuable when you are teaching the concept, sanity-checking Bayesian priors, or comparing several plausible α settings before moving to more detailed analysis.
Play the optional Simplex Sampler mini-game
This mini-game is separate from the calculator result, but it is built from the same idea: a Dirichlet distribution lives on a simplex, which is the triangle of all valid three-part compositions. In the game, glowing targets represent compositions such as (0.18, 0.31, 0.51). Your job is to move a sampler inside the triangle and hold it on each target long enough to lock in the sample. Targets appear near the center, the corners, or one dominant side depending on the current phase, so the run teaches you what different α patterns feel like rather than only telling you in words.
If you have already entered α values in the calculator, the opening phase borrows that shape so the first few targets reflect your current setup. After that, the game deliberately shifts through center-heavy, corner-heavy, and one-component-dominant phases. You will see very quickly that the geometry of the distribution matters: center-seeking phases reward smooth movement in the middle, while low-α phases send you chasing extreme points near vertices.
Game insight: targets near a corner correspond to mixtures where one component dominates. Tight clusters near the center reflect larger total concentration.
