14.4  Special Expectations
14.4  Special ExpectationsThe special expectations, such as the mean, variance, and moment generating function, for continuous random variables are just a straightforward extension of those of the discrete case. Again, all we need to do is replace the summations with integrals.
 Expected Value

The expected value or mean of a continuous random variable \(X\) is:
\(\mu=E(X)=\int^{+\infty}_{\infty} xf(x)dx\)
 Variance

The variance of a continuous random variable \(X\) is:
\(\sigma^2=Var(X)=E[(X\mu)^2]=\int^{+\infty}_{\infty}(x\mu)^2 f(x)dx\)
Alternatively, you can still use the shortcut formula for the variance, \(\sigma^2=E(X^2)\mu^2\), with:
\(E(X^2)=\int^{+\infty}_{\infty} x^2 f(x)dx\)
 Standard Deviation

The standard deviation of a continuous random variable \(X\) is:
\(\sigma=\sqrt{Var(X)}\)
 Moment Generating Function

The moment generating function of a continuous random variable \(X\), if it exists, is:
\(M(t)=\int^{+\infty}_{\infty} e^{tx}f(x)dx\)
for \(h<t<h\).
As before, differentiating the moment generating function provides us with a way of finding the mean:
\(E(X)=M'(0)\)
and the variance:
\(\text{Var}(X)=M^{\prime\prime}(0)\left(M^\prime(0)\right)^2\)
Example 142 Revisited Again
Suppose \(X\) is a continuous random variable with the following probability density function:
\(f(x)=3x^2, \qquad 0<x<1\)
What is the mean of \(X\)?
Solution
What is the variance of \(X\)?
Solution
Example 148
Suppose \(X\) is a continuous random variable with the following probability density function:
\(f(x)=xe^{x}\)
for \(0<x<\infty\). Use the moment generating function \(M(t)\) to find the mean of \(X\).
Solution
The moment generating function is found by integrating:
\(M(t)=E(e^{tX})=\int^{+\infty}_0 e^{tx} (xe^{x})dx=\int^{+\infty}_0 xe^{x(1t)}dx\)
Because the upper limit is \(\infty\), we can rewrite the integral using a limit:
\(M(t)=\lim\limits_{b \to \infty} \int_0^b xe^{x(1t)}dx\)
Now, you might recall from your study of calculus that integrating this beast is going to require integration by parts. If you need to integrate
\(\int udv\)
integration by parts tells us that the integral is:
\(\int udv=uv\int vdu\)
In our case, let's let:
\(u=x\) and \(dv=e^{x(1t)}\)
Differentiating \(u\) and integrating \(dv\), we get:
\(du=dx\) and \(v=\dfrac{1}{1t}e^{x(1t)}\)
Therefore, using the integration by parts formula, we get:
\(M(t)=\lim\limits_{b \to \infty} \left\{\left[\dfrac{1}{1t}xe^{x(1t)}\right]_{x=0}^{x=b}\left(\dfrac{1}{1t}\right)\int_0^be^{x(1t)}dx\right\}\)
Evaluating the first term at \(x=0\) and \(x=b\), and integrating the last term, we get:
\(M(t)=\lim\limits_{b \to \infty}\left\{\left[\dfrac{1}{1t} be^{b(1t)}\right]+\left(\dfrac{1}{1t}\right) \left[\left(\dfrac{1}{1t}\right)e^{x(1t)}\right]_{x=0}^{x=b} \right\}\)
which, upon evaluating the last term at \(x=0\) and \(x=b\), as well as simplifying and distributing the limit as \(b\) goes to infinity, we get:
\(M(t)=\lim\limits_{b \to \infty}\left[\dfrac{1}{1t} \dfrac{b}{e^{b(1t)}}\right]\left(\dfrac{1}{1t}\right)^2 \lim\limits_{b \to \infty}(e^{b(1t)}1)\)
Now, taking the limit of the second term is straightforward:
\(\lim\limits_{b \to \infty}(e^{b(1t)}1)=1\)
Therefore:
\(M(t)=\lim\limits_{b \to \infty}\left[\dfrac{1}{1t} \dfrac{b}{e^{b(1t)}}\right]+\left(\dfrac{1}{1t}\right)^2\)
Now, if you take the limit of the first term as \(b\) goes to infinity, you can see that we get infinity over infinity! You might recall that in this situation we need to use what is called L'HÃ´pital's Rule. It tells us that we can find the limit of that first term by first differentiating the numerator and denominator separately. Doing just that, we get:
\(M(t)=\lim\limits_{b \to \infty}\left[\dfrac{1}{1t} \times \dfrac{1}{(1t)e^{b(1t)}}\right]+\left(\dfrac{1}{1t}\right)^2\)
Now, if you take the limit as \(b\) goes to infinity, you see that the first term approaches 0. Therefore (finally):
\(M(t)=\left(\dfrac{1}{1t}\right)^2\)
as long as \(t<1\). Now, with the hard work behind us, using the m.g.f. to find the mean of \(X\) is a straightforward exercise: