Random variable X with uniform distribution over the interval (2,7) Find the moment generating function and use it to obtain the mean and variance of X.
I was able to find the mgf which is given by: (e^7t - e^2t)/5t and the first derivative of the mgf, but division by 0 occurs when I substitute t = 0. How can I go about doing this using ONLY the mgf?
in order to simplify the calculation you can first shift the rv calculating mean and variance of
$$Y=X-2$$
which is uniform in $(0;5)$
thus
$$M_Y(t)=\frac{e^{5t}-1}{5t}$$
$$M'_Y(t)=\frac{25e^{5t}\cdot t-5e^{5t}+5}{25t^2}$$
this expression in $t=0$ gives $\frac{0}{0}$ thus apply de l'Hôpital obtaining
$$\left.\frac{125e^{5t}}{50}\right]_{t=0}=2.5$$
thus
$$\mathbb{E}[X]=\mathbb{E}[Y]+2=4.5$$
as desired
Similar reasoning for variance but observe that $\mathbb{V}[X]=\mathbb{V}[Y]$