# Uniform Probabilty

#### abecedarian

I need help in solving this problem.

Problem

The lifetimes of batteries are independent uniformly distributed random variables over (0,1) month. A device requires 2 batteries to operate. when a battery fails, both batteries in service are replaced and discarded. If you have a total of n batteries, find the mean of the total amount of time that the device can operate.

#### romsek

Math Team
first thing I'd do is treat pairs of batteries as a single entity.

$Pr[\text{battery pack life}<t]=Pr[\text{battery 1 life}<t]Pr[\text{battery 2 life}<t] = t^2$

so the pdf of a battery pack lifetime is the derivative of this, i.e.

$p(t) = 2t,~t \in [0,1]$

Since we always replace an entire pack we'll consider first $n$ being even so there are $\dfrac n 2$ packs.

The lifetime of the device is just the sum of the lifetimes of these $\dfrac n 2$ packs.

Each pack has an expected lifetime of

$E[t] = \displaystyle{\int_0^1}2t^2~dt = \dfrac 2 3$

and the expected value of this sum is just the sum of the expected values so

$E[t] = \dfrac n 2 \dfrac 2 3 = \dfrac n 3$

If $n$ is odd, then the battery left over can't be used for anything and we essentially have $n-1$ batteries to make $\dfrac {n-1}{2}$ packs.

In this case $E[t] = \dfrac{n-1}{3}$

So our final expectation is

$E[t] = \dfrac{\left \lfloor \frac n 2 \right \rfloor}{3}$

#### romsek

Math Team
The solution in post #2 is incorrect. The following is correct.

Again treat two batteries at a time as a single entity called a pack.

$Pr[\text{life of pack}<t] =1-Pr[\text{life of pack}>t]^2$

In other words in order for the pack to have failed by time $t$ both batteries cannot have lasted longer than $t$

$Pr[\text{life of pack}>1] = 1-t$

$Pr[\text{life of pack}<t]=1-(1-t)^2 = 2t-t^2$

Thus the pdf of the pack lifetime is

$p(t) = \dfrac{d}{dt} 2t-t^2 = 2(1-t)$

The expected lifetime of a pack is thus

$E[t] = \displaystyle{\int_0^1}2t(1-t) = \dfrac 1 3$

and again the Expected value of the sum of $\dfrac n 2$ of these packs is just

$E\left[t | \dfrac n 2 \text{ packs }\right] = \dfrac n 2 \dfrac 1 3 = \dfrac n 6$

and by the argument of post #2 the final answer is

$E[t | n \text{ batteries }]=\dfrac{\left \lfloor \frac n 2 \right \rfloor}{6}$

Last edited: