Math problem

sdahal3s
Ch2Probability.pdf

IE 3301 Introduction to Statistics Lecture 2 Probability

SHOUYI WANG shouyiw@uta.edu

Probability

Ø Sample Spaces and Events Ø Probability Theory

• Defini:on and Axioms • Condi:onal Probability •  Independence • Bayes’ Rule

Ø Coun:ng Sample Points

2

Sample Spaces and Events

Ø Random Experiment Ø Sample Space (S)

• Discrete • Con:nuous • Tree diagram

Ø Event (A, B) Ø Set Nota:on

3

Random Experiment Ø The task that results in a random outcome

• Toss a coin / die • See how long a light bulb lasts • Count how many people enter the post office between 2:00 and 3:00 pm tomorrow.

Ø Sample Space S = the set of all possible outcomes Ø Each outcome in a sample space is an element or a member of the sample space.

4

Discrete Sample Spaces Ø Tossing a coin: S = {H, T} Ø Tossing a die: S = {1, 2, 3, 4, 5, 6} Ø Tossing 3 coins: S = { HHH, HHT, HTH, THH, HTT, THT, TTH, TTT }

Ø Count # people that enter the post office: S = {0, 1, 2, 3, 4, 5,…}

5

Con:nuous Sample Spaces

Ø Values between 0 and 130: S = {x | 0 < x < 130}

Ø Life:me of a light bulb: S = {x | 0 ≤ x < ∞}

Ø Points on a circle of radius 2: S = {(x, y) | x 2 + y 2 = 4}

Ø Points inside a circle of radius 2: S = {(x,y) | x 2 + y 2 < 4}

6

7

An engineer in charge of the maintenance of a par:cular machine no:ces that its breakdowns can be characterized as due to an electrical failure within the machine, a mechanical failure of some component of the machine, or operator misuse. When the machine is running, the engineer is uncertain what will be the cause of the next breakdown. The problem can be thought of as an experiment with the sample space:

S = {electrical, mechanical, misuse}

Example of Sample Space

Tree Diagram Example 2.2: Toss a coin once. If heads, then toss the coin again; if tails, then roll a six-sided die.

8

Tree Diagram Example 2.3: Three items are selected at random from a manufacturing process. Each item is inspected and classified defec:ve, D , or nondefec:ve, N. What is the sample space in this experiment?

9

Events

Ø  An event is a subset of a sample space •  Toss 3 coins: A = {exactly two heads}

= {HHT, HTH, THH} •  Light bulb: A = {lasts < 200 hours}

= {x | 0 ≤ x < 200} •  Post Office: A = {≥ 3 people enter post office} = {3, 4, 5, ….}

•  Example 2.2: A = {odd number on die} = {T1, T3, T5}

10

11

The control of errors in a computer sofware product is obviously of great importance. The number of separate errors in a par:cular piece of sofware can be viewed as having a sample space.

S = {0 errors, 1 error, 2 errors, 3 errors, …}

Consider the event A that there are no more than two errors in a sofware product.

A = {0 errors, 1 error, 2 errors} ⊂ S

Example of Event

Set Nota:on / Venn Diagrams Ø Aʹ is the complement of A = S - A

• Light bulb: A = {x | 0 ≤ x < 200} Aʹ = {x | 200 ≤ x < ∞} = {x | x ≥ 200}

• Toss 3 coins: A = {HHT, HTH, THH} Aʹ = {HHH, HTT, THT, TTH, TTT}

• Venn Diagram: S = en:re rectangle

12

Set Nota:on / Venn Diagrams Ø A ∩ B is the intersec9on of A and B

•  Events for which both A and B occur •  Light bulb: A = {x | 0 ≤ x < 200}, B = {x | x > 50} ⇒ A ∩ B = {x | 50 < x < 200}

•  Toss 3 coins: A = {HHT, HTH, THH}, B = {HHH, THH, THT} ⇒ A ∩ B = {THH}

13

Set Nota:on / Venn Diagrams Ø A ∪ B is the union of A and B

•  Events for which either A or B (or both) occur •  Light bulb: A = {x | 0 ≤ x < 200}, B = {x | 5 ≤ x < 500} ⇒ A ∪ B = {x | 0 ≤ x < 500}

•  Toss 3 coins: A = {HHT, THH}, B = {HHH, THH} ⇒ A ∪ B = {HHH, HHT, THH}

14

Ø Mutually exclusive (or disjoint) events • Events that have nothing in common • A ∩ B = ∅ (empty set)

15

Set Nota:on / Venn Diagrams

16

A ∩ B = B ∩ A A ∩ A = A A ∩ S = A

A ∩ ∅ = ∅ A ∩ Aʹ = ∅

A ∩ (B ∩ C) = (A ∩ B ) ∩ C

