I'd like to ask for clarification of the following example in my textbook.
Example:
Suppose events are occurring at random with average rate $\lambda$ per unit of time. What is the probability density function of the random variable $X$, the waiting time to the second event?
We first find $F(x)$.
$F(x) = Pr[X$ $\leq$ $x] = Pr[$waiting time less than $x$ units of time for the 2nd event$]$
$=$ $1-Pr[$waiting more than $x$ units of time for the 2nd event$]$
$=$ $1-Pr[$less than 2 events take place in $x$ units of time$]$
$=$ $1-Pr[$0 events in $x$ units$] - Pr[$1 event in $x$ units$]$
$=$ $1-e^{-\lambda x}-\lambda x e^{-\lambda x}$,
using the Poisson distribution. We now differentiate $F(x)$ to find the density function $f(x)$.
$f(x) =\dfrac {dF(x)}{dx} = \lambda e^{-\lambda x} - \lambda e^{-\lambda x} + \lambda ^2 x e ^{-\lambda x } = \lambda ^2 x e ^{-\lambda x }$
Thus the density function of the random variable $X$, the waiting time to the second event, is given by
$f(x) = \lambda ^2 x e ^{-\lambda x } \qquad x\geq 0$
$\:\qquad = 0 \qquad \qquad \quad otherwise$
This is an extension of the exponential distribution which is the density function of the waiting time to the first event.
(End of example)
How did they transition from the first part to the second part here "using the Poisson distribution"? It looks like the exponential dist. to me.
Edit: To clarify, I wish to know how: $Pr[$0 events in $x$ units$]$ becomes $-e^{-\lambda x}$ and $Pr[$1 event in $x$ units$]$ becomes $-\lambda x e^{-\lambda x}$.
$1-Pr[$0 events in $x$ units$] - Pr[$1 event in $x$ units$]$
$=$ $1-e^{-\lambda x}-\lambda x e^{-\lambda x}$,
If you can explain this process, I'd appreciate your help.
Thanks in advance.