The Formula for Expected Value

Formula for expected value
Formula for expected value. Discrete case is above and continuous case is below. C.K. Taylor

One natural question to ask about a probability distribution is, "What is its center?" The expected value is one such measurement of the center of a probability distribution. Since it is measuring the mean, it should come as no surprise that this formula is derived from that of the mean.

Before getting started we may wonder, "What is the expected value?" Suppose that we have a random variable associated to a probability experiment.

Let's say that we repeat this experiment over and over again. Over the long run of several repetitions of the same probability experiment, if we averaged out all of our values of the random variable, we would obtain the expected value. 

In what follows we will see how to use the formula for expected value. We will look at both the ​discrete and continuous settings and see the similarities and differences in the formulas.​

The Formula for a Discrete Random Variable

We start by analyzing the discrete case. Given a discrete random variable X, suppose that it has values x1, x2, x3, . . . xn, and respective probabilities of p1, p2, p3, . . . pn. This is saying that the probability mass function for this random variable gives f(xi) = pi

The expected value of X is given by the formula:

E(X) = x1p1 + x2p2 + x3p3 + . . . + xnpn.

If we use the probability mass function and summation notation, then we can more compactly write this formula as follows, where the summation is taken over the index i:

E(X) = Σ xif(xi).

This version of the formula is helpful to see because it also works when we have an infinite sample space. This formula can also easily be adjusted for the continuous case.

An Example

Flip a coin three times and let X be the number of heads. The random variable is discrete and finite.

  The only possible values that we can have are 0, 1, 2 and 3. This has probability distribution of 1/8 for X = 0, 3/8 for X = 1, 3/8 for X = 2, 1/8 for X = 3. Use the expected value formula to obtain:

(1/8)0 + (3/8)1 + (3/8)2 + (1/8)3 = 12/8 = 1.5

In this example, we see that, in the long run, we will average a total of 1.5 heads from this experiment.  This makes sense with our intuition as one-half of 3 is 1.5.

The Formula for a Continuous Random Variable

We now turn to a continuous random variable, which we will denote by X.  We will let the probability density function of  be given by the function f(x). 

The expected value of X is given by the formula:

E(X) = ∫ x f(x) dx.

Here we see that the expected value of our random variable is expressed as an integral. 

Applications of Expected Value

There are many applications for the expected value of a random variable. This formula makes an interesting appearance in the St. Petersburg Paradox.

Format
mla apa chicago
Your Citation
Taylor, Courtney. "The Formula for Expected Value." ThoughtCo, Jan. 31, 2018, thoughtco.com/formula-for-expected-value-3126269. Taylor, Courtney. (2018, January 31). The Formula for Expected Value. Retrieved from https://www.thoughtco.com/formula-for-expected-value-3126269 Taylor, Courtney. "The Formula for Expected Value." ThoughtCo. https://www.thoughtco.com/formula-for-expected-value-3126269 (accessed May 20, 2018).