(A ∩ B)ʹ = Aʹ ∪ B ́

A ∪ B = B ∪ A A ∪ A = A A ∪ S = S A ∪ ∅ = A A ∪ Aʹ = S

A ∪ (B ∪ C) = (A ∪ B ) ∪ C

(A ∪ B)ʹ = Aʹ ∩ Bʹ

Set Rules for Events

Venn Diagrams: Example

Ø Find A ∩ B, B ∩ C, A ∩ C, B ʹ∩ A, A ∩ B ∩ C, (A ∪ B) ∩ Cʹ ?

17

Probability Theory Ø What is Probability?

• Axioms • Addi:ve Rules

Ø Condi:onal Probability • Defini:on • Mul:plica:ve Rules

Ø Independent Events Ø Bayes’ Rule

18

19

Experiment < Anything >

. . .

Sample Space Sample Space Sample Space Sample Space

Random Experiment Random Experiment

# of Random Experiment = N Outcome Event

# of event = f

eventtheofmeasureyprobabilitoreventtheofyprobabilitp

p N f bigVeryN

:

⎯⎯⎯⎯ →⎯ →

. . . Under same condition

What is Probability ?

Probability Theory Ø  Interpreta:ons of probabili:es

• Subjec:ve: Based on people’s experience and general knowledge

• Equally likely: Outcomes have equal probability ⇒  Roll a six-sided die: P(1) = … = P(6) = 1/6

• Limi:ng Rela:ve Frequency:

as N → ∞ 20

nA N =

# of times event A occurs total # of trials

→ P(A)

P(A) = nA N =

# of outcomes in event A total # of outcomes in S

Probability Axioms

Ø  0 ≤ P(A) ≤ 1 Ø  P(∅) = 0 Ø  P(S) = 1 Ø  If events A1, A2, … , Ak are mutually exclusive, then P(A1 ∪ A2 ∪ … ∪ Ak) = P(A1) + P(A2) +…+ P(Ak) Example: Roll a six-sided die – P(even) = P(2) + P(4) + P(6) = 3/6

P({2, 3, 4, 6}) = P(even) + P(3) = 3/6 + 1/6 = 4/6 P({1, 2, 3, 4, 5, 6}) = P(S) = 1

21

Probability: Addi:ve Rules Ø  For event A: P(Aʹ) = 1 - P(A )

•  Roll a six-sided die: P({2, 3, 4, 6}) =4/6 ⇒ P({1, 5}) = 1 - 4/6 = 2/6

Ø  For events A and B: P(A ∪ B ) = P(A ) + P(B ) - P(A ∩ B ) •  Roll a six-sided die: P(even) = 3/6, P({2, 3}) = 2/6

P(even ∪ {2, 3}) = P(even) + P({2, 3}) - P({2}) = 4/6

22

Probability: Addi:ve Rules Ø  For 3 events A, B, and C: P(A ∪ B ∪ C )

= P(A ) + P(B ) + P(C ) - P(A ∩ B ) - P(A ∩ C ) - P(B ∩ C ) + P(A ∩ B ∩ C ) Ø  Note: This is a generaliza:on of the last axiom.

23

Probability: Addi:ve Rules Summary

24

Ø The condi9onal probability of B, given A, is the probability that event B occurs when it is known that event A occurs:

where P(A) > 0

25

P(B | A) = # of outcomes in events A and B # of outcomes in event A

= P(A∩B) P(A)

Condi9onal Probability

Ø  Extensions of Axioms and Rules:

26

P(C |A∩B)= P(A∩B∩C) P(A∩B)

P(A∪B |C)= P(A |C)+P(B |C)−P(A∩B |C)

P(A |B)=1−P( !A |B)

Condi9onal Probability

Condi:onal Probability: Example Table 2.1 Popula:on of college-educated adults in a small town, categorized by gender and employment status:

Find P(M ), P(U ), P(M ∩ U ), P(M | U ), P(E ), P(M ∩ E), P(M ∪ E )

27

Condi:onal Probability: Example

Ø P(M ) ; P(U )

Ø P(M ∩ U )

Ø P(M | U ) or P(M | U )

Ø P(E ) ; P(M ∩ E )

Ø P(M ∪ E ) = P(M ) + P(E ) - P(M ∩ E )

28

9 5

900 500 ==

3 1

900 300 ==

45 2

900 40 ==

15 2

300 40 ==

15 2

1/3 2/45

==

3 2

900 600 ==

45 23

900 460 ==

45 32

900 640

900 460

900 600

900 500 ==−+=

Probability: Mul:plica:ve Rules Ø Derived from the defini:on of condi:onal probability:

P(A ∩ B) = P(A) P(B | A)

Ø  In general, for events A1, A2, … , Ak : P(A1 ∩ A2 ∩ … ∩ Ak)

