Distribution of time that a flashlight can operate The lifetimes of batteries are independent exponential random variables , each having parameter $\lambda$. A flashlight needs two batteries to work. If one has a flashlight and a stockpile of n batteries, What is the distribution of time that the flashlight can operate?
What I have so far:
Let $Y$ be the lifetime of the flashlight; $Y_1=min(X_1,...,X_n)$ where $X_i$ is the lifetime of a battery ($1\le i\le n$), and $Y_2$ the second smallest of the $X_i$ (so $Y_1\le Y_2$)
I wanted to compute: $P[Y\le t]=P[Y_2\le k+m|Y_1\le m]$ where $k+m=t$ then we have that $$P[Y_2\le k+m|Y_1\le m]={P[Y_2\le k+m, Y_1\le m]\over P[Y_1\le m]}={P[Y_2\le k+m] P[Y_1\le m]\over P[Y_1\le m]}=P[Y_2\le k+m=t]$$ (because of the independence of the random variables)
So $P[Y_2\le t]=P[min(X_1,...,X_{j-1},X_{j+1},...X_n)\le t]$ (assuming $X_j=min(X_1,...,X_n)$) hence:
$$P[min(X_1,...,X_{j-1},X_{j+1},...X_n)\le t]= 1-P[min(X_1,...,X_{j-1},X_{j+1},...X_n)\ge t]=1-P[X_1\ge t,...,X_{j-1}\ge t, X_{j+1}\ge t,... X_n\ge t]=1-e^{(n-1)\lambda t}$$
I would really appreciate if you can tell me if this is the correct approach :)
 A: Second answer, for a different interpretation: Batteries cannot die before they go into the flashlight. Because this interpretation involves both the
minimum of two exponentials and the sum of several exponentials, it makes a
more interesting problem than did the assumptions in my first answer. It is the interpretation suggested in Andre's note and used copper.hat's multiple integration.
Step 1: Wait for one of two initial batteries to fail. This waiting time is
the minimum of two exponentials with failure rate $\lambda$, and hence
$X_1$ ~ EXP($2\lambda$).
Step 2: Throw out dead battery, replace with new one. By the no-memory property,
the one of the two batteries in the flashlight that did not die is as good
as new. Waiting time for one of these two batteries to die is again
$X_2$ ~ EXP($2\lambda$).
Last step $n-1$; Throw out dead battery, replace with $n$th (last remaining
replacement) battery:  Light goes out after additional time
$X_{n-1}$ ~ EXP($2\lambda$).
Total time flashlight is lit is $T = X_1 + \dots + X_{n-1}$. This is the
sum of $(n-1)$ exponentials, so $T$ ~ GAMMA($n-1,$ $2\lambda$).
This is a gamma distribution with shape parameter $n-1$ and rate parameter $2\lambda.$ When the shape parameter is a positive integer the gamma
distribution is sometimes called an Erlang distribution (especially in
queueing theory). 
Check: A previous answer, apparently using the same assumptions and with $n=3,$
has the CDF of the random variable $T$ as 
$F_T(x) = 1 - \exp(-2\lambda x)(1 + 2\lambda x),$ for $x > 0$. The form of
the CDF does indeed get messier with increasing $n$, but the mean and variance
are simple expressions in $n$ and $\lambda.$
In R, we easily verify (in one instance, anyhow) that this is a special case of the gamma (Erlang)
distribution. Let $n = 3$, $\lambda = 1/15$, and $x = 1$. So this is the
(small) probability that the flashlight goes dark by time 1.
The code 'pgamma(1, 2, 2/15)' and the code '1 - exp(-2/15)*(1 + 2/15)' both
return the probability 0.008136905. Also,
'qgamma(.5, 2, 2/15)' finds the exact median time the flaslhight burns to be 12.58760, and
'mean(rgamma(10^5, 2, 2/15))' approximates the mean as
14.97 (exact is 15).
A: First, we need to be clear that in your problem $\lambda$ is the failure rate of each battery, not the mean time until failure. (Both parameterizations of the exponential distribution are in use.)
Second, we need to assume that all the batteries are subject to failure
from the start. Also, your flashlight is
useless after $n - 1$ battery failures.
Subject to these understandings, your approach is OK. 
The general result is that if $X_i$ ~ EXP($\lambda_i$) independently, for
$i = 1, \dots, k$, then $Y = \min(X_1, \dots X_k)$ is exponential with 
failure rate $\sum_{i=1}^k \lambda_i$. In your case $k = n-1$ and 
 $\lambda = \lambda_i$, so the exponential failure rate is $(n-1)\lambda$.
