First Passage Time of Markov Process: Can you spot a mistake? I came up with the following problem myself and cannot spot the mistake in my algebra, can someone help, please?
Consider a box with N particles. These particles can permanently exit the box either left (at rate L per particle) or right (at rate R per particle). What is the mean first passage time when a particle exits the box on the right?
My approach is this: Let $p_n(t)$ be the probability that there are $n$ particles in the box but no particle has exited the box on the right by time t. Then, the Master equation shall be:
$$\partial_t p_n(t) = L(n+1)p_{n+1}-(R+L)np_n$$
and has initial condition $p_n(0)=\delta_{N,0}$. Using a generating function $G(z,t)= \sum_n z^np_n(t)$, I can transform the problem into
$$\partial_t G = (L-(R+L)z)\partial_z G$$
with the initial condition $G(z,0)=z^N$.
This can be solved using the method of characteristics:
$$G(z,t)=\left(\left(z-\frac{L}{L+R}\right)e^{-(L+R)t}+\frac{L}{L+R}\right)^N$$
Finally, the probability that no particle has exited the box on the right by time t is $$S(t)=\sum_n p_n(t)=G(1,t)=\left(\frac{R}{L+R}e^{-(L+R)t}+\frac{L}{L+R}\right)^N.$$
The end result follows by computing the probability density of the mean first passage time $F(t)=-\mathrm{d}S(t)/\mathrm{d} t$ and then computing $\int_0^\infty t F(t) \mathrm{d} t$.
However, I do not think that I am getting the correct result. Notice that $S(t) \to \left(\frac{L}{L+R}\right)^N$ as $t \to \infty$, i.e., the probability that all particles exited on the left. But, I would expect $S(t) \to 0$ so that $F(t)$ is indeed a probability density function that satisfies $\int_0^\infty F(t) \mathrm{d} t = S(0)-S(\infty)=1-0=1$.
What did go wrong in my computation? Do I have the wrong Master equation? Thanks for any ideas.
 A: There is a basic thing wrong with how this question is formulated: there is a positive (but perhaps small) probability that all the particles exit the box on the left and none ever exit on the right, which means that strictly speaking $E[\tau]$ is $+\infty$. Perhaps you want to modify the setup so that $\tau$ is either the first time a particle exits on the right or the time when all the particles have exited out the left.
I only came to this realization after I had already analyzed the problem in the below way. So I will leave this analysis in the answer even though it is not needed to answer your question. Note that both my method and yours are correct even though they look different.
Let $\tau$ be the first time that a particle exits out the right side of the box. Then
\begin{align}
P(\tau>t+h) &=P(\tau>t+h \mid \tau>t) P(\tau>t) + P(\tau>t+h \mid \tau \leq t) P(\tau \leq t) \\ & =P(\tau>t+h \mid \tau>t) P(\tau>t).\end{align}
Therefore
$$\frac{d}{dt} P(\tau>t) = P(\tau>t) \lim_{h \to 0} \frac{P(\tau>t+h \mid \tau>t)-1}{h}.$$
Now you can find that conditional probability in the $h \to 0$ limit by using the total probability formula again:
\begin{align}P(\tau>t+h \mid \tau>t) & =\sum_n P(\tau>t+h \mid \tau>t,N(t)=n) P(N(t)=n \mid \tau>t) \\ & =\sum_n (1-nRh+o(h))p_n.\end{align}
Recalling $\sum_n p_n=1$ you have
$$P(\tau>t+h \mid \tau>t)-1=\sum_n (-nRh+o(h))p_n.$$
Summarizing, $\frac{d}{dt} P(\tau>t)=P(\tau>t) \sum_n -nRp_n$ and $P(\tau>0)=1$ so $P(\tau>t)=e^{-R \int_0^t \sum_n n p_n(s) ds}$ and $E[\tau]=\int_0^\infty P(\tau>t) dt$.
Note that my $p_n$ is by definition conditional on no exits to the right having happened yet. Therefore my $p_n$ satisfy $\partial_t p_n = L[(n+1) p_{n+1} - n p_n],n=0,1,\dots N-1,\partial_t p_N=-LNp_N$ with $p_n(0)=\delta_{N,n}$.
