# Number of events of Poisson process A until first occurrence of Poisson process B

Given two Poisson processes with parameters $\lambda_A$ and $\lambda_B$, I need to find the distribution of events of process A, until the first occurrence of process B.

I realize that the time in question is distributed $\exp(\lambda_B)$ but i'm not sure how to use it.

If you add the two processes together, you get another Poisson process with parameter $\lambda_A+\lambda_B$. If you start with a Poisson process with that parameter, then take the points of that process and label each one of them independently $A$ with probability $\frac{\lambda_A}{\lambda_A+\lambda_B}$ and $B$ with probability $\frac{\lambda_B}{\lambda_A+\lambda_B}$, the points labelled $A$ and those labelled $B$ you get two independent Poisson processes, one with rate $\lambda_A$ and one with rate $\lambda_B$.
This means that if you are told where the points of the combined process occur, each one independently (and independently of where they are) came from process A with probability $\frac{\lambda_A}{\lambda_A+\lambda_B}$. The number of points from process A before the first point from process B is therefore just a geometric random variable with parameter $\frac{\lambda_B}{\lambda_A+\lambda_B}$ (using the definition of geometric where $0$ is a possible value).