Comparison between two exponentail random variables A and B are exponentially distributed with parameter $\alpha$ and $\beta$.
A and B race with each other continuously. $N_b$ denotes the number of times B wins before A wins single time. Find $P (N_b = n )$ for $n \geq 0$.
Any hint or help is highly appreciated.
 A: Denote by $F$  the event $B>A$ (B wins before A ) since the events are independent and denote $S$ the event $A>B$
$$\Bbb{P}(B>A, n \text{ times}) = \Bbb{P} (FF \ldots FS) = \bigg(\frac{\alpha}{\alpha + \beta}\bigg)^n \frac{\beta}{\alpha + \beta} $$
since $\Bbb{P}(A>B) = P(A \geq B) = 1 - P(B>A)$
A: Suppose:


*

*$A_i$ and $B_i$ for each $i = 1, 2, \ldots$ represent times for A and B to complete their $i^{\rm th}$ race, respectively.

*Once the $i^{\rm th}$ race is complete, the $(i+1)^{\rm th}$ race is begun immediately, without regard to the status of the other racer (i.e., the two processes are independent).

*Let $N_A(t)$ and $N_B(t)$ represent the total number of races completed by A and B at time $t$, respectively.

*A and B start their first race simultaneously at time $t = 0$.

*For each $i$, the time-to-event variables are exponential parameterized by rate: $f_{A_i}(t) = \alpha e^{-\alpha t}$, and $f_{B_i}(t) = \beta e^{-\beta t}$, for $t > 0$.


Then the desired probability is $$\Pr[N_B(A_1) = n] = \Pr\left[\sum_{i=1}^n B_i \le A_1 < \sum_{i=1}^{n+1} B_i\right].$$
However, it is easier to regard the above as a Poisson process.  Interarrival times are exponentially distributed and have independent increments.  The random variable $N_B(t)$ is Poisson with rate parameter $\lambda = \beta t$; i.e., $$\Pr[N_B(t) = n] = e^{-\beta t} \frac{(\beta t)^n}{n!}, \quad n = 0, 1, 2, \ldots,$$ hence $$\Pr[N_B(A_1) = n] = \int_{a = 0}^\infty \Pr[N_B(a) = n] f_{A_1}(a) \, da.$$  We then easily find $$\Pr[N_B(t) = n] = \int_{a=0}^\infty e^{-\beta a} \frac{(\beta a)^n}{n!} \alpha e^{-a \alpha} \, da = \frac{\alpha \beta^n}{(\alpha+\beta)^{n+1}} \int_{a=0}^\infty \frac{(\alpha+\beta)^{n+1} a^n e^{-(\alpha+\beta)a}}{\Gamma(n+1)} \, da$$ and since the last integral is that of a gamma density with shape $n+1$ and rate $\alpha + \beta$, we have $$\Pr[N_B(A_1) = n] = \frac{\alpha \beta^n}{(\alpha+\beta)^{n+1}} = (1-p)^n p,$$ where $p = \alpha/(\alpha+\beta)$ is the probability that A wins the first race before B.  Note that we also could have used the memorylessness property of the exponential distribution:  if $B$ completes a race, then the time that it takes for $B$ to complete the next one is equivalent to the time that it would have taken had $B$ not completed the previous race--i.e., each time $B$ completes and $A$ has not, the situation reverts to that when both had just started the race.  This is why we can intuitively reason that the desired probability distribution is a geometric random variable:  the probability that B completes exactly $n$ races is equal to the probability that we observe $n$ "failures" followed by one "success" in a series of independent Bernoulli trials with probability of success $p = \beta/(\alpha + \beta)$.
