# Expected value

In probability and statistics, the expected value is the theoretical mean (this assumes that the experiment is run a relatively large number of times) of a random variable, X. For example, the experiment of rolling a fair six-sided die has six possible outcomes, all of which have an equal probability of occurring:

{1, 2, 3, 4, 5, 6}

The expected value of rolling a die is calculated as the sum of the products of each outcome multiplied by their respective probabilities: In this particular experiment, all of the outcomes of rolling the die have an equal probability of occurring, but this is not always the case. The expected value takes the different weights of outcomes into consideration. For example, if instead the six-sided die were weighted such that certain outcomes were more probable (e.g. 1 has a 1/4 chance of occurring instead of 1/6), the equation would be adjusted to account for that. There are many different formulas for calculating the expected value depending on the types of events involved. The roll of a die is an example of a discrete random variable.

## Expected value for discrete random variables

Discrete random variables involve events that are countable. Events such as the flip of a coin or the roll of a die are discrete random variables. Given that X is a random variable such that its elements, {x1, x2, x3, ..., xn} have probabilities P(x1), P(x2), P(x3), ..., P(xn), the expected value, E, of a discrete random variable can be found using the following formula: Example

Let X be the random variable that represents the set: {1, 3, 3, 3, 3, 3, 4, 4, 5, 5}. Given that one of the numbers is selected randomly from the set, we can expect to select the four possible numbers with the following probabilities:

 X P(X) 1 3 4 5 0.1 0.5 0.2 0.2

Find the expected value.

 E(X)   Thus, the expected value is 3.4.

Note that in cases where P(xi) is the same for all of the possible outcomes, the expected value formula can be simplified to the arithmetic mean μ of the random variable, where n is the number of outcomes: ## Expected value for continuous random variables

Continuous random variables have an infinite number of outcomes within the range of its possible values. For example, the range of heights of students in a 10th grade class may be 55-75 inches, but the exact height of each individual student can take on any value within that range, be it 58 in, 62.3123 in, 74.5 in, and so on.

When calculating the expected value of a continuous random variable, it is not possible to use the exact probabilities of each outcome as we would with a discrete random variable. Instead, the probability density function (PDF) of the continuous random variable is used. A PDF provides the relative likelihood of the value of the random variable equalling that of the sample. Given that X is a continuous random variable with a PDF of f(x), its expected value can be found using the following formula: Example

Let X be a continuous random variable, X, with the following PDF, f(x): Find the expected value.

 E(X)     Thus, the expected value is 5/3.

## Finding variance using expected value

The expected value can be used to find variance using the following formula: Example

Using the previous example in the continuous random variable section, find the variance.

In the previous example, we already found the expected value of the continuous random variable. E(X) = 5/3, so: To find the variance, we need to compute E(X2):

 E(X2)    Thus, the variance is: 