Expected length of middle piece in a randomly broken pole

This question has appeared here before requesting the expected length of the smallest piece and of the largest piece. What about the middle piece?

I break a meter long pole into three random pieces. What is the expected value of the second longest piece?

We could do this by one minus the expected value of the largest plus the expected value of the smallest (I think?) but I would prefer a more direct calculation.

Denote the break points by $$X,Y\sim \operatorname{Unif}(0,1)$$.

Suppose that $$X. In this case, the three pieces have length $$X$$, $$Y-X$$, $$1-Y$$. There are three cases for the longest piece: $$\begin{array}{rclr|clrcl|rcl} X & &\text{longest} & & & Y-X & & \text{longest} & & & 1-Y & & \text{longest}\\\hline X&>&Y-X & & & Y-X&>&X & & & 1-Y &>& X\\ X&>&1-Y & & & Y-X&>&1-Y & & & 1 - Y &>& Y - X\\ \end{array}$$ This divides the upper half of the unit square (above the line $$y=x$$) into three parts. I found them on paper by drawing the lines and highlighting where the conditions in the above table were true in three colors, but I don't have a scanner. There is a good picture here (but it is of the smallest case, rather than the largest, which is similar but not identical).

After this, I think we divide each region into the cases of which is second longest, then calculate the value times the integral over each region?

Is there a better way to do it?

• Longest minus shortes? The expectation of 1-(Largest+Shortest) is the expectation of the middle piece. – zoli Jul 25 '19 at 7:13
• I know that if you break the pole randomly into three pieces the expected length of each piece is 1/3, I'm not too sure where this question differs from that. – johnson Jul 25 '19 at 11:19
• @Zoli ah yes that's what meant to say – WQ Arielle Cosette Jul 25 '19 at 17:46
• @johnson Conditioned on being the second longest piece our expectation can change. E.g. clearly the expected length of the shortest piece isn't 1/3, as it can be at most 1/3. So you need to be more careful. – Misha Schmalian Jul 25 '19 at 18:18
• Brute force integrating over all of those parts results in the answer being 5/18. This matches @zoli 's answer. – JimB Jul 26 '19 at 4:55