7. Expectation, Averages, Variability 93
7.6 Problems on Chapter 7
7.1 Let X have probability function f (x) = ( 1
2x for x = 2, 3, 4, 5, or 6
11/40 for x = 1 Find the mean and vari-ance for X.
7.2 A game is played where a fair coin is tossed until the first tail occurs. The probability x tosses will be needed is f (x) = .5x; x = 1, 2, 3, · · · . You win $2xif x tosses are needed for x = 1, 2, 3, 4, 5 but lose $256 if x > 5. Determine your expected winnings.
7.3 Diagnostic tests. Consider diagnostic tests like those discussed above in the example of Section 7.3 and in Problem 15 for Chapter 4. Assume that for a randomly selected person, P (D) = .02, P (R|D) = 1, P r(R|D) = .05, so that the inexpensive test only gives false positive, and not
false negative, results.
Suppose that this inexpensive test costs $10. If a person tests positive then they are also given a more expensive test, costing $100, which correctly identifies all persons with the disease. What is the expected cost per person if a population is tested for the disease using the inexpensive test followed, if necessary, by the expensive test?
7.4 Diagnostic tests II. Two percent of the population has a certain condition for which there are two diagnostic tests. Test A, which costs $1 per person, gives positive results for 80% of persons with the condition and for 5% of persons without the condition. Test B, which costs $100 per person, gives positive results for all persons with the condition and negative results for all persons without it.
(a) Suppose that test B is given to 150 persons, at a cost of $15,000. How many cases of the condition would one expect to detect?
(b) Suppose that 2000 persons are given test A, and then only those who test positive are given test B. Show that the expected cost is $15,000 but that the expected number of cases detected is much larger than in part (a).
7.5 The probability that a roulette wheel stops on a red number is 18/37. For each bet on “red” you win the amount bet if the wheel stops on a red number, and lose your money if it does not.
(a) If you bet $1 on each of 10 consecutive plays, what is your expected winnings? What is your expected winnings if you bet $10 on a single play?
(b) For each of the two cases in part (a), calculate the probability that you made a profit (that is, your “winnings” are positive, not negative).
7.6 Slot machines. Consider the slot machine discussed above in Problem 16 for Chapter 4. Suppose that the number of each type of symbol on wheels 1, 2 and 3 is as given below:
Wheel
Symbols 1 2 3
Flower 2 6 2
Dog 4 3 3
House 4 1 5
If all three wheels stop on a flower, you win $20 for a $1 bet. If all three wheels stop on a dog, you win $10, and if all three stop on a house, you win $5. Otherwise you win nothing.
Find your expected winnings per dollar spent.
7.7 Suppose that n people take a blood test for a disease, where each person has probability p of having the disease, independent of other persons. To save time and money, blood samples from k people are pooled and analyzed together. If none of the k persons has the disease then the test will be negative, but otherwise it will be positive. If the pooled test is positive then each of the k persons is tested separately (so k + 1 tests are done in that case).
(a) Let X be the number of tests required for a group of k people. Show that E(X) = k + 1 − k(1 − p)k.
(b) What is the expected number of tests required for n/k groups of k people each? If p = .01, evaluate this for the cases k = 1, 5, 10.
(c) Show that if p is small, the expected number of tests in part (b) is approximately n(kp + k−1), and is minimized for k .
= p−1/2.
7.8 A manufacturer of car radios ships them to retailers in cartons of n radios. The profit per radio is $59.50, less shipping cost of $25 per carton, so the profit is $ (59.5n− 25) per carton. To promote sales by assuring high quality, the manufacturer promises to pay the retailer $200X2if X radios in the carton are defective. (The retailer is then responsible for repairing any defective radios.) Suppose radios are produced independently and that 5% of radios are defective. How many radios should be packed per carton to maximize expected net profit per carton?
7.9 Let X have a geometric distribution with probability function f (x) = p(1 − p)x; x = 0, 1, 2, ...
(a) Calculate the m.g.f. M (t) = E¡ etX¢
, where t is a parameter.
(b) Find the mean and variance of X.
(c) Use your result in (b) to show that if p is the probability of “success” (S) in a sequence of Bernoulli trials, then the expected number of trials until the first S occurs is 1/p. Explain why this is “obvious”.
7.10 Analysis of Algorithms: Quicksort. Suppose we have a set S of distinct numbers and we wish to sort them from smallest to largest. The quicksort algorithm works as follows: When n = 2 it just compares the numbers and puts the smallest one first. For n > 2 it starts by choosing a random “pivot” number from the n numbers. It then compares each of the other n− 1 numbers with the pivot and divides them into groups S1(numbers smaller than the pivot) and ¯S1( numbers bigger than the pivot). It then does the same thing with S1and ¯S1as it did with S, and repeats this recursively until the numbers are all sorted. (Try this out with, say n = 10 numbers to see how
it works.) In computer science it is common to analyze such algorithms by finding the expected number of comparisons (or other operations) needed to sort a list. Thus, let
Cn= expected number of comparisons for lists of length n (a) Show that if X is the number of comparisons needed,
Cn= Xn
i=1
E(X| initial pivot is ith smallest number) µ1
n
¶
(b) Show that
E(X|initial pivot is ith smallest number) = n − 1 + Ci−1+ Cn−i and thus that Cnsatisfies the recursion (note C0= C1 = 0)
Cn= n − 1 + 2 n
n−1X
k=1
Ck n = 2, 3, . . .
(c) Show that
(n + 1)Cn+1= 2n + (n + 2)Cn n = 1, 2, . . . (d) (Harder) Use the result of part (c) to show that for large n,
Cn+1
n + 1 ∼ 2 log (n + 1)
(Note: an∼ bnmeans an/bn→ 1 as n → ∞) This proves a result from computer science which says that for Quicksort, Cn∼ O(n log n).
7.11 Find the distributions that corresponds to the following moment-generating functions:
(a) M (t) = 3e−t1−2 (b) M (t) = e2(et−1)
7.12 Find the moment generating function of the discrete uniform distribution X on{a, a + 1, ..., b};
P (X = x) = 1
b − a + 1, for x = a, a + 1, ..., b.
What do you get in the special case a = b and in the case b = a + 1? Use the moment generating function in these two cases to confirm the expected value and the variance of X.
7.13 Let X be a random variable taking values in the set{0, 1, 2} with moments E(X) = 1, E(X2) = 3/2.
(a) Find the moment generating function of X (b) Find the first six moments of X
(c) Find P (X = i), i = 0, 1, 2.
(d) Show that any probability distribution on{0, 1, 2} is completely determined by its first two moments.