Finding marginal density functions for arrival times? (Poisson Process) The joint density of the first and second arrivals, denoted $W_1,W_2$ is:
$$f(w_1,w_2)=\lambda^2 e^{-\lambda w_2}$$
I am asked to find the marginal density functions for $W_1$ and for $W_2$ and also the density of the inter-arrival time, $W_1-W_2$.

I am reading a related theorem, which says that the waiting time $W_n$ has the gamma distribution with the pdf:
$$f_{W_n}(t) = \frac{\lambda^n t^{n-1}}{(n-1)!}e^{-\lambda t}$$
In particular, $W_1$, the time to the first event, is exponentially distributed:
$f_{W_1}=\lambda e^{-\lambda t}$. Similarly obtained, $f_{W_2}=\lambda^2 t e^{-\lambda t}$.
I understand how to plug $n$ into this theorem to generate the answer, but I don't really understand how I would have derived that. Can someone explain? I'd also really appreciate help on the second component. I have no clue how to start that. I also don't understand if this theorem is generally applicable - shouldn't I have to be using the joint distribution to derive these functions?
EDIT:
There is a hint in a different book recommending the change of variables $S_0=W_1$ and $S_1=W_2-W_1$.
 A: If you're dealing only with the first and second arrival times and no later ones, then you can write
\begin{align}
& f_{W_2} (w_2) = \int_0^{w_2} f_{W_2,W_2} (w_1,w_2) \, dw_1 = \int_0^{w_2} \lambda e^{-\lambda w_2}   (\lambda\,dw_1) \\[10pt]
= {} & \lambda^2 e^{-\lambda w_2} \int_0^{w_2} dw_1 \quad (\text{because $\lambda^2 e^{-\lambda w_2}$ does not change as $w_1$ goes from $0$ to $w_2$}),
\end{align}
\begin{align}
f_{W_1} (w_1) = \int_{w_1}^\infty \lambda e^{-\lambda w_2} (\lambda\,dw_2) = \text{etc.}
\end{align}
I assume $W_1-W_2$ is a typo and you meant $W_2-W_1$.  Maybe the simplest way to approach this is two begin like this:
\begin{align}
\Pr(W_2-W_1\le w) & = \int_0^\infty \left( \int_{w_1}^{w_1+w} \lambda^2 e^{-\lambda w_2}  \,dw_2 \right)  \,dw_1 \\[10pt]
& = \int_0^\infty \left( \int_{w_1}^{w_1+w} \lambda^2 e^{-\lambda w_2}  \,dw_2 \right)  \,dw_1 \\[10pt]
& = \int_0^\infty \left( \int_0^w \lambda^2 e^{-\lambda(v+w_1)} \, dv \right) \, dw_1 \\[10pt]
& = \int_0^\infty \left( \lambda e^{-\lambda w_1} \int_0^w e^{-\lambda v} (\lambda\,dv) \right) \, dw_1 \\[10pt]
& = \int_0^\infty \left( \lambda e^{-\lambda w_1} \left( 1 - e^{-\lambda w} \right) \right) \, dw_1 \\[10pt]
& = 1 - e^{-\lambda w}.
\end{align}
Then differentiate to get the density function.
