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
PSES8 by Devore Chapter 2: Probability Contents 2 .1 Sample Space and Events . . . . . . . . . 2 .2 Counting Techniques . . . . . . . . . . . . 2 .3 Set Operations and Definitions . . . . . . 2 .4 Interpretation of Probability . . . . . . . . 2 .5 Axioms of Probability . . . . . . . . . . . 2 .6 Properties of Probability . . . . . . . . . . 2 .7 Conditional Probability and Tree Diagram 2 .8 Independence . . . . . . . . . . . . . . . . 2 .9 The Law of Total Probability . . . . . . . 2 .10Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7 15 16 17 18 21 25 27 31 2 .1 Sample Space and Events What would you say... Probability of getting #3 when you throw a die =? Probability of getting odd # when you throw a die =? Experiment is any action or process whose outcome is subject to uncertainity. Sample Space: of an experiment is S = a set of all possible outcomes. Event is any subset of the sample space S. 2 Probability of equally likely outcomes If each outcomes in S is equally likely, then probablity of an event A is P (A) = # of outcomes in A # of outcomes in S 3 Example: Thorw a die. S = {1, 2, 3, 4, 5, 6} P ( 1 ) = 1/6 P ( even ) = 3/6 Example: Throw a fair coin. S = {H, T } P ( Head) = 1/2 4 Example: Throw a fair coin twice S = {(T, H), (H, T ), (H, H), (T, T )} P ( two heads) = {(H, H)} 1 = {(T, H), (H, T ), (H, H), (T, T )} 4 Example: Throw a fair coin twice, record number of heads. S = {0, 1, 2} P ( two heads) = 1/3?? (Wrong because 0,1,2 are not equally likely) 5 Example: Throw a die twice. What is the probability the sum of the two numbers will equal 7? What is the probability the sum of the two numbers will equal 4? What is the probability the (min of two numbers is greater than 4)? 6 2 .2 Counting Techniques Example: If you have 9 players in a baseball team, how many different batting orders can you make? John, Jake and Emily were on the team. If batting order were made up by random fashion, what is the probability that John, Jake and Emily will bat in a row? Counting Formulas • When you have n subjects, there are n! ways to order. • When you have k subjects out of n subjects, there are n!/(n − k)! ways to order. • When you choose k subjects out of n, without regard to order, there are n n! = k (n − k)! k! possible combinations. 7 Example: Batting Orders 1. There are 9 players in a basebal team. How many different batting orders are possible? (9! = 362, 880orders.) 2. 15 players? (15!/6! = 1, 816, 214, 400 orders.) 3. 3 pichers(have to bat 9th) 5 sluggers (have to bat clean up) and 7 players? (7!(5!/(5−3)!(3) = 907, 200 orders.) 4. 9 players including John, Jake and Emily. How many ways that John, Jake and Emily will hit in that order? 5. What about three of them bat in a row? 8 Example: Boys and Girls 1. There are 5 boys and 5 girls. If they have to sit in a line, how many ways are there? 2. If no two boys and no two girls can sit together, how many ways are there? 3. If all boys have to sit together, how many ways are there? 9 Exercise: Light Bulbs in a Box #38 (p.66) A box contains four 40w bulbs, five 60w bulbs, and six 75w bulbs. Three bulbs are selected at once in random. What is P ( exactly two 75w)? You can think through this problem using with order, or without order. let Y = [draw 75w], and N = [did not draw 75w bulb]. 1. If you do it WITH order: T = Total number of outcomes = 15!/12! P ( exactly two 75w) = P (Y Y N, Y N Y, N Y Y ) = 3 ∗ (6 ∗ 5 ∗ 9)/T 10 2. If you do it WITHOUT order: 15 T = Total number of outcomes = 3 6 9 P ( exactly two 75w) = /T. 2 1 4 5 6 P ( same rating) = + + /T. 3 3 3 4 5 6 P ( one from each rating) = /T. 1 1 1 9 P ( at least six draws before first 75w) = P ( no 75w in first 5 draws) = /T. 5 11 Example: Sequence with Cards • You have 7 cards labeled as , A, B, C, D, E. How many different sequence can be made using 3 cards? • How about cards A, A, A, B, B, B, B? 1. Do it using orders, then remove orders 2. Do it without using ordes from beginning • How about cards A,A,B,B,B,C,C,C,C? 12 Example: Birthday Probability Say there are 30 people in the class. Assume distribution of Bday is even, and independent. P ( at least one guy has same Bday as you ) = 1 − P ( nobody has same Bday as you ) = 1 − (364/365)30 = 0.079 P ( at least one pair of same Bday ) = 1 − P ( nobody has same Bday as anybody ) 364 363 335 1 30 365! = 1− ··· =1−( ) = .7 365 365 365 365 (365 − 30)! 23 people makes around 50% 13 Example: Throw a fair coin n times. What is the number of ways you can get x heads? P ( filp coin 5 times get 2 heads ) = # of outcome for getting 2 heads # of outcome in S (HHT T T ), (HT HT T ), (HT T HT ), (HT T T H), . . .) 25 5 1 = 2 25 = In general, n 1 P ( filp fair coin n times get x heads ) = x 2n 14 2 .3 Set Operations and Definitions Let S = {1, 2, 3, 4, 5, 6, 7, 8}, A = {1, 3, 5, 7}, B = {2, 4, 5} C = {8, 9} then Union: A ∪ B = {1, 2, 3, 4, 5, 7} Intersection: A ∩ B = {5} Complement: A0 = {2, 4, 6, 8} Null Set: = {∅} Disjoint if A ∩ B = {∅} Exhaustive if A ∪ B ∪ C = S 15 2 .4 Interpretation of Probability We interpret probability as the limit of relative frequency. That means, if we have P (A) = .6, then as we repeat the experiment in identical and independent fashion, relative frequency of event A occurring will be closer and closer to .6. 16 2 .5 Axioms of Probability Ax1 For any event A, P (A) ≥ 0. Ax2 P (S) = 1. Ax3 If A1 , A2 , A3 , . . . is an infinite collection of disjoint events, then P (A1 ∪ A2 ∪ A3 ∪ · · · ) = ∞ X P (Ai ) i=1 These three axioms imply that P (∅) = 0. 17 2 .6 Properties of Probability For any three event A, B and C, 1. P (A) ≤ 1 (from Axiom 2) 2. P (A) + P (A0 ) = 1. Therefore, P (A) = 1 − P (A0 ) 3. P (B) = P (B ∩ A) + P (B ∩ A0 ) (from Axiom 3) (from Axiom 3) 4. Inclusion-Exclusion P (A ∪ B) = P (A) + P (B) − P (A ∩ B). 5. Inclusion-Exclusion for three events P (A ∪ B ∪ C) = P (A) + P (B) + P (C) − P (A ∩ B) − P (A ∩ C) − P (B ∩ C) + P (A ∩ B ∩ C) 6. DeMorgan’s Law: For any events A, B and C, A0 ∩ B 0 = (A ∪ B)0 A0 ∪ B 0 = (A ∩ B)0 A0 ∩ B 0 ∩ C 0 = (A ∪ B ∪ C)0 A0 ∪ B 0 ∪ C 0 = (A ∩ B ∩ C)0 18 Example: Project Funding 2.13 (p.57) There are 3 projects that has applied for the grant. Let Ai represent an event that project i gets funded. There are 3 projects. Given P (A1 ) = .22, P (A2 ) = .25, P (A3 ) = .28 and P (A1 ∩ A2 ) = .11, P (A1 ∩ A3 ) = .05, P (A2 ∩ A3 ) = .07, P (A1 ∩ A2 ∩ A3 ) = 0.01, Calculate the probability of : 1. P ( At least one of project 1 and 2 get award ) = P (A1 ∪ A2 ) = P (A1 ) + P (A2 ) − P (A1 ∩ A2 ) = .36 2. P (Neither project 1 nor 2 get award) = P ((A1 ∪ A2 )0 ) = 1 − P (A1 ∪ A2 ) = .64 19 3. P ( At least one of 3 project gets award ) = P (A1 ∪ A2 ∪ A3 ) = P (A1 ) + P (A2 ) + P (A3 ) −P (A1 ∩ A2 ) − P (A1 ∩ A3 ) − P (A2 ∩ A3 ) + P (A1 ∩ A2 ∩ A3 ) = .53 4. P ( None of the project get award ) = P (A01 ∩ A02 ∩ A03 ) = P (A1 ∪ A2 ∪ A3 )0 = 1 − P (A1 ∪ A2 ∪ A3 ) = .47 5. P ( Only project 3 is awarded ) = P (A3 ) − P (A3 ∩ A1 ) − P (A3 ∩ A2 ) + P (A1 ∩ A2 ∩ A3 ) P (A01 ∩ A02 ) ∪ A3 = P (A3 ) + P (A01 ∩ A02 ∩ A03 ) = .75 20 2 .7 Conditional Probability and Tree Diagram • Conditional Probability of event A given that the event B has occurred, is denoted as P (A|B), and defined as P (A ∩ B) P (A|B) = P (B) • Using the conditonal probablity, intersection of A and B can be written as P (A ∩ B) = P (A|B) · P (B). • The law of total probability: Let A1 , A2 , A3 , . . . , Ak be mutually exclusive and exhaustive events. Then for any other event B, P (B) = P (B ∩ A1 ) + · · · + P (B ∩ Ak ) = P (B|A1 )P (A1 ) + · · · + P (B|Ak )P (Ak ) 21 Example: Made in Plant A or B (2.24 on p.67) Electrical product made in two plants. A sales man pick up a product randomly. Plant A Plant B Total Defective 2 1 3 Non-defective 6 9 15 Total 8 10 18 3 . 18 8 P ( product was made in plant A) = 18 P ( product being defective ) = P ( was made in Plant A | It’s defective) = 2/18 3/18 = 2 3 22 Example: Lightblub in a Box Continued 2.49 p.74 A box contains four 40w bulbs, five 60w bulbs, and six 75w bulbs. Three bulbs are selected at once in random. P (all 75w) P (at least one is not 75w ) P (at least one is not 75w ) = 1 − P (all are not 75w ) P (all have same rating | at least one is not 75w) = 23 Example: Monte Hall Problem Suppose you’re on a game show, and given the choice of three doors: Behind one door is a car and two goats. You pick a door and the host, who knows what’s behind the doors, opens one of unchosen door and shows you a goat. ”Do you want to switch your choice?” Is it advantagious for you to change? 24 2 .8 Independence • Two events A and B are independent if P (A|B) = P (A), or P (A ∩ B) = P (A) · P (B). Events are said to be dependent otherwise. • Mutually exclusive events cannot be independent. 25 Exercise: Aircraft Seam 2.77 (p.80) An aircraft seam requires 25 rivets. The seam will have to be reworked if any of these rivets is defective. Suppose rivets are independent of each other. a If only 1% of all rivets needs to be reworked, what is the probability that a seam needs to be reworked. P ( a seam needs rework) = P ( at least one of 25 revet are defect) = 1 − P ( all of 25 revet are good) = 1 − P (R1 is good ) · P (R2 is good ) · · · P (R25 is good ) = 1 − P ( a rivet is good)25 = 1 − (.99)25 = .222 If we have 1 − (.999)25 = 0.025 26 2 .9 The Law of Total Probability Note P (B ∩ A) = P (B|A)P (A). Then for event B, can be written using formula #2, P (B) = P (B ∩ A) + P (B ∩ A0 ) = P (B|A)P (A) + P (B|A0 )P (A0 ) Instead of A, A0 , if A1 , A2 , A3 are mutually exclusive and exhaustive events, we can write P (B) = P (B|A1 )P (A1 ) + P (B|A2 )P (A2 ) + P (B|A3 )P (A3 ) Bayes’ theorem Bay’s theorem says P (A|B) = P (B|A)P (A) P (B|A)P (A) + P (B|A0 )P (A0 ) 27 For any events A, an d B (2.56) P (A|B) + P (A0 |B) = 1. Example: Red and White ball There are 5 red balls and 3 White balls in a box. Three balls are drawn without replacement. What is the conditional distribution that P (two of them are red | at least one of them is red) 28 Example: Testing for Rare Disease (2.30 on p.73) Say, only 1 in 1000 adults is afflicted with this rare disease. That is P (Inf ected) = 0.001. A diagnostic test has been developed, however, accuracy of the test is not 100%. If a test result is positive, If Infected If not infected test positive .99 = P (Pos | nfectedI) .02 = P (Pos | not infected’) test negative .01 = P (Neg | Infected) .98 P (Neg | not infected) what is the probability the individual is actually has this disease? If a test result is negative, what is the probability the individual is actually does not have this disease? So we are interested in P (Infected | Pos) and P (not infected | neg). 29 Using the Baye’s theorem, P (I|P ) = P (I ∩ P ) P (P |I)P (I) = P (P ) P (P |I)P (I) + P (P |I 0 )P (I 0 ) (.99)(.001) = = 0.0472 (.99)(.001) + (.02)(.999) So if your test comes back positive, you have about 5% chance of having the disease. P (I 0 |B 0 ) = P (P 0 |I 0 )P (I 0 ) P (I 0 ∩ P 0 ) = P (P 0 ) P (P 0 |I 0 )P (I 0 ) + P (P 0 |I)P (I) (.98)(.999) = = 0.9999898 (.98)(.999) + (.01)(.001) If your test comes back negative, you probably don’t have the disease. 30 2 .10 Review Questions Example: 1. If P (A) = .70, P (B) = .60, and A, B are independent of each other then P (A∪B) = 2. If P (A) = .70, P (B) = .60, and A, B are independent then P (A|B) = . . 3. If P (A) = .80, P (B) = .50, and P (A ∪ B) = .9 are A, B independent? 31 Example: Red and White ball There are 5 red balls and 3 White balls in a box. Three balls are drawn without replacement. What is the conditional distribution that P (two of them are red | at least one of them is red) 1. Do it without using order 2. Do it with tree and order 32 Circuit Problem: 1. Parallel 2. Series 3. Mixed 33 Example: Batch Testing 2.61 (p.75) Conponents are shipped in a batch of ten. Among all batches, 50% are grade A (0 defects out of 10). 30% are grade B (1 defects out of 10), and 20% are grade C (2 defects out of 10). Everytime a batch arrives, two sample components from a batch is randomly selected and tested. 1. If a bach is grade A, what is the probability that both Sample tests OK? Since there are no defectives in grade A, P (both tests OK |A) = 1. 2. If a bach is grade B, what is the probability that both Sample tests OK? Since there are 1 defective in grade B, P (both OK |B) = 92 / 10 = .8. 2 3. If a bach is grade C, what is the probability that both Sample tests OK? 34 Since there are 1 defective in grade C, P (both OK |C) = 8 2 / 10 2 = .62. 4. Use law of total probability to calculate P(both sample tests OK). L of TP says P (both OK) = P (both OK |A)P (A) + P (both OK |B)P (B) + P (both OK |C)P (C) = 1(.5) + .8(.3) + .62(.2) = .864 5. Suppose two sample actually tested OK. Now what is the probability that the batch contained 0 defects out of 10? 35 We want to calculate P (A ∩ both OK ) P ( both OK) P (both OK |A) P (A) .5 = = P ( both OK) .864 P (A|both OK ) = Denominator is the answer of part d). Numerator is the first term in part d). 36