Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Attempting to calculate the moment generating function for the uniform distrobution I run into ah non-convergent integral.

Building of the definition of the Moment Generating Function

$ M(t) = E[ e^{tx}] = \left\{ \begin{array}{l l} \sum\limits_x e^{tx} p(x) &\text{if $X$ is discrete with mass function $p( x)$}\\ \int\limits_{-\infty}^\infty e^{tx} f( x) dx &\text{if $X$ is continuous with density $f( x)$} \end{array}\right. $

and the definition of the Uniform Distribution

$ f( x) = \left\{ \begin{array}{l l} \frac{ 1}{ b - a} & a < x < b\\ 0 & otherwise \end{array} \right. $

I end up with a non-converging integral

$\begin{array}{l l} M( t) &= \int\limits_{-\infty}^\infty e^{tx} f(x) dx\\ &= \int\limits_{-\infty}^\infty e^{tx} \frac{ 1}{ b - a} dx\\ &= \left. e^{tx} \frac{ 1}{ t(b - a)} \right|_{-\infty}^{\infty}\\ &= \infty \end{array}$

I should find $M(t) = \frac{ e^{tb} - e^{ta}}{ t(b - a)}$, what am I missing here?

share|cite|improve this question
up vote 5 down vote accepted

The density is $\frac{1}{b-a}$ on $[a,b]$ and zero elsewhere. So integrate from $a$ to $b$. Or else integrate from $-\infty$ to $\infty$, but use the correct density function. From $-\infty$ to $a$, for example, you are integrating $(0)e^{tx}$. The same is true from $b$ to $\infty$. The only non-zero contribution comes from $$\int_a^b\frac{1}{b-a}e^{tx}\,dx.$$

share|cite|improve this answer

The limits of integration are not correct. You should integrate from $a$ to $b$ not from $-\infty$ to $+\infty$.

share|cite|improve this answer
This answer might be correct, but it must be clear that the mistake was in writing $$\int_{-\infty}^{+\infty}e^{tx}{1\over b-a}\,dx$$ while $$\int_{-\infty}^{+\infty}e^{tx}f(x)\,dx$$ is correct. – G. Sassatelli May 18 '15 at 11:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.