Just like for discrete variables, the variance and the standard deviation measures the spread of the random variable around its mean. The formulas remain unchanged for the continuous random variable.

\[ \sigma^{2}=Var(X)=E[X^{2}]-E[X]^{2} \] \[ Var(cX)=c^{2}Var(X) \] \[ Var(aX+bY)=a^{2}Var(X)+b^{2}Var(Y) \]

Example

Find the variance of the random variable \(Y\), where \(f_{Y}(y)=3(1-y)^{2},0<y<1\)

\[ E(Y) = \int_{0}^{1}y * 3(1-y)^{2}\ dy \\ = 3 \int_{0}^{1}y*(1-2y+y^{2})\ dy \\ = 3 \int_{0}^{1}y-2y^{2}+y^{3}\ dy \\ = 3 \bigg[ \frac{y^{2}}{2}-\frac{2y^{3}}{3}+\frac{y^{4}}{4}\bigg|_{0}^{1} = \frac{1}{4} \]

\[ E(Y^{2}) = 3 \int_{0}^{1}y^{2} * 3(1-y)^{2}\ dy \\ = 3 \int_{0}^{1}y^{2}-2y^{3}+y^{4}\ dy = \frac{1}{10} \]

Using R functions

f.Ey <- function(y){y*3*(1-y)^2}
f.Eysq <- function(y){y^2*3*(1-y)^2}

(E_Y <- integrate(f.Ey, lower=0, upper = 1))
## 0.25 with absolute error < 2.8e-15
(E_Ysq <- integrate(f.Eysq, lower=0, upper = 1))
## 0.1 with absolute error < 1.1e-15
(Var_Y = E_Ysq$value - (E_Y$value)^2)
## [1] 0.0375

You try it

A random variable \(Y\) is described by the pdf \(f_{Y}(y)=2y\) for \(0\leq y\leq 1\). What is the standard deviation of \(3Y+2\)

Note that \(Var(3Y+2) = 9Var(Y)\).

First find \(E(Y)\) \[ E(Y) = \int^{1}_{0}y*2y\ dy = \frac{2}{3} \]

Then find \(E(Y^{2})\) \[ E(Y^{2}) = \int_{0}^{1}y^{2}*2y\ dy = \frac{1}{2} \\ \]

Then use

\[Var(Y) = E[Y^{2}]-E[Y]^{2}= \frac{1}{2} - (\frac{2}{3})^{2} = \frac{1}{18}\]

So that means:

\[9Var(Y) = 9*\frac{1}{18} = \frac{1}{2}\]

and the standard deviation is

\[ \sigma_{3Y+2} = \sqrt{\frac{1}{2}} = \frac{1}{\sqrt{2}} \]