# How do I compute this probability distribution?

Choose a random number uniformly over the unit interval $x_1 \in [0,1]$. Now chose a second number that is dependent on the first, such that it is chosen uniformly over the interval $x_2 \in [0, x_1]$. What is the probability distribution $x_2$? Is it a distribution that is already well-known?

Here's what I got so far - I examined small discrete cases, say with the integers $\{1,2,3\}$. In this case the probabilities work out to:

\begin{array}{rcl} P(1,3) &=& (1/3)(1/1 + 1/2 + 1/3) \cr P(2,3) &=& (1/3)(1/2 + 1/3) \cr P(3,3) &=& (1/3)(1/3) \end{array}

This generalizes to something like $$P(n,k) = \frac{1}{k} \sum_{q=n}^k \frac{1}{q}$$ which can be reduced to the Digamma function $$= \frac{\Psi(k+1) - \Psi(n)}{k}$$

because of this, I would not be surprised if the answer was some combination of gamma functions. I'm stuck here, since I'm not quite sure how if taking the limit of large $k$ will (upon normalization) give the answer I'm looking for.

-

$x_2$ is equal in distribution to $U_1 U_2$ where $U_1$ and $U_2$ are independent uniform$(0,1)$ random variables. It is very easy to find the distribution of $U_1 U_2$...

EDIT: Continuing this iteratively, so that $x_{n+1}$ is uniform on $(0,x_n)$, the infinite sum $x:=x_1+x_2+x_3+\cdots$ (which is finite with probability $1$, by the monotone convergence theorem) is equal in distribution to $U_1 + U_1 U_2 + U_1 U_2 U_3 + \cdots$, where the $U_i$ are independent uniform$(0,1)$ rv's. The distribution of $x$ is the Dickamn distribution.

EDIT: Here are three ways to compute the distribution function of $x_2$ (the first one is the direct approach). It is given, for $0 < x \leq 1$, by $F(x)=x - x \log x$; hence $x_2$ has probability density function $f(x)=-\log(x)$, $0 < x < 1$ (as leonbloy already found).

Approach 1): Since conditioned on $x_1 = s$, $0 < s < 1$, $x_2$ is uniformly distributed on $(0,s)$, the law of total probability gives, for $0 < x \leq 1$, $${\rm P}(x_2 \le x) = \int_0^1 {{\rm P}(x_2 \le x|x_1 = s)ds} = \int_0^x {{\rm P}(x_2 \le x|x_1 = s)ds} + \int_x^1 {{\rm P}(x_2 \le x|x_1 = s)ds}$$ $$= \int_0^x {1ds} + \int_x^1 {\frac{x}{s}ds} = x - x\log x.$$

Approach 2): $x_2$ is distributed as $U_1 U_2$, where $U_1$ and $U_2$ are independent uniform$(0,1)$ rv's. Hence, $${\rm P}(x_2 \le x) = {\rm P}(U_1 U_2 \le x) = \int_0^1 {{\rm P}(U_1 U_2 \le x|U_1 = s)ds} = \int_0^1 {P\bigg(U_2 \le \frac{x}{s}\bigg)ds}$$ $$= \int_0^x {P\bigg(U_2 \le \frac{x}{s}\bigg)ds} + \int_x^1 {P\bigg(U_2 \le \frac{x}{s}\bigg)ds} = \int_0^x {1ds} + \int_x^1 {\frac{x}{s}ds} = x - x \log x.$$ (So, approaches 1) and 2) are quite similar: both rely on the law of total probability.)

Approach 3): Let $U_i$, $i=1,2$, be as above, and note that $-\log U_i$ is exponential$(1)$. Then, for any $0 < x \leq 1$, $${\rm P}(x_2 \le x) = {\rm P}(U_1 U_2 \le x) = {\rm P}(\log U_1 + \log U_2 \le \log x) = {\rm P}( - \log x \le \xi_1 + \xi_2 ),$$ where $\xi_1$ and $\xi_2$ are independent exponential$(1)$ rv's. The random variable $\xi_1+\xi_2$ has gamma density function $ye^{-y}$, $y > 0$. Hence, $${\rm P}(x_2 \le x) = \int_{ - \log x}^\infty {ye^{ - y} dy} = -e^{-y}(y+1) \big|_{ - \log x}^\infty = x - x \log x.$$ This approach can be useful for determining the distribution of $U_1 \cdots U_n$, where $U_i$ are independent uniform$(0,1)$ rv's.

-

It can be interesting to attack from problem from a discrete analog; but it's not a very simple way here. What your problem statement gives you directly is the conditional probability $P(x_2 | x_1)$ and the marginal $P(x_1)$. Then...

$$P(x_2) = \int P(x_2,x_1) dx_1 = \int P(x_2 | x_1) P(x_1) dx_1$$

You have $P(x_1)=1$ in $[0,1]$ and $P(x_2 | x_1) = 1/x_1$ with $0 \le x_2 \le x_1 \le 1$, so you get $P(x_2) = - \log(x_2)$

-