23
1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Embed Size (px)

Citation preview

Page 1: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

1

NA387 Lecture 5: Combinatorics,

Conditional Probability

(Devore, Chapter 2, Sections: 2.3 – 2.4)

Page 2: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Topics

• Counting Techniques, Combinatorics– Equally Likely Counting N(A)/N– Permutations– Combinations

• Conditional Probability

Page 3: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Probability Counting Techniques

• Equally Likely Counting (# outcomes is small)

• Product Rule for Ordered Pairs

• Tree Diagrams

• Permutations

• Combinations

Page 4: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

4

Simple Counting Techniques• When various outcomes are “equally likely”, then

computing probabilities reduces to counting.

– P(A) = N(A) / N– Let’s define event A as: The Probability of rolling a

Seven (sum of outcomes in rolling 2 fair dice); – N= 36 outcomes in sample space

• Outcomes that yield a sum of 7: (1,6) , (6,1), (2,5) , (5,2) , (3,4) , (4,3)

• N(A) = 6• N = 36 So, P(A) = 6/36 = 1/6

– Note: Here N is relatively small

– However, N may be quite large or outcomes may not be “equally likely”, so we need additional counting rules.

Page 5: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Product Rule for Ordered Pairs

• Ordered Pairs: Select Two Objects– Object 1 – select n1 ways

– Object 2 – select n2 ways

– Total Number of pairs: n1*n2

• Examples:– Roll Two Dice (6 outcomes per die) total pairs: 36– Suppose every vehicle sold in a dealership has 1 engine and 1

transmission from the following options (outcomes):• Engine (Object A): 4-cyl, 6-cyl, 8-cyl• Transmission (Object B): Automatic, Manual• How may total pairs do you have?

Page 6: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Tree Diagrams- Example:

A production process consists of machining (M) and finishing (F).Suppose you have three machiningoperations (M1, M2, M3). After completion, products coming out ofM1 and M2 feed finishing operations F1, F2, F3.Whereas products coming out of M3 go to F4, F5, F6.

How many ordered pairs can we get?

M1

M2

M3

F1F2

F3

F1F2F3

F4

F5

F6

Page 7: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

General Product Rule

• We may use the general product rule if we keep adding objects to form ordered collections of k-tuples (n1* n2*..nk ordered collections)– Ordered pair ~ 2-tuple– Three objects in collection ~ 3-tuple– Four objects in collection ~ 4-tuple, …

• Suppose each of our engine/transmission collections have either a 5-year or 7-year warranty.

• How many ordered collections are possible (ways in which one object of each may be selected)?– (hint: draw tree diagram, then compare with product

rule)

Page 8: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

With or Without Replacement?

• An important question when identifying collections of objects is whether you select objects with or without replacement.

• Prior examples assumed “with replacement” or “with repetition”, in other words, we assumed that we could pick as many objects as we wish without depleting the supply, say of the 4cyl transmissions…

Page 9: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Permutations

• An ordered sequence of k objects are selected from a set of n distinct objects. (without replacement)

• Total number of different permutations (arrangements) of n different objects = n!

• Total number of permutations of n objects taken k at a time is:

• (Note: m! ~ means m factorial) for instance: 4! = 4 x 3 x 2 x 1; 0! = 1 !

!, kn

nP nk

Page 10: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Example-Devore. A boy has 4 beads – red, white, blue, and yellow. How different ways can three of the beads be strung together in a row?

3,44!

4 3 !P

4! 24

24 different ways

This is a permutation, since the beads will be in a row (order).

totalnumber selected

Page 11: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Ordered vs. Non-ordered

• Another distinction to be made is whether we consider order in classifying outcomes.

• Example: Suppose you have 3 circuit board locations and each board will require two components.

• How does the number of possibilities change if the order of the location matters vs. if it does not matter?

Outcomes 1 2 31 A B2 B A3 A B4 B A5 A B6 B A

Board Locations

Page 12: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Combinations• A combination is an unordered subset of

size k that can be selected from a set of n distinct objects.

• Number of combinations of size k is much smaller than the number of permutations, because when order is disregarded, a number of permutations correspond to the same combination

• Consider the prior example of 3 circuit board locations and two components per board. What is the number of Combinations?

)!(!!

!,

knkn

k

Pn nk

k

Page 13: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Ex. A boy has 4 beads – red, white, blue, and yellow. How different ways can three of the beads be chosen to trade away?

4 4!

3 3! 4 3 !

4!4

3!

4 different ways

This is a combination since they are chosen without regard to order.

total number selected

Page 14: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Ex. Three balls are selected at random without replacement from the jar below. Find the probability that one ball is red and two are black.

2 3

1 2

8

3

2 3 3

56 28

Page 15: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Combinations: Example

• Suppose a manufacturing bin of 50 parts contains 3 defective parts.

• Samples of 6 parts are selected w/o replacement.

• How many different ways are there to obtain samples that contain exactly 2 defects?– Is order important?

– Note: This is (slightly) more challenging. Easier to break it into 5 steps as follows:

Page 16: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Defect Example Continued• Five Step Solution:

1. Find combinations of subsets that will yield exactly 2 defects (Event A)

2. Find combinations of subsets for the remaining 4 parts selected.

3. Find total possible subsets for exactly two defects is the product rule (n1 * n2) where n1 is number of collections of 2 defects and n2 is the number of collections of 4 non-defects.

4. Find total number of subsets of sample size (e.g., samples of 6)

5. P (Exactly 2 defects) = N(A) / N• Where N(A) = # subset combinations containing 2 defects• N = # subset combinations

Page 17: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

A Further Complication• Suppose you want to determine the probability of

finding at least 2 defects.

– Hint:• At least 2 find 2 or 3 defects• Event A = exactly 2 defects, Event B = exactly 3

defects• P (A U B) = P (A) + P (B) – P (A B)

• Note: P (A B) = 0 because mutually exclusive events

• P (exactly 2) + P (Exactly 3)

• Repeat the 5-step process again for exactly 3 defects.

UU

Page 18: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Conditional Probability

• Conditional probability is used when the outcome of an event may (or may not) change, given the outcome of a related event.

• P(A|B) = Prob of A given B

0)(

)(

)()|(

BPfor

BP

BAPBAP

Page 19: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Conditional Probability -- Interpretation

• How should we interpret P(B | A)?– If all outcomes of an experiment are equally likely and there are n total

outcomes, then:• P(A) = (number of A outcomes) / n• P(A B) = (number of outcomes in A and B)/n• So, P(B|A) = outcomes of A and B / outcomes of A

– So, P(B | A) represents the relative frequency of event B among the trials that produce an outcome in event A.

0)(

)(/)()|(

APfor

APBAPABPU

Page 20: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Conditional Probability Example

• P(A|B) = P(A B) / P(B)

– Example:• Event A: 90% of Car Model X Have Air

Conditioning• Event B: 10% of Car Model X Have Sunroof• Event (A and B) : 8% of Car Model X Have Both

– Given the Car has a Sunroof, what is the probability that it has air conditioning?

U

Page 21: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Conditional Probability

• Conditional probability is often derived from tree diagrams or contingency tables.

• Suppose you manufacture 100 piston shafts.– Event A: feature A is not defective– Event B: feature B is not defective

P(A Not Def | B Def)?

P(A Not Def | B Not Def)?

P(A U B)?

P(B)?

Draw Tree Diagram.

Defective Not Defective

Feature A Defective 80 9

(Surface Finish)

Not Defective 6 5

Feature B: (Roundness)

Page 22: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Solution to Defect Example (Slide 15)

• Step 1: 3! / (2! * 1!) = 3

• Step 2: 47! / (4! * 43!) = 178,365 ways

• Step 3: 3 x 178,365 = 535,095 N(A)

• Step 4: 50! / (6! * 44!) = 15,890,700 N

• Step 5: P (exactly 2) = N(A) / N– P (exactly 2) = 535,095 / 15,890,700 = 0.034

Page 23: 1 NA387 Lecture 5: Combinatorics, Conditional Probability (Devore, Chapter 2, Sections: 2.3 – 2.4)

Solutions

• Shaft Defects example :

– P(A Not Def | B Def)? = 6/86 = 0.07

– P(A Not Def | B Not Def)? 5/14 = 0.36