Existence of the moment generating function for a discrete uniform distribution

moment-generating-functionsprobability theory

Problem: A random variable $X$ is said to have a discrete uniform distribution over $[1, N]$, with probability mass
function as
\begin{split}
P(X = x) = \begin{cases}
\frac{1}{N} &\text{for } x =1, 2, \dots, N\\
0 & \text{otherwise}.
\end{cases}
\end{split}

Check if mgf exists. If exist, then find the form of mgf.

My Approach: Note that $X \sim U(1,N)$. Thus $E[e^{tX}]$ becomes
$$ E[e^{tX}] = \sum_{x} e^{tx} \cdot P(X=x) = \sum_{i=1}^N e^{ti} \cdot \frac{1}{N} = \frac{1}{N} \cdot \Bigg( {\sum_{i=0}^N e^{ti}} \Bigg) – \frac{1}{N} = {\frac{e^{t(N+1)}-e^t}{N(e^t-1)}} $$

Now let's recall the condition for the MGF to exist:

The moment generating function (MGF) of a random variable $X$ is a function $M_X(t)$ defined as
$$ M_X(t) = E[e^{tX}] $$
We say that MGF of $X$ exists, if there exists a positive constant $a$ such that $M_X(t)$ is finite for all $t\in[−a,a]$.

The doubt: The denominator of the mgf becomes $0$ at $t=0$. But this shouldn't happen since I know the mgf of the discrete uniform distribution exists (and is exactly of the form which I found). Where did I go wrong?

Any sort of help will be highly appreciated! 🙂

Best Answer

At the step $$ \mathbb E[e^{tX}] = \frac1N\sum_{i=1}^N e^{ti} $$ you have already shown that $\mathbb E[e^{tX}]$ exists, since it is a finite sum of finite quantities.

However, when you simplify that expression to $$ \mathbb E[e^{tX}] = {\frac{e^{t(N+1)}-e^t}{N(e^t-1)}} $$ you are assuming that $e^t \ne 1$. When $e^t = 1$, you are turning $\underbrace{1 + 1 + \dots + 1}_{N \text{ terms}}$ into $\frac{1^{N+1}-1}{1-1}$, which is not true (and your new simplified form is $\frac00$).

(In general, the identity $1 + r + r^2 + \dots + r^k = \frac{r^{k+1}-1}{r-1}$ only holds when $r \ne 1$.)

What you can say instead is that $\mathbb E[e^{tX}]$ exists, and satisfies $$ \mathbb E[e^{tX}] = \begin{cases} {\frac{e^{t(N+1)}-e^t}{N(e^t-1)}} & t \ne 0 \\ 1 & t=0.\end{cases} $$

Related Question