The following is an interview question from Jane Street.
A number from $0$ to $1$ is put on a piece of paper. You and person $X$ are playing a game. You must get less than the number on the paper, but above $X$’s guess. You know $X$ chooses to pick a number at random. What is lowest number you can choose to maximize your probability of winning?
An answer given at glassdoor seems to be $0.25.$ But the explanation there does not seem rigorous.
So you have two independent random variables : $X \sim U[0,1]$ is the guess of $X$, and $P$ is the paper value, also having the same distribution as you mentioned. $X$ is independent of $P$, because $X$ guesses without knowing $P$.
Now, you ask yourself : for which $a$ is $P(X \leq a \leq P)$ maximized? You would pick such an $a$, of course for yourself, so you would have the best probability of winning.
This consists of the two independent events $\{X \leq a\} \cap \{a \leq P\}$. By independence, the probability breaks into $P(X \leq a) \times P(a \leq P)$. The first is $a$ ,the second $1-a$, so the total probability is $a(1-a)$.
This is maximized at $a = 0.5$ (that can be easily seen by $a(1-a) = -(a-\frac 12)^2 + \frac 14$).
Thus, you will most likely choose $0.5$ , and then have a $25%$ chance of winning.
The intuitive reason why this is true, is that if you go too low, say $0.3$, then you risk $X$ getting above you, but if you go too high , say $0.7$, then you risk going above $P$. This balances out at $0.5$, and unfortunately your probability can never be too high because with probability half $X > P$ happens, so in that case you'd lose anyway because of something not in your hands.