A random variable is a variable whose value can change under different outcomes. For example, the result of flipping a standard 6-sided die is a random variable that takes each of the values from 1 to 6 with probability
There are two types of random variables, discrete and continuous. The die-roll example from above is an example of a discrete random variable, since the variable can take on a finite number of discrete values. Choosing a random real number from the interval would be an example of a continuous random variable.
A random variable contains a lot of information. We can summarize this information to get an idea of the behaviour of the random variable over the long term. The expected value of a random variable is the weighted average of all possible outcomes. For example, if we roll a standard 6-sided die, there are 6 possibilities, each occurring with probability , so the expected value is . We often denote the expected value of a random variable by or More generally, the formula is
If we have two random variables and and constants then the following properties of expectation hold:
This is known as linearity of expectation, and holds even when and are not independent events. Each of these statements follow easily from the definition of expected value, and will be elaborated on in future.
1. There are 2 bags and balls numbered 1 through 5 are placed in them. From each bag, 1 ball is removed. What is the expected value of the total of the two balls?
Consider the following table, which lists the possible values of the first ball in the first row, and the possible values of the second ball in the second row. Each entry on the table is obtained by finding the sum of these two values.
Let be the random variable denoting the sum of these values. Then, we can see that the probability distribution of is given by
As such, this allows us to calculate
(*) How can we use the linearity of expectation to arrive at the result quickly?
2. six-sided dice are rolled. What is the expected number of times is rolled?
To determine the expected number of times 5 is rolled, we can define to be the random variable for the number of times a is rolled, and to be the random variable for die rolling a . It is easy to see that We have , so by the linearity of expectation, . so .
Note: We can also answer this question by noting that since the probability of getting each number is equal, the expected number of times we get each number is the same, and the sum of these expectations is , so for each number the expectation is .
Mathematically speaking, let be the random variable for the number of times is rolled out of throws. By symmetry, we know that is a constant. Since there are a total of results, hence . This gives us