Introduction
Before moving onto the main topic, let us discuss random variables and their types. A random variable is a term where the output depends on the random phenomenon. The three types of random variables are singular, continuous, discrete.
A random variable with a countable number of possible values is called a discrete random variable. The discrete random variables can have either a finite set or a countable number of discrete variables. The probability of every value in the discrete random variable is between 0 to 1. The sum of all the probabilities is equal to 1. For example, the number of children in a family, the number of chairs in a room, etc.
Expectation
The expectation is also an expected value of a random variable. It tells you about the behavior of a random variable. We can say expectation as an average value of the random variables, where each value is weighted according to its probability.
Suppose X is a discrete random variable with values x1, x2, x3, x4, … xn. The probability of every xi is P(xi) (1 ≤ i ≤ n). The expected value of the random variable X is E(X), defined by
Example 1. Find E(X) for the random variable X given in the table below:
Value of X | 1 | 5 | 8 |
p.m.f | 3/10 | 1/2 | 2/10 |
Solution: E(X) = 1*(3/10) + 5*(1/2) + 8*(2/10) = 4.4
Example 2. Roll two unbiased 6-sided dice. You win $800 if the sum is 3 and lose $50 otherwise. How much do you expect to win on average per trial?
Solution: The probability of getting sum = 3 is 2/36 because you can either get (1, 2) or (2, 1) to get a sum equal to 3.
Then the probability of not getting the sum = 3 will be 34/36.
If you play N times, you can expect N*(2/36) of getting sum equal to 3 and N*(34/36) of getting sum not equal to 3.
Thus your expected winnings will be:
800*(2/36)N - 50*(34/36)N = -$2.78N
Now divide it by N to get the expected average per trial.
-$2.78 will be the expected average per trial.
Example 3. Suppose we have a die with six faces marked with four 2’s, one 3, and one 6. What would you expect the average of 12000 rolls to be?
Solution: The probability of getting 2 is 4/6.
The probability of getting 3 is 1/6.
The probability of getting 6 is 1/6.
Value of X | 2 | 3 | 6 |
Expected count | (4/6)*12000 = 8000 | (1/6)*12000 = 2000 | (1/6)*12000 = 2000 |
Expected average of these 12000 rolls will be
(8000*2 + 2000*3 + 2000*6) / 12000 = 2.83
Expected average of 12000 rolls = 2.83