In class, my professor computed the density of a gamma random variable by taking the derivative of its CDF, but he skipped many steps. I am trying to go through the derivation carefully but cannot reproduce his final result.
Let $k$ be the shape and $\mu$ be the scale. Then the CDF for a gamma random variable $T$ is
$$ F(t) = 1 - \sum_{i=0}^{k-1} \frac{e^{-\mu t} (\mu t)^{i}}{i!} $$
Using the product rule, I get
$$ \begin{align} f(t) &= \frac{\partial}{\partial t} F(t) \\ &= \frac{\partial}{\partial t} \Big( 1 - \sum_{i=0}^{k-1} \frac{e^{-\mu t} (\mu t)^{i}}{i!} \Big) \\ &= - \sum_{i=0}^{k-1} \frac{\partial}{\partial t} \Big( \frac{e^{-\mu t} (\mu t)^{i}}{i!} \Big) \\ &= - \sum_{i=0}^{k-1} \frac{1}{i!} \frac{\partial}{\partial t} \Big( e^{-\mu t} (\mu t)^{i} \Big) \end{align} $$
where
$$ \frac{\partial}{\partial t} \Big( e^{-\mu t} (\mu t)^{i} \Big) = e^{-\mu t} (-\mu)(\mu t)^i + e^{-\mu t} i (\mu t)^{i-1} $$
Putting everything together, we get
$$ f(t) = \sum_{i=0}^{k-1} \frac{\mu e^{-\mu t} (\mu t)^i}{i!} - \sum_{i=0}^{k-1} \frac{e^{-\mu t} (\mu t)^{i-1}}{(i-1)!} $$
But here I am stuck. I know that
$$ f(t) = \frac{\mu e^{-\mu t} (\mu t)^{k-1}}{(k-1)!} $$
but am not sure how to get there.
a) note that the second sum starts from $i=1$;
that's because when you derivate $\frac{(\mu t)^i}{i!}$ you get $\frac{i(\mu t)^{i-1}}{i!}$ which is $0$ for $i=0$, and only for $1 \le i$ becomes $\frac{(\mu t)^{i-1}}{(i-1)!}$
b) factor out $e^{-\mu t}$
c) you are left with a telescoping sum