

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 1
Once we have defined a random variable for our experiment, we can statistically analyze the outcomes of the experiment.
For example, we can ask: What is the average value (called the expected value ) of a random variable when the experiment is carried out a large number of times?
Can we just calculate the arithmetic mean across all possible values of the random variable?
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 2
No, we cannot, since it is possible that some outcomes are more likely than others.
For example, assume the possible outcomes of an experiment are 1 and 2 with probabilities of 0.1 and 0.9, respectively.
Is the average value 1.5?
No, since 2 is much more likely to occur than 1, the average must be larger than 1.5.
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 3
Instead, we have to calculate the weighted sum of all possible outcomes, that is, each value of the random variable has to be multiplied with its probability before being added to the sum.
In our example, the average value is given by 0.1โ 1 + 0.9โ 2 = 0.1 + 1.8 = 1.9.
Definition: The expected value (or expectation) of the random variable X(s) on the sample space S is equal to:
E(X) = โsโSp(s)X(s).
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 4
Example: Let X be the random variable equal to the sum of the numbers that appear when a pair of dice is rolled. There are 36 outcomes (= pairs of numbers from 1 to 6). The range of X is {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}.
Are the 36 outcomes equally likely? Yes, if the dice are not biased. Are the 11 values of X equally likely to occur? No, the probabilities vary across values.
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 5
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 6
This means that if we roll the dice many times, sum all the numbers that appear and divide the sum by the number of trials, we expect to find a value of 7.
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 7
Theorem: If X and Y are random variables on a sample space S, then E(X + Y) = E(X) + E(Y). Furthermore, if Xi, i = 1, 2, @, n with a positive integer n, are random variables on S, then E(X 1 + X 2 + @ + Xn) = E(X 1 ) + E(X 2 ) + @ + E(Xn). Moreover, if a and b are real numbers, then E(aX + b) = aE(X) + b.
Note the typo in the textbook!
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 8
Knowing this theorem, we could now solve the previous example much more easily:
Let X 1 and X 2 be the numbers appearing on the first and the second die, respectively.
For each die, there is an equal probability for each of the six numbers to appear. Therefore, E(X 1 ) = E(X 2 ) = (1 + 2 + 3 + 4 + 5 + 6)/6 = 7/2.
We now know that E(X 1 + X 2 ) = E(X 1 ) + E(X 2 ) = 7.
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 9
We can use our knowledge about expected values to compute the average-case complexity of an algorithm. Let the sample space be the set of all possible inputs a 1 , a 2 , @, an, and the random variable X assign to each aj the number of operations that the algorithm executes for that input. For each input aj, the probability that this input occurs is given by p(aj). The algorithmโs average-case complexity then is:
E(X) = โj=1,@,np(aj)X(aj)
April 2, 2013 Applied Discrete MathematicsWeek 10: Advanced Counting 10
However, in order to conduct such an average-case analysis, you would need to find out: