# Variance Formula of Random Variable With Example

Probability / Wednesday, September 26th, 2018

# Variance

One of the important measures of variability of a random variable is variance. Let X is a random variable with probability distribution f(x) and mean µ. Then the variance of X is defined as
$V(X)=E\left[ {{\left( X-\mu \right)}^{2}} \right]$
$i.e.,V(X)={{\sum\limits_{x}{\left( x-\mu \right)}}^{2}}f(x),\text{Where X is discrete}$
$i.e.,V(X)=\int\limits_{-\infty }^{\infty }{{{\left( x-\mu \right)}^{2}}f(x)dx,\text{Where X is continuous}}$
Variance is also denoted as σ2.

Note:

The positive square root of variance is known as standard deviation. It is denoted as σ.
$i.e.,\sigma =\sqrt{V(X)}$
For the computation of variance we use the formula
$V(X)=E\left[ {{\left( X-\mu \right)}^{2}} \right]=E\left[ {{X}^{2}}+{{\mu }^{2}}-2\mu X \right]$
$i.e.,V(X)=E\left[ {{X}^{2}} \right]+{{\mu }^{2}}-2\mu E\left[ X \right]$
$i.e.,V(X)=E\left[ {{X}^{2}} \right]+{{\mu }^{2}}-2\mu .\mu =E\left[ {{X}^{2}} \right]-{{\mu }^{2}}$
$Hence,V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}$

## Properties

1. If X is a random variable, then V(aX+b) = a2V(X), where a and b are constants.

Proof:
$Let,T=aX+b,then$
$E\left[ T \right]=E\left[ aX+b \right]$
$\Rightarrow T-E\left[ T \right]=aX+b-E\left[ aX+b \right]$
$\Rightarrow T-E\left[ T \right]=aX+b-aE\left[ X \right]-b$
$\Rightarrow T-E\left[ T \right]=a\left[ X-E\left[ X \right] \right]$
Squaring both sides, we get
$\Rightarrow {{\left[ T-E\left[ T \right] \right]}^{2}}={{a}^{2}}{{\left[ X-E\left[ X \right] \right]}^{2}}$
Taking expectation of both sides, we get
$\Rightarrow E{{\left[ T-E\left[ T \right] \right]}^{2}}={{a}^{2}}E{{\left[ X-E\left[ X \right] \right]}^{2}}$
$\therefore V\left( T \right)={{a}^{2}}V\left( X \right),\left[ as,V(X)=E\left[ {{\left( X-\mu \right)}^{2}} \right] \right]$
$\therefore V\left( aX+b \right)={{a}^{2}}V\left( X \right)$
2. Variance of constant is zero, i.e., V(c) = 0

 Example 01

Suppose X is discrete random variable and let the probability mass function of X is given by
$f(x)=\frac{1}{m},x=1,2,3,…,m$
$f(x)=0,~~otherwise$
Where m is a fixed integer larger than 1. Find the variance of X.

Solution:
We know that,
$V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}$
So, let’s calculate
$E\left[ X \right]=\sum\nolimits_{x=1}^{m}{xf(x)=\frac{1}{m}\sum\nolimits_{x=1}^{m}{x}}$
$\Rightarrow E\left[ X \right]=\frac{1}{m}\left\{ \frac{m\left( m+1 \right)}{2} \right\}=\frac{m+1}{2}$
$E\left[ {{X}^{2}} \right]=\sum\limits_{x=1}^{m}{{{x}^{2}}f(x)=\frac{1}{m}\sum\limits_{x=1}^{m}{{{x}^{2}}}}$
$\Rightarrow E\left[ {{X}^{2}} \right]=\frac{1}{m}\left\{ \frac{m\left( m+1 \right)\left( 2m+1 \right)}{6} \right\}$
$\therefore E\left[ {{X}^{2}} \right]=\frac{\left( m+1 \right)\left( 2m+1 \right)}{6}$
Therefore,
$V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}$
$\Rightarrow V(X)=\frac{\left( m+1 \right)\left( 2m+1 \right)}{6}-\frac{{{\left( m+1 \right)}^{2}}}{4}$
$\therefore V(X)=\frac{{{m}^{2}}-1}{12}$

 Example 02

A random variable X has the following probability function

 X -2 -1 0 1 2 3 f(X) 0.1 K 0.2 2k 0.3 k

Find the value of k and calculate mean, variance and standard deviation.

Solution:
We know that, Σ f(x) = 1
i.e., 0.1 + k + 0.2 + 2k + 0.3 +k = 1
i.e., 4k + 0.6 = 1
therefore, k = 0.1
$\text{Now mean}=E\left( x \right)=\sum{x.f(x)}$
$\Rightarrow E\left( x \right)=(-2)(0.1)+(-1)(0.1)+1(0.2)+2(0.3)+3(0.1)$
$\therefore E\left( x \right)=0.8$
$Variance=V\left( X \right)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}$
$E\left[ {{X}^{2}} \right]=\sum{{{x}^{2}}f(x)}$
$\Rightarrow E\left[ {{X}^{2}} \right]=(4)(0.1)+(1)(0.1)+(1)(0.2)+(4)(0.3)+9(0.1)$
$\therefore E\left[ {{X}^{2}} \right]=2.8$
$\therefore V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}=2.8-0.16=2.64$
$\therefore \text{Standard Deviation}=\sigma =\sqrt{V(X)}=\sqrt{2.64}=1.62$

 Example 03

Let the random variable X have the distribution:
$P(X=0)=P(X=2)=p$
$P(X=1)=1-2p,for~0\le p\le \frac{1}{2}$
Then for what value of p is the Variance of X is maximum.

Solution:
Here, X = 0, 1, 2
$E\left( X \right)=0(p)+1\left( 1-2p \right)+2(p)=1$
$E\left[ {{X}^{2}} \right]=0(p)+1\left( 1-2p \right)+4(p)=1+2p$
$\therefore V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}=2p$
So, for 0 ≤ p ≤ ½ Var(X) is maximum when p = ½
That is V(X) = 2p = 2(1/2) =1

 Example 04

Suppose that the random variable X is uniformly distributed over [a, b]. Then we have E(X) = (a+b)/2. Compute V(X).

Solution:
$\text{We have},\text{ E}\left( \text{X} \right)\text{ }=\frac{\left( a+b \right)}{2}$
$E\left( {{X}^{2}} \right)=\int\limits_{a}^{b}{{{x}^{2}}}\frac{1}{b-a}dx=\frac{1}{b-a}\left[ \frac{{{b}^{3}}-{{a}^{3}}}{3} \right]$
$\therefore V(X)=E\left[ {{X}^{2}} \right]-E{{\left[ X \right]}^{2}}$
$\Rightarrow V(X)=\frac{1}{b-a}\left[ \frac{{{b}^{3}}-{{a}^{3}}}{3} \right]-\frac{{{\left( a+b \right)}^{2}}}{4}$
After a simple computation
$V(X)=\frac{{{\left( b-a \right)}^{2}}}{12}$

<< Previous     Next>>

;