Solution (source code)

= Solution

The <moment-generating function> is $M_X(t)=\mathbb E[e^{tX}]$ where finite. For <independent> $X,Y$, <independence> factors the expectation, giving $M_{X+Y}(t)=M_X(t)M_Y(t)$ wherever both factors are finite.

For the given <probability density function> and $t<1$, put $s=(1-t)x$ to obtain
$$
M_{X_n}(t)=\frac1{(n-1)!}\int_0^\infty x^{n-1}e^{-(1-t)x}\,dx=\frac{\Gamma(n)}{(n-1)!(1-t)^n}=\boxed{(1-t)^{-n}}.
$$
Here $\Gamma(n)=(n-1)!$, obtained by repeated <integration by parts>. For $t\geq1$ the defining integral diverges.

Each $Y_i$ has <moment-generating function> $(1-t)^{-1}$, so <independence> gives
$$
M_{\sum_{i=1}^nY_i}(t)=(1-t)^{-n}\quad(t<1).
$$
The <uniqueness theorem for moment-generating functions> applies when the functions are finite on a <neighborhood> of zero. Hence \b[the sum has the same distribution as $X_n$], a <Gamma distribution> of shape $n$ and rate one, with the displayed <probability density function> in the source.