Evaluating mean of uniform distribution using mgf

2k Views Asked by At

For the uniform [0,1] R.V, the mgf is $M(s)=\frac{e^s-1}{s}$ and the derivative is $M'(s)=\frac{se^s-e^s+1}{s^2}$ to calculate the mean we have to take the limit $\lim_{s\to0}M'(s)$. Why is it that for this distribution we have to take the limit and cannot evaluate at 0. Whereas for other distributions we can evaluate at 0 directly. Is this an issue that arises because of swapping the derivative with the integral because $$\frac{d}{ds}\int e^{sx}f(x)dx\big|_{s=0}= \int\frac{d}{ds} e^{sx}f(x)dx\big|_{s=0}= \int xe^{sx}f(x)dx\big|_{s=0}=\int xf(x)dx $$ seems to imply that we should be able to evaulate at 0 for all distributions including the uniform. So the trouble of not being able to evaluate at 0 should not arise.

Edit: If we assume that $s\ne0$, why then are we allowed to perform the differentiation and evaluate at 0.

2

There are 2 best solutions below

0
On

You can just do that. The problem is that the derivative is not what you intuitively think it is (i.e. mere substitution). Indeed, for example, $M(0)=\mathbb{E}(e^{0\cdot X})=e^0=1$ and so the function $M$ has to be defined by parts: $M(s)=\frac{e^s-1}{s}$ if $s\neq 0$ and $M(0)=1$. Similarly,

$$M'(0)=\lim_{h\to 0}\frac{M(h)-M(0)}{h}=\lim_{h\to 0}\frac{e^h-1-h}{h^2}=\frac{1}{2}.$$

Thus you also have to write $M'$ by parts, but it is still well behaved.

0
On

The MGF isn't $\frac{e^s-1}{s}$ if $s=0$ (double-check your derivation of the MGF to see where $s\ne0$ is assumed); instead, $M(0)=\Bbb\exp(0X)=1$. Differentiating from first principles, the mean is$$M^\prime(0):=\lim_{h\to0}\frac{(e^h-1)/h-1}{h}=\lim_{h\to0}\frac{e^h-1-h}{h^2}.$$