text
stringlengths
1
7.76k
source
stringlengths
17
81
54 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES a car to pass on a highway, or the times between emissions of particles from a radioactive source, are simulated by a sequence of random numbers, each of which is chosen by computing (−1/λ) log(rnd), where 1/λ is the average time between cars or emissions. Write a program to simulate the times between cars when the average time between cars is 30 seconds. Have your program compute an area bar graph for these times by breaking the time interval from 0 to 120 into 24 subintervals. On the same pair of axes, plot the function f(x) = (1/30)e−(1/30)x. Does the function fit the bar graph well? 10 In Exercise 9, the distribution came “out of a hat.” In this problem, we will again consider an experiment whose outcomes are not equally likely. We will determine a function f(x) which can be used to determine the probability of certain events. Let T be the right triangle in the plane with vertices at the points (0, 0), (1, 0), and (0, 1). The experiment consists of picking a point at random in the interior of T, and recording only the x-coordinate of the point. Thus, the sample space is the set [0, 1], but the outcomes do not seem to be equally likely. We can simulate this experiment by asking a computer to return two random real numbers in [0, 1], and recording the first of these two numbers if their sum is less than 1. Write this program and run it for 10,000 trials. Then make a bar graph of the result, breaking the interval [0, 1] into 10 intervals. Compare the bar graph with the function f(x) = 2 −2x. Now show that there is a constant c such that the height of T at the x-coordinate value x is c times f(x) for every x in [0, 1]. Finally, show that Z 1 0 f(x) dx = 1 . How might one use the function f(x) to determine the probability that the outcome is between .2 and .5? 11 Here is another way to pick a chord at random on the circle of unit radius. Imagine that we have a card table whose sides are of length 100. We place coordinate axes on the table in such a way that each side of the table is parallel to one of the axes, and so that the center of the table is the origin. We now place a circle of unit radius on the table so that the center of the circle is the origin. Now pick out a point (x0, y0) at random in the square, and an angle θ at random in the interval (−π/2, π/2). Let m = tan θ. Then the equation of the line passing through (x0, y0) with slope m is y = y0 + m(x −x0) , and the distance of this line from the center of the circle (i.e., the origin) is d = y0 −mx0 √ m2 + 1 . We can use this distance formula to check whether the line intersects the circle (i.e., whether d < 1). If so, we consider the resulting chord a random chord.
prob_Page_62_Chunk4901
2.2. CONTINUOUS DENSITY FUNCTIONS 55 This describes an experiment of dropping a long straw at random on a table on which a circle is drawn. Write a program to simulate this experiment 10000 times and estimate the probability that the length of the chord is greater than √ 3. How does your estimate compare with the results of Example 2.6? 2.2 Continuous Density Functions In the previous section we have seen how to simulate experiments with a whole continuum of possible outcomes and have gained some experience in thinking about such experiments. Now we turn to the general problem of assigning probabilities to the outcomes and events in such experiments. We shall restrict our attention here to those experiments whose sample space can be taken as a suitably chosen subset of the line, the plane, or some other Euclidean space. We begin with some simple examples. Spinners Example 2.7 The spinner experiment described in Example 2.1 has the interval [0, 1) as the set of possible outcomes. We would like to construct a probability model in which each outcome is equally likely to occur. We saw that in such a model, it is necessary to assign the probability 0 to each outcome. This does not at all mean that the probability of every event must be zero. On the contrary, if we let the random variable X denote the outcome, then the probability P( 0 ≤X ≤1) that the head of the spinner comes to rest somewhere in the circle, should be equal to 1. Also, the probability that it comes to rest in the upper half of the circle should be the same as for the lower half, so that P  0 ≤X < 1 2  = P 1 2 ≤X < 1  = 1 2 . More generally, in our model, we would like the equation P(c ≤X < d) = d −c to be true for every choice of c and d. If we let E = [c, d], then we can write the above formula in the form P(E) = Z E f(x) dx , where f(x) is the constant function with value 1. This should remind the reader of the corresponding formula in the discrete case for the probability of an event: P(E) = X ω∈E m(ω) .
prob_Page_63_Chunk4902
56 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Figure 2.11: Spinner experiment. The difference is that in the continuous case, the quantity being integrated, f(x), is not the probability of the outcome x. (However, if one uses infinitesimals, one can consider f(x) dx as the probability of the outcome x.) In the continuous case, we will use the following convention. If the set of out- comes is a set of real numbers, then the individual outcomes will be referred to by small Roman letters such as x. If the set of outcomes is a subset of R2, then the individual outcomes will be denoted by (x, y). In either case, it may be more convenient to refer to an individual outcome by using ω, as in Chapter 1. Figure 2.11 shows the results of 1000 spins of the spinner. The function f(x) is also shown in the figure. The reader will note that the area under f(x) and above a given interval is approximately equal to the fraction of outcomes that fell in that interval. The function f(x) is called the density function of the random variable X. The fact that the area under f(x) and above an interval corresponds to a probability is the defining property of density functions. A precise definition of density functions will be given shortly. 2 Darts Example 2.8 A game of darts involves throwing a dart at a circular target of unit radius. Suppose we throw a dart once so that it hits the target, and we observe where it lands. To describe the possible outcomes of this experiment, it is natural to take as our sample space the set Ωof all the points in the target. It is convenient to describe these points by their rectangular coordinates, relative to a coordinate system with origin at the center of the target, so that each pair (x, y) of coordinates with x2+y2 ≤ 1 describes a possible outcome of the experiment. Then Ω= { (x, y) : x2 + y2 ≤1 } is a subset of the Euclidean plane, and the event E = { (x, y) : y > 0 }, for example, corresponds to the statement that the dart lands in the upper half of the target, and so forth. Unless there is reason to believe otherwise (and with experts at the
prob_Page_64_Chunk4903
2.2. CONTINUOUS DENSITY FUNCTIONS 57 game there may well be!), it is natural to assume that the coordinates are chosen at random. (When doing this with a computer, each coordinate is chosen uniformly from the interval [−1, 1]. If the resulting point does not lie inside the unit circle, the point is not counted.) Then the arguments used in the preceding example show that the probability of any elementary event, consisting of a single outcome, must be zero, and suggest that the probability of the event that the dart lands in any subset E of the target should be determined by what fraction of the target area lies in E. Thus, P(E) = area of E area of target = area of E π . This can be written in the form P(E) = Z E f(x) dx , where f(x) is the constant function with value 1/π. In particular, if E = { (x, y) : x2 + y2 ≤a2 } is the event that the dart lands within distance a < 1 of the center of the target, then P(E) = πa2 π = a2 . For example, the probability that the dart lies within a distance 1/2 of the center is 1/4. 2 Example 2.9 In the dart game considered above, suppose that, instead of observ- ing where the dart lands, we observe how far it lands from the center of the target. In this case, we take as our sample space the set Ωof all circles with centers at the center of the target. It is convenient to describe these circles by their radii, so that each circle is identified by its radius r, 0 ≤r ≤1. In this way, we may regard Ωas the subset [0, 1] of the real line. What probabilities should we assign to the events E of Ω? If E = { r : 0 ≤r ≤a } , then E occurs if the dart lands within a distance a of the center, that is, within the circle of radius a, and we saw in the previous example that under our assumptions the probability of this event is given by P([0, a]) = a2 . More generally, if E = { r : a ≤r ≤b } , then by our basic assumptions, P(E) = P([a, b]) = P([0, b]) −P([0, a]) = b2 −a2 = (b −a)(b + a) = 2(b −a)(b + a) 2 .
prob_Page_65_Chunk4904
58 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 0 0.2 0.4 0.6 0.8 1 2 1.5 1 0.5 0 Figure 2.12: Distribution of dart distances in 400 throws. Thus, P(E) =2(length of E)(midpoint of E). Here we see that the probability assigned to the interval E depends not only on its length but also on its midpoint (i.e., not only on how long it is, but also on where it is). Roughly speaking, in this experiment, events of the form E = [a, b] are more likely if they are near the rim of the target and less likely if they are near the center. (A common experience for beginners! The conclusion might well be different if the beginner is replaced by an expert.) Again we can simulate this by computer. We divide the target area into ten concentric regions of equal thickness. The computer program Darts throws n darts and records what fraction of the total falls in each of these concentric regions. The program Areabargraph then plots a bar graph with the area of the ith bar equal to the fraction of the total falling in the ith region. Running the program for 1000 darts resulted in the bar graph of Figure 2.12. Note that here the heights of the bars are not all equal, but grow approximately linearly with r. In fact, the linear function y = 2r appears to fit our bar graph quite well. This suggests that the probability that the dart falls within a distance a of the center should be given by the area under the graph of the function y = 2r between 0 and a. This area is a2, which agrees with the probability we have assigned above to this event. 2 Sample Space Coordinates These examples suggest that for continuous experiments of this sort we should assign probabilities for the outcomes to fall in a given interval by means of the area under a suitable function. More generally, we suppose that suitable coordinates can be introduced into the sample space Ω, so that we can regard Ωas a subset of Rn. We call such a sample space a continuous sample space. We let X be a random variable which represents the outcome of the experiment. Such a random variable is called a continuous random variable. We then define a density function for X as follows.
prob_Page_66_Chunk4905
2.2. CONTINUOUS DENSITY FUNCTIONS 59 Density Functions of Continuous Random Variables Definition 2.1 Let X be a continuous real-valued random variable. A density function for X is a real-valued function f which satisfies P(a ≤X ≤b) = Z b a f(x) dx for all a, b ∈R. 2 We note that it is not the case that all continuous real-valued random variables possess density functions. However, in this book, we will only consider continuous random variables for which density functions exist. In terms of the density f(x), if E is a subset of R, then P(X ∈E) = Z E f(x) dx . The notation here assumes that E is a subset of R for which R E f(x) dx makes sense. Example 2.10 (Example 2.7 continued) In the spinner experiment, we choose for our set of outcomes the interval 0 ≤x < 1, and for our density function f(x) =  1, if 0 ≤x < 1, 0, otherwise. If E is the event that the head of the spinner falls in the upper half of the circle, then E = { x : 0 ≤x ≤1/2 }, and so P(E) = Z 1/2 0 1 dx = 1 2 . More generally, if E is the event that the head falls in the interval [a, b], then P(E) = Z b a 1 dx = b −a . 2 Example 2.11 (Example 2.8 continued) In the first dart game experiment, we choose for our sample space a disc of unit radius in the plane and for our density function the function f(x, y) =  1/π, if x2 + y2 ≤1, 0, otherwise. The probability that the dart lands inside the subset E is then given by P(E) = Z Z E 1 π dx dy = 1 π · (area of E) . 2
prob_Page_67_Chunk4906
60 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES In these two examples, the density function is constant and does not depend on the particular outcome. It is often the case that experiments in which the coordinates are chosen at random can be described by constant density functions, and, as in Section 1.2, we call such density functions uniform or equiprobable. Not all experiments are of this type, however. Example 2.12 (Example 2.9 continued) In the second dart game experiment, we choose for our sample space the unit interval on the real line and for our density the function f(r) =  2r, if 0 < r < 1, 0, otherwise. Then the probability that the dart lands at distance r, a ≤r ≤b, from the center of the target is given by P([a, b]) = Z b a 2r dr = b2 −a2 . Here again, since the density is small when r is near 0 and large when r is near 1, we see that in this experiment the dart is more likely to land near the rim of the target than near the center. In terms of the bar graph of Example 2.9, the heights of the bars approximate the density function, while the areas of the bars approximate the probabilities of the subintervals (see Figure 2.12). 2 We see in this example that, unlike the case of discrete sample spaces, the value f(x) of the density function for the outcome x is not the probability of x occurring (we have seen that this probability is always 0) and in general f(x) is not a probability at all. In this example, if we take λ = 2 then f(3/4) = 3/2, which being bigger than 1, cannot be a probability. Nevertheless, the density function f does contain all the probability information about the experiment, since the probabilities of all events can be derived from it. In particular, the probability that the outcome of the experiment falls in an interval [a, b] is given by P([a, b]) = Z b a f(x) dx , that is, by the area under the graph of the density function in the interval [a, b]. Thus, there is a close connection here between probabilities and areas. We have been guided by this close connection in making up our bar graphs; each bar is chosen so that its area, and not its height, represents the relative frequency of occurrence, and hence estimates the probability of the outcome falling in the associated interval. In the language of the calculus, we can say that the probability of occurrence of an event of the form [x, x + dx], where dx is small, is approximately given by P([x, x + dx]) ≈f(x)dx , that is, by the area of the rectangle under the graph of f. Note that as dx →0, this probability →0, so that the probability P({x}) of a single point is again 0, as in Example 2.7.
prob_Page_68_Chunk4907
2.2. CONTINUOUS DENSITY FUNCTIONS 61 A glance at the graph of a density function tells us immediately which events of an experiment are more likely. Roughly speaking, we can say that where the density is large the events are more likely, and where it is small the events are less likely. In Example 2.4 the density function is largest at 1. Thus, given the two intervals [0, a] and [1, 1 + a], where a is a small positive real number, we see that X is more likely to take on a value in the second interval than in the first. Cumulative Distribution Functions of Continuous Random Variables We have seen that density functions are useful when considering continuous ran- dom variables. There is another kind of function, closely related to these density functions, which is also of great importance. These functions are called cumulative distribution functions. Definition 2.2 Let X be a continuous real-valued random variable. Then the cumulative distribution function of X is defined by the equation FX(x) = P(X ≤x) . 2 If X is a continuous real-valued random variable which possesses a density function, then it also has a cumulative distribution function, and the following theorem shows that the two functions are related in a very nice way. Theorem 2.1 Let X be a continuous real-valued random variable with density function f(x). Then the function defined by F(x) = Z x −∞ f(t) dt is the cumulative distribution function of X. Furthermore, we have d dxF(x) = f(x) . Proof. By definition, F(x) = P(X ≤x) . Let E = (−∞, x]. Then P(X ≤x) = P(X ∈E) , which equals Z x −∞ f(t) dt . Applying the Fundamental Theorem of Calculus to the first equation in the statement of the theorem yields the second statement. 2
prob_Page_69_Chunk4908
62 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES -1 -0.5 0 0.5 1 1.5 2 0.25 0.5 0.75 1 1.25 1.5 1.75 2 f (x) F (x) X X Figure 2.13: Distribution and density for X = U 2. In many experiments, the density function of the relevant random variable is easy to write down. However, it is quite often the case that the cumulative distribution function is easier to obtain than the density function. (Of course, once we have the cumulative distribution function, the density function can easily be obtained by differentiation, as the above theorem shows.) We now give some examples which exhibit this phenomenon. Example 2.13 A real number is chosen at random from [0, 1] with uniform prob- ability, and then this number is squared. Let X represent the result. What is the cumulative distribution function of X? What is the density of X? We begin by letting U represent the chosen real number. Then X = U 2. If 0 ≤x ≤1, then we have FX(x) = P(X ≤x) = P(U 2 ≤x) = P(U ≤√x) = √x . It is clear that X always takes on a value between 0 and 1, so the cumulative distribution function of X is given by FX(x) =    0, if x ≤0, √x, if 0 ≤x ≤1, 1, if x ≥1. From this we easily calculate that the density function of X is fX(x) =    0, if x ≤0, 1/(2√x), if 0 ≤x ≤1, 0, if x > 1. Note that FX(x) is continuous, but fX(x) is not. (See Figure 2.13.) 2
prob_Page_70_Chunk4909
2.2. CONTINUOUS DENSITY FUNCTIONS 63 0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1 E.8 Figure 2.14: Calculation of distribution function for Example 2.14. When referring to a continuous random variable X (say with a uniform density function), it is customary to say that “X is uniformly distributed on the interval [a, b].” It is also customary to refer to the cumulative distribution function of X as the distribution function of X. Thus, the word “distribution” is being used in sev- eral different ways in the subject of probability. (Recall that it also has a meaning when discussing discrete random variables.) When referring to the cumulative dis- tribution function of a continuous random variable X, we will always use the word “cumulative” as a modifier, unless the use of another modifier, such as “normal” or “exponential,” makes it clear. Since the phrase “uniformly densitied on the interval [a, b]” is not acceptable English, we will have to say “uniformly distributed” instead. Example 2.14 In Example 2.4, we considered a random variable, defined to be the sum of two random real numbers chosen uniformly from [0, 1]. Let the random variables X and Y denote the two chosen real numbers. Define Z = X + Y . We will now derive expressions for the cumulative distribution function and the density function of Z. Here we take for our sample space Ωthe unit square in R2 with uniform density. A point ω ∈Ωthen consists of a pair (x, y) of numbers chosen at random. Then 0 ≤Z ≤2. Let Ez denote the event that Z ≤z. In Figure 2.14, we show the set E.8. The event Ez, for any z between 0 and 1, looks very similar to the shaded set in the figure. For 1 < z ≤2, the set Ez looks like the unit square with a triangle removed from the upper right-hand corner. We can now calculate the probability distribution FZ of Z; it is given by FZ(z) = P(Z ≤z) = Area of Ez
prob_Page_71_Chunk4910
64 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES -1 1 2 3 0.2 0.4 0.6 0.8 1 -1 1 2 3 0.2 0.4 0.6 0.8 1 FZ (z) f (z) Z Figure 2.15: Distribution and density functions for Example 2.14. 1 E Z Figure 2.16: Calculation of Fz for Example 2.15. =        0, if z < 0, (1/2)z2, if 0 ≤z ≤1, 1 −(1/2)(2 −z)2, if 1 ≤z ≤2, 1, if 2 < z. The density function is obtained by differentiating this function: fZ(z) =        0, if z < 0, z, if 0 ≤z ≤1, 2 −z, if 1 ≤z ≤2, 0, if 2 < z. The reader is referred to Figure 2.15 for the graphs of these functions. 2 Example 2.15 In the dart game described in Example 2.8, what is the distribution of the distance of the dart from the center of the target? What is its density? Here, as before, our sample space Ωis the unit disk in R2, with coordinates (X, Y ). Let Z = √ X2 + Y 2 represent the distance from the center of the target. Let
prob_Page_72_Chunk4911
2.2. CONTINUOUS DENSITY FUNCTIONS 65 -1 -0.5 0.5 1 1.5 2 0.2 0.4 0.6 0.8 1 -1 -0.5 0 0.5 1 1.5 2 0.25 0.5 0.75 1 1.25 1.5 1.75 2 F (z) Z f (z) Z Figure 2.17: Distribution and density for Z = √ X2 + Y 2. E be the event {Z ≤z}. Then the distribution function FZ of Z (see Figure 2.16) is given by FZ(z) = P(Z ≤z) = Area of E Area of target . Thus, we easily compute that FZ(z) =    0, if z ≤0, z2, if 0 ≤z ≤1, 1, if z > 1. The density fZ(z) is given again by the derivative of FZ(z): fZ(z) =    0, if z ≤0, 2z, if 0 ≤z ≤1, 0, if z > 1. The reader is referred to Figure 2.17 for the graphs of these functions. We can verify this result by simulation, as follows: We choose values for X and Y at random from [0, 1] with uniform distribution, calculate Z = √ X2 + Y 2, check whether 0 ≤Z ≤1, and present the results in a bar graph (see Figure 2.18). 2 Example 2.16 Suppose Mr. and Mrs. Lockhorn agree to meet at the Hanover Inn between 5:00 and 6:00 P.M. on Tuesday. Suppose each arrives at a time between 5:00 and 6:00 chosen at random with uniform probability. What is the distribution function for the length of time that the first to arrive has to wait for the other? What is the density function? Here again we can take the unit square to represent the sample space, and (X, Y ) as the arrival times (after 5:00 P.M.) for the Lockhorns. Let Z = |X −Y |. Then we have FX(x) = x and FY (y) = y. Moreover (see Figure 2.19), FZ(z) = P(Z ≤z) = P(|X −Y | ≤z) = Area of E .
prob_Page_73_Chunk4912
66 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 0 0.2 0.4 0.6 0.8 1 0 0.5 1 1.5 2 Figure 2.18: Simulation results for Example 2.15. Thus, we have FZ(z) =    0, if z ≤0, 1 −(1 −z)2, if 0 ≤z ≤1, 1, if z > 1. The density fZ(z) is again obtained by differentiation: fZ(z) =    0, if z ≤0, 2(1 −z), if 0 ≤z ≤1, 0, if z > 1. 2 Example 2.17 There are many occasions where we observe a sequence of occur- rences which occur at “random” times. For example, we might be observing emis- sions of a radioactive isotope, or cars passing a milepost on a highway, or light bulbs burning out. In such cases, we might define a random variable X to denote the time between successive occurrences. Clearly, X is a continuous random variable whose range consists of the non-negative real numbers. It is often the case that we can model X by using the exponential density. This density is given by the formula f(t) =  λe−λt, if t ≥0, 0, if t < 0. The number λ is a non-negative real number, and represents the reciprocal of the average value of X. (This will be shown in Chapter 6.) Thus, if the average time between occurrences is 30 minutes, then λ = 1/30. A graph of this density function with λ = 1/30 is shown in Figure 2.20. One can see from the figure that even though the average value is 30, occasionally much larger values are taken on by X. Suppose that we have bought a computer that contains a Warp 9 hard drive. The salesperson says that the average time between breakdowns of this type of hard drive is 30 months. It is often assumed that the length of time between breakdowns
prob_Page_74_Chunk4913
2.2. CONTINUOUS DENSITY FUNCTIONS 67 E 1 - z 1 - z 1 - z 1 - z E Figure 2.19: Calculation of FZ. 20 40 60 80 100 120 0.005 0.01 0.015 0.02 0.025 0.03 f (t) = (1/30) e - (1/30) t Figure 2.20: Exponential density with λ = 1/30.
prob_Page_75_Chunk4914
68 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 0 20 40 60 80 100 0 0.005 0.01 0.015 0.02 0.025 0.03 Figure 2.21: Residual lifespan of a hard drive. is distributed according to the exponential density. We will assume that this model applies here, with λ = 1/30. Now suppose that we have been operating our computer for 15 months. We assume that the original hard drive is still running. We ask how long we should expect the hard drive to continue to run. One could reasonably expect that the hard drive will run, on the average, another 15 months. (One might also guess that it will run more than 15 months, since the fact that it has already run for 15 months implies that we don’t have a lemon.) The time which we have to wait is a new random variable, which we will call Y . Obviously, Y = X −15. We can write a computer program to produce a sequence of simulated Y -values. To do this, we first produce a sequence of X’s, and discard those values which are less than or equal to 15 (these values correspond to the cases where the hard drive has quit running before 15 months). To simulate a value of X, we compute the value of the expression  −1 λ  log(rnd) , where rnd represents a random real number between 0 and 1. (That this expression has the exponential density will be shown in Chapter 4.3.) Figure 2.21 shows an area bar graph of 10,000 simulated Y -values. The average value of Y in this simulation is 29.74, which is closer to the original average life span of 30 months than to the value of 15 months which was guessed above. Also, the distribution of Y is seen to be close to the distribution of X. It is in fact the case that X and Y have the same distribution. This property is called the memoryless property, because the amount of time that we have to wait for an occurrence does not depend on how long we have already waited. The only continuous density function with this property is the exponential density. 2
prob_Page_76_Chunk4915
2.2. CONTINUOUS DENSITY FUNCTIONS 69 Assignment of Probabilities A fundamental question in practice is: How shall we choose the probability density function in describing any given experiment? The answer depends to a great extent on the amount and kind of information available to us about the experiment. In some cases, we can see that the outcomes are equally likely. In some cases, we can see that the experiment resembles another already described by a known density. In some cases, we can run the experiment a large number of times and make a reasonable guess at the density on the basis of the observed distribution of outcomes, as we did in Chapter 1. In general, the problem of choosing the right density function for a given experiment is a central problem for the experimenter and is not always easy to solve (see Example 2.6). We shall not examine this question in detail here but instead shall assume that the right density is already known for each of the experiments under study. The introduction of suitable coordinates to describe a continuous sample space, and a suitable density to describe its probabilities, is not always so obvious, as our final example shows. Infinite Tree Example 2.18 Consider an experiment in which a fair coin is tossed repeatedly, without stopping. We have seen in Example 1.6 that, for a coin tossed n times, the natural sample space is a binary tree with n stages. On this evidence we expect that for a coin tossed repeatedly, the natural sample space is a binary tree with an infinite number of stages, as indicated in Figure 2.22. It is surprising to learn that, although the n-stage tree is obviously a finite sample space, the unlimited tree can be described as a continuous sample space. To see how this comes about, let us agree that a typical outcome of the unlimited coin tossing experiment can be described by a sequence of the form ω = {H H T H T T H . . .}. If we write 1 for H and 0 for T, then ω = {1 1 0 1 0 0 1 . . .}. In this way, each outcome is described by a sequence of 0’s and 1’s. Now suppose we think of this sequence of 0’s and 1’s as the binary expansion of some real number x = .1101001 · · · lying between 0 and 1. (A binary expansion is like a decimal expansion but based on 2 instead of 10.) Then each outcome is described by a value of x, and in this way x becomes a coordinate for the sample space, taking on all real values between 0 and 1. (We note that it is possible for two different sequences to correspond to the same real number; for example, the sequences {T H H H H H . . .} and {H T T T T T . . .} both correspond to the real number 1/2. We will not concern ourselves with this apparent problem here.) What probabilities should be assigned to the events of this sample space? Con- sider, for example, the event E consisting of all outcomes for which the first toss comes up heads and the second tails. Every such outcome has the form .10∗∗∗∗· · ·, where ∗can be either 0 or 1. Now if x is our real-valued coordinate, then the value of x for every such outcome must lie between 1/2 = .10000 · · · and 3/4 = .11000 · · ·, and moreover, every value of x between 1/2 and 3/4 has a binary expansion of the
prob_Page_77_Chunk4916
70 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 (start) 1 1 1 1 1 1 1 0 0 0 0 0 0 0 Figure 2.22: Tree for infinite number of tosses of a coin. form .10 ∗∗∗∗· · ·. This means that ω ∈E if and only if 1/2 ≤x < 3/4, and in this way we see that we can describe E by the interval [1/2, 3/4). More generally, every event consisting of outcomes for which the results of the first n tosses are prescribed is described by a binary interval of the form [k/2n, (k + 1)/2n). We have already seen in Section 1.2 that in the experiment involving n tosses, the probability of any one outcome must be exactly 1/2n. It follows that in the unlimited toss experiment, the probability of any event consisting of outcomes for which the results of the first n tosses are prescribed must also be 1/2n. But 1/2n is exactly the length of the interval of x-values describing E! Thus we see that, just as with the spinner experiment, the probability of an event E is determined by what fraction of the unit interval lies in E. Consider again the statement: The probability is 1/2 that a fair coin will turn up heads when tossed. We have suggested that one interpretation of this statement is that if we toss the coin indefinitely the proportion of heads will approach 1/2. That is, in our correspondence with binary sequences we expect to get a binary sequence with the proportion of 1’s tending to 1/2. The event E of binary sequences for which this is true is a proper subset of the set of all possible binary sequences. It does not contain, for example, the sequence 011011011 . . . (i.e., (011) repeated again and again). The event E is actually a very complicated subset of the binary sequences, but its probability can be determined as a limit of probabilities for events with a finite number of outcomes whose probabilities are given by finite tree measures. When the probability of E is computed in this way, its value is found to be 1. This remarkable result is known as the Strong Law of Large Numbers (or Law of Averages) and is one justification for our frequency concept of probability. We shall prove a weak form of this theorem in Chapter 8. 2
prob_Page_78_Chunk4917
2.2. CONTINUOUS DENSITY FUNCTIONS 71 Exercises 1 Suppose you choose at random a real number X from the interval [2, 10]. (a) Find the density function f(x) and the probability of an event E for this experiment, where E is a subinterval [a, b] of [2, 10]. (b) From (a), find the probability that X > 5, that 5 < X < 7, and that X2 −12X + 35 > 0. 2 Suppose you choose a real number X from the interval [2, 10] with a density function of the form f(x) = Cx , where C is a constant. (a) Find C. (b) Find P(E), where E = [a, b] is a subinterval of [2, 10]. (c) Find P(X > 5), P(X < 7), and P(X2 −12X + 35 > 0). 3 Same as Exercise 2, but suppose f(x) = C x . 4 Suppose you throw a dart at a circular target of radius 10 inches. Assuming that you hit the target and that the coordinates of the outcomes are chosen at random, find the probability that the dart falls (a) within 2 inches of the center. (b) within 2 inches of the rim. (c) within the first quadrant of the target. (d) within the first quadrant and within 2 inches of the rim. 5 Suppose you are watching a radioactive source that emits particles at a rate described by the exponential density f(t) = λe−λt , where λ = 1, so that the probability P(0, T) that a particle will appear in the next T seconds is P([0, T]) = R T 0 λe−λt dt. Find the probability that a particle (not necessarily the first) will appear (a) within the next second. (b) within the next 3 seconds. (c) between 3 and 4 seconds from now. (d) after 4 seconds from now.
prob_Page_79_Chunk4918
72 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 6 Assume that a new light bulb will burn out after t hours, where t is chosen from [0, ∞) with an exponential density f(t) = λe−λt . In this context, λ is often called the failure rate of the bulb. (a) Assume that λ = 0.01, and find the probability that the bulb will not burn out before T hours. This probability is often called the reliability of the bulb. (b) For what T is the reliability of the bulb = 1/2? 7 Choose a number B at random from the interval [0, 1] with uniform density. Find the probability that (a) 1/3 < B < 2/3. (b) |B −1/2| ≤1/4. (c) B < 1/4 or 1 −B < 1/4. (d) 3B2 < B. 8 Choose independently two numbers B and C at random from the interval [0, 1] with uniform density. Note that the point (B, C) is then chosen at random in the unit square. Find the probability that (a) B + C < 1/2. (b) BC < 1/2. (c) |B −C| < 1/2. (d) max{B, C} < 1/2. (e) min{B, C} < 1/2. (f) B < 1/2 and 1 −C < 1/2. (g) conditions (c) and (f) both hold. (h) B2 + C2 ≤1/2. (i) (B −1/2)2 + (C −1/2)2 < 1/4. 9 Suppose that we have a sequence of occurrences. We assume that the time X between occurrences is exponentially distributed with λ = 1/10, so on the average, there is one occurrence every 10 minutes (see Example 2.17). You come upon this system at time 100, and wait until the next occurrence. Make a conjecture concerning how long, on the average, you will have to wait. Write a program to see if your conjecture is right. 10 As in Exercise 9, assume that we have a sequence of occurrences, but now assume that the time X between occurrences is uniformly distributed between 5 and 15. As before, you come upon this system at time 100, and wait until the next occurrence. Make a conjecture concerning how long, on the average, you will have to wait. Write a program to see if your conjecture is right.
prob_Page_80_Chunk4919
2.2. CONTINUOUS DENSITY FUNCTIONS 73 11 For examples such as those in Exercises 9 and 10, it might seem that at least you should not have to wait on average more than 10 minutes if the average time between occurrences is 10 minutes. Alas, even this is not true. To see why, consider the following assumption about the times between occurrences. Assume that the time between occurrences is 3 minutes with probability .9 and 73 minutes with probability .1. Show by simulation that the average time between occurrences is 10 minutes, but that if you come upon this system at time 100, your average waiting time is more than 10 minutes. 12 Take a stick of unit length and break it into three pieces, choosing the break points at random. (The break points are assumed to be chosen simultane- ously.) What is the probability that the three pieces can be used to form a triangle? Hint: The sum of the lengths of any two pieces must exceed the length of the third, so each piece must have length < 1/2. Now use Exer- cise 8(g). 13 Take a stick of unit length and break it into two pieces, choosing the break point at random. Now break the longer of the two pieces at a random point. What is the probability that the three pieces can be used to form a triangle? 14 Choose independently two numbers B and C at random from the interval [−1, 1] with uniform distribution, and consider the quadratic equation x2 + Bx + C = 0 . Find the probability that the roots of this equation (a) are both real. (b) are both positive. Hints: (a) requires 0 ≤B2 −4C, (b) requires 0 ≤B2 −4C, B ≤0, 0 ≤C. 15 At the Tunbridge World’s Fair, a coin toss game works as follows. Quarters are tossed onto a checkerboard. The management keeps all the quarters, but for each quarter landing entirely within one square of the checkerboard the management pays a dollar. Assume that the edge of each square is twice the diameter of a quarter, and that the outcomes are described by coordinates chosen at random. Is this a fair game? 16 Three points are chosen at random on a circle of unit circumference. What is the probability that the triangle defined by these points as vertices has three acute angles? Hint: One of the angles is obtuse if and only if all three points lie in the same semicircle. Take the circumference as the interval [0, 1]. Take one point at 0 and the others at B and C. 17 Write a program to choose a random number X in the interval [2, 10] 1000 times and record what fraction of the outcomes satisfy X > 5, what fraction satisfy 5 < X < 7, and what fraction satisfy x2 −12x + 35 > 0. How do these results compare with Exercise 1?
prob_Page_81_Chunk4920
74 CHAPTER 2. CONTINUOUS PROBABILITY DENSITIES 18 Write a program to choose a point (X, Y ) at random in a square of side 20 inches, doing this 10,000 times, and recording what fraction of the outcomes fall within 19 inches of the center; of these, what fraction fall between 8 and 10 inches of the center; and, of these, what fraction fall within the first quadrant of the square. How do these results compare with those of Exercise 4? 19 Write a program to simulate the problem describe in Exercise 7 (see Exer- cise 17). How do the simulation results compare with the results of Exercise 7? 20 Write a program to simulate the problem described in Exercise 12. 21 Write a program to simulate the problem described in Exercise 16. 22 Write a program to carry out the following experiment. A coin is tossed 100 times and the number of heads that turn up is recorded. This experiment is then repeated 1000 times. Have your program plot a bar graph for the proportion of the 1000 experiments in which the number of heads is n, for each n in the interval [35, 65]. Does the bar graph look as though it can be fit with a normal curve? 23 Write a program that picks a random number between 0 and 1 and computes the negative of its logarithm. Repeat this process a large number of times and plot a bar graph to give the number of times that the outcome falls in each interval of length 0.1 in [0, 10]. On this bar graph plot a graph of the density f(x) = e−x. How well does this density fit your graph?
prob_Page_82_Chunk4921
Chapter 3 Combinatorics 3.1 Permutations Many problems in probability theory require that we count the number of ways that a particular event can occur. For this, we study the topics of permutations and combinations. We consider permutations in this section and combinations in the next section. Before discussing permutations, it is useful to introduce a general counting tech- nique that will enable us to solve a variety of counting problems, including the problem of counting the number of possible permutations of n objects. Counting Problems Consider an experiment that takes place in several stages and is such that the number of outcomes m at the nth stage is independent of the outcomes of the previous stages. The number m may be different for different stages. We want to count the number of ways that the entire experiment can be carried out. Example 3.1 You are eating at ´Emile’s restaurant and the waiter informs you that you have (a) two choices for appetizers: soup or juice; (b) three for the main course: a meat, fish, or vegetable dish; and (c) two for dessert: ice cream or cake. How many possible choices do you have for your complete meal? We illustrate the possible meals by a tree diagram shown in Figure 3.1. Your menu is decided in three stages—at each stage the number of possible choices does not depend on what is chosen in the previous stages: two choices at the first stage, three at the second, and two at the third. From the tree diagram we see that the total number of choices is the product of the number of choices at each stage. In this examples we have 2 · 3 · 2 = 12 possible menus. Our menu example is an example of the following general counting technique. 2 75
prob_Page_83_Chunk4922
76 CHAPTER 3. COMBINATORICS ice cream cake ice cream cake ice cream cake ice cream cake ice cream cake ice cream cake (start) soup meat fish vegetable juice meat fish vegetable Figure 3.1: Tree for your menu. A Counting Technique A task is to be carried out in a sequence of r stages. There are n1 ways to carry out the first stage; for each of these n1 ways, there are n2 ways to carry out the second stage; for each of these n2 ways, there are n3 ways to carry out the third stage, and so forth. Then the total number of ways in which the entire task can be accomplished is given by the product N = n1 · n2 · . . . · nr. Tree Diagrams It will often be useful to use a tree diagram when studying probabilities of events relating to experiments that take place in stages and for which we are given the probabilities for the outcomes at each stage. For example, assume that the owner of ´Emile’s restaurant has observed that 80 percent of his customers choose the soup for an appetizer and 20 percent choose juice. Of those who choose soup, 50 percent choose meat, 30 percent choose fish, and 20 percent choose the vegetable dish. Of those who choose juice for an appetizer, 30 percent choose meat, 40 percent choose fish, and 30 percent choose the vegetable dish. We can use this to estimate the probabilities at the first two stages as indicated on the tree diagram of Figure 3.2. We choose for our sample space the set Ωof all possible paths ω = ω1, ω2, . . . , ω6 through the tree. How should we assign our probability distribution? For example, what probability should we assign to the customer choosing soup and then the meat? If 8/10 of the customers choose soup and then 1/2 of these choose meat, a proportion 8/10 · 1/2 = 4/10 of the customers choose soup and then meat. This suggests choosing our probability distribution for each path through the tree to be the product of the probabilities at each of the stages along the path. This results in the probability distribution for the sample points ω indicated in Figure 3.2. (Note that m(ω1) + · · · + m(ω6) = 1.) From this we see, for example, that the probability
prob_Page_84_Chunk4923
3.1. PERMUTATIONS 77 (start) soup meat fish vegetable juice .8 .2 .2 .3 .3 .4 .5 .3 meat fish vegetable ω (ω) ω ω ω ω ω ω .4 .24 .16 .06 .08 .06 m 1 2 3 4 5 6 Figure 3.2: Two-stage probability assignment. that a customer chooses meat is m(ω1) + m(ω4) = .46. We shall say more about these tree measures when we discuss the concept of conditional probability in Chapter 4. We return now to more counting problems. Example 3.2 We can show that there are at least two people in Columbus, Ohio, who have the same three initials. Assuming that each person has three initials, there are 26 possibilities for a person’s first initial, 26 for the second, and 26 for the third. Therefore, there are 263 = 17,576 possible sets of initials. This number is smaller than the number of people living in Columbus, Ohio; hence, there must be at least two people with the same three initials. 2 We consider next the celebrated birthday problem—often used to show that naive intuition cannot always be trusted in probability. Birthday Problem Example 3.3 How many people do we need to have in a room to make it a favorable bet (probability of success greater than 1/2) that two people in the room will have the same birthday? Since there are 365 possible birthdays, it is tempting to guess that we would need about 1/2 this number, or 183. You would surely win this bet. In fact, the number required for a favorable bet is only 23. To show this, we find the probability pr that, in a room with r people, there is no duplication of birthdays; we will have a favorable bet if this probability is less than one half.
prob_Page_85_Chunk4924
78 CHAPTER 3. COMBINATORICS Number of people Probability that all birthdays are different 20 .5885616 21 .5563117 22 .5243047 23 .4927028 24 .4616557 25 .4313003 Table 3.1: Birthday problem. Assume that there are 365 possible birthdays for each person (we ignore leap years). Order the people from 1 to r. For a sample point ω, we choose a possible sequence of length r of birthdays each chosen as one of the 365 possible dates. There are 365 possibilities for the first element of the sequence, and for each of these choices there are 365 for the second, and so forth, making 365r possible sequences of birthdays. We must find the number of these sequences that have no duplication of birthdays. For such a sequence, we can choose any of the 365 days for the first element, then any of the remaining 364 for the second, 363 for the third, and so forth, until we make r choices. For the rth choice, there will be 365 −r + 1 possibilities. Hence, the total number of sequences with no duplications is 365 · 364 · 363 · . . . · (365 −r + 1) . Thus, assuming that each sequence is equally likely, pr = 365 · 364 · . . . · (365 −r + 1) 365r . We denote the product (n)(n −1) · · · (n −r + 1) by (n)r (read “n down r,” or “n lower r”). Thus, pr = (365)r (365)r . The program Birthday carries out this computation and prints the probabilities for r = 20 to 25. Running this program, we get the results shown in Table 3.1. As we asserted above, the probability for no duplication changes from greater than one half to less than one half as we move from 22 to 23 people. To see how unlikely it is that we would lose our bet for larger numbers of people, we have run the program again, printing out values from r = 10 to r = 100 in steps of 10. We see that in a room of 40 people the odds already heavily favor a duplication, and in a room of 100 the odds are overwhelmingly in favor of a duplication. We have assumed that birthdays are equally likely to fall on any particular day. Statistical evidence suggests that this is not true. However, it is intuitively clear (but not easy to prove) that this makes it even more likely to have a duplication with a group of 23 people. (See Exercise 19 to find out what happens on planets with more or fewer than 365 days per year.) 2
prob_Page_86_Chunk4925
3.1. PERMUTATIONS 79 Number of people Probability that all birthdays are different 10 .8830518 20 .5885616 30 .2936838 40 .1087682 50 .0296264 60 .0058773 70 .0008404 80 .0000857 90 .0000062 100 .0000003 Table 3.2: Birthday problem. We now turn to the topic of permutations. Permutations Definition 3.1 Let A be any finite set. A permutation of A is a one-to-one mapping of A onto itself. 2 To specify a particular permutation we list the elements of A and, under them, show where each element is sent by the one-to-one mapping. For example, if A = {a, b, c} a possible permutation σ would be σ =  a b c b c a  . By the permutation σ, a is sent to b, b is sent to c, and c is sent to a. The condition that the mapping be one-to-one means that no two elements of A are sent, by the mapping, into the same element of A. We can put the elements of our set in some order and rename them 1, 2, . . . , n. Then, a typical permutation of the set A = {a1, a2, a3, a4} can be written in the form σ =  1 2 3 4 2 1 4 3  , indicating that a1 went to a2, a2 to a1, a3 to a4, and a4 to a3. If we always choose the top row to be 1 2 3 4 then, to prescribe the permutation, we need only give the bottom row, with the understanding that this tells us where 1 goes, 2 goes, and so forth, under the mapping. When this is done, the permutation is often called a rearrangement of the n objects 1, 2, 3, . . . , n. For example, all possible permutations, or rearrangements, of the numbers A = {1, 2, 3} are: 123, 132, 213, 231, 312, 321 . It is an easy matter to count the number of possible permutations of n objects. By our general counting principle, there are n ways to assign the first element, for
prob_Page_87_Chunk4926
80 CHAPTER 3. COMBINATORICS n n! 0 1 1 1 2 2 3 6 4 24 5 120 6 720 7 5040 8 40320 9 362880 10 3628800 Table 3.3: Values of the factorial function. each of these we have n −1 ways to assign the second object, n −2 for the third, and so forth. This proves the following theorem. Theorem 3.1 The total number of permutations of a set A of n elements is given by n · (n −1) · (n −2) · . . . · 1. 2 It is sometimes helpful to consider orderings of subsets of a given set. This prompts the following definition. Definition 3.2 Let A be an n-element set, and let k be an integer between 0 and n. Then a k-permutation of A is an ordered listing of a subset of A of size k. 2 Using the same techniques as in the last theorem, the following result is easily proved. Theorem 3.2 The total number of k-permutations of a set A of n elements is given by n · (n −1) · (n −2) · . . . · (n −k + 1). 2 Factorials The number given in Theorem 3.1 is called n factorial, and is denoted by n!. The expression 0! is defined to be 1 to make certain formulas come out simpler. The first few values of this function are shown in Table 3.3. The reader will note that this function grows very rapidly. The expression n! will enter into many of our calculations, and we shall need to have some estimate of its magnitude when n is large. It is clearly not practical to make exact calculations in this case. We shall instead use a result called Stirling’s formula. Before stating this formula we need a definition.
prob_Page_88_Chunk4927
3.1. PERMUTATIONS 81 n n! Approximation Ratio 1 1 .922 1.084 2 2 1.919 1.042 3 6 5.836 1.028 4 24 23.506 1.021 5 120 118.019 1.016 6 720 710.078 1.013 7 5040 4980.396 1.011 8 40320 39902.395 1.010 9 362880 359536.873 1.009 10 3628800 3598696.619 1.008 Table 3.4: Stirling approximations to the factorial function. Definition 3.3 Let an and bn be two sequences of numbers. We say that an is asymptotically equal to bn, and write an ∼bn, if lim n→∞ an bn = 1 . 2 Example 3.4 If an = n + √n and bn = n then, since an/bn = 1 + 1/√n and this ratio tends to 1 as n tends to infinity, we have an ∼bn. 2 Theorem 3.3 (Stirling’s Formula) The sequence n! is asymptotically equal to nne−n√ 2πn . 2 The proof of Stirling’s formula may be found in most analysis texts. Let us verify this approximation by using the computer. The program StirlingApprox- imations prints n!, the Stirling approximation, and, finally, the ratio of these two numbers. Sample output of this program is shown in Table 3.4. Note that, while the ratio of the numbers is getting closer to 1, the difference between the exact value and the approximation is increasing, and indeed, this difference will tend to infinity as n tends to infinity, even though the ratio tends to 1. (This was also true in our Example 3.4 where n + √n ∼n, but the difference is √n.) Generating Random Permutations We now consider the question of generating a random permutation of the integers between 1 and n. Consider the following experiment. We start with a deck of n cards, labelled 1 through n. We choose a random card out of the deck, note its label, and put the card aside. We repeat this process until all n cards have been chosen. It is clear that each permutation of the integers from 1 to n can occur as a sequence
prob_Page_89_Chunk4928
82 CHAPTER 3. COMBINATORICS Number of fixed points Fraction of permutations n = 10 n = 20 n = 30 0 .362 .370 .358 1 .368 .396 .358 2 .202 .164 .192 3 .052 .060 .070 4 .012 .008 .020 5 .004 .002 .002 Average number of fixed points .996 .948 1.042 Table 3.5: Fixed point distributions. of labels in this experiment, and that each sequence of labels is equally likely to occur. In our implementations of the computer algorithms, the above procedure is called RandomPermutation. Fixed Points There are many interesting problems that relate to properties of a permutation chosen at random from the set of all permutations of a given finite set. For example, since a permutation is a one-to-one mapping of the set onto itself, it is interesting to ask how many points are mapped onto themselves. We call such points fixed points of the mapping. Let pk(n) be the probability that a random permutation of the set {1, 2, . . ., n} has exactly k fixed points. We will attempt to learn something about these prob- abilities using simulation. The program FixedPoints uses the procedure Ran- domPermutation to generate random permutations and count fixed points. The program prints the proportion of times that there are k fixed points as well as the average number of fixed points. The results of this program for 500 simulations for the cases n = 10, 20, and 30 are shown in Table 3.5. Notice the rather surprising fact that our estimates for the probabilities do not seem to depend very heavily on the number of elements in the permutation. For example, the probability that there are no fixed points, when n = 10, 20, or 30 is estimated to be between .35 and .37. We shall see later (see Example 3.12) that for n ≥10 the exact probabilities pn(0) are, to six decimal place accuracy, equal to 1/e ≈.367879. Thus, for all practi- cal purposes, after n = 10 the probability that a random permutation of the set {1, 2, . . ., n} has no fixed points does not depend upon n. These simulations also suggest that the average number of fixed points is close to 1. It can be shown (see Example 6.8) that the average is exactly equal to 1 for all n. More picturesque versions of the fixed-point problem are: You have arranged the books on your book shelf in alphabetical order by author and they get returned to your shelf at random; what is the probability that exactly k of the books end up in their correct position? (The library problem.) In a restaurant n hats are checked and they are hopelessly scrambled; what is the probability that no one gets his own hat back? (The hat check problem.) In the Historical Remarks at the end of this section, we give one method for solving the hat check problem exactly. Another
prob_Page_90_Chunk4929
3.1. PERMUTATIONS 83 Date Snowfall in inches 1974 75 1975 88 1976 72 1977 110 1978 85 1979 30 1980 55 1981 86 1982 51 1983 64 Table 3.6: Snowfall in Hanover. Year 1 2 3 4 5 6 7 8 9 10 Ranking 6 9 5 10 7 1 3 8 2 4 Table 3.7: Ranking of total snowfall. method is given in Example 3.12. Records Here is another interesting probability problem that involves permutations. Esti- mates for the amount of measured snow in inches in Hanover, New Hampshire, in the ten years from 1974 to 1983 are shown in Table 3.6. Suppose we have started keeping records in 1974. Then our first year’s snowfall could be considered a record snowfall starting from this year. A new record was established in 1975; the next record was established in 1977, and there were no new records established after this year. Thus, in this ten-year period, there were three records established: 1974, 1975, and 1977. The question that we ask is: How many records should we expect to be established in such a ten-year period? We can count the number of records in terms of a permutation as follows: We number the years from 1 to 10. The actual amounts of snowfall are not important but their relative sizes are. We can, therefore, change the numbers measuring snowfalls to numbers 1 to 10 by replacing the smallest number by 1, the next smallest by 2, and so forth. (We assume that there are no ties.) For our example, we obtain the data shown in Table 3.7. This gives us a permutation of the numbers from 1 to 10 and, from this per- mutation, we can read offthe records; they are in years 1, 2, and 4. Thus we can define records for a permutation as follows: Definition 3.4 Let σ be a permutation of the set {1, 2, . . ., n}. Then i is a record of σ if either i = 1 or σ(j) < σ(i) for every j = 1, . . . , i −1. 2 Now if we regard all rankings of snowfalls over an n-year period to be equally likely (and allow no ties), we can estimate the probability that there will be k records in n years as well as the average number of records by simulation.
prob_Page_91_Chunk4930
84 CHAPTER 3. COMBINATORICS We have written a program Records that counts the number of records in ran- domly chosen permutations. We have run this program for the cases n = 10, 20, 30. For n = 10 the average number of records is 2.968, for 20 it is 3.656, and for 30 it is 3.960. We see now that the averages increase, but very slowly. We shall see later (see Example 6.11) that the average number is approximately log n. Since log 10 = 2.3, log 20 = 3, and log 30 = 3.4, this is consistent with the results of our simulations. As remarked earlier, we shall be able to obtain formulas for exact results of certain problems of the above type. However, only minor changes in the problem make this impossible. The power of simulation is that minor changes in a problem do not make the simulation much more difficult. (See Exercise 20 for an interesting variation of the hat check problem.) List of Permutations Another method to solve problems that is not sensitive to small changes in the problem is to have the computer simply list all possible permutations and count the fraction that have the desired property. The program AllPermutations produces a list of all of the permutations of n. When we try running this program, we run into a limitation on the use of the computer. The number of permutations of n increases so rapidly that even to list all permutations of 20 objects is impractical. Historical Remarks Our basic counting principle stated that if you can do one thing in r ways and for each of these another thing in s ways, then you can do the pair in rs ways. This is such a self-evident result that you might expect that it occurred very early in mathematics. N. L. Biggs suggests that we might trace an example of this principle as follows: First, he relates a popular nursery rhyme dating back to at least 1730: As I was going to St. Ives, I met a man with seven wives, Each wife had seven sacks, Each sack had seven cats, Each cat had seven kits. Kits, cats, sacks and wives, How many were going to St. Ives? (You need our principle only if you are not clever enough to realize that you are supposed to answer one, since only the narrator is going to St. Ives; the others are going in the other direction!) He also gives a problem appearing on one of the oldest surviving mathematical manuscripts of about 1650 B.C., roughly translated as:
prob_Page_92_Chunk4931
3.1. PERMUTATIONS 85 Houses 7 Cats 49 Mice 343 Wheat 2401 Hekat 16807 19607 The following interpretation has been suggested: there are seven houses, each with seven cats; each cat kills seven mice; each mouse would have eaten seven heads of wheat, each of which would have produced seven hekat measures of grain. With this interpretation, the table answers the question of how many hekat measures were saved by the cats’ actions. It is not clear why the writer of the table wanted to add the numbers together.1 One of the earliest uses of factorials occurred in Euclid’s proof that there are infinitely many prime numbers. Euclid argued that there must be a prime number between n and n! + 1 as follows: n! and n! + 1 cannot have common factors. Either n!+1 is prime or it has a proper factor. In the latter case, this factor cannot divide n! and hence must be between n and n! + 1. If this factor is not prime, then it has a factor that, by the same argument, must be bigger than n. In this way, we eventually reach a prime bigger than n, and this holds for all n. The “n!” rule for the number of permutations seems to have occurred first in India. Examples have been found as early as 300 B.C., and by the eleventh century the general formula seems to have been well known in India and then in the Arab countries. The hat check problem is found in an early probability book written by de Mont- mort and first printed in 1708.2 It appears in the form of a game called Treize. In a simplified version of this game considered by de Montmort one turns over cards numbered 1 to 13, calling out 1, 2, . . . , 13 as the cards are examined. De Montmort asked for the probability that no card that is turned up agrees with the number called out. This probability is the same as the probability that a random permutation of 13 elements has no fixed point. De Montmort solved this problem by the use of a recursion relation as follows: let wn be the number of permutations of n elements with no fixed point (such permutations are called derangements). Then w1 = 0 and w2 = 1. Now assume that n ≥3 and choose a derangement of the integers between 1 and n. Let k be the integer in the first position in this derangement. By the definition of derangement, we have k ̸= 1. There are two possibilities of interest concerning the position of 1 in the derangement: either 1 is in the kth position or it is elsewhere. In the first case, the n −2 remaining integers can be positioned in wn−2 ways without resulting in any fixed points. In the second case, we consider the set of integers {1, 2, . . ., k −1, k + 1, . . . , n}. The numbers in this set must occupy the positions {2, 3, . . ., n} so that none of the numbers other than 1 in this set are fixed, and 1N. L. Biggs, “The Roots of Combinatorics,” Historia Mathematica, vol. 6 (1979), pp. 109–136. 2P. R. de Montmort, Essay d’Analyse sur des Jeux de Hazard, 2d ed. (Paris: Quillau, 1713).
prob_Page_93_Chunk4932
86 CHAPTER 3. COMBINATORICS also so that 1 is not in position k. The number of ways of achieving this kind of arrangement is just wn−1. Since there are n −1 possible values of k, we see that wn = (n −1)wn−1 + (n −1)wn−2 for n ≥3. One might conjecture from this last equation that the sequence {wn} grows like the sequence {n!}. In fact, it is easy to prove by induction that wn = nwn−1 + (−1)n . Then pi = wi/i! satisfies pi −pi−1 = (−1)i i! . If we sum from i = 2 to n, and use the fact that p1 = 0, we obtain pn = 1 2! −1 3! + · · · + (−1)n n! . This agrees with the first n + 1 terms of the expansion for ex for x = −1 and hence for large n is approximately e−1 ≈.368. David remarks that this was possibly the first use of the exponential function in probability.3 We shall see another way to derive de Montmort’s result in the next section, using a method known as the Inclusion-Exclusion method. Recently, a related problem appeared in a column of Marilyn vos Savant.4 Charles Price wrote to ask about his experience playing a certain form of solitaire, sometimes called “frustration solitaire.” In this particular game, a deck of cards is shuffled, and then dealt out, one card at a time. As the cards are being dealt, the player counts from 1 to 13, and then starts again at 1. (Thus, each number is counted four times.) If a number that is being counted coincides with the rank of the card that is being turned up, then the player loses the game. Price found that he rarely won and wondered how often he should win. Vos Savant remarked that the expected number of matches is 4 so it should be difficult to win the game. Finding the chance of winning is a harder problem than the one that de Mont- mort solved because, when one goes through the entire deck, there are different patterns for the matches that might occur. For example matches may occur for two cards of the same rank, say two aces, or for two different ranks, say a two and a three. A discussion of this problem can be found in Riordan.5 In this book, it is shown that as n →∞, the probability of no matches tends to 1/e4. The original game of Treize is more difficult to analyze than frustration solitaire. The game of Treize is played as follows. One person is chosen as dealer and the others are players. Each player, other than the dealer, puts up a stake. The dealer shuffles the cards and turns them up one at a time calling out, “Ace, two, three,..., 3F. N. David, Games, Gods and Gambling (London: Griffin, 1962), p. 146. 4M. vos Savant, Ask Marilyn, Parade Magazine, Boston Globe, 21 August 1994. 5J. Riordan, An Introduction to Combinatorial Analysis, (New York: John Wiley & Sons, 1958).
prob_Page_94_Chunk4933
3.1. PERMUTATIONS 87 king,” just as in frustration solitaire. If the dealer goes through the 13 cards without a match he pays the players an amount equal to their stake, and the deal passes to someone else. If there is a match the dealer collects the players’ stakes; the players put up new stakes, and the dealer continues through the deck, calling out, “Ace, two, three, ....” If the dealer runs out of cards he reshuffles and continues the count where he left off. He continues until there is a run of 13 without a match and then a new dealer is chosen. The question at this point is how much money can the dealer expect to win from each player. De Montmort found that if each player puts up a stake of 1, say, then the dealer will win approximately .801 from each player. Peter Doyle calculated the exact amount that the dealer can expect to win. The answer is: 26516072156010218582227607912734182784642120482136091446715371962089931 52311343541724554334912870541440299239251607694113500080775917818512013 82176876653563173852874555859367254632009477403727395572807459384342747 87664965076063990538261189388143513547366316017004945507201764278828306 60117107953633142734382477922709835281753299035988581413688367655833113 24476153310720627474169719301806649152698704084383914217907906954976036 28528211590140316202120601549126920880824913325553882692055427830810368 57818861208758248800680978640438118582834877542560955550662878927123048 26997601700116233592793308297533642193505074540268925683193887821301442 70519791882/ 33036929133582592220117220713156071114975101149831063364072138969878007 99647204708825303387525892236581323015628005621143427290625658974433971 65719454122908007086289841306087561302818991167357863623756067184986491 35353553622197448890223267101158801016285931351979294387223277033396967 79797069933475802423676949873661605184031477561560393380257070970711959 69641268242455013319879747054693517809383750593488858698672364846950539 88868628582609905586271001318150621134407056983214740221851567706672080 94586589378459432799868706334161812988630496327287254818458879353024498 00322425586446741048147720934108061350613503856973048971213063937040515 59533731591. This is .803 to 3 decimal places. A description of the algorithm used to find this answer can be found on his Web page.6 A discussion of this problem and other problems can be found in Doyle et al.7 The birthday problem does not seem to have a very old history. Problems of this type were first discussed by von Mises.8 It was made popular in the 1950s by Feller’s book.9 6P. Doyle, “Solution to Montmort’s Probleme du Treize,” http://math.ucsd.edu/˜doyle/. 7P. Doyle, C. Grinstead, and J. Snell, “Frustration Solitaire,” UMAP Journal, vol. 16, no. 2 (1995), pp. 137-145. 8R. von Mises, “¨Uber Aufteilungs- und Besetzungs-Wahrscheinlichkeiten,” Revue de la Facult´e des Sciences de l’Universit´e d’Istanbul, N. S. vol. 4 (1938-39), pp. 145-163. 9W. Feller, Introduction to Probability Theory and Its Applications, vol. 1, 3rd ed. (New York:
prob_Page_95_Chunk4934
88 CHAPTER 3. COMBINATORICS Stirling presented his formula n! ∼ √ 2πn n e n in his work Methodus Differentialis published in 1730.10 This approximation was used by de Moivre in establishing his celebrated central limit theorem that we will study in Chapter 9. De Moivre himself had independently established this approximation, but without identifying the constant π. Having established the approximation 2B √n for the central term of the binomial distribution, where the constant B was deter- mined by an infinite series, de Moivre writes: . . . my worthy and learned Friend, Mr. James Stirling, who had applied himself after me to that inquiry, found that the Quantity B did denote the Square-root of the Circumference of a Circle whose Radius is Unity, so that if that Circumference be called c the Ratio of the middle Term to the Sum of all Terms will be expressed by 2/√nc . . . .11 Exercises 1 Four people are to be arranged in a row to have their picture taken. In how many ways can this be done? 2 An automobile manufacturer has four colors available for automobile exteri- ors and three for interiors. How many different color combinations can he produce? 3 In a digital computer, a bit is one of the integers {0,1}, and a word is any string of 32 bits. How many different words are possible? 4 What is the probability that at least 2 of the presidents of the United States have died on the same day of the year? If you bet this has happened, would you win your bet? 5 There are three different routes connecting city A to city B. How many ways can a round trip be made from A to B and back? How many ways if it is desired to take a different route on the way back? 6 In arranging people around a circular table, we take into account their seats relative to each other, not the actual position of any one person. Show that n people can be arranged around a circular table in (n −1)! ways. John Wiley & Sons, 1968). 10J. Stirling, Methodus Differentialis, (London: Bowyer, 1730). 11A. de Moivre, The Doctrine of Chances, 3rd ed. (London: Millar, 1756).
prob_Page_96_Chunk4935
3.1. PERMUTATIONS 89 7 Five people get on an elevator that stops at five floors. Assuming that each has an equal probability of going to any one floor, find the probability that they all get offat different floors. 8 A finite set Ωhas n elements. Show that if we count the empty set and Ωas subsets, there are 2n subsets of Ω. 9 A more refined inequality for approximating n! is given by √ 2πn n e n e1/(12n+1) < n! < √ 2πn n e n e1/(12n) . Write a computer program to illustrate this inequality for n = 1 to 9. 10 A deck of ordinary cards is shuffled and 13 cards are dealt. What is the probability that the last card dealt is an ace? 11 There are n applicants for the director of computing. The applicants are inter- viewed independently by each member of the three-person search committee and ranked from 1 to n. A candidate will be hired if he or she is ranked first by at least two of the three interviewers. Find the probability that a candidate will be accepted if the members of the committee really have no ability at all to judge the candidates and just rank the candidates randomly. In particular, compare this probability for the case of three candidates and the case of ten candidates. 12 A symphony orchestra has in its repertoire 30 Haydn symphonies, 15 modern works, and 9 Beethoven symphonies. Its program always consists of a Haydn symphony followed by a modern work, and then a Beethoven symphony. (a) How many different programs can it play? (b) How many different programs are there if the three pieces can be played in any order? (c) How many different three-piece programs are there if more than one piece from the same category can be played and they can be played in any order? 13 A certain state has license plates showing three numbers and three letters. How many different license plates are possible (a) if the numbers must come before the letters? (b) if there is no restriction on where the letters and numbers appear? 14 The door on the computer center has a lock which has five buttons numbered from 1 to 5. The combination of numbers that opens the lock is a sequence of five numbers and is reset every week. (a) How many combinations are possible if every button must be used once?
prob_Page_97_Chunk4936
90 CHAPTER 3. COMBINATORICS (b) Assume that the lock can also have combinations that require you to push two buttons simultaneously and then the other three one at a time. How many more combinations does this permit? 15 A computing center has 3 processors that receive n jobs, with the jobs assigned to the processors purely at random so that all of the 3n possible assignments are equally likely. Find the probability that exactly one processor has no jobs. 16 Prove that at least two people in Atlanta, Georgia, have the same initials, assuming no one has more than four initials. 17 Find a formula for the probability that among a set of n people, at least two have their birthdays in the same month of the year (assuming the months are equally likely for birthdays). 18 Consider the problem of finding the probability of more than one coincidence of birthdays in a group of n people. These include, for example, three people with the same birthday, or two pairs of people with the same birthday, or larger coincidences. Show how you could compute this probability, and write a computer program to carry out this computation. Use your program to find the smallest number of people for which it would be a favorable bet that there would be more than one coincidence of birthdays. *19 Suppose that on planet Zorg a year has n days, and that the lifeforms there are equally likely to have hatched on any day of the year. We would like to estimate d, which is the minimum number of lifeforms needed so that the probability of at least two sharing a birthday exceeds 1/2. (a) In Example 3.3, it was shown that in a set of d lifeforms, the probability that no two life forms share a birthday is (n)d nd , where (n)d = (n)(n −1) · · · (n −d + 1). Thus, we would like to set this equal to 1/2 and solve for d. (b) Using Stirling’s Formula, show that (n)d nd ∼  1 + d n −d n−d+1/2 e−d . (c) Now take the logarithm of the right-hand expression, and use the fact that for small values of x, we have log(1 + x) ∼x −x2 2 . (We are implicitly using the fact that d is of smaller order of magnitude than n. We will also use this fact in part (d).)
prob_Page_98_Chunk4937
3.1. PERMUTATIONS 91 (d) Set the expression found in part (c) equal to −log(2), and solve for d as a function of n, thereby showing that d ∼ p 2(log 2) n . Hint: If all three summands in the expression found in part (b) are used, one obtains a cubic equation in d. If the smallest of the three terms is thrown away, one obtains a quadratic equation in d. (e) Use a computer to calculate the exact values of d for various values of n. Compare these values with the approximate values obtained by using the answer to part d). 20 At a mathematical conference, ten participants are randomly seated around a circular table for meals. Using simulation, estimate the probability that no two people sit next to each other at both lunch and dinner. Can you make an intelligent conjecture for the case of n participants when n is large? 21 Modify the program AllPermutations to count the number of permutations of n objects that have exactly j fixed points for j = 0, 1, 2, . . . , n. Run your program for n = 2 to 6. Make a conjecture for the relation between the number that have 0 fixed points and the number that have exactly 1 fixed point. A proof of the correct conjecture can be found in Wilf.12 22 Mr. Wimply Dimple, one of London’s most prestigious watch makers, has come to Sherlock Holmes in a panic, having discovered that someone has been producing and selling crude counterfeits of his best selling watch. The 16 counterfeits so far discovered bear stamped numbers, all of which fall between 1 and 56, and Dimple is anxious to know the extent of the forger’s work. All present agree that it seems reasonable to assume that the counterfeits thus far produced bear consecutive numbers from 1 to whatever the total number is. “Chin up, Dimple,” opines Dr. Watson. “I shouldn’t worry overly much if I were you; the Maximum Likelihood Principle, which estimates the total number as precisely that which gives the highest probability for the series of numbers found, suggests that we guess 56 itself as the total. Thus, your forgers are not a big operation, and we shall have them safely behind bars before your business suffers significantly.” “Stuff, nonsense, and bother your fancy principles, Watson,” counters Holmes. “Anyone can see that, of course, there must be quite a few more than 56 watches—why the odds of our having discovered precisely the highest num- bered watch made are laughably negligible. A much better guess would be twice 56.” (a) Show that Watson is correct that the Maximum Likelihood Principle gives 56. 12H. S. Wilf, “A Bijection in the Theory of Derangements,” Mathematics Magazine, vol. 57, no. 1 (1984), pp. 37–40.
prob_Page_99_Chunk4938
92 CHAPTER 3. COMBINATORICS (b) Write a computer program to compare Holmes’s and Watson’s guessing strategies as follows: fix a total N and choose 16 integers randomly between 1 and N. Let m denote the largest of these. Then Watson’s guess for N is m, while Holmes’s is 2m. See which of these is closer to N. Repeat this experiment (with N still fixed) a hundred or more times, and determine the proportion of times that each comes closer. Whose seems to be the better strategy? 23 Barbara Smith is interviewing candidates to be her secretary. As she inter- views the candidates, she can determine the relative rank of the candidates but not the true rank. Thus, if there are six candidates and their true rank is 6, 1, 4, 2, 3, 5, (where 1 is best) then after she had interviewed the first three candidates she would rank them 3, 1, 2. As she interviews each candidate, she must either accept or reject the candidate. If she does not accept the candidate after the interview, the candidate is lost to her. She wants to de- cide on a strategy for deciding when to stop and accept a candidate that will maximize the probability of getting the best candidate. Assume that there are n candidates and they arrive in a random rank order. (a) What is the probability that Barbara gets the best candidate if she inter- views all of the candidates? What is it if she chooses the first candidate? (b) Assume that Barbara decides to interview the first half of the candidates and then continue interviewing until getting a candidate better than any candidate seen so far. Show that she has a better than 25 percent chance of ending up with the best candidate. 24 For the task described in Exercise 23, it can be shown13 that the best strategy is to pass over the first k −1 candidates where k is the smallest integer for which 1 k + 1 k + 1 + · · · + 1 n −1 ≤1 . Using this strategy the probability of getting the best candidate is approxi- mately 1/e = .368. Write a program to simulate Barbara Smith’s interviewing if she uses this optimal strategy, using n = 10, and see if you can verify that the probability of success is approximately 1/e. 3.2 Combinations Having mastered permutations, we now consider combinations. Let U be a set with n elements; we want to count the number of distinct subsets of the set U that have exactly j elements. The empty set and the set U are considered to be subsets of U. The empty set is usually denoted by φ. 13E. B. Dynkin and A. A. Yushkevich, Markov Processes: Theorems and Problems, trans. J. S. Wood (New York: Plenum, 1969).
prob_Page_100_Chunk4939
3.2. COMBINATIONS 93 Example 3.5 Let U = {a, b, c}. The subsets of U are φ, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} . 2 Binomial Coefficients The number of distinct subsets with j elements that can be chosen from a set with n elements is denoted by
prob_Page_101_Chunk4940
94 CHAPTER 3. COMBINATORICS n = 0 1 10 1 10 45 120 210 252 210 120 45 10 1 9 1 9 36 84 126 126 84 36 9 1 8 1 8 28 56 70 56 28 8 1 7 1 7 21 35 35 21 7 1 6 1 6 15 20 15 6 1 5 1 5 10 10 5 1 4 1 4 6 4 1 3 1 3 3 1 2 1 2 1 1 1 1 j = 0 1 2 3 4 5 6 7 8 9 10 Figure 3.3: Pascal’s triangle. Pascal’s Triangle The relation 3.1, together with the knowledge that n 0  = n n  = 1 , determines completely the numbers
prob_Page_102_Chunk4941
3.2. COMBINATIONS 95 The above formula can be rewritten in the form n j  = n! j!(n −j)! . This immediately shows that n j  =  n n −j  . When using Equation 3.2 in the calculation of
prob_Page_103_Chunk4942
96 CHAPTER 3. COMBINATORICS (start) S F F F F S S S S S S F F F p q p p q p q q p q p q q q q q q p p p p p p q q p p q m (ω) ω ω ω ω ω ω ω ω ω 2 3 3 2 2 2 2 2 1 2 3 4 5 6 7 8 Figure 3.4: Tree diagram of three Bernoulli trials. Bernoulli Trials Our principal use of the binomial coefficients will occur in the study of one of the important chance processes called Bernoulli trials. Definition 3.5 A Bernoulli trials process is a sequence of n chance experiments such that 1. Each experiment has two possible outcomes, which we may call success and failure. 2. The probability p of success on each experiment is the same for each ex- periment, and this probability is not affected by any knowledge of previous outcomes. The probability q of failure is given by q = 1 −p. 2 Example 3.7 The following are Bernoulli trials processes: 1. A coin is tossed ten times. The two possible outcomes are heads and tails. The probability of heads on any one toss is 1/2. 2. An opinion poll is carried out by asking 1000 people, randomly chosen from the population, if they favor the Equal Rights Amendment—the two outcomes being yes and no. The probability p of a yes answer (i.e., a success) indicates the proportion of people in the entire population that favor this amendment. 3. A gambler makes a sequence of 1-dollar bets, betting each time on black at roulette at Las Vegas. Here a success is winning 1 dollar and a failure is losing
prob_Page_104_Chunk4943
3.2. COMBINATIONS 97 1 dollar. Since in American roulette the gambler wins if the ball stops on one of 18 out of 38 positions and loses otherwise, the probability of winning is p = 18/38 = .474. 2 To analyze a Bernoulli trials process, we choose as our sample space a binary tree and assign a probability distribution to the paths in this tree. Suppose, for example, that we have three Bernoulli trials. The possible outcomes are indicated in the tree diagram shown in Figure 3.4. We define X to be the random variable which represents the outcome of the process, i.e., an ordered triple of S’s and F’s. The probabilities assigned to the branches of the tree represent the probability for each individual trial. Let the outcome of the ith trial be denoted by the random variable Xi, with distribution function mi. Since we have assumed that outcomes on any one trial do not affect those on another, we assign the same probabilities at each level of the tree. An outcome ω for the entire experiment will be a path through the tree. For example, ω3 represents the outcomes SFS. Our frequency interpretation of probability would lead us to expect a fraction p of successes on the first experiment; of these, a fraction q of failures on the second; and, of these, a fraction p of successes on the third experiment. This suggests assigning probability pqp to the outcome ω3. More generally, we assign a distribution function m(ω) for paths ω by defining m(ω) to be the product of the branch probabilities along the path ω. Thus, the probability that the three events S on the first trial, F on the second trial, and S on the third trial occur is the product of the probabilities for the individual events. We shall see in the next chapter that this means that the events involved are independent in the sense that the knowledge of one event does not affect our prediction for the occurrences of the other events. Binomial Probabilities We shall be particularly interested in the probability that in n Bernoulli trials there are exactly j successes. We denote this probability by b(n, p, j). Let us calculate the particular value b(3, p, 2) from our tree measure. We see that there are three paths which have exactly two successes and one failure, namely ω2, ω3, and ω5. Each of these paths has the same probability p2q. Thus b(3, p, 2) = 3p2q. Considering all possible numbers of successes we have b(3, p, 0) = q3 , b(3, p, 1) = 3pq2 , b(3, p, 2) = 3p2q , b(3, p, 3) = p3 . We can, in the same manner, carry out a tree measure for n experiments and determine b(n, p, j) for the general case of n Bernoulli trials.
prob_Page_105_Chunk4944
98 CHAPTER 3. COMBINATORICS Theorem 3.6 Given n Bernoulli trials with probability p of success on each exper- iment, the probability of exactly j successes is b(n, p, j) = n j  pjqn−j where q = 1 −p. Proof. We construct a tree measure as described above. We want to find the sum of the probabilities for all paths which have exactly j successes and n −j failures. Each such path is assigned a probability pjqn−j. How many such paths are there? To specify a path, we have to pick, from the n possible trials, a subset of j to be successes, with the remaining n −j outcomes being failures. We can do this in
prob_Page_106_Chunk4945
3.2. COMBINATIONS 99 k b(n, p, k) 45 .0485 46 .0580 47 .0666 48 .0735 49 .0780 50 .0796 51 .0780 52 .0735 53 .0666 54 .0580 55 .0485 Table 3.8: Binomial probabilities for n = 100, p = 1/2. Binomial Distributions Definition 3.6 Let n be a positive integer, and let p be a real number between 0 and 1. Let B be the random variable which counts the number of successes in a Bernoulli trials process with parameters n and p. Then the distribution b(n, p, k) of B is called the binomial distribution. 2 We can get a better idea about the binomial distribution by graphing this dis- tribution for different values of n and p (see Figure 3.5). The plots in this figure were generated using the program BinomialPlot. We have run this program for p = .5 and p = .3. Note that even for p = .3 the graphs are quite symmetric. We shall have an explanation for this in Chapter 9. We also note that the highest probability occurs around the value np, but that these highest probabilities get smaller as n increases. We shall see in Chapter 6 that np is the mean or expected value of the binomial distribution b(n, p, k). The following example gives a nice way to see the binomial distribution, when p = 1/2. Example 3.10 A Galton board is a board in which a large number of BB-shots are dropped from a chute at the top of the board and deflected offa number of pins on their way down to the bottom of the board. The final position of each slot is the result of a number of random deflections either to the left or the right. We have written a program GaltonBoard to simulate this experiment. We have run the program for the case of 20 rows of pins and 10,000 shots being dropped. We show the result of this simulation in Figure 3.6. Note that if we write 0 every time the shot is deflected to the left, and 1 every time it is deflected to the right, then the path of the shot can be described by a sequence of 0’s and 1’s of length n, just as for the n-fold coin toss. The distribution shown in Figure 3.6 is an example of an empirical distribution, in the sense that it comes about by means of a sequence of experiments. As expected,
prob_Page_107_Chunk4946
100 CHAPTER 3. COMBINATORICS 0 20 40 60 80 100 120 0 0.025 0.05 0.075 0.1 0.125 0.15 0 20 40 60 80 100 0.02 0.04 0.06 0.08 0.1 0.12 p = .5 n = 40 n = 80 n = 160 n = 30 n = 120 n = 270 p = .3 0 Figure 3.5: Binomial distributions.
prob_Page_108_Chunk4947
3.2. COMBINATIONS 101 Figure 3.6: Simulation of the Galton board. this empirical distribution resembles the corresponding binomial distribution with parameters n = 20 and p = 1/2. 2 Hypothesis Testing Example 3.11 Suppose that ordinary aspirin has been found effective against headaches 60 percent of the time, and that a drug company claims that its new aspirin with a special headache additive is more effective. We can test this claim as follows: we call their claim the alternate hypothesis, and its negation, that the additive has no appreciable effect, the null hypothesis. Thus the null hypothesis is that p = .6, and the alternate hypothesis is that p > .6, where p is the probability that the new aspirin is effective. We give the aspirin to n people to take when they have a headache. We want to find a number m, called the critical value for our experiment, such that we reject the null hypothesis if at least m people are cured, and otherwise we accept it. How should we determine this critical value? First note that we can make two kinds of errors. The first, often called a type 1 error in statistics, is to reject the null hypothesis when in fact it is true. The second, called a type 2 error, is to accept the null hypothesis when it is false. To determine the probability of both these types of errors we introduce a function α(p), defined to be the probability that we reject the null hypothesis, where this probability is calculated under the assumption that the null hypothesis is true. In the present case, we have α(p) = X m≤k≤n b(n, p, k) .
prob_Page_109_Chunk4948
102 CHAPTER 3. COMBINATORICS Note that α(.6) is the probability of a type 1 error, since this is the probability of a high number of successes for an ineffective additive. So for a given n we want to choose m so as to make α(.6) quite small, to reduce the likelihood of a type 1 error. But as m increases above the most probable value np = .6n, α(.6), being the upper tail of a binomial distribution, approaches 0. Thus increasing m makes a type 1 error less likely. Now suppose that the additive really is effective, so that p is appreciably greater than .6; say p = .8. (This alternative value of p is chosen arbitrarily; the following calculations depend on this choice.) Then choosing m well below np = .8n will increase α(.8), since now α(.8) is all but the lower tail of a binomial distribution. Indeed, if we put β(.8) = 1 −α(.8), then β(.8) gives us the probability of a type 2 error, and so decreasing m makes a type 2 error less likely. The manufacturer would like to guard against a type 2 error, since if such an error is made, then the test does not show that the new drug is better, when in fact it is. If the alternative value of p is chosen closer to the value of p given in the null hypothesis (in this case p = .6), then for a given test population, the value of β will increase. So, if the manufacturer’s statistician chooses an alternative value for p which is close to the value in the null hypothesis, then it will be an expensive proposition (i.e., the test population will have to be large) to reject the null hypothesis with a small value of β. What we hope to do then, for a given test population n, is to choose a value of m, if possible, which makes both these probabilities small. If we make a type 1 error we end up buying a lot of essentially ordinary aspirin at an inflated price; a type 2 error means we miss a bargain on a superior medication. Let us say that we want our critical number m to make each of these undesirable cases less than 5 percent probable. We write a program PowerCurve to plot, for n = 100 and selected values of m, the function α(p), for p ranging from .4 to 1. The result is shown in Figure 3.7. We include in our graph a box (in dotted lines) from .6 to .8, with bottom and top at heights .05 and .95. Then a value for m satisfies our requirements if and only if the graph of α enters the box from the bottom, and leaves from the top (why?—which is the type 1 and which is the type 2 criterion?). As m increases, the graph of α moves to the right. A few experiments have shown us that m = 69 is the smallest value for m that thwarts a type 1 error, while m = 73 is the largest which thwarts a type 2. So we may choose our critical value between 69 and 73. If we’re more intent on avoiding a type 1 error we favor 73, and similarly we favor 69 if we regard a type 2 error as worse. Of course, the drug company may not be happy with having as much as a 5 percent chance of an error. They might insist on having a 1 percent chance of an error. For this we would have to increase the number n of trials (see Exercise 28). 2 Binomial Expansion We next remind the reader of an application of the binomial coefficients to algebra. This is the binomial expansion, from which we get the term binomial coefficient.
prob_Page_110_Chunk4949
3.2. COMBINATIONS 103 .4 1 .5 .6 .7 .8 .9 1 .0 1.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1.0 .4 1 .5 .6 .7 .8 .9 1 .0 1.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1.0 Figure 3.7: The power curve. Theorem 3.7 (Binomial Theorem) The quantity (a + b)n can be expressed in the form (a + b)n = n X j=0 n j  ajbn−j . Proof. To see that this expansion is correct, write (a + b)n = (a + b)(a + b) · · · (a + b) . When we multiply this out we will have a sum of terms each of which results from a choice of an a or b for each of n factors. When we choose j a’s and (n −j) b’s, we obtain a term of the form ajbn−j. To determine such a term, we have to specify j of the n terms in the product from which we choose the a. This can be done in
prob_Page_111_Chunk4950
104 CHAPTER 3. COMBINATORICS Proof. The first statement in the corollary follows from the fact that 2n = (1 + 1)n = n 0  + n 1  + n 2  + · · · + n n  , and the second from the fact that 0 = (1 −1)n = n 0  − n 1  + n 2  −· · · + (−1)n n n  . 2 The first statement of the corollary tells us that the number of subsets of a set of n elements is 2n. We shall use the second statement in our next application of the binomial theorem. We have seen that, when A and B are any two events (cf. Section 1.2), P(A ∪B) = P(A) + P(B) −P(A ∩B). We now extend this theorem to a more general version, which will enable us to find the probability that at least one of a number of events occurs. Inclusion-Exclusion Principle Theorem 3.8 Let P be a probability distribution on a sample space Ω, and let {A1, A2, . . . , An} be a finite set of events. Then P(A1 ∪A2 ∪· · · ∪An) = n X i=1 P(Ai) − X 1≤i<j≤n P(Ai ∩Aj) + X 1≤i<j<k≤n P(Ai ∩Aj ∩Ak) −· · · . (3.3) That is, to find the probability that at least one of n events Ai occurs, first add the probability of each event, then subtract the probabilities of all possible two-way intersections, add the probability of all three-way intersections, and so forth. Proof. If the outcome ω occurs in at least one of the events Ai, its probability is added exactly once by the left side of Equation 3.3. We must show that it is added exactly once by the right side of Equation 3.3. Assume that ω is in exactly k of the sets. Then its probability is added k times in the first term, subtracted
prob_Page_112_Chunk4951
3.2. COMBINATIONS 105 Hence, 1 = k 0  = k X j=1 k j  (−1)j−1 . If the outcome ω is not in any of the events Ai, then it is not counted on either side of the equation. 2 Hat Check Problem Example 3.12 We return to the hat check problem discussed in Section 3.1, that is, the problem of finding the probability that a random permutation contains at least one fixed point. Recall that a permutation is a one-to-one map of a set A = {a1, a2, . . . , an} onto itself. Let Ai be the event that the ith element ai remains fixed under this map. If we require that ai is fixed, then the map of the remaining n−1 elements provides an arbitrary permutation of (n−1) objects. Since there are (n −1)! such permutations, P(Ai) = (n −1)!/n! = 1/n. Since there are n choices for ai, the first term of Equation 3.3 is 1. In the same way, to have a particular pair (ai, aj) fixed, we can choose any permutation of the remaining n −2 elements; there are (n −2)! such choices and thus P(Ai ∩Aj) = (n −2)! n! = 1 n(n −1) . The number of terms of this form in the right side of Equation 3.3 is n 2  = n(n −1) 2! . Hence, the second term of Equation 3.3 is −n(n −1) 2! · 1 n(n −1) = −1 2! . Similarly, for any specific three events Ai, Aj, Ak, P(Ai ∩Aj ∩Ak) = (n −3)! n! = 1 n(n −1)(n −2) , and the number of such terms is n 3  = n(n −1)(n −2) 3! , making the third term of Equation 3.3 equal to 1/3!. Continuing in this way, we obtain P(at least one fixed point) = 1 −1 2! + 1 3! −· · · (−1)n−1 1 n! and P(no fixed point) = 1 2! −1 3! + · · · (−1)n 1 n! .
prob_Page_113_Chunk4952
106 CHAPTER 3. COMBINATORICS Probability that no one n gets his own hat back 3 .333333 4 .375 5 .366667 6 .368056 7 .367857 8 .367882 9 .367879 10 .367879 Table 3.9: Hat check problem. From calculus we learn that ex = 1 + x + 1 2!x2 + 1 3!x3 + · · · + 1 n!xn + · · · . Thus, if x = −1, we have e−1 = 1 2! −1 3! + · · · + (−1)n n! + · · · = .3678794 . Therefore, the probability that there is no fixed point, i.e., that none of the n people gets his own hat back, is equal to the sum of the first n terms in the expression for e−1. This series converges very fast. Calculating the partial sums for n = 3 to 10 gives the data in Table 3.9. After n = 9 the probabilities are essentially the same to six significant figures. Interestingly, the probability of no fixed point alternately increases and decreases as n increases. Finally, we note that our exact results are in good agreement with our simulations reported in the previous section. 2 Choosing a Sample Space We now have some of the tools needed to accurately describe sample spaces and to assign probability functions to those sample spaces. Nevertheless, in some cases, the description and assignment process is somewhat arbitrary. Of course, it is to be hoped that the description of the sample space and the subsequent assignment of a probability function will yield a model which accurately predicts what would happen if the experiment were actually carried out. As the following examples show, there are situations in which “reasonable” descriptions of the sample space do not produce a model which fits the data. In Feller’s book,14 a pair of models is given which describe arrangements of certain kinds of elementary particles, such as photons and protons. It turns out that experiments have shown that certain types of elementary particles exhibit behavior 14W. Feller, Introduction to Probability Theory and Its Applications vol. 1, 3rd ed. (New York: John Wiley and Sons, 1968), p. 41
prob_Page_114_Chunk4953
3.2. COMBINATIONS 107 which is accurately described by one model, called “Bose-Einstein statistics,” while other types of elementary particles can be modelled using “Fermi-Dirac statistics.” Feller says: We have here an instructive example of the impossibility of selecting or justifying probability models by a priori arguments. In fact, no pure reasoning could tell that photons and protons would not obey the same probability laws. We now give some examples of this description and assignment process. Example 3.13 In the quantum mechanical model of the helium atom, various parameters can be used to classify the energy states of the atom. In the triplet spin state (S = 1) with orbital angular momentum 1 (L = 1), there are three possibilities, 0, 1, or 2, for the total angular momentum (J). (It is not assumed that the reader knows what any of this means; in fact, the example is more illustrative if the reader does not know anything about quantum mechanics.) We would like to assign probabilities to the three possibilities for J. The reader is undoubtedly resisting the idea of assigning the probability of 1/3 to each of these outcomes. She should now ask herself why she is resisting this assignment. The answer is probably because she does not have any “intuition” (i.e., experience) about the way in which helium atoms behave. In fact, in this example, the probabilities 1/9, 3/9, and 5/9 are assigned by the theory. The theory gives these assignments because these frequencies were observed in experiments and further parameters were developed in the theory to allow these frequencies to be predicted. 2 Example 3.14 Suppose two pennies are flipped once each. There are several “rea- sonable” ways to describe the sample space. One way is to count the number of heads in the outcome; in this case, the sample space can be written {0, 1, 2}. An- other description of the sample space is the set of all ordered pairs of H’s and T’s, i.e., {(H, H), (H, T), (T, H), (T, T)}. Both of these descriptions are accurate ones, but it is easy to see that (at most) one of these, if assigned a constant probability function, can claim to accurately model reality. In this case, as opposed to the preceding example, the reader will probably say that the second description, with each outcome being assigned a probability of 1/4, is the “right” description. This conviction is due to experience; there is no proof that this is the way reality works. 2 The reader is also referred to Exercise 26 for another example of this process. Historical Remarks The binomial coefficients have a long and colorful history leading up to Pascal’s Treatise on the Arithmetical Triangle,15 where Pascal developed many important 15B. Pascal, Trait´e du Triangle Arithm´etique (Paris: Desprez, 1665).
prob_Page_115_Chunk4954
108 CHAPTER 3. COMBINATORICS 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 1 3 6 10 15 21 28 36 1 4 10 20 35 56 84 1 5 15 35 70 126 1 6 21 56 126 1 7 28 84 1 8 36 1 9 1 Table 3.10: Pascal’s triangle. natural numbers 1 2 3 4 5 6 7 8 9 triangular numbers 1 3 6 10 15 21 28 36 45 tetrahedral numbers 1 4 10 20 35 56 84 120 165 Table 3.11: Figurate numbers. properties of these numbers. This history is set forth in the book Pascal’s Arith- metical Triangle by A. W. F. Edwards.16 Pascal wrote his triangle in the form shown in Table 3.10. Edwards traces three different ways that the binomial coefficients arose. He refers to these as the figurate numbers, the combinatorial numbers, and the binomial numbers. They are all names for the same thing (which we have called binomial coefficients) but that they are all the same was not appreciated until the sixteenth century. The figurate numbers date back to the Pythagorean interest in number pat- terns around 540 BC. The Pythagoreans considered, for example, triangular patterns shown in Figure 3.8. The sequence of numbers 1, 3, 6, 10, . . . obtained as the number of points in each triangle are called triangular numbers. From the triangles it is clear that the nth triangular number is simply the sum of the first n integers. The tetrahedral numbers are the sums of the triangular numbers and were obtained by the Greek mathematicians Theon and Nicomachus at the beginning of the second century BC. The tetrahedral number 10, for example, has the geometric representation shown in Figure 3.9. The first three types of figurate numbers can be represented in tabular form as shown in Table 3.11. These numbers provide the first four rows of Pascal’s triangle, but the table was not to be completed in the West until the sixteenth century. In the East, Hindu mathematicians began to encounter the binomial coefficients in combinatorial problems. Bhaskara in his Lilavati of 1150 gave a rule to find the 16A. W. F. Edwards, Pascal’s Arithmetical Triangle (London: Griffin, 1987).
prob_Page_116_Chunk4955
3.2. COMBINATIONS 109 1 3 6 10 Figure 3.8: Pythagorean triangular patterns. Figure 3.9: Geometric representation of the tetrahedral number 10.
prob_Page_117_Chunk4956
110 CHAPTER 3. COMBINATORICS 11 12 22 13 23 33 14 24 34 44 15 25 35 45 55 16 26 36 46 56 66 Table 3.12: Outcomes for the roll of two dice. number of medicinal preparations using 1, 2, 3, 4, 5, or 6 possible ingredients.17 His rule is equivalent to our formula n r  = (n)r r! . The binomial numbers as coefficients of (a+b)n appeared in the works of math- ematicians in China around 1100. There are references about this time to “the tabulation system for unlocking binomial coefficients.” The triangle to provide the coefficients up to the eighth power is given by Chu Shih-chieh in a book written around 1303 (see Figure 3.10).18 The original manuscript of Chu’s book has been lost, but copies have survived. Edwards notes that there is an error in this copy of Chu’s triangle. Can you find it? (Hint: Two numbers which should be equal are not.) Other copies do not show this error. The first appearance of Pascal’s triangle in the West seems to have come from calculations of Tartaglia in calculating the number of possible ways that n dice might turn up.19 For one die the answer is clearly 6. For two dice the possibilities may be displayed as shown in Table 3.12. Displaying them this way suggests the sixth triangular number 1 + 2 + 3 + 4 + 5 + 6 = 21 for the throw of 2 dice. Tartaglia “on the first day of Lent, 1523, in Verona, having thought about the problem all night,”20 realized that the extension of the figurate table gave the answers for n dice. The problem had suggested itself to Tartaglia from watching people casting their own horoscopes by means of a Book of Fortune, selecting verses by a process which included noting the numbers on the faces of three dice. The 56 ways that three dice can fall were set out on each page. The way the numbers were written in the book did not suggest the connection with figurate numbers, but a method of enumeration similar to the one we used for 2 dice does. Tartaglia’s table was not published until 1556. A table for the binomial coefficients was published in 1554 by the German mathe- matician Stifel.21 Pascal’s triangle appears also in Cardano’s Opus novum of 1570.22 17ibid., p. 27. 18J. Needham, Science and Civilization in China, vol. 3 (New York: Cambridge University Press, 1959), p. 135. 19N. Tartaglia, General Trattato di Numeri et Misure (Vinegia, 1556). 20Quoted in Edwards, op. cit., p. 37. 21M. Stifel, Arithmetica Integra (Norimburgae, 1544). 22G. Cardano, Opus Novum de Proportionibus Numerorum (Basilea, 1570).
prob_Page_118_Chunk4957
3.2. COMBINATIONS 111 Figure 3.10: Chu Shih-chieh’s triangle. [From J. Needham, Science and Civilization in China, vol. 3 (New York: Cambridge University Press, 1959), p. 135. Reprinted with permission.]
prob_Page_119_Chunk4958
112 CHAPTER 3. COMBINATORICS Cardano was interested in the problem of finding the number of ways to choose r objects out of n. Thus by the time of Pascal’s work, his triangle had appeared as a result of looking at the figurate numbers, the combinatorial numbers, and the binomial numbers, and the fact that all three were the same was presumably pretty well understood. Pascal’s interest in the binomial numbers came from his letters with Fermat concerning a problem known as the problem of points. This problem, and the correspondence between Pascal and Fermat, were discussed in Chapter 1. The reader will recall that this problem can be described as follows: Two players A and B are playing a sequence of games and the first player to win n games wins the match. It is desired to find the probability that A wins the match at a time when A has won a games and B has won b games. (See Exercises 4.1.40-4.1.42.) Pascal solved the problem by backward induction, much the way we would do today in writing a computer program for its solution. He referred to the combina- torial method of Fermat which proceeds as follows: If A needs c games and B needs d games to win, we require that the players continue to play until they have played c + d −1 games. The winner in this extended series will be the same as the winner in the original series. The probability that A wins in the extended series and hence in the original series is c+d−1 X r=c 1 2c+d−1 c + d −1 r  . Even at the time of the letters Pascal seemed to understand this formula. Suppose that the first player to win n games wins the match, and suppose that each player has put up a stake of x. Pascal studied the value of winning a particular game. By this he meant the increase in the expected winnings of the winner of the particular game under consideration. He showed that the value of the first game is 1 · 3 · 5 · . . . · (2n −1) 2 · 4 · 6 · . . . · (2n) x . His proof of this seems to use Fermat’s formula and the fact that the above ratio of products of odd to products of even numbers is equal to the probability of exactly n heads in 2n tosses of a coin. (See Exercise 39.) Pascal presented Fermat with the table shown in Table 3.13. He states: You will see as always, that the value of the first game is equal to that of the second which is easily shown by combinations. You will see, in the same way, that the numbers in the first line are always increasing; so also are those in the second; and those in the third. But those in the fourth line are decreasing, and those in the fifth, etc. This seems odd.23 The student can pursue this question further using the computer and Pascal’s backward iteration method for computing the expected payoffat any point in the series. 23F. N. David, op. cit., p. 235.
prob_Page_120_Chunk4959
3.2. COMBINATIONS 113 if each one staken 256 in From my opponent’s 256 6 5 4 3 2 1 positions I get, for the games games games games games games 1st game 63 70 80 96 128 256 2nd game 63 70 80 96 128 3rd game 56 60 64 64 4th game 42 40 32 5th game 24 16 6th game 8 Table 3.13: Pascal’s solution for the problem of points. In his treatise, Pascal gave a formal proof of Fermat’s combinatorial formula as well as proofs of many other basic properties of binomial numbers. Many of his proofs involved induction and represent some of the first proofs by this method. His book brought together all the different aspects of the numbers in the Pascal triangle as known in 1654, and, as Edwards states, “That the Arithmetical Triangle should bear Pascal’s name cannot be disputed.”24 The first serious study of the binomial distribution was undertaken by James Bernoulli in his Ars Conjectandi published in 1713.25 We shall return to this work in the historical remarks in Chapter 8. Exercises 1 Compute the following: (a)
prob_Page_121_Chunk4960
114 CHAPTER 3. COMBINATORICS 5 Use the program BinomialProbabilities to find the probability that, in 100 tosses of a fair coin, the number of heads that turns up lies between 35 and 65, between 40 and 60, and between 45 and 55. 6 Charles claims that he can distinguish between beer and ale 75 percent of the time. Ruth bets that he cannot and, in fact, just guesses. To settle this, a bet is made: Charles is to be given ten small glasses, each having been filled with beer or ale, chosen by tossing a fair coin. He wins the bet if he gets seven or more correct. Find the probability that Charles wins if he has the ability that he claims. Find the probability that Ruth wins if Charles is guessing. 7 Show that b(n, p, j) = p q n −j + 1 j  b(n, p, j −1) , for j ≥1. Use this fact to determine the value or values of j which give b(n, p, j) its greatest value. Hint: Consider the successive ratios as j increases. 8 A die is rolled 30 times. What is the probability that a 6 turns up exactly 5 times? What is the most probable number of times that a 6 will turn up? 9 Find integers n and r such that the following equation is true: 13 5  + 2 13 6  + 13 7  = n r  . 10 In a ten-question true-false exam, find the probability that a student gets a grade of 70 percent or better by guessing. Answer the same question if the test has 30 questions, and if the test has 50 questions. 11 A restaurant offers apple and blueberry pies and stocks an equal number of each kind of pie. Each day ten customers request pie. They choose, with equal probabilities, one of the two kinds of pie. How many pieces of each kind of pie should the owner provide so that the probability is about .95 that each customer gets the pie of his or her own choice? 12 A poker hand is a set of 5 cards randomly chosen from a deck of 52 cards. Find the probability of a (a) royal flush (ten, jack, queen, king, ace in a single suit). (b) straight flush (five in a sequence in a single suit, but not a royal flush). (c) four of a kind (four cards of the same face value). (d) full house (one pair and one triple, each of the same face value). (e) flush (five cards in a single suit but not a straight or royal flush). (f) straight (five cards in a sequence, not all the same suit). (Note that in straights, an ace counts high or low.) 13 If a set has 2n elements, show that it has more subsets with n elements than with any other number of elements.
prob_Page_122_Chunk4961
3.2. COMBINATIONS 115 14 Let b(2n, .5, n) be the probability that in 2n tosses of a fair coin exactly n heads turn up. Using Stirling’s formula (Theorem 3.3), show that b(2n, .5, n) ∼ 1/√πn. Use the program BinomialProbabilities to compare this with the exact value for n = 10 to 25. 15 A baseball player, Smith, has a batting average of .300 and in a typical game comes to bat three times. Assume that Smith’s hits in a game can be consid- ered to be a Bernoulli trials process with probability .3 for success. Find the probability that Smith gets 0, 1, 2, and 3 hits. 16 The Siwash University football team plays eight games in a season, winning three, losing three, and ending two in a tie. Show that the number of ways that this can happen is 8 3 5 3  = 8! 3! 3! 2! . 17 Using the technique of Exercise 16, show that the number of ways that one can put n different objects into three boxes with a in the first, b in the second, and c in the third is n!/(a! b! c!). 18 Baumgartner, Prosser, and Crowell are grading a calculus exam. There is a true-false question with ten parts. Baumgartner notices that one student has only two out of the ten correct and remarks, “The student was not even bright enough to have flipped a coin to determine his answers.” “Not so clear,” says Prosser. “With 340 students I bet that if they all flipped coins to determine their answers there would be at least one exam with two or fewer answers correct.” Crowell says, “I’m with Prosser. In fact, I bet that we should expect at least one exam in which no answer is correct if everyone is just guessing.” Who is right in all of this? 19 A gin hand consists of 10 cards from a deck of 52 cards. Find the probability that a gin hand has (a) all 10 cards of the same suit. (b) exactly 4 cards in one suit and 3 in two other suits. (c) a 4, 3, 2, 1, distribution of suits. 20 A six-card hand is dealt from an ordinary deck of cards. Find the probability that: (a) All six cards are hearts. (b) There are three aces, two kings, and one queen. (c) There are three cards of one suit and three of another suit. 21 A lady wishes to color her fingernails on one hand using at most two of the colors red, yellow, and blue. How many ways can she do this?
prob_Page_123_Chunk4962
116 CHAPTER 3. COMBINATORICS 22 How many ways can six indistinguishable letters be put in three mail boxes? Hint: One representation of this is given by a sequence |LL|L|LLL| where the |’s represent the partitions for the boxes and the L’s the letters. Any possible way can be so described. Note that we need two bars at the ends and the remaining two bars and the six L’s can be put in any order. 23 Using the method for the hint in Exercise 22, show that r indistinguishable objects can be put in n boxes in n + r −1 n −1  = n + r −1 r  different ways. 24 A travel bureau estimates that when 20 tourists go to a resort with ten hotels they distribute themselves as if the bureau were putting 20 indistinguishable objects into ten distinguishable boxes. Assuming this model is correct, find the probability that no hotel is left vacant when the first group of 20 tourists arrives. 25 An elevator takes on six passengers and stops at ten floors. We can assign two different equiprobable measures for the ways that the passengers are dis- charged: (a) we consider the passengers to be distinguishable or (b) we con- sider them to be indistinguishable (see Exercise 23 for this case). For each case, calculate the probability that all the passengers get offat different floors. 26 You are playing heads or tails with Prosser but you suspect that his coin is unfair. Von Neumann suggested that you proceed as follows: Toss Prosser’s coin twice. If the outcome is HT call the result win. if it is TH call the result lose. If it is TT or HH ignore the outcome and toss Prosser’s coin twice again. Keep going until you get either an HT or a TH and call the result win or lose in a single play. Repeat this procedure for each play. Assume that Prosser’s coin turns up heads with probability p. (a) Find the probability of HT, TH, HH, TT with two tosses of Prosser’s coin. (b) Using part (a), show that the probability of a win on any one play is 1/2, no matter what p is. 27 John claims that he has extrasensory powers and can tell which of two symbols is on a card turned face down (see Example 3.11). To test his ability he is asked to do this for a sequence of trials. Let the null hypothesis be that he is just guessing, so that the probability is 1/2 of his getting it right each time, and let the alternative hypothesis be that he can name the symbol correctly more than half the time. Devise a test with the property that the probability of a type 1 error is less than .05 and the probability of a type 2 error is less than .05 if John can name the symbol correctly 75 percent of the time.
prob_Page_124_Chunk4963
3.2. COMBINATIONS 117 28 In Example 3.11 assume the alternative hypothesis is that p = .8 and that it is desired to have the probability of each type of error less than .01. Use the program PowerCurve to determine values of n and m that will achieve this. Choose n as small as possible. 29 A drug is assumed to be effective with an unknown probability p. To estimate p the drug is given to n patients. It is found to be effective for m patients. The method of maximum likelihood for estimating p states that we should choose the value for p that gives the highest probability of getting what we got on the experiment. Assuming that the experiment can be considered as a Bernoulli trials process with probability p for success, show that the maximum likelihood estimate for p is the proportion m/n of successes. 30 Recall that in the World Series the first team to win four games wins the series. The series can go at most seven games. Assume that the Red Sox and the Mets are playing the series. Assume that the Mets win each game with probability p. Fermat observed that even though the series might not go seven games, the probability that the Mets win the series is the same as the probability that they win four or more game in a series that was forced to go seven games no matter who wins the individual games. (a) Using the program PowerCurve of Example 3.11 find the probability that the Mets win the series for the cases p = .5, p = .6, p = .7. (b) Assume that the Mets have probability .6 of winning each game. Use the program PowerCurve to find a value of n so that, if the series goes to the first team to win more than half the games, the Mets will have a 95 percent chance of winning the series. Choose n as small as possible. 31 Each of the four engines on an airplane functions correctly on a given flight with probability .99, and the engines function independently of each other. Assume that the plane can make a safe landing if at least two of its engines are functioning correctly. What is the probability that the engines will allow for a safe landing? 32 A small boy is lost coming down Mount Washington. The leader of the search team estimates that there is a probability p that he came down on the east side and a probability 1 −p that he came down on the west side. He has n people in his search team who will search independently and, if the boy is on the side being searched, each member will find the boy with probability u. Determine how he should divide the n people into two groups to search the two sides of the mountain so that he will have the highest probability of finding the boy. How does this depend on u? *33 2n balls are chosen at random from a total of 2n red balls and 2n blue balls. Find a combinatorial expression for the probability that the chosen balls are equally divided in color. Use Stirling’s formula to estimate this probability.
prob_Page_125_Chunk4964
118 CHAPTER 3. COMBINATORICS Using BinomialProbabilities, compare the exact value with Stirling’s ap- proximation for n = 20. 34 Assume that every time you buy a box of Wheaties, you receive one of the pictures of the n players on the New York Yankees. Over a period of time, you buy m ≥n boxes of Wheaties. (a) Use Theorem 3.8 to show that the probability that you get all n pictures is 1 − n 1  n −1 n m + n 2  n −2 n m −· · · + (−1)n−1  n n −1   1 n m . Hint: Let Ek be the event that you do not get the kth player’s picture. (b) Write a computer program to compute this probability. Use this program to find, for given n, the smallest value of m which will give probability ≥.5 of getting all n pictures. Consider n = 50, 100, and 150 and show that m = n log n + n log 2 is a good estimate for the number of boxes needed. (For a derivation of this estimate, see Feller.26) *35 Prove the following binomial identity 2n n  = n X j=0 n j 2 . Hint: Consider an urn with n red balls and n blue balls inside. Show that each side of the equation equals the number of ways to choose n balls from the urn. 36 Let j and n be positive integers, with j ≤n. An experiment consists of choosing, at random, a j-tuple of positive integers whose sum is at most n. (a) Find the size of the sample space. Hint: Consider n indistinguishable balls placed in a row. Place j markers between consecutive pairs of balls, with no two markers between the same pair of balls. (We also allow one of the n markers to be placed at the end of the row of balls.) Show that there is a 1-1 correspondence between the set of possible positions for the markers and the set of j-tuples whose size we are trying to count. (b) Find the probability that the j-tuple selected contains at least one 1. 37 Let n (mod m) denote the remainder when the integer n is divided by the integer m. Write a computer program to compute the numbers
prob_Page_126_Chunk4965
3.2. COMBINATIONS 119 arithmetic using the basic function mod(n, m). Try to write your program to make as large a table as possible. Run your program for the cases m = 2 to 7. Do you see any patterns? In particular, for the case m = 2 and n a power of 2, verify that all the entries in the (n −1)st row are 1. (The corresponding binomial numbers are odd.) Use your pictures to explain why this is true. 38 Lucas27 proved the following general result relating to Exercise 37. If p is any prime number, then
prob_Page_127_Chunk4966
120 CHAPTER 3. COMBINATORICS 3.3 Card Shuffling Much of this section is based upon an article by Brad Mann,28 which is an exposition of an article by David Bayer and Persi Diaconis.29 Riffle Shuffles Given a deck of n cards, how many times must we shuffle it to make it “random”? Of course, the answer depends upon the method of shuffling which is used and what we mean by “random.” We shall begin the study of this question by considering a standard model for the riffle shuffle. We begin with a deck of n cards, which we will assume are labelled in increasing order with the integers from 1 to n. A riffle shuffle consists of a cut of the deck into two stacks and an interleaving of the two stacks. For example, if n = 6, the initial ordering is (1, 2, 3, 4, 5, 6), and a cut might occur between cards 2 and 3. This gives rise to two stacks, namely (1, 2) and (3, 4, 5, 6). These are interleaved to form a new ordering of the deck. For example, these two stacks might form the ordering (1, 3, 4, 2, 5, 6). In order to discuss such shuffles, we need to assign a probability distribution to the set of all possible shuffles. There are several reasonable ways in which this can be done. We will give several different assignment strategies, and show that they are equivalent. (This does not mean that this assignment is the only reasonable one.) First, we assign the binomial probability b(n, 1/2, k) to the event that the cut occurs after the kth card. Next, we assume that all possible interleavings, given a cut, are equally likely. Thus, to complete the assignment of probabilities, we need to determine the number of possible interleavings of two stacks of cards, with k and n −k cards, respectively. We begin by writing the second stack in a line, with spaces in between each pair of consecutive cards, and with spaces at the beginning and end (so there are n −k + 1 spaces). We choose, with replacement, k of these spaces, and place the cards from the first stack in the chosen spaces. This can be done in n k  ways. Thus, the probability of a given interleaving should be 1
prob_Page_128_Chunk4967
3.3. CARD SHUFFLING 121 there are 4 rising sequences; they are (1), (2, 3, 4), (5, 6), and (7). It is easy to see that an ordering is the result of a riffle shuffle applied to the identity ordering if and only if it has no more than two rising sequences. (If the ordering has two rising sequences, then these rising sequences correspond to the two stacks induced by the cut, and if the ordering has one rising sequence, then it is the identity ordering.) Thus, the sample space of orderings obtained by applying a riffle shuffle to the identity ordering is naturally described as the set of all orderings with at most two rising sequences. It is now easy to assign a probability distribution to this sample space. Each ordering with two rising sequences is assigned the value b(n, 1/2, k)
prob_Page_129_Chunk4968
122 CHAPTER 3. COMBINATORICS corresponding factor in the probability is i, and the number of cards in this stack decreases by 1. Thus, the numerator is seen to be k!(n −k)!, since all cards in both stacks are eventually chosen. Therefore, this process assigns the probability 1
prob_Page_130_Chunk4969
3.3. CARD SHUFFLING 123 to obtain the deck in the order that it was in before the unshuffle was performed. Thus, this a-unshuffle corresponds to a unique a-shuffle, and this a-shuffle is the inverse of the original a-unshuffle. If we apply an ab-unshuffle U3 to a deck, we obtain a set of ab stacks, which are then combined, in order, to form one stack. We label these stacks with ordered pairs of integers, where the first coordinate is between 0 and a −1, and the second coordinate is between 0 and b −1. Then we label each card with the label of its stack. The number of possible labels is ab, as required. Using this labelling, we can describe how to find a b-unshuffle and an a-unshuffle, such that if these two unshuffles are applied in this order to the deck, we obtain the same set of ab stacks as were obtained by the ab-unshuffle. To obtain the b-unshuffle U2, we sort the deck into b stacks, with the ith stack containing all of the cards with second coordinate i, for 0 ≤i ≤b −1. Then these stacks are combined to form one stack. The a-unshuffle U1 proceeds in the same manner, except that the first coordinates of the labels are used. The resulting a stacks are then combined to form one stack. The above description shows that the cards ending up on top are all those labelled (0, 0). These are followed by those labelled (0, 1), (0, 2), . . . , (0, b − 1), (1, 0), (1, 1), . . . , (a −1, b −1). Furthermore, the relative order of any pair of cards with the same labels is never altered. But this is exactly the same as an ab-unshuffle, if, at the beginning of such an unshuffle, we label each of the cards with one of the labels (0, 0), (0, 1), . . . , (0, b −1), (1, 0), (1, 1), . . . , (a −1, b −1). This completes the proof. 2 In Figure 3.11, we show the labels for a 2-unshuffle of a deck with 10 cards. There are 4 cards with the label 0 and 6 cards with the label 1, so if the 2-unshuffle is performed, the first stack will have 4 cards and the second stack will have 6 cards. When this unshuffle is performed, the deck ends up in the identity ordering. In Figure 3.12, we show the labels for a 4-unshuffle of the same deck (because there are four labels being used). This figure can also be regarded as an example of a pair of 2-unshuffles, as described in the proof above. The first 2-unshuffle will use the second coordinate of the labels to determine the stacks. In this case, the two stacks contain the cards whose values are {5, 1, 6, 2, 7} and {8, 9, 3, 4, 10} . After this 2-unshuffle has been performed, the deck is in the order shown in Fig- ure 3.11, as the reader should check. If we wish to perform a 4-unshuffle on the deck, using the labels shown, we sort the cards lexicographically, obtaining the four stacks {1, 2}, {3, 4}, {5, 6, 7}, and {8, 9, 10} . When these stacks are combined, we once again obtain the identity ordering of the deck. The point of the above theorem is that both sorting procedures always lead to the same initial ordering.
prob_Page_131_Chunk4970
124 CHAPTER 3. COMBINATORICS Figure 3.11: Before a 2-unshuffle. Figure 3.12: Before a 4-unshuffle.
prob_Page_132_Chunk4971
3.3. CARD SHUFFLING 125 Theorem 3.10 If D is any ordering that is the result of applying an a-shuffle and then a b-shuffle to the identity ordering, then the probability assigned to D by this pair of operations is the same as the probability assigned to D by the process of applying an ab-shuffle to the identity ordering. Proof. Call the sample space of a-shuffles Sa. If we label the stacks by the integers from 0 to a −1, then each cut-interleaving pair, i.e., shuffle, corresponds to exactly one n-digit base a integer, where the ith digit in the integer is the stack of which the ith card is a member. Thus, the number of cut-interleaving pairs is equal to the number of n-digit base a integers, which is an. Of course, not all of these pairs leads to different orderings. The number of pairs leading to a given ordering will be discussed later. For our purposes it is enough to point out that it is the cut-interleaving pairs that determine the probability assignment. The previous theorem shows that there is a 1-1 correspondence between Sa,b and Sab. Furthermore, corresponding elements give the same ordering when applied to the identity ordering. Given any ordering D, let m1 be the number of elements of Sa,b which, when applied to the identity ordering, result in D. Let m2 be the number of elements of Sab which, when applied to the identity ordering, result in D. The previous theorem implies that m1 = m2. Thus, both sets assign the probability m1 (ab)n to D. This completes the proof. 2 Connection with the Birthday Problem There is another point that can be made concerning the labels given to the cards by the successive unshuffles. Suppose that we 2-unshuffle an n-card deck until the labels on the cards are all different. It is easy to see that this process produces each permutation with the same probability, i.e., this is a random process. To see this, note that if the labels become distinct on the sth 2-unshuffle, then one can think of this sequence of 2-unshuffles as one 2s-unshuffle, in which all of the stacks determined by the unshuffle have at most one card in them (remember, the stacks correspond to the labels). If each stack has at most one card in it, then given any two cards in the deck, it is equally likely that the first card has a lower or a higher label than the second card. Thus, each possible ordering is equally likely to result from this 2s-unshuffle. Let T be the random variable that counts the number of 2-unshuffles until all labels are distinct. One can think of T as giving a measure of how long it takes in the unshuffling process until randomness is reached. Since shuffling and unshuffling are inverse processes, T also measures the number of shuffles necessary to achieve randomness. Suppose that we have an n-card deck, and we ask for P(T ≤s). This equals 1 −P(T > s). But T > s if and only if it is the case that not all of the labels after s 2-unshuffles are distinct. This is just the birthday problem; we are asking for the probability that at least two people have the same birthday, given
prob_Page_133_Chunk4972
126 CHAPTER 3. COMBINATORICS that we have n people and there are 2s possible birthdays. Using our formula from Example 3.3, we find that P(T > s) = 1 − 2s n  n! 2sn . (3.4) In Chapter 6, we will define the average value of a random variable. Using this idea, and the above equation, one can calculate the average value of the random variable T (see Exercise 6.1.41). For example, if n = 52, then the average value of T is about 11.7. This means that, on the average, about 12 riffle shuffles are needed for the process to be considered random. Cut-Interleaving Pairs and Orderings As was noted in the proof of Theorem 3.10, not all of the cut-interleaving pairs lead to different orderings. However, there is an easy formula which gives the number of such pairs that lead to a given ordering. Theorem 3.11 If an ordering of length n has r rising sequences, then the number of cut-interleaving pairs under an a-shuffle of the identity ordering which lead to the ordering is n + a −r n  . Proof. To see why this is true, we need to count the number of ways in which the cut in an a-shuffle can be performed which will lead to a given ordering with r rising sequences. We can disregard the interleavings, since once a cut has been made, at most one interleaving will lead to a given ordering. Since the given ordering has r rising sequences, r −1 of the division points in the cut are determined. The remaining a −1 −(r −1) = a −r division points can be placed anywhere. The number of places to put these remaining division points is n + 1 (which is the number of spaces between the consecutive pairs of cards, including the positions at the beginning and the end of the deck). These places are chosen with repetition allowed, so the number of ways to make these choices is n + a −r a −r  = n + a −r n  . In particular, this means that if D is an ordering that is the result of applying an a-shuffle to the identity ordering, and if D has r rising sequences, then the probability assigned to D by this process is
prob_Page_134_Chunk4973
3.3. CARD SHUFFLING 127 The above theorem shows that the essential information about the probability assigned to an ordering under an a-shuffle is just the number of rising sequences in the ordering. Thus, if we determine the number of orderings which contain exactly r rising sequences, for each r between 1 and n, then we will have determined the distribution function of the random variable which consists of applying a random a-shuffle to the identity ordering. The number of orderings of {1, 2, . . ., n} with r rising sequences is denoted by A(n, r), and is called an Eulerian number. There are many ways to calculate the values of these numbers; the following theorem gives one recursive method which follows immediately from what we already know about a-shuffles. Theorem 3.12 Let a and n be positive integers. Then an = a X r=1 n + a −r n  A(n, r) . (3.5) Thus, A(n, a) = an − a−1 X r=1 n + a −r n  A(n, r) . In addition, A(n, 1) = 1 . Proof. The second equation can be used to calculate the values of the Eulerian numbers, and follows immediately from the Equation 3.5. The last equation is a consequence of the fact that the only ordering of {1, 2, . . ., n} with one rising sequence is the identity ordering. Thus, it remains to prove Equation 3.5. We will count the set of a-shuffles of a deck with n cards in two ways. First, we know that there are an such shuffles (this was noted in the proof of Theorem 3.10). But there are A(n, r) orderings of {1, 2, . . ., n} with r rising sequences, and Theorem 3.11 states that for each such ordering, there are exactly n + a −r n  cut-interleaving pairs that lead to the ordering. Therefore, the right-hand side of Equation 3.5 counts the set of a-shuffles of an n-card deck. This completes the proof. 2 Random Orderings and Random Processes We now turn to the second question that was asked at the beginning of this section: What do we mean by a “random” ordering? It is somewhat misleading to think about a given ordering as being random or not random. If we want to choose a random ordering from the set of all orderings of {1, 2, . . ., n}, we mean that we want every ordering to be chosen with the same probability, i.e., any ordering is as “random” as any other.
prob_Page_135_Chunk4974
128 CHAPTER 3. COMBINATORICS The word “random” should really be used to describe a process. We will say that a process that produces an object from a (finite) set of objects is a random process if each object in the set is produced with the same probability by the process. In the present situation, the objects are the orderings, and the process which produces these objects is the shuffling process. It is easy to see that no a-shuffle is really a random process, since if T1 and T2 are two orderings with a different number of rising sequences, then they are produced by an a-shuffle, applied to the identity ordering, with different probabilities. Variation Distance Instead of requiring that a sequence of shuffles yield a process which is random, we will define a measure that describes how far away a given process is from a random process. Let X be any process which produces an ordering of {1, 2, . . ., n}. Define fX(π) be the probability that X produces the ordering π. (Thus, X can be thought of as a random variable with distribution function f.) Let Ωn be the set of all orderings of {1, 2, . . ., n}. Finally, let u(π) = 1/|Ωn| for all π ∈Ωn. The function u is the distribution function of a process which produces orderings and which is random. For each ordering π ∈Ωn, the quantity |fX(π) −u(π)| is the difference between the actual and desired probabilities that X produces π. If we sum this over all orderings π and call this sum S, we see that S = 0 if and only if X is random, and otherwise S is positive. It is easy to show that the maximum value of S is 2, so we will multiply the sum by 1/2 so that the value falls in the interval [0, 1]. Thus, we obtain the following sum as the formula for the variation distance between the two processes: ∥fX −u ∥= 1 2 X π∈Ωn |fX(π) −u(π)| . Now we apply this idea to the case of shuffling. We let X be the process of s successive riffle shuffles applied to the identity ordering. We know that it is also possible to think of X as one 2s-shuffle. We also know that fX is constant on the set of all orderings with r rising sequences, where r is any positive integer. Finally, we know the value of fX on an ordering with r rising sequences, and we know how many such orderings there are. Thus, in this specific case, we have ∥fX −u ∥= 1 2 n X r=1 A(n, r) 2s + n −r n  /2ns −1 n! . Since this sum has only n summands, it is easy to compute this for moderate sized values of n. For n = 52, we obtain the list of values given in Table 3.14. To help in understanding these data, they are shown in graphical form in Fig- ure 3.13. The program VariationList produces the data shown in both Table 3.14 and Figure 3.13. One sees that until 5 shuffles have occurred, the output of X is
prob_Page_136_Chunk4975
3.3. CARD SHUFFLING 129 Number of Riffle Shuffles Variation Distance 1 1 2 1 3 1 4 0.9999995334 5 0.9237329294 6 0.6135495966 7 0.3340609995 8 0.1671586419 9 0.0854201934 10 0.0429455489 11 0.0215023760 12 0.0107548935 13 0.0053779101 14 0.0026890130 Table 3.14: Distance to the random process. 5 10 15 20 0.2 0.4 0.6 0.8 1 Figure 3.13: Distance to the random process.
prob_Page_137_Chunk4976
130 CHAPTER 3. COMBINATORICS very far from random. After 5 shuffles, the distance from the random process is essentially halved each time a shuffle occurs. Given the distribution functions fX(π) and u(π) as above, there is another way to view the variation distance ∥fX −u ∥. Given any event T (which is a subset of Sn), we can calculate its probability under the process X and under the uniform process. For example, we can imagine that T represents the set of all permutations in which the first player in a 7-player poker game is dealt a straight flush (five consecutive cards in the same suit). It is interesting to consider how much the probability of this event after a certain number of shuffles differs from the probability of this event if all permutations are equally likely. This difference can be thought of as describing how close the process X is to the random process with respect to the event T. Now consider the event T such that the absolute value of the difference between these two probabilities is as large as possible. It can be shown that this absolute value is the variation distance between the process X and the uniform process. (The reader is asked to prove this fact in Exercise 4.) We have just seen that, for a deck of 52 cards, the variation distance between the 7-riffle shuffle process and the random process is about .334. It is of interest to find an event T such that the difference between the probabilities that the two processes produce T is close to .334. An event with this property can be described in terms of the game called New-Age Solitaire. New-Age Solitaire This game was invented by Peter Doyle. It is played with a standard 52-card deck. We deal the cards face up, one at a time, onto a discard pile. If an ace is encountered, say the ace of Hearts, we use it to start a Heart pile. Each suit pile must be built up in order, from ace to king, using only subsequently dealt cards. Once we have dealt all of the cards, we pick up the discard pile and continue. We define the Yin suits to be Hearts and Clubs, and the Yang suits to be Diamonds and Spades. The game ends when either both Yin suit piles have been completed, or both Yang suit piles have been completed. It is clear that if the ordering of the deck is produced by the random process, then the probability that the Yin suit piles are completed first is exactly 1/2. Now suppose that we buy a new deck of cards, break the seal on the package, and riffle shuffle the deck 7 times. If one tries this, one finds that the Yin suits win about 75% of the time. This is 25% more than we would get if the deck were in truly random order. This deviation is reasonably close to the theoretical maximum of 33.4% obtained above. Why do the Yin suits win so often? In a brand new deck of cards, the suits are in the following order, from top to bottom: ace through king of Hearts, ace through king of Clubs, king through ace of Diamonds, and king through ace of Spades. Note that if the cards were not shuffled at all, then the Yin suit piles would be completed on the first pass, before any Yang suit cards are even seen. If we were to continue playing the game until the Yang suit piles are completed, it would take 13 passes
prob_Page_138_Chunk4977
3.3. CARD SHUFFLING 131 through the deck to do this. Thus, one can see that in a new deck, the Yin suits are in the most advantageous order and the Yang suits are in the least advantageous order. Under 7 riffle shuffles, the relative advantage of the Yin suits over the Yang suits is preserved to a certain extent. Exercises 1 Given any ordering σ of {1, 2, . . ., n}, we can define σ−1, the inverse ordering of σ, to be the ordering in which the ith element is the position occupied by i in σ. For example, if σ = (1, 3, 5, 2, 4, 7, 6), then σ−1 = (1, 4, 2, 5, 3, 7, 6). (If one thinks of these orderings as permutations, then σ−1 is the inverse of σ.) A fall occurs between two positions in an ordering if the left position is occu- pied by a larger number than the right position. It will be convenient to say that every ordering has a fall after the last position. In the above example, σ−1 has four falls. They occur after the second, fourth, sixth, and seventh positions. Prove that the number of rising sequences in an ordering σ equals the number of falls in σ−1. 2 Show that if we start with the identity ordering of {1, 2, . . ., n}, then the prob- ability that an a-shuffle leads to an ordering with exactly r rising sequences equals
prob_Page_139_Chunk4978
132 CHAPTER 3. COMBINATORICS (b) Give an accurate estimate for the probability that in three riffle shuffles of a 52-card deck, the first card ends up in one of the first 26 positions. Using a computer, accurately estimate the probability of the same event after seven riffle shuffles. 4 Let X denote a particular process that produces elements of Sn, and let U denote the uniform process. Let the distribution functions of these processes be denoted by fX and u, respectively. Show that the variation distance ∥fX −u ∥is equal to max T ⊂Sn X π∈T  fX(π) −u(π)  . Hint: Write the permutations in Sn in decreasing order of the difference fX(π) −u(π). 5 Consider the process described in the text in which an n-card deck is re- peatedly labelled and 2-unshuffled, in the manner described in the proof of Theorem 3.9. (See Figures 3.10 and 3.13.) The process continues until the labels are all different. Show that the process never terminates until at least ⌈log2(n)⌉unshuffles have been done.
prob_Page_140_Chunk4979
Chapter 4 Conditional Probability 4.1 Discrete Conditional Probability Conditional Probability In this section we ask and answer the following question. Suppose we assign a distribution function to a sample space and then learn that an event E has occurred. How should we change the probabilities of the remaining events? We shall call the new probability for an event F the conditional probability of F given E and denote it by P(F|E). Example 4.1 An experiment consists of rolling a die once. Let X be the outcome. Let F be the event {X = 6}, and let E be the event {X > 4}. We assign the distribution function m(ω) = 1/6 for ω = 1, 2, . . ., 6. Thus, P(F) = 1/6. Now suppose that the die is rolled and we are told that the event E has occurred. This leaves only two possible outcomes: 5 and 6. In the absence of any other information, we would still regard these outcomes to be equally likely, so the probability of F becomes 1/2, making P(F|E) = 1/2. 2 Example 4.2 In the Life Table (see Appendix C), one finds that in a population of 100,000 females, 89.835% can expect to live to age 60, while 57.062% can expect to live to age 80. Given that a woman is 60, what is the probability that she lives to age 80? This is an example of a conditional probability. In this case, the original sample space can be thought of as a set of 100,000 females. The events E and F are the subsets of the sample space consisting of all women who live at least 60 years, and at least 80 years, respectively. We consider E to be the new sample space, and note that F is a subset of E. Thus, the size of E is 89,835, and the size of F is 57,062. So, the probability in question equals 57,062/89,835 = .6352. Thus, a woman who is 60 has a 63.52% chance of living to age 80. 2 133
prob_Page_141_Chunk4980
134 CHAPTER 4. CONDITIONAL PROBABILITY Example 4.3 Consider our voting example from Section 1.2: three candidates A, B, and C are running for office. We decided that A and B have an equal chance of winning and C is only 1/2 as likely to win as A. Let A be the event “A wins,” B that “B wins,” and C that “C wins.” Hence, we assigned probabilities P(A) = 2/5, P(B) = 2/5, and P(C) = 1/5. Suppose that before the election is held, A drops out of the race. As in Exam- ple 4.1, it would be natural to assign new probabilities to the events B and C which are proportional to the original probabilities. Thus, we would have P(B| A) = 2/3, and P(C| A) = 1/3. It is important to note that any time we assign probabilities to real-life events, the resulting distribution is only useful if we take into account all relevant information. In this example, we may have knowledge that most voters who favor A will vote for C if A is no longer in the race. This will clearly make the probability that C wins greater than the value of 1/3 that was assigned above. 2 In these examples we assigned a distribution function and then were given new information that determined a new sample space, consisting of the outcomes that are still possible, and caused us to assign a new distribution function to this space. We want to make formal the procedure carried out in these examples. Let Ω= {ω1, ω2, . . . , ωr} be the original sample space with distribution function m(ωj) assigned. Suppose we learn that the event E has occurred. We want to assign a new distribution function m(ωj|E) to Ωto reflect this fact. Clearly, if a sample point ωj is not in E, we want m(ωj|E) = 0. Moreover, in the absence of information to the contrary, it is reasonable to assume that the probabilities for ωk in E should have the same relative magnitudes that they had before we learned that E had occurred. For this we require that m(ωk|E) = cm(ωk) for all ωk in E, with c some positive constant. But we must also have X E m(ωk|E) = c X E m(ωk) = 1 . Thus, c = 1 P E m(ωk) = 1 P(E) . (Note that this requires us to assume that P(E) > 0.) Thus, we will define m(ωk|E) = m(ωk) P(E) for ωk in E. We will call this new distribution the conditional distribution given E. For a general event F, this gives P(F|E) = X F ∩E m(ωk|E) = X F ∩E m(ωk) P(E) = P(F ∩E) P(E) . We call P(F|E) the conditional probability of F occurring given that E occurs, and compute it using the formula P(F|E) = P(F ∩E) P(E) .
prob_Page_142_Chunk4981
4.1. DISCRETE CONDITIONAL PROBABILITY 135 (start) p (ω) ω ω ω ω ω 1/2 1/2 l ll 2/5 3/5 1/2 1/2 b w w b 1/5 3/10 1/4 1/4 Urn Color of ball 1 2 3 4 Figure 4.1: Tree diagram. Example 4.4 (Example 4.1 continued) Let us return to the example of rolling a die. Recall that F is the event X = 6, and E is the event X > 4. Note that E ∩F is the event F. So, the above formula gives P(F|E) = P(F ∩E) P(E) = 1/6 1/3 = 1 2 , in agreement with the calculations performed earlier. 2 Example 4.5 We have two urns, I and II. Urn I contains 2 black balls and 3 white balls. Urn II contains 1 black ball and 1 white ball. An urn is drawn at random and a ball is chosen at random from it. We can represent the sample space of this experiment as the paths through a tree as shown in Figure 4.1. The probabilities assigned to the paths are also shown. Let B be the event “a black ball is drawn,” and I the event “urn I is chosen.” Then the branch weight 2/5, which is shown on one branch in the figure, can now be interpreted as the conditional probability P(B|I). Suppose we wish to calculate P(I|B). Using the formula, we obtain P(I|B) = P(I ∩B) P(B) = P(I ∩B) P(B ∩I) + P(B ∩II) = 1/5 1/5 + 1/4 = 4 9 . 2
prob_Page_143_Chunk4982
136 CHAPTER 4. CONDITIONAL PROBABILITY (start) p (ω) ω ω ω ω ω 9/20 11/20 b w 4/9 5/9 5/11 6/11 I II II I 1/5 3/10 1/4 1/4 Urn Color of ball 1 3 2 4 Figure 4.2: Reverse tree diagram. Bayes Probabilities Our original tree measure gave us the probabilities for drawing a ball of a given color, given the urn chosen. We have just calculated the inverse probability that a particular urn was chosen, given the color of the ball. Such an inverse probability is called a Bayes probability and may be obtained by a formula that we shall develop later. Bayes probabilities can also be obtained by simply constructing the tree measure for the two-stage experiment carried out in reverse order. We show this tree in Figure 4.2. The paths through the reverse tree are in one-to-one correspondence with those in the forward tree, since they correspond to individual outcomes of the experiment, and so they are assigned the same probabilities. From the forward tree, we find that the probability of a black ball is 1 2 · 2 5 + 1 2 · 1 2 = 9 20 . The probabilities for the branches at the second level are found by simple divi- sion. For example, if x is the probability to be assigned to the top branch at the second level, we must have 9 20 · x = 1 5 or x = 4/9. Thus, P(I|B) = 4/9, in agreement with our previous calculations. The reverse tree then displays all of the inverse, or Bayes, probabilities. Example 4.6 We consider now a problem called the Monty Hall problem. This has long been a favorite problem but was revived by a letter from Craig Whitaker to Marilyn vos Savant for consideration in her column in Parade Magazine.1 Craig wrote: 1Marilyn vos Savant, Ask Marilyn, Parade Magazine, 9 September; 2 December; 17 February 1990, reprinted in Marilyn vos Savant, Ask Marilyn, St. Martins, New York, 1992.
prob_Page_144_Chunk4983
4.1. DISCRETE CONDITIONAL PROBABILITY 137 Suppose you’re on Monty Hall’s Let’s Make a Deal! You are given the choice of three doors, behind one door is a car, the others, goats. You pick a door, say 1, Monty opens another door, say 3, which has a goat. Monty says to you “Do you want to pick door 2?” Is it to your advantage to switch your choice of doors? Marilyn gave a solution concluding that you should switch, and if you do, your probability of winning is 2/3. Several irate readers, some of whom identified them- selves as having a PhD in mathematics, said that this is absurd since after Monty has ruled out one door there are only two possible doors and they should still each have the same probability 1/2 so there is no advantage to switching. Marilyn stuck to her solution and encouraged her readers to simulate the game and draw their own conclusions from this. We also encourage the reader to do this (see Exercise 11). Other readers complained that Marilyn had not described the problem com- pletely. In particular, the way in which certain decisions were made during a play of the game were not specified. This aspect of the problem will be discussed in Sec- tion 4.3. We will assume that the car was put behind a door by rolling a three-sided die which made all three choices equally likely. Monty knows where the car is, and always opens a door with a goat behind it. Finally, we assume that if Monty has a choice of doors (i.e., the contestant has picked the door with the car behind it), he chooses each door with probability 1/2. Marilyn clearly expected her readers to assume that the game was played in this manner. As is the case with most apparent paradoxes, this one can be resolved through careful analysis. We begin by describing a simpler, related question. We say that a contestant is using the “stay” strategy if he picks a door, and, if offered a chance to switch to another door, declines to do so (i.e., he stays with his original choice). Similarly, we say that the contestant is using the “switch” strategy if he picks a door, and, if offered a chance to switch to another door, takes the offer. Now suppose that a contestant decides in advance to play the “stay” strategy. His only action in this case is to pick a door (and decline an invitation to switch, if one is offered). What is the probability that he wins a car? The same question can be asked about the “switch” strategy. Using the “stay” strategy, a contestant will win the car with probability 1/3, since 1/3 of the time the door he picks will have the car behind it. On the other hand, if a contestant plays the “switch” strategy, then he will win whenever the door he originally picked does not have the car behind it, which happens 2/3 of the time. This very simple analysis, though correct, does not quite solve the problem that Craig posed. Craig asked for the conditional probability that you win if you switch, given that you have chosen door 1 and that Monty has chosen door 3. To solve this problem, we set up the problem before getting this information and then compute the conditional probability given this information. This is a process that takes place in several stages; the car is put behind a door, the contestant picks a door, and finally Monty opens a door. Thus it is natural to analyze this using a tree measure. Here we make an additional assumption that if Monty has a choice
prob_Page_145_Chunk4984
138 CHAPTER 4. CONDITIONAL PROBABILITY 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1 1/2 1/2 1/2 1/2 1/2 1 1/2 1 1 1 1 Door opened by Monty Door chosen by contestant Path probabilities Placement of car 1 2 3 1 2 3 1 1 2 2 3 3 2 3 3 2 3 3 1 1 2 1 1 2 1/18 1/18 1/18 1/18 1/18 1/9 1/9 1/9 1/18 1/9 1/9 1/9 1/3 1/3 Figure 4.3: The Monty Hall problem. of doors (i.e., the contestant has picked the door with the car behind it) then he picks each door with probability 1/2. The assumptions we have made determine the branch probabilities and these in turn determine the tree measure. The resulting tree and tree measure are shown in Figure 4.3. It is tempting to reduce the tree’s size by making certain assumptions such as: “Without loss of generality, we will assume that the contestant always picks door 1.” We have chosen not to make any such assumptions, in the interest of clarity. Now the given information, namely that the contestant chose door 1 and Monty chose door 3, means only two paths through the tree are possible (see Figure 4.4). For one of these paths, the car is behind door 1 and for the other it is behind door 2. The path with the car behind door 2 is twice as likely as the one with the car behind door 1. Thus the conditional probability is 2/3 that the car is behind door 2 and 1/3 that it is behind door 1, so if you switch you have a 2/3 chance of winning the car, as Marilyn claimed. At this point, the reader may think that the two problems above are the same, since they have the same answers. Recall that we assumed in the original problem
prob_Page_146_Chunk4985
4.1. DISCRETE CONDITIONAL PROBABILITY 139 1/3 1/3 1/3 1/2 1 Door opened by Monty Door chosen by contestant Unconditional probability Placement of car 1 2 1 1 3 3 1/18 1/9 1/3 Conditional probability 1/3 2/3 Figure 4.4: Conditional probabilities for the Monty Hall problem. if the contestant chooses the door with the car, so that Monty has a choice of two doors, he chooses each of them with probability 1/2. Now suppose instead that in the case that he has a choice, he chooses the door with the larger number with probability 3/4. In the “switch” vs. “stay” problem, the probability of winning with the “switch” strategy is still 2/3. However, in the original problem, if the contestant switches, he wins with probability 4/7. The reader can check this by noting that the same two paths as before are the only two possible paths in the tree. The path leading to a win, if the contestant switches, has probability 1/3, while the path which leads to a loss, if the contestant switches, has probability 1/4. 2 Independent Events It often happens that the knowledge that a certain event E has occurred has no effect on the probability that some other event F has occurred, that is, that P(F|E) = P(F). One would expect that in this case, the equation P(E|F) = P(E) would also be true. In fact (see Exercise 1), each equation implies the other. If these equations are true, we might say the F is independent of E. For example, you would not expect the knowledge of the outcome of the first toss of a coin to change the probability that you would assign to the possible outcomes of the second toss, that is, you would not expect that the second toss depends on the first. This idea is formalized in the following definition of independent events. Definition 4.1 Let E and F be two events. We say that they are independent if either 1) both events have positive probability and P(E|F) = P(E) and P(F|E) = P(F) , or 2) at least one of the events has probability 0. 2
prob_Page_147_Chunk4986
140 CHAPTER 4. CONDITIONAL PROBABILITY As noted above, if both P(E) and P(F) are positive, then each of the above equations imply the other, so that to see whether two events are independent, only one of these equations must be checked (see Exercise 1). The following theorem provides another way to check for independence. Theorem 4.1 Two events E and F are independent if and only if P(E ∩F) = P(E)P(F) . Proof. If either event has probability 0, then the two events are independent and the above equation is true, so the theorem is true in this case. Thus, we may assume that both events have positive probability in what follows. Assume that E and F are independent. Then P(E|F) = P(E), and so P(E ∩F) = P(E|F)P(F) = P(E)P(F) . Assume next that P(E ∩F) = P(E)P(F). Then P(E|F) = P(E ∩F) P(F) = P(E) . Also, P(F|E) = P(F ∩E) P(E) = P(F) . Therefore, E and F are independent. 2 Example 4.7 Suppose that we have a coin which comes up heads with probability p, and tails with probability q. Now suppose that this coin is tossed twice. Using a frequency interpretation of probability, it is reasonable to assign to the outcome (H, H) the probability p2, to the outcome (H, T) the probability pq, and so on. Let E be the event that heads turns up on the first toss and F the event that tails turns up on the second toss. We will now check that with the above probability assignments, these two events are independent, as expected. We have P(E) = p2 + pq = p, P(F) = pq + q2 = q. Finally P(E ∩F) = pq, so P(E ∩F) = P(E)P(F). 2 Example 4.8 It is often, but not always, intuitively clear when two events are independent. In Example 4.7, let A be the event “the first toss is a head” and B the event “the two outcomes are the same.” Then P(B|A) = P(B ∩A) P(A) = P{HH} P{HH,HT} = 1/4 1/2 = 1 2 = P(B). Therefore, A and B are independent, but the result was not so obvious. 2
prob_Page_148_Chunk4987
4.1. DISCRETE CONDITIONAL PROBABILITY 141 Example 4.9 Finally, let us give an example of two events that are not indepen- dent. In Example 4.7, let I be the event “heads on the first toss” and J the event “two heads turn up.” Then P(I) = 1/2 and P(J) = 1/4. The event I∩J is the event “heads on both tosses” and has probability 1/4. Thus, I and J are not independent since P(I)P(J) = 1/8 ̸= P(I ∩J). 2 We can extend the concept of independence to any finite set of events A1, A2, . . . , An. Definition 4.2 A set of events {A1, A2, . . . , An} is said to be mutually indepen- dent if for any subset {Ai, Aj, . . . , Am} of these events we have P(Ai ∩Aj ∩· · · ∩Am) = P(Ai)P(Aj) · · · P(Am), or equivalently, if for any sequence ¯A1, ¯A2, . . . , ¯An with ¯Aj = Aj or ˜Aj, P( ¯A1 ∩¯A2 ∩· · · ∩¯An) = P( ¯A1)P( ¯A2) · · · P( ¯An). (For a proof of the equivalence in the case n = 3, see Exercise 33.) 2 Using this terminology, it is a fact that any sequence (S, S, F, F, S, . . . , S) of possible outcomes of a Bernoulli trials process forms a sequence of mutually independent events. It is natural to ask: If all pairs of a set of events are independent, is the whole set mutually independent? The answer is not necessarily, and an example is given in Exercise 7. It is important to note that the statement P(A1 ∩A2 ∩· · · ∩An) = P(A1)P(A2) · · · P(An) does not imply that the events A1, A2, . . . , An are mutually independent (see Exercise 8). Joint Distribution Functions and Independence of Random Variables It is frequently the case that when an experiment is performed, several different quantities concerning the outcomes are investigated. Example 4.10 Suppose we toss a coin three times. The basic random variable ¯X corresponding to this experiment has eight possible outcomes, which are the ordered triples consisting of H’s and T’s. We can also define the random variable Xi, for i = 1, 2, 3, to be the outcome of the ith toss. If the coin is fair, then we should assign the probability 1/8 to each of the eight possible outcomes. Thus, the distribution functions of X1, X2, and X3 are identical; in each case they are defined by m(H) = m(T) = 1/2. 2
prob_Page_149_Chunk4988
142 CHAPTER 4. CONDITIONAL PROBABILITY If we have several random variables X1, X2, . . . , Xn which correspond to a given experiment, then we can consider the joint random variable ¯X = (X1, X2, . . . , Xn) defined by taking an outcome ω of the experiment, and writing, as an n-tuple, the corresponding n outcomes for the random variables X1, X2, . . . , Xn. Thus, if the random variable Xi has, as its set of possible outcomes the set Ri, then the set of possible outcomes of the joint random variable ¯X is the Cartesian product of the Ri’s, i.e., the set of all n-tuples of possible outcomes of the Xi’s. Example 4.11 (Example 4.10 continued) In the coin-tossing example above, let Xi denote the outcome of the ith toss. Then the joint random variable ¯X = (X1, X2, X3) has eight possible outcomes. Suppose that we now define Yi, for i = 1, 2, 3, as the number of heads which occur in the first i tosses. Then Yi has {0, 1, . . ., i} as possible outcomes, so at first glance, the set of possible outcomes of the joint random variable ¯Y = (Y1, Y2, Y3) should be the set {(a1, a2, a3) : 0 ≤a1 ≤1, 0 ≤a2 ≤2, 0 ≤a3 ≤3} . However, the outcome (1, 0, 1) cannot occur, since we must have a1 ≤a2 ≤a3. The solution to this problem is to define the probability of the outcome (1, 0, 1) to be 0. In addition, we must have ai+1 −ai ≤1 for i = 1, 2. We now illustrate the assignment of probabilities to the various outcomes for the joint random variables ¯X and ¯Y . In the first case, each of the eight outcomes should be assigned the probability 1/8, since we are assuming that we have a fair coin. In the second case, since Yi has i + 1 possible outcomes, the set of possible outcomes has size 24. Only eight of these 24 outcomes can actually occur, namely the ones satisfying a1 ≤a2 ≤a3. Each of these outcomes corresponds to exactly one of the outcomes of the random variable ¯X, so it is natural to assign probability 1/8 to each of these. We assign probability 0 to the other 16 outcomes. In each case, the probability function is called a joint distribution function. 2 We collect the above ideas in a definition. Definition 4.3 Let X1, X2, . . . , Xn be random variables associated with an exper- iment. Suppose that the sample space (i.e., the set of possible outcomes) of Xi is the set Ri. Then the joint random variable ¯X = (X1, X2, . . . , Xn) is defined to be the random variable whose outcomes consist of ordered n-tuples of outcomes, with the ith coordinate lying in the set Ri. The sample space Ωof ¯X is the Cartesian product of the Ri’s: Ω= R1 × R2 × · · · × Rn . The joint distribution function of ¯X is the function which gives the probability of each of the outcomes of ¯X. 2 Example 4.12 (Example 4.10 continued) We now consider the assignment of prob- abilities in the above example. In the case of the random variable ¯X, the probabil- ity of any outcome (a1, a2, a3) is just the product of the probabilities P(Xi = ai),
prob_Page_150_Chunk4989
4.1. DISCRETE CONDITIONAL PROBABILITY 143 Not smoke Smoke Total Not cancer 40 10 50 Cancer 7 3 10 Totals 47 13 60 Table 4.1: Smoking and cancer. S 0 1 0 40/60 10/60 C 1 7/60 3/60 Table 4.2: Joint distribution. for i = 1, 2, 3. However, in the case of ¯Y , the probability assigned to the outcome (1, 1, 0) is not the product of the probabilities P(Y1 = 1), P(Y2 = 1), and P(Y3 = 0). The difference between these two situations is that the value of Xi does not affect the value of Xj, if i ̸= j, while the values of Yi and Yj affect one another. For example, if Y1 = 1, then Y2 cannot equal 0. This prompts the next definition. 2 Definition 4.4 The random variables X1, X2, . . . , Xn are mutually independent if P(X1 = r1, X2 = r2, . . . , Xn = rn) = P(X1 = r1)P(X2 = r2) · · · P(Xn = rn) for any choice of r1, r2, . . . , rn. Thus, if X1, X2, . . . , Xn are mutually independent, then the joint distribution function of the random variable ¯X = (X1, X2, . . . , Xn) is just the product of the individual distribution functions. When two random variables are mutually independent, we shall say more briefly that they are indepen- dent. 2 Example 4.13 In a group of 60 people, the numbers who do or do not smoke and do or do not have cancer are reported as shown in Table 4.1. Let Ωbe the sample space consisting of these 60 people. A person is chosen at random from the group. Let C(ω) = 1 if this person has cancer and 0 if not, and S(ω) = 1 if this person smokes and 0 if not. Then the joint distribution of {C, S} is given in Table 4.2. For example P(C = 0, S = 0) = 40/60, P(C = 0, S = 1) = 10/60, and so forth. The distributions of the individual random variables are called marginal distributions. The marginal distributions of C and S are: pC =  0 1 50/60 10/60  ,
prob_Page_151_Chunk4990
144 CHAPTER 4. CONDITIONAL PROBABILITY pS =  0 1 47/60 13/60  . The random variables S and C are not independent, since P(C = 1, S = 1) = 3 60 = .05 , P(C = 1)P(S = 1) = 10 60 · 13 60 = .036 . Note that we would also see this from the fact that P(C = 1|S = 1) = 3 13 = .23 , P(C = 1) = 1 6 = .167 . 2 Independent Trials Processes The study of random variables proceeds by considering special classes of random variables. One such class that we shall study is the class of independent trials. Definition 4.5 A sequence of random variables X1, X2, . . . , Xn that are mutually independent and that have the same distribution is called a sequence of independent trials or an independent trials process. Independent trials processes arise naturally in the following way. We have a single experiment with sample space R = {r1, r2, . . . , rs} and a distribution function mX =  r1 r2 · · · rs p1 p2 · · · ps  . We repeat this experiment n times. To describe this total experiment, we choose as sample space the space Ω= R × R × · · · × R, consisting of all possible sequences ω = (ω1, ω2, . . . , ωn) where the value of each ωj is chosen from R. We assign a distribution function to be the product distribution m(ω) = m(ω1) · . . . · m(ωn) , with m(ωj) = pk when ωj = rk. Then we let Xj denote the jth coordinate of the outcome (r1, r2, . . . , rn). The random variables X1, . . . , Xn form an independent trials process. 2 Example 4.14 An experiment consists of rolling a die three times. Let Xi repre- sent the outcome of the ith roll, for i = 1, 2, 3. The common distribution function is mi =  1 2 3 4 5 6 1/6 1/6 1/6 1/6 1/6 1/6  .
prob_Page_152_Chunk4991
4.1. DISCRETE CONDITIONAL PROBABILITY 145 The sample space is R3 = R × R × R with R = {1, 2, 3, 4, 5, 6}. If ω = (1, 3, 6), then X1(ω) = 1, X2(ω) = 3, and X3(ω) = 6 indicating that the first roll was a 1, the second was a 3, and the third was a 6. The probability assigned to any sample point is m(ω) = 1 6 · 1 6 · 1 6 = 1 216 . 2 Example 4.15 Consider next a Bernoulli trials process with probability p for suc- cess on each experiment. Let Xj(ω) = 1 if the jth outcome is success and Xj(ω) = 0 if it is a failure. Then X1, X2, . . . , Xn is an independent trials process. Each Xj has the same distribution function mj =  0 1 q p  , where q = 1 −p. If Sn = X1 + X2 + · · · + Xn, then P(Sn = j) = n j  pjqn−j , and Sn has, as distribution, the binomial distribution b(n, p, j). 2 Bayes’ Formula In our examples, we have considered conditional probabilities of the following form: Given the outcome of the second stage of a two-stage experiment, find the proba- bility for an outcome at the first stage. We have remarked that these probabilities are called Bayes probabilities. We return now to the calculation of more general Bayes probabilities. Suppose we have a set of events H1, H2, . . . , Hm that are pairwise disjoint and such that the sample space Ωsatisfies the equation Ω= H1 ∪H2 ∪· · · ∪Hm . We call these events hypotheses. We also have an event E that gives us some information about which hypothesis is correct. We call this event evidence. Before we receive the evidence, then, we have a set of prior probabilities P(H1), P(H2), . . . , P(Hm) for the hypotheses. If we know the correct hypothesis, we know the probability for the evidence. That is, we know P(E|Hi) for all i. We want to find the probabilities for the hypotheses given the evidence. That is, we want to find the conditional probabilities P(Hi|E). These probabilities are called the posterior probabilities. To find these probabilities, we write them in the form P(Hi|E) = P(Hi ∩E) P(E) . (4.1)
prob_Page_153_Chunk4992
146 CHAPTER 4. CONDITIONAL PROBABILITY Number having The results Disease this disease + + + – – + – – d1 3215 2110 301 704 100 d2 2125 396 132 1187 410 d3 4660 510 3568 73 509 Total 10000 Table 4.3: Diseases data. We can calculate the numerator from our given information by P(Hi ∩E) = P(Hi)P(E|Hi) . (4.2) Since one and only one of the events H1, H2, . . . , Hm can occur, we can write the probability of E as P(E) = P(H1 ∩E) + P(H2 ∩E) + · · · + P(Hm ∩E) . Using Equation 4.2, the above expression can be seen to equal P(H1)P(E|H1) + P(H2)P(E|H2) + · · · + P(Hm)P(E|Hm) . (4.3) Using (4.1), (4.2), and (4.3) yields Bayes’ formula: P(Hi|E) = P(Hi)P(E|Hi) Pm k=1 P(Hk)P(E|Hk) . Although this is a very famous formula, we will rarely use it. If the number of hypotheses is small, a simple tree measure calculation is easily carried out, as we have done in our examples. If the number of hypotheses is large, then we should use a computer. Bayes probabilities are particularly appropriate for medical diagnosis. A doctor is anxious to know which of several diseases a patient might have. She collects evidence in the form of the outcomes of certain tests. From statistical studies the doctor can find the prior probabilities of the various diseases before the tests, and the probabilities for specific test outcomes, given a particular disease. What the doctor wants to know is the posterior probability for the particular disease, given the outcomes of the tests. Example 4.16 A doctor is trying to decide if a patient has one of three diseases d1, d2, or d3. Two tests are to be carried out, each of which results in a positive (+) or a negative (−) outcome. There are four possible test patterns ++, +−, −+, and −−. National records have indicated that, for 10,000 people having one of these three diseases, the distribution of diseases and test results are as in Table 4.3. From this data, we can estimate the prior probabilities for each of the diseases and, given a particular disease, the probability of a particular test outcome. For example, the prior probability of disease d1 may be estimated to be 3215/10,000 = .3215. The probability of the test result +−, given disease d1, may be estimated to be 301/3215 = .094.
prob_Page_154_Chunk4993
4.1. DISCRETE CONDITIONAL PROBABILITY 147 d1 d2 d3 + + .700 .131 .169 + – .075 .033 .892 – + .358 .604 .038 – – .098 .403 .499 Table 4.4: Posterior probabilities. We can now use Bayes’ formula to compute various posterior probabilities. The computer program Bayes computes these posterior probabilities. The results for this example are shown in Table 4.4. We note from the outcomes that, when the test result is ++, the disease d1 has a significantly higher probability than the other two. When the outcome is +−, this is true for disease d3. When the outcome is −+, this is true for disease d2. Note that these statements might have been guessed by looking at the data. If the outcome is −−, the most probable cause is d3, but the probability that a patient has d2 is only slightly smaller. If one looks at the data in this case, one can see that it might be hard to guess which of the two diseases d2 and d3 is more likely. 2 Our final example shows that one has to be careful when the prior probabilities are small. Example 4.17 A doctor gives a patient a test for a particular cancer. Before the results of the test, the only evidence the doctor has to go on is that 1 woman in 1000 has this cancer. Experience has shown that, in 99 percent of the cases in which cancer is present, the test is positive; and in 95 percent of the cases in which it is not present, it is negative. If the test turns out to be positive, what probability should the doctor assign to the event that cancer is present? An alternative form of this question is to ask for the relative frequencies of false positives and cancers. We are given that prior(cancer) = .001 and prior(not cancer) = .999. We know also that P(+|cancer) = .99, P(−|cancer) = .01, P(+|not cancer) = .05, and P(−|not cancer) = .95. Using this data gives the result shown in Figure 4.5. We see now that the probability of cancer given a positive test has only increased from .001 to .019. While this is nearly a twenty-fold increase, the probability that the patient has the cancer is still small. Stated in another way, among the positive results, 98.1 percent are false positives, and 1.9 percent are cancers. When a group of second-year medical students was asked this question, over half of the students incorrectly guessed the probability to be greater than .5. 2 Historical Remarks Conditional probability was used long before it was formally defined. Pascal and Fermat considered the problem of points: given that team A has won m games and team B has won n games, what is the probability that A will win the series? (See Exercises 40–42.) This is clearly a conditional probability problem. In his book, Huygens gave a number of problems, one of which was:
prob_Page_155_Chunk4994
148 CHAPTER 4. CONDITIONAL PROBABILITY .001 can not .01 .95 .05 + - .001 0 .05 .949 + - .051 .949 + - .981 1 0 can not .001 .05 0 .949 can not .019 Original Tree Reverse Tree .99 .999 Figure 4.5: Forward and reverse tree diagrams. Three gamblers, A, B and C, take 12 balls of which 4 are white and 8 black. They play with the rules that the drawer is blindfolded, A is to draw first, then B and then C, the winner to be the one who first draws a white ball. What is the ratio of their chances?2 From his answer it is clear that Huygens meant that each ball is replaced after drawing. However, John Hudde, the mayor of Amsterdam, assumed that he meant to sample without replacement and corresponded with Huygens about the difference in their answers. Hacking remarks that “Neither party can understand what the other is doing.”3 By the time of de Moivre’s book, The Doctrine of Chances, these distinctions were well understood. De Moivre defined independence and dependence as follows: Two Events are independent, when they have no connexion one with the other, and that the happening of one neither forwards nor obstructs the happening of the other. Two Events are dependent, when they are so connected together as that the Probability of either’s happening is altered by the happening of the other.4 De Moivre used sampling with and without replacement to illustrate that the probability that two independent events both happen is the product of their prob- abilities, and for dependent events that: 2Quoted in F. N. David, Games, Gods and Gambling (London: Griffin, 1962), p. 119. 3I. Hacking, The Emergence of Probability (Cambridge: Cambridge University Press, 1975), p. 99. 4A. de Moivre, The Doctrine of Chances, 3rd ed. (New York: Chelsea, 1967), p. 6.
prob_Page_156_Chunk4995
4.1. DISCRETE CONDITIONAL PROBABILITY 149 The Probability of the happening of two Events dependent, is the prod- uct of the Probability of the happening of one of them, by the Probability which the other will have of happening, when the first is considered as having happened; and the same Rule will extend to the happening of as many Events as may be assigned.5 The formula that we call Bayes’ formula, and the idea of computing the proba- bility of a hypothesis given evidence, originated in a famous essay of Thomas Bayes. Bayes was an ordained minister in Tunbridge Wells near London. His mathemat- ical interests led him to be elected to the Royal Society in 1742, but none of his results were published within his lifetime. The work upon which his fame rests, “An Essay Toward Solving a Problem in the Doctrine of Chances,” was published in 1763, three years after his death.6 Bayes reviewed some of the basic concepts of probability and then considered a new kind of inverse probability problem requiring the use of conditional probability. Bernoulli, in his study of processes that we now call Bernoulli trials, had proven his famous law of large numbers which we will study in Chapter 8. This theorem assured the experimenter that if he knew the probability p for success, he could predict that the proportion of successes would approach this value as he increased the number of experiments. Bernoulli himself realized that in most interesting cases you do not know the value of p and saw his theorem as an important step in showing that you could determine p by experimentation. To study this problem further, Bayes started by assuming that the probability p for success is itself determined by a random experiment. He assumed in fact that this experiment was such that this value for p is equally likely to be any value between 0 and 1. Without knowing this value we carry out n experiments and observe m successes. Bayes proposed the problem of finding the conditional probability that the unknown probability p lies between a and b. He obtained the answer: P(a ≤p < b|m successes in n trials) = R b a xm(1 −x)n−m dx R 1 0 xm(1 −x)n−m dx . We shall see in the next section how this result is obtained. Bayes clearly wanted to show that the conditional distribution function, given the outcomes of more and more experiments, becomes concentrated around the true value of p. Thus, Bayes was trying to solve an inverse problem. The computation of the integrals was too difficult for exact solution except for small values of j and n, and so Bayes tried approximate methods. His methods were not very satisfactory and it has been suggested that this discouraged him from publishing his results. However, his paper was the first in a series of important studies carried out by Laplace, Gauss, and other great mathematicians to solve inverse problems. They studied this problem in terms of errors in measurements in astronomy. If an as- tronomer were to know the true value of a distance and the nature of the random 5ibid, p. 7. 6T. Bayes, “An Essay Toward Solving a Problem in the Doctrine of Chances,” Phil. Trans. Royal Soc. London, vol. 53 (1763), pp. 370–418.
prob_Page_157_Chunk4996
150 CHAPTER 4. CONDITIONAL PROBABILITY errors caused by his measuring device he could predict the probabilistic nature of his measurements. In fact, however, he is presented with the inverse problem of knowing the nature of the random errors, and the values of the measurements, and wanting to make inferences about the unknown true value. As Maistrov remarks, the formula that we have called Bayes’ formula does not appear in his essay. Laplace gave it this name when he studied these inverse prob- lems.7 The computation of inverse probabilities is fundamental to statistics and has led to an important branch of statistics called Bayesian analysis, assuring Bayes eternal fame for his brief essay. Exercises 1 Assume that E and F are two events with positive probabilities. Show that if P(E|F) = P(E), then P(F|E) = P(F). 2 A coin is tossed three times. What is the probability that exactly two heads occur, given that (a) the first outcome was a head? (b) the first outcome was a tail? (c) the first two outcomes were heads? (d) the first two outcomes were tails? (e) the first outcome was a head and the third outcome was a head? 3 A die is rolled twice. What is the probability that the sum of the faces is greater than 7, given that (a) the first outcome was a 4? (b) the first outcome was greater than 3? (c) the first outcome was a 1? (d) the first outcome was less than 5? 4 A card is drawn at random from a deck of cards. What is the probability that (a) it is a heart, given that it is red? (b) it is higher than a 10, given that it is a heart? (Interpret J, Q, K, A as 11, 12, 13, 14.) (c) it is a jack, given that it is red? 5 A coin is tossed three times. Consider the following events A: Heads on the first toss. B: Tails on the second. C: Heads on the third toss. D: All three outcomes the same (HHH or TTT). E: Exactly one head turns up. 7L. E. Maistrov, Probability Theory: A Historical Sketch, trans. and ed. Samual Kotz (New York: Academic Press, 1974), p. 100.
prob_Page_158_Chunk4997
4.1. DISCRETE CONDITIONAL PROBABILITY 151 (a) Which of the following pairs of these events are independent? (1) A, B (2) A, D (3) A, E (4) D, E (b) Which of the following triples of these events are independent? (1) A, B, C (2) A, B, D (3) C, D, E 6 From a deck of five cards numbered 2, 4, 6, 8, and 10, respectively, a card is drawn at random and replaced. This is done three times. What is the probability that the card numbered 2 was drawn exactly two times, given that the sum of the numbers on the three draws is 12? 7 A coin is tossed twice. Consider the following events. A: Heads on the first toss. B: Heads on the second toss. C: The two tosses come out the same. (a) Show that A, B, C are pairwise independent but not independent. (b) Show that C is independent of A and B but not of A ∩B. 8 Let Ω= {a, b, c, d, e, f}. Assume that m(a) = m(b) = 1/8 and m(c) = m(d) = m(e) = m(f) = 3/16. Let A, B, and C be the events A = {d, e, a}, B = {c, e, a}, C = {c, d, a}. Show that P(A ∩B ∩C) = P(A)P(B)P(C) but no two of these events are independent. 9 What is the probability that a family of two children has (a) two boys given that it has at least one boy? (b) two boys given that the first child is a boy? 10 In Example 4.2, we used the Life Table (see Appendix C) to compute a con- ditional probability. The number 93,753 in the table, corresponding to 40- year-old males, means that of all the males born in the United States in 1950, 93.753% were alive in 1990. Is it reasonable to use this as an estimate for the probability of a male, born this year, surviving to age 40? 11 Simulate the Monty Hall problem. Carefully state any assumptions that you have made when writing the program. Which version of the problem do you think that you are simulating? 12 In Example 4.17, how large must the prior probability of cancer be to give a posterior probability of .5 for cancer given a positive test? 13 Two cards are drawn from a bridge deck. What is the probability that the second card drawn is red?
prob_Page_159_Chunk4998
152 CHAPTER 4. CONDITIONAL PROBABILITY 14 If P( ˜B) = 1/4 and P(A|B) = 1/2, what is P(A ∩B)? 15 (a) What is the probability that your bridge partner has exactly two aces, given that she has at least one ace? (b) What is the probability that your bridge partner has exactly two aces, given that she has the ace of spades? 16 Prove that for any three events A, B, C, each having positive probability, and with the property that P(A ∩B) > 0, P(A ∩B ∩C) = P(A)P(B|A)P(C|A ∩B) . 17 Prove that if A and B are independent so are (a) A and ˜B. (b) ˜A and ˜B. 18 A doctor assumes that a patient has one of three diseases d1, d2, or d3. Before any test, he assumes an equal probability for each disease. He carries out a test that will be positive with probability .8 if the patient has d1, .6 if he has disease d2, and .4 if he has disease d3. Given that the outcome of the test was positive, what probabilities should the doctor now assign to the three possible diseases? 19 In a poker hand, John has a very strong hand and bets 5 dollars. The prob- ability that Mary has a better hand is .04. If Mary had a better hand she would raise with probability .9, but with a poorer hand she would only raise with probability .1. If Mary raises, what is the probability that she has a better hand than John does? 20 The Polya urn model for contagion is as follows: We start with an urn which contains one white ball and one black ball. At each second we choose a ball at random from the urn and replace this ball and add one more of the color chosen. Write a program to simulate this model, and see if you can make any predictions about the proportion of white balls in the urn after a large number of draws. Is there a tendency to have a large fraction of balls of the same color in the long run? 21 It is desired to find the probability that in a bridge deal each player receives an ace. A student argues as follows. It does not matter where the first ace goes. The second ace must go to one of the other three players and this occurs with probability 3/4. Then the next must go to one of two, an event of probability 1/2, and finally the last ace must go to the player who does not have an ace. This occurs with probability 1/4. The probability that all these events occur is the product (3/4)(1/2)(1/4) = 3/32. Is this argument correct? 22 One coin in a collection of 65 has two heads. The rest are fair. If a coin, chosen at random from the lot and then tossed, turns up heads 6 times in a row, what is the probability that it is the two-headed coin?
prob_Page_160_Chunk4999
4.1. DISCRETE CONDITIONAL PROBABILITY 153 23 You are given two urns and fifty balls. Half of the balls are white and half are black. You are asked to distribute the balls in the urns with no restriction placed on the number of either type in an urn. How should you distribute the balls in the urns to maximize the probability of obtaining a white ball if an urn is chosen at random and a ball drawn out at random? Justify your answer. 24 A fair coin is thrown n times. Show that the conditional probability of a head on any specified trial, given a total of k heads over the n trials, is k/n (k > 0). 25 (Johnsonbough8) A coin with probability p for heads is tossed n times. Let E be the event “a head is obtained on the first toss’ and Fk the event ‘exactly k heads are obtained.” For which pairs (n, k) are E and Fk independent? 26 Suppose that A and B are events such that P(A|B) = P(B|A) and P(A∪B) = 1 and P(A ∩B) > 0. Prove that P(A) > 1/2. 27 (Chung9) In London, half of the days have some rain. The weather forecaster is correct 2/3 of the time, i.e., the probability that it rains, given that she has predicted rain, and the probability that it does not rain, given that she has predicted that it won’t rain, are both equal to 2/3. When rain is forecast, Mr. Pickwick takes his umbrella. When rain is not forecast, he takes it with probability 1/3. Find (a) the probability that Pickwick has no umbrella, given that it rains. (b) the probability that he brings his umbrella, given that it doesn’t rain. 28 Probability theory was used in a famous court case: People v. Collins.10 In this case a purse was snatched from an elderly person in a Los Angeles suburb. A couple seen running from the scene were described as a black man with a beard and a mustache and a blond girl with hair in a ponytail. Witnesses said they drove offin a partly yellow car. Malcolm and Janet Collins were arrested. He was black and though clean shaven when arrested had evidence of recently having had a beard and a mustache. She was blond and usually wore her hair in a ponytail. They drove a partly yellow Lincoln. The prosecution called a professor of mathematics as a witness who suggested that a conservative set of probabilities for the characteristics noted by the witnesses would be as shown in Table 4.5. The prosecution then argued that the probability that all of these character- istics are met by a randomly chosen couple is the product of the probabilities or 1/12,000,000, which is very small. He claimed this was proof beyond a rea- sonable doubt that the defendants were guilty. The jury agreed and handed down a verdict of guilty of second-degree robbery. 8R. Johnsonbough, “Problem #103,” Two Year College Math Journal, vol. 8 (1977), p. 292. 9K. L. Chung, Elementary Probability Theory With Stochastic Processes, 3rd ed. (New York: Springer-Verlag, 1979), p. 152. 10M. W. Gray, “Statistics and the Law,” Mathematics Magazine, vol. 56 (1983), pp. 67–81.
prob_Page_161_Chunk5000