probability/ uniform distribution I got an interesting question which I'm clueless about. 
so I thought maybe someone here could give me a direction. 
The questions is: 
A 1­ meter long stick is broken at a (uniformly) random point to two pieces. The largest piece is then broken randomly again to two pieces, and you keep the largest of the two.
what is the probability that this piece is longer than 1⁄2 meter ?
 A: Consider the following process:


*

*Draw uniformly at random $X$ in $[0,1]$, and set $A\stackrel{\rm def}{=} \max(X,1-X)$. This is the length of the largest piece in the first step.

*Draw uniformly at random $Y$ in $[0,A]$, and set $B\stackrel{\rm def}{=} \max(Y,1-Y)$. This is the length of the largest piece in the second step.

*You are interested in $\mathbb{P}\{ B > \frac{1}{2} \} = 1 - \mathbb{P}\{ B \leq \frac{1}{2} \}$.
We will rely on the following (easy to prove) fact:

Fact. If $U\sim\operatorname{Uniform}([0,a])$, then $\max(U,a-U)\sim\operatorname{Uniform}([\frac{a}{2},a])$.

From there, we get that $A\sim\operatorname{Uniform}([\frac{1}{2},1])$. Since, conditioned on $A$, $Y\sim\operatorname{Uniform}([0,A])$, we also get that $B\sim\operatorname{Uniform}([\frac{A}{2},A])$.
From there, we get that
$$\begin{align}
\mathbb{P}\left\{ B \leq \frac{1}{2} \right\}
&= \mathbb{E}[\mathbb{1}_{\{B \leq \frac{1}{2}\}}]
= \mathbb{E}[\mathbb{E}[\mathbb{1}_{\{B \leq \frac{1}{2}\}}\mid A]] 
= \mathbb{E}\left[\frac{\frac{1}{2}-\frac{A}{2}}{A-\frac{A}{2}}\right]\\
&= \mathbb{E}\left[\frac{1-A}{A}\right]
= \frac{1}{1-\frac{1}{2}}\int_{1/2}^1 \frac{1-a}{a} da
= 2\left(\int_{1/2}^1 \frac{da}{a}-\frac{1}{2}\right) \\
&= 2\ln 2-1
\end{align}$$
so that finally $$\mathbb{P}\left\{ B > \frac{1}{2} \right\} = 2-2\ln 2.$$
