# Gamma distribution as the sum of exponential random variables

Let $X_1, X_2, \ldots X_k$ be i.i.d r.v.s from the exponential distribution. Let their pdf be: $f(s) = \lambda e^{-\lambda s}$.

The pdf of the gamma distribution can be got by considering the $k-$convolution product of these pdfs.

However, when I try to derive the expression of the cdf from first principles I seem to be making an error. But for some reason I just cannot spot the problem and any help will be greatly appreciated.

The following is what I've got so far:

Let $T(k) = \sum_{i=1}^k X_i$. We want an expression for $P(T(k) \leq t)$, which we denote as $G_k(t)$.

Now, $$G_k(t) = \int_{0}^{\infty} f(s)G_{k-1}(t-s) ds \qquad (\ast)$$

In particular,$$G_2(t) = \int_{0}^{\infty} f(s)G_{1}(t-s) ds = \int_{0}^{\infty} \lambda e^{-\lambda s} \left( \int_{0}^{t-s} \lambda e^{-\lambda x}dx \right) ds$$

But, this seems to give: $$\int_{0}^{\infty} \lambda e^{-\lambda s} \left( 1- e^{-\lambda(t-s)}\right) ds = 1 - \lambda e^{-\lambda t}\int_{0}^{\infty}ds$$

$(\ast)$

$$G_k(t) = P\left(\sum_{i=1}^k X_i \leq t\right) = \int_{R} f_{X_1, X_2, \ldots X_k} (s_1, s_2, \ldots s_k) dS$$

where $f_{X_1, X_2, \ldots X_k}$ is the joint distribution of $k$ exponentials and $R$ is the region: $$R = \left\{ (x_1, x_2, \ldots x_k): \sum x_i \leq t, x_i \geq 0 \right\}$$

Due to independence and Fubini's theorem, this can re-written as:

$$\int_{0}^{\infty} f_{X_1}(s)\left(\int_{R'_s}f_{X_2, \ldots X_k} (s_2, \ldots s_k)dS'\right)ds$$

where the region $R'_s$ is: $$R'_s = \left\{ (x_2, \ldots x_k): \sum x_i \leq t-s, x_i \geq 0 \right\}$$

... Oh got it. If $s$ exceeds $t$ at least one $x_i$ will be negative.

Upper limit in the integral expression of $G_{k}(t)$ should be $t$.

$G_{k}(t) = \int\limits_{0}^{t} f(s) G_{k-1}(t-s)ds$

This will make the last expression to be

$\int\limits_0^t \lambda e^{-\lambda s}(1-e^{-\lambda(t-s)})ds = 1 - e^{-\lambda t} - \lambda t e^{-\lambda t}$