# A stick of length 1 is broken in a random place that is U(0, 1). Let X be the length of the longer piece and let Y be the length of the shorter piece.

A stick of length $1$ is broken in a random place that is $U(0, 1)$. Let $X$ be the length of the longer piece and let $Y$ be the length of the shorter piece.

$a)$ Find the pdf and expected value of $X$.

$b)$ Find the pdf and expected value of $Y$.

$U \sim U(0,1)$

I got to the point where I have an equation for the cdf of $X$:

$$\frac{1}{2}[P(1-U \leq X \:\:|\:\: U < \frac{1}{2}) + P(U \leq X \:\:|\:\: U > \frac{1}{2})]$$

but I don't know how to get the pdf from that at all.

Any help on this question would be appreciated.

$U \sim U(0,1)$

Define $X = \text{max}\{U, 1-U\}$

so that

$$X = \begin{cases} 1-U, & 0 < U < 1/2 \\ U, & 1/2 \leq U < 1 \end{cases}$$

It follows that

$$X = \frac{1 + |2U - 1|}{2}$$

$$F_X(x) = P (X \leq x), \:\:\:\: 1/2 < x < 1$$

$$=P\left(\frac{1 + |2U - 1|}{2} \leq x \right)$$

$$=P(|2U - 1| \leq 2x-1)$$

$$=P(-2x+1 \leq 2U - 1 \leq 2x-1)$$

$$=P(1-x \leq U \leq x)$$

$$=P(1-x < U \leq x)$$

$$=F_U(x) - F_U(1-x)$$

Differentiating with respect to $x$:

$$f_X(x) = f_U(x) + f_U(1-x), \:\:\:\:\: \text{for}\:\:\: 1/2 < x < 1$$

It follows that

$$f_X(x) = \begin{cases} 2, & \text{if}\:\:\:1/2 < x < 1, \\ 0, & \text{otherwise} \end{cases}$$

and since we have for a uniform variable

$$f_Z(z) = \begin{cases} \frac{1}{b-a}, & \text{if}\:\:\:a < z < b, \\ 0, & \text{otherwise} \end{cases}$$

$$E[Z] = \frac{b+a}{2}$$

It follows that

$$E[X] = \frac{1 + 1/2}{2} = \frac{3}{4}$$

• For me, the intermediate step $X=|U-1/2|+1/2$ is what helped me reach $X = \frac{1 + |2U - 1|}{2}$. – jackz314 Mar 12 at 10:00

The CDF of $X$ is that for $u\in(1/2;1)$

$$\mathsf P(X\leq u) ~=~ \tfrac 12 \mathsf P(1-U\leq u\mid U\leq 1/2)+\tfrac 1 2\mathsf P(U\leq u\mid U> 1/2)$$

If $U$ is uniformly distributed on $(0;1)$, then on condition that $U\leq \tfrac 12$, $U$ is uniformly distributed on $(0;1/2)$.

\begin{align}\mathsf P(U\leq u\mid U\leq \tfrac 12) ~ = & ~ \dfrac{\mathsf P(U\leq u)\mathbf 1_{0\leq u\leq 1/2}}{\mathsf P(U\leq 1/2)}\\ ~ = & ~ 2u~\mathbf 1_{u\in(0;1/2)}\end{align}

And similarly

\begin{align}\mathsf P(U\leq u\mid U\geq \tfrac 12) ~ = & ~ \dfrac{\mathsf P(1/2\leq U\leq u)\mathbf 1_{1/2\leq u\leq 1}}{\mathsf P(U\geq 1/2)}\\ ~ = & ~ (2u-1)~\mathbf 1_{u\in(1/2;1)}\end{align}

Continue from here.

PS: To simplify maters:

\begin{align}f_X(x) ~=& ~ \frac{\operatorname d ~}{\operatorname d x}\mathsf P(X\leq x) \\ = & ~ \left\lvert\frac{\operatorname d ~}{\operatorname d x}\tfrac 12 \mathsf P(1-U\leq x\mid U\leq 1/2)\right\rvert+\left\lvert\tfrac 1 2\mathsf P(U\leq x\mid U> 1/2)\right\rvert \\ = & ~ (f_U(1-x)+f_U(x))~\mathbf 1_{x\in(1/2;1)} \\ = & ~ 2~\mathbf 1_{x\in(1/2;1)} \end{align}

• Sorry I really don't understand a lot of the notation here, especially in the PS... – Sam N. Mar 15 '16 at 5:39

To try it another way:

Let $U$ measure the break point.   This is uniformly distributed over the length of the stick.$$U\sim\mathcal U(0~;1)$$

With probability $1/2$ the stick is broken close to one end ($0$) and with probability $1/2$ the stick is broken close to the other ($1$).

Either way, the break point will be uniformly distributed over whichever half it occurs on.   The conditional distributions are thus:

$$U\mid_{(U<1/2)}~\sim~\mathcal U(0~;1/2)$$ $$U\mid_{(U\geq 1/2)}~\sim~\mathcal U[1/2~;1)$$

When $U<1/2$ the length of the longer piece, $X$, equals $1-U$, otherwise it is $U$.   So:

$$X\mid_{(U<1/2)}~\sim~\mathcal U(1/2~;1)$$ $$X\mid_{(U\geq 1/2)}~\sim~\mathcal U[1/2~;1)$$

Since there is equal probability of the break point being on either half, then the length of the longer piece is uniformly distributed over the interval $1/2$ to $1$:

$$X~\sim~\mathcal U(1/2~;1)$$

Given this, you can find the CDF, pdf, and expected value of $X$.

Those for $Y$ are found similarly.

As a check, $\mathsf E(X)+\mathsf E(Y) = 1$ (why?).