[Math] expected value of longest length of stick broken into 3 pieces

probabilityprobability distributionsprobability theorypuzzle

I know this question has already been asked and answered here:Average length of the longest segment
But I am trying to determine the answer in the following way. Let $X$ and $Y$ be two independent uniform variables on $[0,1]$ (the length of the stick is assumed to be equal to 1). If we suppose $Y>X$, then the three lengths of the stick are $X$, $Y-X$ and $1-Y$, so we just have to determine the cdf of $M=\max(X,Y-X,1-Y)$. Let $t\in[0,1]$, then:
$$\mathbb{P}(M\leq t)=\mathbb{P}(X\leq t,Y-X\leq t,1-Y\leq t).$$
However, when I try to determine this probability graphically in the unit square, I find $0.5t^2+t-0.5$. I know this is a slightly different approach than the one used in the link above, as I am not going through the laws of $\min(X,Y)$ and $\max(X,Y)$, but rather considering the two symmetric cases where $X<Y$ and $X>Y$. Does anyone understand where I am making a mistake? Thanks.

Best Answer

By your method, you should be calculating :

$$\begin{align}\mathsf P(M\leq t, Y>X) ~=~& \mathsf P(X\leq t, Y-X\leq t, 1-Y\leq t, \color{blue}{Y>X})\\[1ex]~=~& \left(\int_0^1\int_0^1 \mathbf 1_{y-t\leq x\leq t\,,\, x<y\,,\, 1-t\leq y}\;\mathrm d\, x\;\mathrm d\,y\right)\mathbf 1_{0< t< 1}+\tfrac 1 2\mathbf 1_{1\leq t} \\[1ex] ~=~& \left(\int_{1-t}^1\int_{\max\{0,y-t\}}^{\min\{y,t\}}\;\mathrm d\, x\;\mathrm d\,y\right)\mathbf 1_{0< t< 1} +\tfrac 1 2\mathbf 1_{1\leq t}\\[1ex] =~& \left(\int_{\min\{t,1-t\}}^t\int_{0}^{y}\;\mathrm d\, x\;\mathrm d\,y +\int_{\max\{t,1-t\}}^1\int_{y-t}^t\;\mathrm d\, x\;\mathrm d\,y \right)\mathbf 1_{0< t< 1}+\tfrac 1 2\mathbf 1_{1\leq t}\\[1ex] =~& \left(\int_{\min\{t,1-t\}}^ty\;\mathrm d\,y +\int_{\max\{t,1-t\}}^1 2t-y\;\mathrm d\,y\right)\mathbf 1_{0< t< 1}+\tfrac 1 2\mathbf 1_{1\leq t} \\[1ex] =~& \left(\int_{1-t}^1 2t-y\;\mathrm d\,y \right)\mathbf 1_{0< t< 1/2}+ \left(\int_{1-t}^ty\;\mathrm d\,y +\int_{t}^1 2t-y\;\mathrm d\,y\right)\mathbf 1_{1/2\leq t< 1}+\tfrac 1 2\mathbf 1_{1\leq t} \\[1ex] =~& (\tfrac 5 2 t^2-t)\,\mathbf 1_{0 < t < 1/2}+ (-\tfrac 32 t^2+3t-1)\,\mathbf 1_{1/2\leq t < 1}+\tfrac 1 2\mathbf 1_{1\leq t} \\[4ex] \mathsf P(M\leq t) ~=~& (5t^2-2t)\,\mathbf 1_{0 < t < 1/2}+ (-3 t^2+6t-2)\,\mathbf 1_{1/2\leq t < 1}+\mathbf 1_{1\leq t}\end{align}$$