Deriving mean through MGF for discrete uniform distribution

574 Views Asked by At

The MGF of a discrete uniform distribution is given as

$$M_X(t) = \frac{e^t(1-(e^t)^k)}{k(1-e^t)}$$

Looking for $E(X)$, I am computing $$M_X'(t) =\frac{(k(e^t-1)-1)e^{(kt+t)}+e^t}{ k(e^t-1)^2}$$

which doesn't make sense cause denominator will become zero and mean should be $$E(X)=\frac{k+1}{2}$$

How do I get the mean from the MGF? I can't seem to find out where I went wrong.