I have to say that batteries would not be my favorite example of
items that have exponential lifetimes. The "no-memory" property of
exponential distributions states that for exponential $X$, we have
$P\{X > s+t | X > s\} = P\{X > t\},$ for $s, t > 0$. (This is what you
showed at the start of your answer.) 
Sometimes, this property is
expressed by saying that "used is as good as new." In practice, the property holds
pretty well for computer chips, which mainly die by accident (electric shock
or cosmic ray) rather than by wearing out. For a battery, it does not
seem the case that a used one has the same reliability as a used one.
Also, the two batteries in a flashlight tend to wear out at the same time.
And by taking the max you are assuming the batteries in storage are
subject to the same risk as those in the flashlight. Altogether, 
the exponential distribution does not match with my intuition about
batteries and flashlights, so I will not try to give you an intuitive
argument for your answer in terms of batteries.
Suppose a satellite has $n = 10$ computer chips, all of which must function
in order for the satellite to do its job. Each chip fails after an
exponentially distributed length of time with rate 1/15 (average lifetime
15 years), then the lifetime of the satellite is exponential with rate 10/15,
average $15/10 = 1.5$ years. Here is a simulation in R to confirm the
distribution of the minimum. (Based on 100,000 imaginary satellites,
each in a row of the matrix. Simulation results from one run of program:  mean life 1.50, SD life 1.51, and the
probability of lasting more than a year is just above half.)
m = 100000;  n = 10;  lam = 1/15.
DIES = matrix(rexp(m*n, lam), nrow=m)  # m x n matrix of chips
x = apply(DIES, 1, min)  # min of each row = satellite failure time
mean(x)     # avg time to satellite failure,  exact = 1.5
sd(x)       # sd, exact = 1.5
mean(x > 1) # probability satellite survives more than 1 year
A: We are given $n$ batteries, and we put them two at a time in the flashlight. When one of the batteries fails, we swap it out and replace it with an unused one, if possible. The key here is that the battery that we did not swap out now behaves as a completely new battery. That's because the exponential distribution has the special property: given that a battery has survived to time $t$, the distribution of the additional time that it survives is independent of $t$.
Hence, the lifetime of every pair of batteries follows the distribution of the minimum of two exponential random variables. The probability that the minimum is less than $a$ is given by $1 - \exp(-2\lambda a)$, hence the minimum is itself an exponential with parameter $2 \lambda$.
Now since we swap out a battery exactly $n-1$ times, the total lifetime of the flashlight is the sum of $n-1$ independent, identically distributed exponentials of $2 \lambda$, which is a Gamma distribution with parameters $n-1$ and $2 \lambda$. (This result can be seen easily by noting that the sum of two Gamma-distributed variables is also Gamma distributed, and the exponential is a special case of the Gamma).
A: This is not an answer, but will not fit in a comment.
Given $n$ batteries with run times $x_1,...,x_n$ (unknown to the user), just computing the operating time is moderately complex.
For example, suppose we have 3 batteries.
One starts with batteries $1,2$, then replaces $1$ by $3$ if $x_1<x_2$ in which case the operating time is $T(x)= \min(x_1+x_3,x_2)$ or
replaces $2$ by $3$ if $x_1 > x_2$ in which case the operating time is $T(x)= \min(x_1, x_2+x_3)$. We can ignore the $x_1=x_2$ case, in this context.
So, using independence and symmetry, we have $F_T(\alpha) = P\{x| T(x) \le \alpha \} = 2 P\{ x | x_1 < x_2 \text{ and } (x_1+x_3 \le \alpha \text{ or } x_2 \le \alpha )\} $
Computing this, we have
$F_T(\alpha) = 2\int_{x_2=0}^\alpha \int_{x_1=0}^{x_2} \int_{x_3=0}^\infty \phi 
+2\int_{x_2=\alpha}^\infty \int_{x_1=0}^{\alpha} \int_{x_3=0}^{\alpha-x_1} \phi$,
where $\phi(x) = \lambda^3 e^{-\lambda(x_1+x_2+x_3)}$.
Then $F_T(\alpha) = 1- e^{-2 \alpha \lambda}(1+2 \alpha \lambda)$, for $\alpha \ge 0$.
It doesn't get simpler when we add more batteries...
