# Distribution of x1/(x1+x2) with x1 and x2 being 2 uniformly distributed random variables [closed]

Let $X_1$ and $X_2$ be two uniformly distributed random variables on [0,1]. What is the statistical distribution of the ratio $\frac{X_1}{X_1+X_2}$ ?

Same question with 3 variables $X_1$, $X_2$ and $X_3$: what is the statistical distribution of $\frac{X_1}{X_1+X_2+X_3}$ ?

## closed as off-topic by Francois Ziegler, Robert Israel, Anthony Quas, GH from MO, Emil JeřábekSep 13 at 16:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "MathOverflow is for mathematicians to ask each other questions about their research. See Math.StackExchange to ask general questions in mathematics." – Robert Israel, GH from MO, Emil Jeřábek
If this question can be reworded to fit the rules in the help center, please edit the question.

This is mechanized in Mathematica:

CDF[TransformedDistribution[x1/(x1 + x2 + x3),{x1\[Distributed]UniformDistribution[{0, 1}],
x2\[Distributed]UniformDistribution[{0, 1}],x3\[Distributed] UniformDistribution[{0, 1}]}],t]


$$\begin{array}{cc} \{ & \begin{array}{cc} 1 & t>1 \\ -\frac{t}{t-1} & 0<t\leq \frac{1}{3} \\ \frac{5 t^2+2 t-1}{6 t^2} & \frac{1}{2}<t\leq 1 \\ \frac{21 t^3-27 t^2+9 t-1}{6 (t-1) t^2} & \frac{1}{3}<t\leq \frac{1}{2} \\ \end{array} \\ \end{array}$$

In the case $n=4$ Mathematica produces

$$\begin{array}{cc} \{ & \begin{array}{cc} 1 & t\geq 1 \\ -\frac{3 t}{2 (t-1)} & 0<t\leq \frac{1}{4} \\ \frac{25 t^3-3 t^2+3 t-1}{24 t^3} & \frac{1}{2}\leq t<1 \\ \frac{-23 t^4+68 t^3-66 t^2+20 t-2}{24 (t-1) t^3} & \frac{1}{3}\leq t<\frac{1}{2} \\ \frac{220 t^4-256 t^3+96 t^2-16 t+1}{24 (t-1) t^3} & \frac{1}{4}<t<\frac{1}{3} \\ \end{array} \\ \end{array}$$

• Great! What about for n=2? – Jerome Caron Sep 13 at 16:52
• OK, I used Mathematica Online and recovered the expressions. For the case n=2 see my reply above. – Jerome Caron Sep 14 at 8:39

For $1/2\leq a<b\leq 1$, the probability that $a<\frac{X_1}{X_1+X_2}<b$ is equal to the area inside the unit square where $a<\frac{x}{x+y}<b$. This can be rewritten as $\frac{1}{b}-1<\frac{y}{x}<\frac{1}{a}-1$. In particular we can see that the region is a triangle with height 1 and base length $\frac{1}{a}-\frac{1}{b}$. For $b\rightarrow a$ we get that the area is close to $(b-a)\frac{1}{a^2}$. Hence the probability density between $1/2$ and $1$ is proportional to $\frac{1}{a^2}$. By symmetry the probability density between $0$ and $1/2$ is proportional to $\frac{1}{(1-a)^2}$.

Matlab code: A=rand(1,1e6); B=rand(1,1e6); histogram(A./(A+B))

• Nice! I checked with Mathematica Online (they have a 15 days free trial..) and recovered the same expressions, apart from a factor 0.5. The distributions are $\frac{1}{2a^2}$ and $\frac{1}{2(1-a)^2}$. The factor 0.5 comes in when computing the triangle area. – Jerome Caron Sep 14 at 8:37

Consider the general case $Z=\frac{X_1}{X_1+\sum_{p=2}^mX_p}$, with $X_1,X_2,\ldots X_m$ independent and uniform in $(0,1)$, and ask for the probability $P(Z<a)$ with $0<a<1$. Rewrite this probability (using the fact that $X_p$ and $1-X_p$ have identical distributions): $$P\left[\frac{X_1}{X_1+\sum_{p=2}^m X_p}<a\right]=P\left[\frac{X_1}{X_1+\sum_{p=2}^m (1-X_p)}<a\right]=P\left[(1-a)X_1+\sum_{p=2}^m X_p<(m-1)a\right]$$ This latter distribution follows from theorem 1 of Ratios of Normal Variables and Ratios of Sums of Uniform Variables (page 200).