# Understand Probability & Expected Value

One fair question to ask about probability distributions is, “What is the center?” The expected value is one of the central measurements of the probability distribution. Since it measures the mean, it is not surprising that this formula is derived from the mean. To establish a starting point, we must answer the question, “What is the expected value?” Suppose we have a random variable associated with a probability experiment. Suppose we repeat this experiment over and over again. In the long run of several repetitions of the same probability experiment, if we average all our values ​​of the random variable , we will obtain the expected value.

In the following we will see how to use the formula for the expected value. We’ll look at discrete and continuous arrangements and look at the similarities and differences in the formulas.
Formulas for Discrete Random Variables

We start by analyzing the discrete cases. Given a discrete random variable X , suppose it has the values ​​x 1 , x 2 , x 3 ,. . . x n , and their respective probabilities are p 1 , p 2 , p 3 ,. . . p n . This says that the probability mass function for this random variable gives f ( x i ) = p i .

The expected value of X is given by the formula:

E ( X ) = x 1 p 1 + x 2 p 2 + x 3 p 3 +. . . + x n p n .

Using the probability mass function and summation notation allows us to write this formula more succinctly as follows, where the sum is taken from index i :

E ( X ) = x i f ( x i ).

This version of the formula is very helpful to look at as it also works when we have an infinite sample space. This formula can also be easily adapted for the continuous case.
An example

Flip the coin three times and let X be the number of heads. The random variable X is discrete and finite. The only possible values ​​we can have are 0, 1, 2 and 3. This has a 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 get:

(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 get a total average of 1.5 heads from this experiment. This makes sense to our intuition because half of 3 is 1.5.
Formulas for Continuous Random Variables

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

The expected value of X is given by the formula:

E ( X ) = xf ( x ) d x.

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

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