# How do you find the mean of the random variable x?

## X= 0,1,2,3 P(x) = 0.15, 0.35, 0.45, 0.05 What is the variance and standard deviation of the random variable $x$? What is the standard deviation of the random variable $x$?

Feb 5, 2017

Mean: $\mu = 1.4$
Variance: ${\sigma}^{2} = 0.64$
Standard deviation: $\sigma = 0.8$

#### Explanation:

We are given that $X$ could take on the values $\left\{0 , 1 , 2 , 3\right\}$ with respective probabilities $\left\{0.15 , 0.35 , 0.45 , 0.05\right\}$. Since $X$ is discrete, we can imagine $X$ as a 4-sided die that's been weighted so that it lands on "0" 15% of the time, "1" 35% of the time, etc.

The question is, when we roll this die once, what value should we expect to get? Or perhaps, if we roll the die a huge number of times, what should the average value of all those rolls be?

Well, of the 100% of the rolls, 15% should be "0", 35% should be "1", 45% should be "2", and 5% should be "3". If we add all these together, we'll have what's known as a weighted average.

In fact, if we placed these relative weights at their matching points on a number line, the point that would "balance the scale" is the mean that we seek.

This is a good way to interpret the mean of a discrete random variable. Mathematically, the mean $\mu$ is the sum of all the possible values, weighted by their probabilities. As a formula, this is:

$\mu = E \left[X\right] = {\sum}_{\text{all } x} \left[x \cdot P \left(X = x\right)\right]$

In our case, this works out to be:

$\mu = \left[0 \cdot P \left(0\right)\right] + \left[1 \cdot P \left(1\right)\right] + \left[2 \cdot P \left(2\right)\right] + \left[3 \cdot P \left(3\right)\right]$
$\textcolor{w h i t e}{\mu} = \left(0\right) \left(0.15\right) + \left(1\right) \left(0.35\right) + \left(2\right) \left(0.45\right) + \left(3\right) \left(0.05\right)$
$\textcolor{w h i t e}{\mu} = \text{ "0" "+" "0.35" "+" "0.9" "+" } 0.15$
$\textcolor{w h i t e}{\mu} = 1.4$

So, over a large number of rolls, we would expect the average roll value to be $\mu = 1.4$.

The variance is a measure of the "spread" of $X$. Going back to our "balanced number line" idea, if we moved our weights out from our "centre of gravity" $\mu$ so that they are twice as far away, $\mu$ itself wouldn't change, but the variance would increase, by a factor of 4.

That's because the variance ${\sigma}^{2}$ of a random variable is the average squared distance between each possible value and $\mu$. (We square the distances so that they're all positive.) As a formula, this is:

${\sigma}^{2} = \text{Var} \left(X\right) = E \left[{\left(X - \mu\right)}^{2}\right]$

Using a bit of algebra and probability theory, this becomes

${\sigma}^{2} = E \left[{X}^{2}\right] - {\mu}^{2}$
color(white)(sigma^2)=sum_("all x")x^2P(X=x)" "-" "mu^2

For this problem, we get

${\sigma}^{2} = \left[{0}^{2} \cdot P \left(0\right)\right] + \left[{1}^{2} \cdot P \left(1\right)\right] + \left[{2}^{2} \cdot P \left(2\right)\right]$
$\textcolor{w h i t e}{{\sigma}^{2} =} + \left[{3}^{2} \cdot P \left(3\right)\right] \text{ "-" } {1.4}^{2}$
$\textcolor{w h i t e}{{\sigma}^{2}} = \left(0\right) \left(0.15\right) + \left(1\right) \left(0.35\right) + \left(4\right) \left(0.45\right) + \left(9\right) \left(0.05\right)$
$\textcolor{w h i t e}{{\sigma}^{2} =} - 1.96$
$\textcolor{w h i t e}{{\sigma}^{2}} = 0.64$

So the average squared distance between each possible $X$ value and $\mu$ is ${\sigma}^{2} = 0.64$.

Standard deviation is easy—it's just the square root of the variance. But, why bother with it if it's pretty much the same? Because the units of ${\sigma}^{2}$ are the square of the units of $X$. If $X$ measures time, for example, its variance is in units of ${\text{(time)}}^{2}$, which really doesn't help us if we're trying to establish a "margin of error".

That's where standard deviation comes in. The standard deviation $\sigma$ of $X$ is a measure of how far from $\mu$ we should expect $X$ to be. It's simply

$\sigma = \sqrt{{\sigma}^{2}}$

For this problem, that works out to be

$\sigma = \sqrt{0.64} = 0.8$

So every time we pick an $X$, the expected distance between $\mu$ and that $X$ is $\sigma = 0.8$. And since $\sigma$ is in the same "units" as $X$, it's much more easy to use to help us construct a margin of error. (See: confidence intervals.)