= P(A1)P(A2 | A1)P(A3 |A1 ∩ A2) …

P(Ak |A1 ∩ A2∩ … ∩ Ak-1)

29

Independence in Probability Ø Two events, A and B, are independent if and only if the following condi:ons exist • P(A | B ) = P(A ) or P(B | A ) = P(B )

Ø Given that events A and B are independent, the mul:plica:ve rule becomes: • P(A ∩ B ) = P(A ) P(B )

30

Independent Events: Example Ø Female managers claim they are not being promoted.

Are promo9on decisions independent of gender?

31

P NP Totals

M 46 184 230

F 8 32 40

Totals 54 216 270

Independent Events: Example Ø Define events M = male, Mʹ = female, A = promoted, Aʹ = not promoted.

Ø Show events A and M are independent: • P(A | M ) = P(A ) or P(M | A ) = P(M ) • or P(A ∩ M ) = P(A ) P(M )

Ø Equivalently, can replace M with M ʹ and A with A ʹ in the formulas above.

32

Independent Events: Example

Ø Show P(A | M ) = P(A ):

Ø Thus, events A and M are independent. Ø Promo:on decisions are independent of gender.

33

2.0 270 54

people of # total promoted people of #

)( ===AP

2.0 230 46

males of # total promoted males of #

)|( ===MAP

Independent Events: Example Ø Show P(A ∩ M ) = P(A ) P(M ):

Ø Thus, events A and M are independent. Ø Note:

34

270 54

)( =AP 270 230

people of # total males of #)( ==MP

2.0 270/230 270/46

)( )(

)|( === MP MAPMAP ∩

270 46

people of # total males promoted of #

)( ==MAP ∩

270 46

270 230

270 54

)()( =⎟ ⎠

⎞ ⎜ ⎝

⎛ ⎟ ⎠

⎞ ⎜ ⎝

⎛ =⇒ MPAP

Independent Events: Example Ø Tree diagram

35

Bayes’Rule Development Ø Bayes’rule allows us to compute a condi:onal probability knowing the “reverse” condi:onal probabili:es. • Suppose events B1, B2, and B3 par::on S. • Suppose we know P(B1), P(B2), and P(B3). • For a given event A, suppose we also know P(A | B1), P(A | B2), and P(A | B3).

• We can also know or calculate P(A). Ø We wish to find the condi:onal probabili:es P(B1 |A), P(B2 |A), and P(B3 | A).

36

Bayes Rule Development

Ø Law of Total Probability P(A) = P(A ∩ B1) + P(A ∩ B2) + P(A ∩ B3) = P(A | B1)P(B1) + P(A | B2)P(B2) + P(A | B3)P(B3)

37

A

B2 B3 B1

A∩B2 A∩B1 A∩B3

Bayes Rule Development Ø Bayes’Rule allows us to find the condi:onal probability that B1 (or B2 or B3) occurs given that A has occurred:

38

)( )(

)|( 11 AP ABP

ABP ∩

=

∑ = =

++ =

3

1

11

332211

11

)()|( )()|(

)()|()()|()()|( )()|(

i ii BPBAP

BPBAP BPBAPBPBAPBPBAP

BPBAP

Bayes Rule: General Formula

39

Bayes Rule: General Formula Ø Given events B1, B2, … , Bk par::on S.

Ø Law of Total Probability

Ø Bayes’Rule

for r = 1, 2, …, k

40

∑ = = k

i ii

rr r

BPBAP BPBAP

ABP 1

)()|( )()|(

)|(

P(A)= P(A | Bi)P(Bi)i=1 k

Bayes Rule Example Ø Example: Assembly plant has two machines B1 and B2 • B1 makes 30% and B2 makes 70% of the products ⇒ P(B1) = 0.3 and P(B2) = 0.7

Ø Define event A = defec:ve product • Machine B1 produces 2% defec:ves • Machine B2 produces 5% defec:ves ⇒ P(A | B1) = 0.02 and P(A | B2) = 0.05

Ø Given that a product is defec9ve, what is the probability that it was produced by machine B2?

41

Bayes’Rule Example Ø Find P(defec:ve) = P(A)

Ø Find P(B2 | A)

Ø The probability that a defec:ve product came from machine B2 is about 85%

42

85.0 )041.0( )7.0)(05.0(

)( )()|(

)|( 222 ≈== AP BPBAP

ABP

041.0)7.0)(05.0()3.0)(02.0( )()|()()|()( 2211

=+=

+= BPBAPBPBAPAP

Coun:ng Sample Points Ø Mul:plica:on Rule Ø Factorial and Choose Nota:on

• Permuta:ons • Par::ons • Combina:ons

Ø Probability Calcula:on Example

43

Coun:ng Sample Points Ø Mul9plica9on rule

Ø Example: A developer offers the following op:ons • Exterior style: 4 choices • Floor plan: 3 choices ⇒ # of possible home op:ons = (4)(3) =12

44

Coun:ng Sample Points Ø Modifica:on of Example

• 2 of the exterior styles only allow 2 floor plans ⇒  (2)(3) + (2)(2) = 10

Tree Diagram

45

Coun:ng Sample Points Ø Factorial:

Ø Choose r out of n:

• 

46

)!(! ! rnr

n r n

− =

⎟⎟ ⎟ ⎟

⎜⎜ ⎜ ⎜

;1 0 ⎟

⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ ==⎟⎟

⎞ ⎜⎜ ⎝

n nn

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

− =⎟⎟

⎞ ⎜⎜ ⎝

rn n

r n

Coun:ng Permuta:ons

Ø Permuta9on: ordered arrangement of a set of dis:nct objects • # ways to arrange n dis:nct objects = n(n - 1)(n - 2)…(1) = n! permuta:ons • # ways to arrange r objects selected from a larger set of n objects:

47

nPr = n!

(n−r)!

Coun:ng Permuta:ons Ø Examples

• # ways to order {a, b, c, d}: (4)(3)(2)(1) = 4! = 24

• # ways to assign 4 dis:nct awards among 15 people, where each can receive at most one award:

48

760,32)12)(13)(14)(15( !11

!11)12)(13)(14)(15( !11 !15

)!415( !15

415

==

== −

=P

Coun:ng Permuta:ons Ø Ordered arrangement of a set objects, not all dis:nct • # dis:nct arrangements of n objects of which n1 are of one kind, n2 are of second kind, … , and nk are of a kth kind:

where n1 + n2 +…+ nk = n

49

!!! !

21 knnn n !

Coun:ng Permuta:ons Ø Example

• # ways to arrange 8 photos of which 4 are family, 2 are wedding couples, and 2 are vaca:on:

50

420)5)(6)(7)(2( )2)(2( )5)(6)(7)(8( )1)(2)(1)(2(!4 !4)5)(6)(7)(8(

!2!2!4 !8

==

=

=

Coun:ng Ways to Par::on Ø Par::oning objects into disjoint cells

• # ways to par::on a set of n objects into r cells so that there are n1 in cell 1, n2 in cell 2, … , and nr in cell r :

where n1 + n2 +…+ nr = n

• Note: Same formula as previous.

51

!!! !

,, 2121 rr nnn n

nnn n

!! =⎟⎟ ⎠

⎞ ⎜⎜ ⎝

Coun:ng Ways to Par::on Ø Example

• # ways to assign 11 kids to 3 teams of sizes 4, 4, and 3:

52

550,11)5)(3)(7)(10)(11( )2)(3)(2)(3)(4( )5)(6)(7)(8)(9)(10)(11(

)1)(2)(3)(1)(2)(3)(4(!4 !4)5)(6)(7)(8)(9)(10)(11(

!3!4!4 !11

3,4,4 11

==

=

==⎟⎟ ⎠

⎞ ⎜⎜ ⎝

Coun:ng Combina:ons Ø Selec:on of objects from a larger set, where the different orderings of the objects are only counted as one combina:on. • # ways to select r objects from a set of n :

• Note: This is same as par::oning n objects into 2 cells, one with r objects and another with (n - r) objects.

53

)!(! ! rnr

n r n

Crn −

=⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ =

Coun:ng Combina:ons

Ø  Example • # ways to select 4 kids out of 11:

54

330)3)(10)(11( )2)(3)(4( )8)(9)(10)(11(

!7)1)(2)(3)(4( !7)8)(9)(10)(11(

!7!4 !11

)!411(!4 !11

4 11

==

=

== −

=⎟⎟ ⎠

⎞ ⎜⎜ ⎝

Probability Calcula:on Example Ø A deck of 52 cards consists of 4 suits, each with 13 ranks.

Ø Each card is equally likely. Ø A poker hand consists of 5 cards.

• # of ways to deal a poker hand =

Ø What is the probability of a “full house” poker hand?

55

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

5 52

Probability Calcula:on Example Ø A “full house” consists of 3 cards of one rank and 2 cards of second rank.

Ø # of ways to get a full house

• # of ways to get r cards of a given rank =

• # of choices for the first rank = 13 • # of choices for the second rank = 12 ⇒  # of ways =

56

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

r 4

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

2 4

3 4

)12)(13(

Probability Calcula:on Example

Ø P(full house)

57

0014.0

5 52

2 4

3 4

)12)(13( ≈

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎟⎟ ⎠

⎞ ⎜⎜ ⎝

⎛ ⎟⎟ ⎠

⎞ ⎜⎜ ⎝

=

handpoker a deal to waysof # house full aget to waysof #

=