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
Lecture # 3 Counting Techniques 1. Multiplication Principle: Let E and F be two sets of outcomes of an experiment. We use the multiplication rule to calculate the probability that both E and F occur. Definition: Let E1, E2, E3, ..., En be a sequence of n independent events. If Ek can occur Mk ways for k = 1, 2, 3, …, n, then there are M1, M2, M3, …, Mn ways for all events to occur. Examples: Example 1) How many different combinations can be made for a briefcase that has a 3-dial lock, with each dial having numbers from 0 – 9 available? Answer: A briefcase 3-dial lock has possibly 3 slots with numbers. 0 0 0 Pick a no. Pick a no. Pick a no. for Dial 1 for Dial 2 for Dial 3 E1 E2 E3 Where E1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} => n(E1) = 10 E2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} => n(E2) = 10 E3 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} => n(E3) = 10 This means, there are 10 choices for dial 1, 10 for dial 2 and 10 for dial 3. Therefore, there are 10 x 10 x 10 = 1000 possible combinations of 3 digit numbers to unlock the briefcase. Intuitively, we are making the combinations such as 0-0-0, 0-0-1, 0-0-2, …, 9-9-8, 9-9-9. When we count all these combinations, they are 1000 in number. Example 2) How many license plates on car can be made if the first 3 entries must be letters, followed by 3 numbers so that you will be able to uniquely identify a car? Answer: The idea is to list all possible license plates that uniquely identify any car. With 3 letters at the first place and 3 digits on the remaining 3 places, the license plate will look like: A B A 2 1 8 Pick a letter for entry 1 26 Pick a letter for entry 2 26 Pick a letter for entry 3 26 Pick a number for entry 4 10 Pick a number for entry 5 10 Pick a number for entry 6 10 The number of choices for the first entry = 26 (there are total 26 English letters for A – Z) The number of choices for the second entry = 26 The number of choices for the third entry = 26 The number of choices for the fourth entry = 10 (1 digit number can be from 0 – 9) The number of choices for the fifth entry = 10 The number of choices for the sixth entry = 10 Using the multiplication rule, we have the total number of possible license plates that can be made = 26 x 26 x 26 x 10 x 10 x 10 = 17, 576, 000 Example 3) Suppose you take a multiple choice exam that has 10 questions, each question has 5 answers. How many different ways could the exam be answered? Instructor: Ms. Azmat Nafees 8-Sep-09 Answer: Let’s say the five choices for each question can be A, B, C, D, & E Then all questions from 1 – 10 will have choices: 1. A, B, C, D, E 2. A, B, C, D, E . ….. . ….. . ….. . ….. 8. A, B, C, D, E 9. A, B, C, D, E 10. A, B, C, D, E If an event for Q.1 could be = E1 = {guessing an answer for question 1} => n(E1) = 5 An event for Q.2 could be = E1 = {guessing an answer for question 2} => n(E2) = 5, and so on. Then the total number of ways the exam could be answered = 5 x 5 x 5 x 5 x 5 x 5 x 5 x 5 x 5 x 5 = (5)10 = 9, 765, 625 Example 4) Two cards are drawn without replacement from a deck of 52 cards in such a way that: A1 = an ace on the first draw A2 = an ace on the second draw Total number of ordered two cards= 52 x 51 Total number of two cards= 4 x 3 Total number of 1st card ace, 2nd not ace = 4 x 48 Total number of 1st card not ace, 2nd ace = 48 x 4 Total number of both cards not ace = 48 x 7 As, Total cards = (Ace) x (Not Ace) 52 = 4 x 48 Example 5) A box contains 100 microchips produced by factory 1 and 2. Some are defective and some are non-defective (good). Defective (A) Factory 1 (B) 15 (A ∩ B) Factory2 (B’) 5 (A ∩ B’) Total 20 45 (A’ ∩ B) 35 (A’ ∩ B’) 80 40 100 Good (A’) 60 Total a) P(A) = n(A)/n(S) = 20/100 b) P(A’) = 80/100 c) P(B’) = 60/10 d) P(B’) = 40/100 e) P(A ∩ B) = 15/100 f) P(A’ ∩ B’) = 35/100 g) P(A ∩ B’) = 5/100 Instructor: Ms. Azmat Nafees 8-Sep-09 2. Multiplication theorem (for without replacement): P(A∩B) = P(A) . P (B/A) = P(B). P(A/B) For instance, in previous example no. 5 of microchip we had: P(A∩B) = 15/100 We can compute the same probability such as P(A ∩ B) = P(B) x P(A/B) = (20/100) x (15/20) = 15/100 Similarly in example 4, if 5 cards are drawn from a deck of 52 cards, then possible outcomes: With replacement: 52 x 52 x 52 x 52 x 52 = (52)ହ Without replacement: 52 x 51 x 50 x 49 x 48 3. Conditional Probability: The probability of an event occurring given that another event has already occurred is called a conditional probability. The probability that event B occurs, given that event A has already occurred is P(B|A) = P(A and B) / P(A) This formula comes from the general multiplication rule. Example: Using the joint probability table in question 5: Probability of a defective chip while it has been determined that a micro chip was produced in factory 1 P(A/B) = P(A ∩ B)/P(B) = 15/100 / 60/100 = 15/60 Probability of a good (A’) microchip, if it is determined that chip was produced in factory 2 (B’) P(A’/B’) = 35/40 Or, P(A’/B’) = P(A’ ∩ B’)/P(B’) = (35/100) /(40/100) = 35/40 Probability of a defective (A) microchip given that it is produced in factory 2 (B’) P(A/B’) = 5/40 Or P(A/B’) = P(A ∩ B’)/P(B’) = (5/100) /(40/100) = 5/40 Example 6) Two cards are drawn without replacement from a deck of cards. Let ܣଵ = an ace on the first draw, and ܣଶ = an ace on the second draw Partitioning the number of ways to draw 2 cards: Ace( ) Not Ace (′ ) Total (Ace) 4x3 4 x 48 4 x 51 = n(ܣଵ ) ′ (Not Ace) 48 x 4 48 x 47 48 x 51 = n(ܣଵ ′) Probability of getting ܣଵ ܽ݊݀ ܣଶ = P(ܣଵ ∩ ܣଶ ) = Instructor: Ms. Azmat Nafees (భ ∩మ ) (ௌ) Total 4 x 51 = n((ܣଶ ) 48 x 51 = n(ܣ′ଶ ) 52 x 51 = n(S) (ସ×ଷ) = (ହଶ×ହଵ) 8-Sep-09 P(ܣଵ ) regardless of whatever comes on the 2nd draw will be: (4 x 51) / (52x51) = 4/52 = 1/13 Similarly, P(ܣଶ ) regardless of whatever will be on 1st draw” (4 x51) /(52x51) = 4/52 = 1/13 The conditional probability that one ace is drawn on the 2nd draw given that an ace was obtained on the 1st draw: P(ܣଶ /ܣଵ ) = (భ ∩ మ ) (భ ) = (ସ×ଷ)∕(ହଶ×ହଵ) ସ∕ହଶ = ଵ ଵ Or P(ܣଶ /ܣଵ ) = (4 x 3) /(4 x 51) = 3/51 = 1/17 (computing directly from the joint probabilities’ table) Now the probability of ܣଵ ܽ݊݀ ܣଶ without replacement is: ܲ(ܣଵ ∩ ܣଶ ) = ܲ(ܣଵ ). ܲ(ܣଶ /ܣଵ ) = (4/52) · (3/51) = (4 x 3)/(52 x 51) = 1/(13 x 17) Properties of conditional probability: 1) 0 ≤ P(A|B) ≤ 1 2) If ܣଵ ܽ݊݀ ܣଶ are mutually exclusive events, then: P(ܣଵ ∪ ܣଶ /B) = P(ܣଵ / )ܤ+ ܲ(ܣଶ /)ܤ L.H.S. P(ܣଵ ∪ ܣଶ /B) Since P(AUB) = P(A) + P(B) – P(A∩B) Therefore, P(ܣଵ ∪ ܣଶ /B) = P (ܣଵ / )ܤ+ ܲ(ܣଶ / – )ܤP(ܣଵ / ∩ ܣଶ /B) This is true for not mutually exclusive events. 3) P(ܣଵ ∩ ܣଶ /B) = P(ܣଵ / )ܤ+ ܲ(ܣଶ / – )ܤP(ܣଵ / ∩ܣଶ /B) if ܣଵ ܽ݊݀ ܣଶ are not mutually exclusive events. 4) P(A/B) = 1 – P(A’/B) Proof: We know P(AUA’/B) = P(S) [as AUA’ = S => P(AUA’) = P(S)] ⇒ P(A/B U A’/B) = 1 [ as P(AUA’) = 1 => P(A) + P(A’) = 1] ⇒ P(A/B) + P(A’/B) = 1 ⇒ P(A/B) = 1 – P(A’/B) Or P(A’/B) = 1 – P(A/B) e.g the sample of two coins tossed = S = {HH, HT, TH, TT}, if A = {HH} then A’ = { HT, TH, TT} Therefore, AUA’ = S and A∩A’= { } Instructor: Ms. Azmat Nafees 8-Sep-09 Exercise (selective questions from text book): Q23. Let an event A = color TV set is on, and B = Black and White TV set is on. We are given that P(A) = 0.4, P(B) = 0.3, and P(AUB) = 0.5 a) P(both are on) = P(A B) As P(AUB) = P(A) + P(B) – P(A∩B) 0.5 = 0.4 + 0.3 – P(A∩B) P(A∩B) = 0.4 + 0.3 – 0.5 = 0.2 P(A∩B) = 0.2 These probabilities can be expressed in form of a joint probability table: A(Color TV on) A’(Color TV off) 0.1 (A’∩B) 0.2 (A∩B) B(B&W TV on) 0.2 (A∩B’) 0.5 (A’∩B’) B’(B&W TV off) Total 0.4 0.6 b) P(A∩B’)= 0.2 c) P(exactly one is on) = 0.2 + 0.1 = 0.3 d) P(A’∩B’) = 0.5 Total 0.3 0.7 1 Q22. In this statement, we are given that: P(winning 1st race) = 0.7 = P(A) P(winning 2nd race) = 0.6 = P(A) P(winning both race) = 0.5 = P(A ∩ B) A A’ Total 0.5 0.1 0.6 B 0.2 0.2 0.4 B’ 0.7 0.3 1 Total a) P(at least 1 race win) = 1 – P(neither race win) = 1 – 0.2 = 0.8 b) P(Exactly one race win) = 0.2 + 0.1 = 0.3 c) 0.2 = P(neither race win) Q25. In this statement, we are given that: B + G = T => 2 + 3 = 5 Let’s say two players, i.e. Player A and Player B a) P(A good) = 3/5 b) P(B good / A good) = 2/4 = 1/2 c) P(B good / A bad) = 3/4 d) P(B good A good) = P(A good) . P(B good / A good) = (3/5) . (2/4) = 3/10 e) P(B good) = 3/5 f) P(A good / B good) = 2/4 = ½ As, B + G = T 2+3=5 2+2=4 Instructor: Ms. Azmat Nafees [for without replacement or conditional probability] 8-Sep-09