# The distribution of K until the n-th occurance of a poisson process takes place

Let's take the following scenario:

Customers arrive at a shopping mall according to a Poisson process with a rate of λ per minute. The mall has a door that closes if nobody passes for two minutes, and it will reopen when someone arrives.

The variable K_n represents the number of times the door closes before the nth person arrives.

• What's the distribution of K_n?
• Find the limit of K_n/n as n tends to infinity.

I started by calculating the probability that no one would arrive within 2-minute intervals and I got the following:

X: number of arrivals in 2 minutes
probability that 0 person arrives in 2 minutes p(0,2) = (2.λ^0.e^-2λ)/(0!) = e^-2λ


which is the same as P(T > t) where T is the time until the first arrival ==> T is exponentially distributed.

However, I am not sure how this can be linked to n and the arrival of the K_n person.

I tried to reason as follows:

if we record each arrival and count K_n, then this counter will remain the same if the interval t between the current arrival and the next one is less than 2, and will increase by one if the interval t is 2 or more, and the probability that t is less or more than 2 follows an exponential distribution.

But how to model the distribution of K_n gathering all of this? or am I missing something?

Would appreciate your help.

• Hint: Each interarrival time is either less than or greater than two minutes, with the probabilities as you have derived them. There are $n$ of these interarrival times. Are you actually interested in the interarrival times themselves, or in the binary events "interarrival time > 2 minutes?" Commented Feb 26 at 21:38
• @jbowman I want to get the distribution of K_n which is the number of door closes. For one interval, I have a e^-2λ chance that it has a length of 2 or more (K for this interval is 1) and 1 - e^-2λ that it's shorter than 2 minutes (K for this interval is 0) and this is repeated n times until the nth person arrives. What I explained is the expected value of K_n right? so what's its probability distribution? Commented Feb 26 at 21:50
• Can you name the distribution of $K_1$, i.e., whether or not the door is closed when the first person arrives? If you can do that, the distribution of $K_n$ will follow. Commented Feb 27 at 1:20
• @jbowman Well working with your hints, K_1 which is the count of door closes in one interval would be a Bernoulli that has values 1 or 0 with probabilities e^-2λ and 1 - e^-2λ respectively ==> the overall K_n is Binomial. Hope this is correct. Commented Feb 27 at 9:21
• Very good, you've got it! Commented Feb 27 at 15:31

## 1 Answer

With the help of @jbowman, Here is the final answer:

For one interval (time between 2 people's arrivals), either the interval is less than 2 minutes ==> the door doesn't close, or it is 2 minutes or more ==> the door closes.

Since people are arriving based on a Poisson process, we can use that to calculate the probability that an interval is longer than 2 minutes.

As mentioned in the question, the probability that an interval is longer than 2 minutes is the same as the probability that no person arrived until time = 2 So if $$X$$ is a random variable for the number of people arriving in 2 minutes $$p(0,2) = \frac{(2λ)^0e^{-2λ}}{0!} = e^{-2λ} = P(T >= 2)$$

So if we take one interval and define $$K_i$$ as the number of door closes, then $$K_i = 1$$ with probability $$e^{-2λ}$$ and $$K_i = 0$$ with probability $$1 - e^{-2λ}$$.

From that we notice that the distribution of $$K_i$$ is Bernoulli and this means that the overall distribution of $$K_n$$ is a Binomial (a repetition of a Bernoulli trial $$n$$ times).