Distribution of a discrete random variable We consider the following random variable $X$: We have a uniform distribution of the numbers of the unit interval $[0,1]$. After a number $x$ from $[0,1]$ is chosen, numbers from $[0,1]$ are chosen until a number $y$ with $x\leq y$ pops up.
The random variable $X$ counts the number of trials to obtain $y$. How to calculate $P(X=n)$, $n=1,2,\ldots$?
 A: The event $X=n$ occurs if and only if among the first $n$ draws of the uniform random variable, $U_1,U_2,\dots,U_n$, that $U_n$ is the largest and $U_1$ is the second largest. Assuming $n\ge 2$ (which is true if you want $P(X=n)>0$), then the probability of this is easily seen to be $$\frac{1}n\times \frac{1}{n-1}.$$
This is because the $n!$ possibile orderings of $U_1,U_2,\dots,U_n$ are equally likely, and in $\frac1n$ of these orderings $U_n$ is the largest, and in $\frac1{n-1}$ of the orderings where $U_n$ is the largest $U_1$ is the second largest.
A: The setting is naturally of independent draws of numbers.
Given $x\in[0,1]$, the probability that $y<x$ is just $x$, so the probability that $n-1$ numbers were chosen and all smaller than $x$ is $x^{n-1}$, and you want the next number to be at least $x$, so the probability for that is $(1-x)$. Thus:
$$P(X=n)=x^{n-1}(1-x),$$
if the initial $x$ is fixed, non-random, and
$$P(X=n)=\int_0^1x^{n-1}(1-x)\,dx=\frac{1}{n}-\frac{1}{n+1},$$
if the sample space of $X$ includes random choices of the initial $x$, and then the distribution of $X$ is of course independent of $x$.
As written, and in lack of any additional information, the original question may be interpreted in both ways.
A: Let $U$ denote the number chosen uniformly from $[0,1]$.
Then $P(X=n\mid U=u)=u^{n-1}(1-u)$ and $f_U(u)=1_{[0,1]}$ so that:$$P(X=n)=\int_0^1P(X=n\mid U=u)du=\left[\frac{u^{n}}{n}-\frac{u^{n+1}}{n+1}\right]_{0}^{1}=\frac{1}{n}-\frac{1}{n+1}$$
Here $X$ counts the number of trials needed to get a number that exceeds $U$ and the $U$ is not looked at as one of these trials.
