# Problem with proof of Poisson distribution as the difference of two gamma distributions

I found the following equations related to the Erlang distribution, ie the difference of two gamma distributions, which is a Poisson process with rate $\lambda t$:

$P(N(t)=t)=\frac { { \lambda }^{ n } }{ n! } \int _{ 0 }^{ T }{ \left( nu^{ n-1 }-\lambda u^{ n } \right) { e }^{ -\lambda u } } du=\frac { { \lambda }^{ n } }{ n! } { \left[ u^{ n }{ e }^{ -\lambda u } \right] }_{ 0 }^{ T }=\frac { { (\lambda t) }^{ n } }{ n! } { e }^{ -\lambda t }$

The one thing I cannot understand is the following part, ie a) how the integral is simplified to $u^{ n }{ e }^{ -u }$ and b) then evaluated simply as ${ t }^{ n }{ e }^{ -\lambda t }$:

$\int _{ 0 }^{ T }{ \left( nu^{ n-1 }-\lambda u^{ n } \right) { e }^{ -u } } du={ \left[ u^{ n }{ e }^{ -u } \right] }_{ 0 }^{ T }={ t }^{ n }{ e }^{ -\lambda t }$

There are no details provided and I scratched my head onto it. Looking at it, it seems that an integration by parts would not be the solution.

While searching on Internet, the proof was done always the same way, ie through the cdf of the Poisson distribution, which is of no use to explain the equation above.

Any help very appreciated.

Regards,

Firstly, you are missing a $\lambda$ in your first equation (reproduced below with the missing terms) - also $T$ should be $t$ $$P(N(t)=t)=\frac { { \lambda }^{ n } }{ n! } \int _{ 0 }^{ t }{ \left( nu^{ n-1 }-\lambda u^{ n } \right) { e }^{ -\color{red}{\lambda} u } } du=\frac { { \lambda }^{ n } }{ n! } { \left[ u^{ n }{ e }^{ -\color{red}{\lambda} u } \right] }_{ 0 }^{ t }=\frac { { (\lambda t) }^{ n } }{ n! } { e }^{ -\lambda t }$$
Consider the function $f(u)=\lambda u^n e^{-\lambda u}$. If you differentiate this with respect to $u$, using the product rule, you obtain $$\frac{df}{du}=nu^{n-1}e^{-\lambda u}-\lambda u^ne^{-\lambda u}$$ Thus $$\int (nu^{n-1}-\lambda u^n)e^{-\lambda u}\ du=\lambda u^n e^{-\lambda u}$$