Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 8: Counting Principles and Probability Advanced Counting Techniques 1. MULTIPLICATION PRINCIPLE (can be visualized as a tree diagram) If a series of choices is made, the total number of distinct ways the series of choices can be made is the product of the number of ways each individual choice can be made. EX: If an outfit consists of a coat, shirt, tie & pants and if John has 2 coats, 3 shirts, 2 ties & 1 pair of pants, there are 2 x 3 x 2 x 1 = 12 different outfits John could wear. 2. Factorials: n! = n(n-1)(n-2)...(3)(2)(1) [and 0! = 1] Factorials count the total number of ways to put a set of distinct objects in order. EX: There are 3! = 3 x 2 x 1 = 6 different arrangements of the letters A, B, C. 3. To count distinct arrangements of objects when they are not all different, we must divide out the factorial of the number of times each object is repeated. EX: ASSISTANT is a 9 letter word. If all letters were different, there would be 9! distinct arrangements. However, there are 2 A’s, 3 S’s and 2 T’s, so the total number of distinct arrangements of ASSISTANT is 4. Permutations: ( ) ( . ) Permutations count the number of ordered arrangements of all possible subsets of a certain size from a set of distinct objects. EX: There are ( ) ( different arrangements of the letters ABCDE taken 3 at a ) time (ABC, ACB, BAC, BCA, CAB, BA, ABD, ADB, …) Note: This problem can also be solved using the Multiplication Principle: 5 (5 ways to choose the first letter, 4 ways to choose the second letter and 3 ways to choose the third letter). ) 5. A permutation when the subset is the whole set is just a factorial of the set size, e.g., ( EX: ( 6. ( ) ) ( [ ( ) ( ) ( and ) ] ) Combinations count the number of ways that subsets of a set of objects can be chosen when order is not important. EX: There are ( ) ( different 3-person committees that can be formed from a ) group of 5 people. (Note: The order people are chosen doesn’t matter.) 7. Useful combination facts: ( ) EX: ( ) ,( ) ,( ) ( ) ,( and : ( ) ( ) )=20 Pascal’s Triangle can be used as an aid for computing small combinations: Now that we can count better, we can tackle some more interesting probability problems. Recall the things we learned earlier about probability 8. Basic Probability Principle: For an event E and its EQUALLY LIKELY sample space S… ( ) In other words, ( ( ) ( ) ) EX: If you randomly draw 1 marble from a bag with 5 red and 3 black marbles, the probability of drawing a red marble is: ( ) ( ) 9. Product Rule of Probability: ( ) ( ∣ E) ) If E & F are independent, this becomes ( ( ) ( ) It is often useful to think of this product rule visually in terms of a tree diagram. EX: From a bag of 8 marbles (5 red and 3 black), what is the probability of randomly drawing a red marble, then a black marble and finally another red marble. Before 1st draw: R R R R R B B B so… ( ) ) and ( Before the 2nd draw IF1st marble was Red: R R R R B B B so… ( ) ) ∣ & ( ∣ nd st Before the 2 draw IF1 marble was Black: R R R R R B B so… ( ) ) ∣ & ( ∣ Continuing this sort of calculation down all of the third branches will give you all of the probabilities for the third draw based on what was drawn in the first two draws. The tree diagram on the right shows the results of these calculations. Now that we have a tree diagram, we see that the branch (the circled one above) that represents drawing a red, followed by a black, followed by a red. If we multiply the 3 probabilities on that branch: ( ) ( ) ( ) , we have the probability of getting red, then black, then red. (Three notes: First, here we are drawing without replacement which is why the probabilities change and secondly, we certainly don’t have to draw a tree diagram in order to solve the problem—rather, it is just a way to visualize the product rule, even if you don’t actually draw it out. And finally, notice that probabilities on all branches after the first set are conditional probabilities because they depend on exactly what was drawn on earlier draws.) Special PDFs 10. Binomial PDF: If n = # of trials, X = # of ‘successes’ & p = probability of ‘success’, then: ( ) ( ) ( ) The most important clue in identifying a Binomial problem is that p, the probability of ‘success’, is the same from trial to trial. EX: If 3 marbles are randomly selected from a bag containing 8 marbles (5 red and 3 black), what is the probability of drawing exactly 2 red marbles if we draw WITH REPLACEMENT. Because the marbles are drawn with replacement, the probability of getting a red marble is constant from trial to trial… .Thus, this is a Binomial problem and n = 3 and X=2. So.. ( ) ( )( ) ( ) ( )( ) ( ) 11. Calculating probabilities when selecting without replacement In problems where you are selecting items ‘without replacement’, the Binomial PDF does not apply because the probability changes from trial to trial. Instead we must go back to the Basic Probability Principle: ( ) . Because this involves counting subsets for which order is not important, we will be using combinations to count “the # of ways” for both the numerator and denominator. EX: If 3 marbles are randomly selected from a bag containing 7 marbles (4 red and 3 black), what is the probability of drawing exactly 2 red marbles. (IT IS IMPORTANT TO NOTE HERE THAT THERE IS NO MENTION OF REPLACING A BALL BEFORE DRAWING THE NEXT ONE. THAT MEANS THAT THE PROBABILITY CHANGES FROM TRIAL TO TRIAL…SO THIS IS NOT BINOMIAL.) ( ( )( ) ) ( ) Although we never put it this way, this formula defines a PDF (called the Hypergeometric). Suppose we have a desired items and b other items and we choose n total items of which exactly x of them are from the group of desired items. Then… ( ) ( )( ( ) ) gives the probability of choosing exactly x of the desired items EX: Use this PDF to solve the problem just above: If 3 marbles are randomly selected from a bag containing 7 marbles (4 red and 3 black), what is the probability of drawing exactly 2 red marbles. a = 4 (total # of red marbles ), b = 3 (total # of black marbles) n = 3 (# of marbles chosen), and x = 2 (# of red marbles chosen) ( ) ( )( ( ) ) ( )( ) ( ) (Notice that this is the same answer & computation as before.) (If you think that it will help you solve these ‘without replacement’ problems, you can use this PDF. If it just seems confusing, then certainly you don’t have to use it when solving these problems. General PDFs and Expected Value 12. Generally speaking, a PDF is simply a listing of each possible value of a random variable (say X) along with its probability of occurring. Both the Binomial PDF & Hypergeometric PDF can be written as a formulas where plugging in a particular X gives the probability of X occurring. This is nice but not necessary. In fact, it is common to put a PDF in table form. EX: For a $2 payment, Pam can try to guess which number will come up on the roll of a single die. If Pam wins, she gets her $2 back and wins $5. If she does not win, she just loses her $2 bet. The PDF for this scenario is: If Pam loses -$2 X If Pam wins $5 P(X) 13. The expected value of a random variable X, denoted E(X), is a weighted average of the X values. (The weights are the associated probabilities.) If the possible values of X are x1 ,x2 ,x3 , … ,xn and associated probabilities are p1 ,p2 ,p3 , … ,pn , then E(X) = x1p1 + x2p2 + x3p3 + … + xnpn . In practical terms, to calculate the expected value when you already have the PDF in table form, just add an x P(x) row to the bottom of the PDF and then add up the products on that new row. EX: For the PDF just above (in #12), compute the expected value. If Pam loses -$2 X If Pam wins $5 P(X) x P(x) ( ) 14. Expected value: special cases For a Binomial PDF [ ( ) ( ) ( ) ], E(X) = n p . EX: Look back at the Binomial in #10 where For a Hypergeometric PDF [ ( ) ( )( ( ) ) . So, E(X) = n p = . ], E(X) = n p as well (if p is taken to be the probability of ‘success’ when choosing the first item.) EX: Look back at the Hypergeometric in #11 where . So, E(X) = n p = 3 . (You don’t have to use these formulas for expected value unless you want to. You can always use the table form of these PDFs-constructing them if needed- & compute E(X) as in #13 above.)