is if one wanted to cut strings (each of initial length 1.0) into K pieces with different lengths, where each piece had a designated average length, but allowing some variation in the relative sizes of the pieces. Recall that The values specify the mean lengths of the cut pieces of string resulting from the distribution. The variance around this mean varies inversely with . Pólya's urn Consider an urn containing balls of K different colors. Initially, the urn contains α1 balls of color 1, α2 balls of color 2, and so on. Now perform N draws from the urn, where after each draw, the ball is placed back into the urn with an additional ball of the same color. In the limit as N approaches infinity, the proportions of different colored balls in the urn will be distributed as Dir(α1,...,αK). For a formal proof, note that the proportions of the different colored balls form a bounded [0,1]K-valued martingale, hence by the martingale convergence theorem, these proportions converge almost surely and in mean to a limiting random vector. To see that this limiting vector has the above Dirichlet distribution, check that all mixed moments agree. Each draw from the urn modifies the probability of drawing a ball of any one color from the urn in the future. This modification diminishes with the number of draws, since the relative effect of adding a new ball to the urn diminishes as the urn accumulates increasing numbers of balls. Random variate generation From gamma distribution With a source of Gamma-distributed random variates, one can easily sample a random vector from the K-dimensional Dirichlet distribution with parameters . First, draw K independent random samples from Gamma distributions each with density and then set The joint distribution of is given by: Next, one uses a change of variables, parametrising in terms of and , and performs a change of variables from such that One must then use the change of variables formula, in which is the transformation Jacobian. Writing y explicitly as a function of x, one obtains The Jacobian now looks like The determinant can be evaluated by noting that it remains unchanged if multiples of a row are added to another row, and adding each of the first K-1 rows to the bottom row to obtain which can be expanded about the bottom row to obtain Substituting for x in the joint pdf and