Suppose that a random vector $X=(X_1,X_2,X_3)$ follows a Dirichlet distribution with a shape parameter $(a_1,a_2,a_3).$

What I want to calculate is the probability of $X_1>X_2$ and I want to check whether I'm on the right track.

What I have done so far is:

Step 1) Find out the joint distribution of $(X_1,X_2)$. Because $x_i$'s should sum up to 1, This is simply given by $$(X_1,X_2)\sim Dir(a_1,a_2,a_3).$$ Say that the distribution is $$Kx_1^{a_1-1}x_2^{a_2-1}(1-x_1-x_2)^{a_3-1},$$ where $K$ is the constant part.

Step 2) Find the probability: $$P[X_1>X_2]=\int^\frac{1}{2}_0\int^{x_1}_0f_{X_1X_2}(x_1,x_2)dx_2dx_1+\int^1_\frac{1}{2}\int^{1-x_1}_0f_{X_1X_2}(x_1,x_2)dx_2dx_1$$ Here, using the integration by parts, the first term of the LHS is $$Kx_1\int^{x_1}_0x_1^{a_1-1}x_2^{a_2-1}(1-x_1-x_2)^{a_3-1}dx_2\bigg|^{x_1=\frac{1}{2}}_0-K\int^\frac{1}{2}_0x_1x_1^{a_1+a_2-2}(1-2x_1)^{a_3-1}dx_1\\=K\bigg(\frac{1}{2}\bigg)^{a_1}\int^\frac{1}{2}_0x_2^{a_2-1}(\frac{1}{2}-x_2)^{a_3-1}dx_2-K2^{a_3-1}\int^\frac{1}{2}_0x_1^{a_1+a_2-1}(\frac{1}{2}-x_1)^{a_3-1}dx_1.$$ Letting $\frac{1}{2}y=x_2$ and $\frac{1}{2}z=x_1$, the above expression is the same as $$K\bigg(\frac{1}{2}\bigg)^{a_1+a_2+a_3-1}\int^1_0y^{a_2-1}(1-y)^{a_3-1}dy-K\bigg(\frac{1}{2}\bigg)^{a_1+a_2}\int^1_0z^{a_1+a_2-1}(1-z)^{a_3-1}dz.$$ So, the value is $$K\bigg(\frac{1}{2}\bigg)^{a_1+a_2+a_3-1}B(a_2,a_3)-K\bigg(\frac{1}{2}\bigg)^{a_1+a_2}B(a_1+a_2,a_3).$$ Similarly, using the integration by parts, the second term of the LHS is $$Kx_1\int^{1-x_1}_0x_1^{a_1-1}x_2^{a_2-1}(1-x_1-x_2)^{a_3-1}dx_2\bigg|^{x_1=1}_\frac{1}{2}-0\\=K\bigg(\frac{1}{2}\bigg)^{a_1+a_2+a_3-1}B(a_2,a_3).$$ so that we can conclude $$P[X_1>X_2]=K\bigg(\frac{1}{2}\bigg)^{a_1+a_2+a_3}B(a_2,a_3)-K\bigg(\frac{1}{2}\bigg)^{a_1+a_2}B(a_1+a_2,a_3).$$ I'm not really good at finding probability. Is this approach correct? or is there any other approach which is correct and easier than this to find out $P[X_1>X_2]?$

  • 1
    $\begingroup$ The form of the answer suggests it cannot be right. Because swapping $a_1$ and $a_2$ should change the answer (call it $p$) to $1-p,$ you will have obtained a general relation for the Beta function whose coefficients are powers of $1/2:$ that's not plausible. Glancing up through the work, it looks like your integrations by parts are incorrect (even accounting for the typographical errors). To get a feel for correct calculation, consider the simpler problem with just two variables: it amounts to evaluating the CDF of a Beta distribution at $1/2.$ $\endgroup$
    – whuber
    Aug 30, 2019 at 12:38

2 Answers 2


The answer:

\begin{equation} P_{X_1 > X_2} = \frac{B(\frac{1}{2};a_2,a_1)}{B(a_1,a_2)}, \end{equation}

where $B(\alpha,\beta) = \int_0^1 t^{\alpha-1}(1-t)^{\beta-1}dt$ is the Beta function and $B(x; \alpha,\beta) = \int_0^x t^{\alpha-1}(1-t)^{\beta-1}dt$ is the incomplete Beta function.


As $x_1+x_2+x_3 = 1$, conditional on a realisation $X_3=x_3$, condition $X_1 > X_2$ becomes $X_2 < \frac{1 - x_3}{2}$. The probability then is computed according to the equation

