As we mentioned earlier, the theory of continuous random variables is very similar to the theory of discrete
random variables. In particular, usually summations are replaced by integrals and PMFs are replaced by PDFs.
The proofs and ideas are very analogous to the discrete case, so sometimes we state the results without
mathematical derivations for the purpose of brevity.
Remember that the expected value of a discrete random variable can be obtained as
EX=xk∈RX∑xkPX(xk).
Now, by replacing the sum by an integral and PMF by PDF, we can write the definition of expected value of
a continuous random variable as
EX=∫−∞∞xfX(x)dx
Example
Let X∼Uniform(a,b). Find EX.
Solution
As we saw, the PDF of X is given by
\begin{equation}
\nonumber f_X(x) = \left{
\begin{array}{l l}
\frac{1}{b-a} & \quad a < x < b\
0 & \quad x < a \textrm{ or } x > b
\end{array} \right.
\end{equation}
so to find its expected value, we can write
This result is intuitively reasonable: since X is uniformly distributed over the interval
[a,b], we expect its mean to be the middle point, i.e., EX=2a+b.
Example
Let X be a continuous random variable with PDF
\begin{equation}
\nonumber f_X(x) = \left{
\begin{array}{l l}
2x & \quad 0 \leq x \leq 1\
0 & \quad \text{otherwise}
\end{array} \right.
\end{equation}
Find the expected value of X.
Solution
We have
EX
=∫−∞∞xfX(x)dx
=∫01x(2x)dx
=∫012x2dx
=32.
Expected Value of a Function of a Continuous Random Variable
Remember the law of the unconscious statistician (LOTUS) for discrete random variables:
E[g(X)]=xk∈RX∑g(xk)PX(xk)(4.2)
Now, by changing the sum to integral and changing the PMF to PDF we will obtain the similar formula for
continuous random variables.
Law of the unconscious statistician (LOTUS) for continuous random variables:
E[g(X)]=∫−∞∞g(x)fX(x)dx(4.3)
As we have seen before, expectation is a linear operation, thus we always have
E[aX+b]=aEX+b, for all a,b∈R, and
E[X1+X2+...+Xn]=EX1+EX2+...+EXn, for any set of random variables X1,X2,...,Xn.
Example
Let X be a continuous random variable with PDF
\begin{equation}
\nonumber f_X(x) = \left{
\begin{array}{l l}
x+\frac{1}{2} & \quad 0 \leq x \leq 1\
0 & \quad \text{otherwise}
\end{array} \right.
\end{equation}
Find E(Xn), where n∈N.
Solution
Using LOTUS we have
E[Xn]
=∫−∞∞xnfX(x)dx
=∫01xn(x+21)dx
=[n+21xn+2+2(n+1)1xn+1]01
=2(n+1)(n+2)3n+4.
Variance
Remember that the variance of any random variable is defined as
Var(X)=E[(X−μX)2]=EX2−(EX)2.
So for a continuous random variable, we can write
Var(X)
=E[(X−μX)2]=∫−∞∞(x−μX)2fX(x)dx
=EX2−(EX)2=∫−∞∞x2fX(x)dx−μX2
Also remember that for a,b∈R, we always have
Var(aX+b)=a2Var(X).(4.4)
Example
Let X be a continuous random variable with PDF
\begin{equation}
\nonumber f_X(x) = \left{
\begin{array}{l l}
\frac{3}{x^4} & \quad x \geq 1\
0 & \quad \text{otherwise}
\end{array} \right.
\end{equation}
Find the mean and variance of X.