\[\begin{align*}

\forall x f(x)\ge 0 \\

\sum_x f(x) = 1

\end{align*}\]

In the case of a continuous random variable, the second formula would be expressed as an integral:

$$\int_x f(x)dx = 1$$

There are some differences between discrete and continuous random variables but the ideas behind them are the same.

To motivate the idea behind an expected value, we'll begin with a more familiar concept: an average.

#### The Average

At some point in time, most folks have taken an average of a number of figures. I'm going to begin by motivating the idea behind the generalized notion of an average.

Suppose I have the following numbers:

$$1, 4, 6, 6, 7, 12, 12, 12, 14, 21$$

The average (which I'll denote as $\mu=E(X)$) of these numbers can be found by summing them up and dividing by the number of numbers that are there (in this case 10):

\[\begin{align*}

\mu = E(X) &= \frac{1+4+6+6+7+12+12+12+14+21}{10} \\

&= \frac{95}{10} \\

&= 9.5

\end{align*}\]

Now I'm going to rewrite the expression above by noting a couple of things. First there are 2 6's and 3 12's. And second, by the distributive property, we are dividing each number by 10 (or multiplying by $\frac{1}{10}$. This makes the expression look like this:

$$\mu = E(X) = 1\frac{1}{10}+4\frac{1}{10} + 6\frac{2}{10}+7\frac{1}{10}+12\frac{3}{10}+14\frac{1}{10}+21\frac{1}{10}$$

In a sense what we've done is we've said that each number has an equal probability with the exception of 6 and 12 since they occurred 2 times and 3 times respectively. We can now construct a probability function from all of those probabilities. This will be a discrete probability function:

\[\begin{align*}

f(x) = \left\{

\begin{array}{ll}

\frac{1}{10} & : x \in \{1,4,7,14,21 \} \\

\frac{2}{10} &: x = 6 \\

\frac{3}{10} &: x = 12 \\

0 &: \text{otherwise}

\end{array}

\right\}

\end{align*}\]

What this says assigns a probability of 10% to the numbers 1, 4, 7, 14 or 21, a probability of 20% to 6, a probability of 30% for 12 and 0% probability for all other numbers.

Note that, this is a probability function since it's never negative and the probabilities add up to 1 ($5 \times 10\% + 20\% + 30\% = 100\%$).

Hence we can rewrite this formula for average (symbolically) as:

$$\mu = E(X) = \sum_x xf(x)$$

This will be our generalized definition of average (or mean) for a discrete random variable. For a continuous random variable our "sum" will just be an integral:

$$\mu = E(X) = \int_x xf(x)dx$$

So that's our "average".

__Example 1__:

Suppose that I have two fair dice. I'm interested in the probabilities of the sum of the two dice. Now each die has 6 sides with the numbers 1 through 6 on them. So there are a total of $6 \times 6 = 36$ possible combinations of rolls. So here are all of the possible combinations:

So there is only 1 way to get a 2, 2 ways to get a 3 and so on. So our probability function will look like:

\[\begin{align*}

f(x) = \left\{

\begin{array}{ll}

\frac{1}{36} & : x =2\\

\frac{2}{36} &: x = 3 \\

\frac{3}{36} &: x = 4 \\

\frac{4}{36} &: x = 5 \\

\frac{5}{36} &: x = 6 \\

\frac{6}{36} &: x = 7 \\

\frac{5}{36} &: x = 8 \\

\frac{4}{36} &: x = 9 \\

\frac{3}{36} &: x = 10 \\

\frac{2}{36} &: x = 11 \\

\frac{1}{36} &: x = 12 \\

0 &: \text{otherwise}

\end{array}

\right\}

\end{align*}\]

The average will then be:

\[\begin{align*}

\mu = E(X) &= \sum_x xf(x) \\

&= 2\frac{1}{36} + 3\frac{2}{36} +4\frac{3}{36} +5\frac{4}{36} +6\frac{5}{36} + 7\frac{6}{36} +8\frac{5}{36} +9\frac{4}{36} +10\frac{3}{36} +11\frac{2}{36} +12\frac{1}{36} \\

&= 7

\end{align*}\]

So the average roll of the die will give us 7.

#### Expected Value

Now I've already introduced the notation of $E(X)$. This notation is expressed as "the expected value of $X$". We're going to generalize the notion of expected value as follows for discrete and continuous random variables generally:

\[\begin{align*}

E[g(x)] &= \sum_x g(x)f(x) \\

E[g(x)] &= \int_x g(x)f(x)dx

\end{align*}\]

At times we might be interested in a more complicated expected value so the generalization above will be useful.

__Example 2__:

Consider our dice game. Suppose that every time you rolled you received \$3 multiplied by the quantity your rolled. So if you roll an 8 you win \$24. What's the expected value of your winnings?

\[\begin{align*}

E[g(x)] &= \sum_x \$3 xf(x) \\

&= \$3\times 2\frac{1}{36} + \$3\times 3\frac{2}{36} +\$3\times 4\frac{3}{36} +\$3\times 5\frac{4}{36} +\$3\times 6\frac{5}{36} + \$3\times 7\frac{6}{36} \\

&\text{ } +\$3\times 8\frac{5}{36} +\$3\times 9\frac{4}{36} +\$3\times 10\frac{3}{36} +\$3\times 11\frac{2}{36} +\$3\times 12\frac{1}{36} \\

&= \$21

\end{align*}\]

__Expected Value is a Linear Operator__

In the above example you may have noticed that the expected value of your winnings (\$21) was just \$3 multiplied by the expected value of the roll of the dice (7). This is not just a coincidence. Expected Value is a linear operator. What that means is for constants $a$ and $b$ and a function $g(x)$:

$$E[a g(x) + b] = aE[g(x)] + b$$

The fact that Expected Value is a linear operator follows from the fact that both summation and integration are linear operators.

It should also be noted here that the expected value of a constant is just the constant:

$$E(c) = c$$

This would be the case if we were just multiplying the probabilities by a constant. Since the probabilities sum up to 1, we would just be multiplying the constant by 1.

__Example 3__:

Consider in Example 2 but suppose it costs us \$20 to play the game. Then what we want to find is this:

$$E[\$3X - \$20]$$

Since Expected Value is a linear operator and (from example 1) we know that $E(X)=7$ we can expand this out:

\[\begin{align*}

E[\$3X - \$20] &= \$3E(X) - \$20 \\

&= \$3 \times 7 - \$20 \\

&= \$1

\end{align*}\]

So on average, you would win about \$1 playing this game.

Back to the Table of Contents

## No comments:

## Post a Comment

Some common OpenID URLs (no change to URL required):

Google: https://www.google.com/accounts/o8/id

Yahoo: http://me.yahoo.com/