# Expectation and Variance

Contents

## Summary

• Expected value of a random variable $\mu \quad =\quad E(X)\quad =\quad \sum { x.P(X\quad =\quad x) }$
• Expected value of f(X) is defined by $E(f\left( x \right) )\quad =\quad \sum { f\left( x \right) p(X\quad =\quad x) }$
• Var(X) is defined by ${ \sigma }^{ 2 }\quad =\quad Var(X)\quad =\quad E({ X }^{ 2 })\quad -\quad (E{ (X) }^{ 2 })$
• Standard deviation is the under root of variance

#### Expected value

When we describe probability, we think of taking chances e.g if I bought a lottery ticket, what are the chances that I am going to win the lottery.

If there are 10000 lottery tickets in a shop, and the winning amount is considered to be $2000. The probability of winning is considered $\frac { 1 }{ 1000 }$ for each ticket. Hence, the expectation per ticket is considered to be $\frac { 2000 }{ 10000 } \quad =\quad 0.2$ which is thought of as an average win per ticket. This can be considered as the expected value of a random variable.The expected value should be regarded as the average value. It is calculated by summing the product of the value of the random variable and its associated probability, taken over all of the values of the random variable. $\mu \quad =\quad E(X)\quad =\quad \sum { x.P(X\quad =\quad x) }$ #### Example #2 Roll a die. If the side that comes up is odd, you win the$ equivalent of that side. If it is even, you lose \$4.

Since a die has 6 faces, we are calculating the probability by keeping that in mind.

$X\quad =\quad 1\quad P(X\quad =\quad 1)\quad =\quad P(\left\{ 1 \right\} )\quad =\quad \frac { 1 }{ 6 }$

(probability of throwing a 1 is $\frac { 1 }{ 6 }$ as 1 is present only once and there are total 6 sides of a die, the rest will be done similarly.)

$X\quad =\quad 3\quad P(X\quad =\quad 1)\quad =\quad P(\left\{ 3 \right\} )\quad =\quad \frac { 1 }{ 6 }$

$X\quad =\quad 5\quad P(X\quad =\quad 1)\quad =\quad P(\left\{ 5 \right\} )\quad =\quad \frac { 1 }{ 6 }$

$X\quad =\quad -4\quad P(X\quad =\quad 1)\quad =\quad P(\left\{ 2,\quad 4,\quad 6 \right\} )\quad =\quad \frac { 3 }{ 6 } \quad =\quad \frac { 1 }{ 2 }$

$E(X)\quad =\quad 1\quad \ast \quad \frac { 1 }{ 6 } \quad +\quad 3\quad \ast \quad \frac { 1 }{ 6 } \quad +\quad 5\quad \ast \quad \frac { 1 }{ 6 } \quad +\quad (-4)\quad \ast \quad \frac { 1 }{ 2 }$

$=\quad \frac { 1 }{ 6 } \quad +\quad \frac { 1 }{ 2 } \quad +\quad \frac { 5 }{ 6 } \quad -\quad 2$

$=\quad -\frac { 1 }{ 2 }$       Ans

#### Example #3

Random variable X has the following probability function, find the expected value.

 X 0 1 2 3 P(X = x) 0.1 0.2 0.4 0.3

E(X) = 0 0.1 + 1 x 0.2 + 2 x 0.4 + 3 x 0.3
= 1.9   Ans

#### Expected Value of a Function of X

Let X be a random variable assuming the values of X with corresponding probabilities for any function f, the mean or expected value of f(X) is defined by:

$E(f\left( x \right) )\quad =\quad \sum { f\left( x \right) p(X\quad =\quad x) }$

#### Example #4

Q. Roll a fair die. Let X = number of dots on the side that comes up. Calculate $E({ x }^{ 2 })$.

$E({ x }^{ 2 })\quad =\quad { 1 }^{ 2 }p(1)\quad +\quad { 2 }^{ 2 }p(2)\quad +\quad { 3 }^{ 2 }p(3)\quad +\quad { 4 }^{ 2 }p(4)\quad +\quad { 5 }^{ 2 }p(5)\quad +\quad { 6 }^{ 2 }p(6)$

$=\quad \frac { 1 }{ 6 } \quad \times \quad (1\quad +\quad 4\quad +\quad 9\quad +\quad 16\quad +\quad 25\quad +\quad 36)$

$=\quad \frac { 91 }{ 6 }$

There are also some rules of calculating expected value that you need to keep in mind.

1. The expected value of a constant is just the constant, example E(x) = x
2. Adding a constant value, c, to each term increases the mean, or expected value, by the constant: E(X + c) = E(X) + c
3. Multiplying a random variable by a constant value, c, multiplies the expected value or mean by that constant: E(cX ) = cE(X)
4. The expected value or mean of the sum of two random variables is the sum of the means. This is also known as the additive law of expectation.
5. E(X + Y) = E(X) + E(Y)

#### Variance

Variance reflects the spread or dispersion of a distribution, if X is a random variable with mean E(X), then the variance of X, denoted by Var(X), is defined by:

${ \sigma }^{ 2 }\quad =\quad Var(X)\quad =\quad E({ X }^{ 2 })\quad -\quad (E{ (X) }^{ 2 })$

#### Example #5

Using the example above

Roll a fair die. Let X = number of dots on the side that comes up.

We will calculate the variance.

We already know that our $E({ X }^{ 2 })\quad =\quad \frac { 91 }{ 6 }$

We will now calculate E(X) to get $\frac { 1 }{ 6 } (1\quad +\quad 2\quad +\quad 3\quad +\quad 4\quad +\quad 5\quad +\quad 6)\quad =\quad \frac { 21 }{ 6 } \quad =\quad \frac { 7 }{ 2 }$

Now plugging the value in the formula we get:

${ \sigma }^{ 2 }\quad =\quad \frac { 91 }{ 6 } \quad -\quad { (\frac { 7 }{ 2 } ) }^{ 2 }$

$=\quad\frac { 35 }{ 12 }$

Inorder to find the standard deviation, all you have to do is take the under root of the variance.

Just like the expected value, variance also has some rules, like the following:

1. The variance of a constant is zero.
2. Adding a constant value, c, to a random variable does not change the variance, because the expectation (mean) increases by the same amount.
3. Multiplying a random variable by a constant increases the variance by the square of the constant.