# Painting Walls and Probability

Suppose Jill and Jane are individually painting separate rooms. Each of the rooms has $4$ walls. The time taken to paint each wall is exponentially distributed with mean $1$ hour. What is the probability that Jill will finish painting $3$ walls before Jane finishes $2$ walls?

This seems to look somewhat similar to a negative binomial distribution. Is this the correct distribution to use?

-
Negative binomial distribution (with p=1/2) seems to fit. – Yuval Filmus Nov 14 '10 at 21:01
Surely there can be a more informative title for this question... – Rahul Nov 14 '10 at 23:35

Here's another way to get the answer of $\frac{5}{16}$. The number of possible ways for Jill to finish three walls before Jane finishes two is small enough to just list. They are (with $X$ denoting Jill finishing a wall and $Y$ denoting Jane finishing a wall)

XXX
YXXX
XYXX
XXYX


Because of the memorylessness of the exponential distribution, starting from any point in time the probability that the next wall will be finished by Jill is $\frac{1}{2}$. Thus the four listed events have probabilities $\frac{1}{8}$, $\frac{1}{16}$, $\frac{1}{16}$, and $\frac{1}{16}$, respectively. So the probability that Jill finishes three before Jane finishes two is $\frac{5}{16}$.

(Update: This answer assumes that you're looking for the probability that Jill finishes at least 3 walls before Jane finishes 2. If you want the probability that Jill finishes exactly 3 walls before Jane finishes 2, then Yuval Filmus is correct that you want $P(X = 3)$, where $X$ is a negative binomial random variable with success probability $p = \frac{1}{2}$ and number of failures $r = 2$. Here, $P(X = 3) = \frac{1}{8}$.)

-
This is the negative binomial distribution with p=1/2, as the OP mentioned. – Yuval Filmus Nov 15 '10 at 3:49
@Yuval Filmus: No, it's not, but thank you for bringing this up because it allowed me to clarify my answer with respect to the OP's question. – Mike Spivey Nov 15 '10 at 5:06
You want $P(X \geq 3)$ where $X$ is a negative binomial r.v. – Yuval Filmus Nov 15 '10 at 20:43
@Yuval Filmus: Good point. I misinterpreted what you meant by "this." Ah, pronoun trouble. – Mike Spivey Nov 15 '10 at 21:12

Let $T$ denote the period of time until Jill finishes painting $3$ walls. Then, $T$ has gamma density $f_T (t) = t^2 {\rm e}^{-t}/2$, $t > 0$. Viewing the number of walls painted by Jane up to time $t$ as a Poisson process (with unit rate), the question amounts to calculate $$\int_0^\infty {{\rm P}(N_t < 2|T = t)f_T (t)\,{\rm d}t}$$ (by virtue of the law of total probability, conditioning on $T$), where $\lbrace N_t : t \geq 0 \rbrace$ is a unit rate Poisson process. The required probability then follows to be $0.3125 = 5/16$.

A complete generalization:

Suppose Jill and Jane are individually painting separate rooms. Each of the rooms has $n \ge \max \lbrace m_1 , m_2 \rbrace$ walls. The time it takes Jill and Jane to paint each wall is exponentially distributed with mean $1/\lambda_1$ and $1/\lambda_2$ hour, respectively. What is the probability that Jill will finish painting $m_1$ walls before Jane finishes $m_2$ walls?

The answer is $$\bigg(\frac{{\lambda _1 }}{{\lambda _1 + \lambda _2 }}\bigg)^{m_1 } \sum\limits_{k = 0}^{m_2 - 1} {{k + m_1 - 1 \choose k} \bigg(\frac{{\lambda _2 }}{{\lambda _1 + \lambda _2 }}\bigg)^k }.$$ This can be proved easily either by using Mike's method, noting that ${\rm P}(X_1 < X_2 ) = \frac{{\lambda _1 }}{{\lambda _1 + \lambda _2 }}$ for independent exponential rv's $X_1$ and $X_2$ with respective means $1/\lambda_1$ and $1/\lambda_2$, or by using my method, noting that the time $T$ it takes Jill to paint $m_1$ walls has gamma density $f_T (t) = \frac{{\lambda _1^{m_1 } {\rm e}^{ - \lambda _1 t} t^{m_1 - 1} }}{{(m_1 - 1)!}}$, $t > 0$. (Letting $\lambda_1 = \lambda_2 = 1$, $m_1=3$, and $m_2=2$, this formula gives $5/16$, the same as for the original problem.)

-