I am trying to derive the first two moment of the geometric distribution using moment generator.
$$M_x(t) = E[e^{tX}]$$
$$\sum_{k=1}^{\infty}(1-p)^{k-1}pe^{tk}$$
$$=\frac{p}{1-p}\sum_{k=1}^{\infty}(1-p)^ke^{tk}$$ $$=\frac{p}{1-p}((1-(1-p)e^t)^{-1}-1)$$
I cannot prove the last equality, since I can't use the geometric summation for $e^{tx}$ since its divergent
How do you usually go about this?
Actually, you can: $(1-p)^ke^tk=[(1-p)e^t]^k$. Now it's geometric. The only thing you need is that $(1-p)e^t<1$ which is equivalent to $t\leq -\log(1-p)$. So the MGF exists for such $t$ but diverges elsewhere.