# conditional difference between 2 uniform random variables. Surely Breiman can't be wrong?

I've already searched and don't find this particular case in XValidated.

Statement:

"Electricity is turned on uniform-randomly at a given time of day (in 24 hour window). Once it has been turned on, the turn-off time is uniform-randomly chosen as well (chosen from the remaining hours left in the day). What is the probability that the electricity will be on for at least 12 hours during the day".

The "at least 12 hours" condition means that electricity must be turned on before/at noon"(otherwise there's no way it could have been on for at least 1/2 the day.

Breiman, Leo "Probability and Stochastic Processes" (1969) presents the answer to this as:

0.5 - 0.5 Ln(2)

I just don't see that - is there a clear derivation of this? Unable to find it (Breiman's book doesn't have the answer for the problem).

Edit: Almost have it.

The answer involves a double integral over the space (T_on, T_off)

where

0 <= T_on <= 0.5   (power turn-on must be noon or earlier for 1/2 day condition

T_on + 0.5 <= T_off <= 1  (power needs to be on for at least 1/2 day past turn-on time)


I can't quite see why the integrand is 1/y - that's the only place that a Log can result from an integration.

The following are automatic, proceeding immediately from definitions and the information given:

• The uniform distribution on any interval $[a,b]$ has density $1/(b-a)$. Therefore (measuring in days), the density of the turn-on time $X$ is

$$f_X(x) = \frac{1}{1-0} = 1.$$

• The turn-off time $Y$ has a uniform distribution on the interval $[X, 1]$ and therefore has density

$$f_{Y|X}(y) = \frac{1}{1-X},$$

which is conditional on $X$.

• Let $I$ be the event "electricity is on for at least half the day;" namely, $0 \le X \le 1$, $Y-X \ge 1/2$, and $Y \le 1$. Then

$$\Pr(I) = \iint_I f_X(x) f_{Y|X}(y) dx dy.$$

The rest is Calculus, which tells us (by Fubini's Theorem) that this can be computed as an iterated single integral,

\eqalign{ \iint_I f_X(x) f_{Y|X}(y) dx dy &= \int_{0}^{1/2} dx \left(\int_{x+1/2}^1 \frac{dy}{1-x}\right) \\ &= \int_{0}^{1/2} \frac{1/2 - x}{1-x}dx\\ &= \int_{0}^{1/2} \left(1 - \frac{1}{2} \frac{1}{1-x}\right) dx \\ &= \frac{1}{2} - \frac{1}{2} \log(2). }