\begin{align} P_{X_1 > X_2} = &\int_0^1 \int_0^{\frac{1-x_3}{2}} K x_3^{a_3-1}x_2^{a_2-1} (1-x_2-x_3)^{a_1-1} dx_2 dx_3=\\ = &K \int_0^1 x_3^{a_3-1}\int_0^{\frac{1-x_3}{2}} x_2^{a_2-1} (1-x_2-x_3)^{a_1-1} dx_2 dx_3, \end{align}

where $K:= \frac{1}{B(a_1,a_2,a_3)}$, and $B(a_1,a_2,a_3)$ is the multivariate Beta function.

The inner integral is computed by the change of variables:

\begin{align} & \int_0^{\frac{1-x_3}{2}} x_2^{a_2-1}(1-x_3-x_2)^{a_1-1}dx_2 = \\ =& \int_0^{\frac{1-x_3}{2}} (1-x_3)^{a_1+a_2-1} (\frac{x_2}{1-x_3})^{a_2-1}(1 - \frac{x_2}{1-x_3})^{a_1-1}d\frac{x_2}{1-x_3} =\\ =& (1-x_3)^{a_1+a_2-1} \int_0^{\frac{1}{2}} t^{a_2-1}(1-t)^{a_1-1} dt =\\ =& (1-x_3)^{a_1+a_2-1} \cdot B(\frac{1}{2}; a_2, a_1). \end{align}

The outer integral computation is straightforward:

\begin{align} P_{X_1 > X_2} = &K \int_0^1 x_3^{a_3-1} (1-x_3)^{a_1+a_2-1} B(\frac{1}{2}; a_2, a_1) dx_3 = \\ = &\frac{B(\frac{1}{2}; a_2, a_1) B(a_3, a_1+a_2)}{B(a_1,a_2,a_3)} \end{align}

Using the property relating Beta and Gamma functions,

\begin{equation} B(a_1,...,a_n) = \frac{\prod_{i=1}^n \Gamma (a_i)}{\Gamma(\sum_{i=1}^n a_i)}, \end{equation}

we can further simplify the final answer as

\begin{align} P_{X_1>X_2} = &B(\frac{1}{2}; a_2, a_1) \frac{\Gamma(a_3)\Gamma(a_1+a_2) \Gamma(a_1+a_2+a_3)}{\Gamma(a_1+a_2+a_3)\Gamma(a_1)\Gamma(a_2)\Gamma(a_3)} = \\ =& \frac{B(\frac{1}{2};a_2,a_1)}{B(a_1,a_2)}. \end{align}

  • 1
    $\begingroup$ It would be a good idea to verify your result somehow. I am suspicious because when I contemplate letting $a_1$ grow small, it looks like your formula grows without bound and therefore cannot be a valid probability. $\endgroup$
    – whuber
    Oct 31, 2019 at 15:17
  • $\begingroup$ I found an error in my reasoning, indeed $a_1$ must not appear in the denominator. Hope you like the updated version ! $\endgroup$
    – Konstantin
    Oct 31, 2019 at 17:03
  • 1
    $\begingroup$ The reasoning in Hunaphu's reply demonstrates the answer cannot depend on $a_3.$ $\endgroup$
    – whuber
    Oct 31, 2019 at 19:04
  • $\begingroup$ It does not, indeed. $\endgroup$
    – Konstantin
    Oct 31, 2019 at 19:56
  • 2
    $\begingroup$ +1 Now it looks right! Thanks for your persistence. $\endgroup$
    – whuber
    Oct 31, 2019 at 20:16

For a two dimensional dirichlet we have $P(X_1 \leq X_2) = P(X_1 \leq 1 - X_1) = P(X_1 \leq \tfrac{1}{2})$. Thus, $$ P(X_1 \leq \tfrac{1}{2}) =\tfrac{1}{B(a_1, a_2)} \int_0^{1/2} x^{a_1 - 1}(1-x)^{a_2-1}\,dx = \tfrac{B_{1/2}(a_1, a_2)}{B(a_1, a_2)}. $$ So $P(X_1 > X_2) = 1-\tfrac{B_{1/2}(a_1, a_2)}{B(a_1, a_2)} = \tfrac{B_{1/2}(a_2, a_1)}{B(a_1, a_2)}$.

If $(Y_i)_i$ are independent Gamma and their sum is $V$ then $(Y_i)_i/V$ is Dirichlet. Therefore $P(X_1 \leq X_2) = P(Y_1 \leq Y_2)$ and, since this does not depend on $V$, any variable beyond the second is irrelevant.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.