Question

A random variable X has the discrete uniform distributionf(x;k)=\frac{1}{k},x=1,2...,kf(x;k)=0, elsewhere.Show that the moment-generating function of X is M_(x)(t)=\frac{e^{t}(1-e^{kt})}{k(1-e^{t})}.

Random variables

A random variable X has the discrete uniform distribution
$$f(x;k)=\frac{1}{k},x=1,2...,k$$
$$f(x;k)=0,$$ elsewhere.
Show that the moment-generating function of X is
$$\displaystyle{M}_{{{x}}}{\left({t}\right)}={\frac{{{e}^{{{t}}}{\left({1}-{e}^{{{k}{t}}}\right)}}}{{{k}{\left({1}-{e}^{{{t}}}\right)}}}}$$.

$$\displaystyle{M}_{{x}}{\left({t}\right)}={E}{\left({e}^{{{t}{X}}}\right)}=\sum_{{x}}{e}^{{{t}{x}}}{f{{\left({x}\right)}}}={\sum_{{{x}-{1}}}^{{k}}}{e}^{{{t}{x}}}\cdot{\frac{{{1}}}{{{k}}}}$$
$$\displaystyle{\frac{{{e}^{{{t}}}}}{{{k}}}}{\sum_{{{x}-{0}}}^{{{k}-{1}}}}{\left({e}^{{{t}}}\right)}^{{{x}}}={\frac{{{e}^{{{t}}}}}{{{k}}}}\cdot{\frac{{{e}^{{{k}{t}}}-{1}}}{{{e}^{{{t}}}-{1}}}}$$
$$\displaystyle{\frac{{{e}^{{{t}}}{\left({1}-{e}^{{{k}{t}}}\right)}}}{{{k}{\left({1}-{e}^{{{t}}}\right)}}}}$$