Presentation is loading. Please wait.

Presentation is loading. Please wait.

Andrej Bogdanov ENGG 2430A: Probability and Statistics for Engineers Spring 2016 2. Axioms of Probability.

Similar presentations


Presentation on theme: "Andrej Bogdanov ENGG 2430A: Probability and Statistics for Engineers Spring 2016 2. Axioms of Probability."— Presentation transcript:

1 Andrej Bogdanov ENGG 2430A: Probability and Statistics for Engineers http://www.cse.cuhk.edu.hk/~syzhang/course/Prob15/ Spring 2016 2. Axioms of Probability part one

2 Probability models A probability model is an assignment of probabilities to every element of the sample space. Probabilities are nonnegative and add up to one. S = { HH, HT, TH, TT } ¼¼¼¼ Examples models a pair of coins with equally likely outcomes

3 Examples a pair of antennas each can be working or defective S = { WW, WD, DW, DD } Model 1: Each antenna defective 10% of the time Defects are “independent”.81.09.01 WW WD DW DD Model 2:Dependent defects: e.g both antennas use same power supply.90 0.1 WW WD DW DD

4 How to come up with a model? Option 1: Use common sense If there is no reason to favor one outcome over another, assign same probability to both S = { 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 56, 61, 62, 63, 64, 65, 66 } E.g. and should get same probability So every outcome w in S must be given probability 1/|S| = 1/36

5 The unfair die S = { 1, 2, 3, 4, 5, 6 } 2 cm 1 cm Common sense model: Probability should be proportional to surface area outcome 123456123456 surface area (in cm 2 ) 122212122212 probability.1.2.2.2.1.2

6 How to come up with a model? Option 2 The probability of an outcome should equal the fraction of times that it occurs when the experiment is performed many times under the same conditions.

7 How to come up with a model? S = { 1, 2, 3, 4, 5, 6 } toss 50 times 44446163164351534251412664636216266362223241324453 outcome 123456123456 occurrences 79811811 probability.14.18.16.22.16.22

8 How to come up with a model? toss 500 times 1356532511132365226434634623345663453543633514546423623551161445613441262462134541255656616436145465 5564544432666511115423226153655664335622316516625253424311263112466133443122113456244222324152625654 2435142565512653245554554435244153234535112232451656555551431435342225311453366652416621555663645155 1466565423451154611556156623152142224326265654263522234145214313453155221561523135262255633144613411 1115146113656156264255326331563211622355663545116144655216122656515362263456355232115565533521245536 The more times we repeat the experiment, the more accurate our model will be outcome occurrences 123456123456 8179737211085 probability.162.158.147.144.220.170

9 How to come up with a model? toss 500,000 times The more times we repeat the experiment, the more accurate our model will be outcome occurrences 123456123456 832308333283436832628338683354 probability.167.167.167.167.167.167

10 How to come up with a model? S = { WW, WD, DW, DD } MTWTFSSMTWTFSSMTWTFSSMTWTFSS WWxxxxxxxx WD DWx DDxxxxx outcome occurrences WWWDDWDD 80158015 probability 8/1401/145/14

11 Exercise Give a probability model for the gender of Hong Kong young children. sample space = { boy, girl } Model 1:common sense 1/2 Model 2: from Hong Kong annual digest of statistics, 2012.51966.48034

12 Events An event is a subset of the sample space. Examples S = { HH, HT, TH, TT } first coin comes out heads E 2 = { HH, HT } both coins come out same E 3 = { HH, TT } both coins come out heads E 1 = { HH }

13 Events The complement of an event is the opposite event. both coins come out heads E 1 = { HH } both coins do not come out heads E 1 c = { HT, TH, TT } S E EcEc

14 Events The intersection of events happens when all events happen. (a) first coin comes out heads E 2 = { HH, HT } (b) both coins come out same E 3 = { HH, TT } both (a) and (b) happen E 2 E 3 = { HH } S E F

15 Events The union of events happens when at least one of the events happens. (a) first coin comes out heads E 2 = { HH, HT } (b) both coins come out same E 3 = { HH, TT } at least one happens E 2 ∪ E 3 = { HH, HT, TT } S E F

16 Probability for finite spaces The probability of an event is the sum of the probabilities of its elements Example S = { HH, HT, TH, TT } ¼ ¼ ¼ ¼ both coins come out heads E 1 = { HH } P(E 1 ) = ¼ first coin comes out heads E 2 = { HH, HT } P(E 2 ) = ½ both coins come out same E 3 = { HH, TT } P(E 3 ) = ½

17 Axioms for finite probability A finite probability space is specified by: A finite sample space S. For every event E, a probability P(E) such that S E 1. for every E : 0 ≤ P(E) ≤ 1 S 2. P(S) = 1 S EF 3. If EF = ∅ then P(E ∪ F) = P(E) + P(F)

18 Rules for calculating probability Complement rule: P(E c ) = 1 – P(E) S E EcEc Difference rule: If E ⊆ F P(F and not E) = P(F) – P(E) S E F Inclusion-exclusion: P(E ∪ F) = P(E) + P(F) – P(EF) S E F You can prove them using the axioms. in particular, P(E) ≤ P(F)

19 Exercise In some town 10% of the people are rich, 5% are famous, and 3% are rich and famous. For a random resident of the town what are the chances that: (a) The person is not rich? (b) The person is rich but not famous? (c) The person is either rich or famous (but not both)?

20 Exercise S R F 10% 5% 3%

21 Equally likely outcomes A probability space has equally likely outcomes if P({x}) = 1/|S| for every x in S Then for every event E P(E) = number of outcomes in E number of outcomes in S |S||S| |E||E| =

22 Problem You toss a coin 4 times. What are the chances that a pair of consecutive heads occurs? S = { HHHH, HHHT, HHTH, HHTT,..., TTTT } We assume equally likely outcomes. E = { HHHH, HHHT, HHTH, HHTT, HTHH, THHH, THHT, TTHH } P(E) = |E|/|S| = 8/16. Solution

23 Problem An urn contains 1 red ball and n - 1 blue balls. The balls are shuffled randomly. You draw k balls without replacement. What is the probability that you drew the red ball? Example: n = 5, k = 3 S = { RBBBB, BRBBB, BBRBB, BBBRB, BBBBR } with equally likely outcomes E = {x: the first 3 symbols of x contain an R } = { RBBBB, BRBBB, BBRBB } P(E) = |E|/|S| = 3/5

24 Solution S = all arrangements of 1 R and n - 1 B s. we assume equally likely outcomes. E = all arrangements in S where the R occurs in one of the first k positions P(E) = |S||S| |E||E| = n k

25 Problem for you to solve An urn contains 8 red balls and 8 blue balls, shuffled randomly. You draw 4 balls without replacement. What is the probability that you drew: (a) No red balls? (b) At least one red ball? (d) The same number of red and blue balls? (c) At least one ball of each color?

26 Poker In 5-card poker you are dealt 5 random cards from a deck. What is the probability you get a:

27 Andrej Bogdanov ENGG 2430A: Probability and Statistics for Engineers http://www.cse.cuhk.edu.hk/~syzhang/course/Prob15/ Spring 2016 2. Axioms of Probability part two

28 Birthdays You have a room with n people. What is the probability that at least two of them have a birthday on the same day of the year? Probability model experiment outcome = birthdays of n people The sample space consists of all sequences (b 1,…, b n ) where b 1,…, b n are numbers between 1 and 365 S n = {(b 1,…, b n ) : 1 ≤ b 1,…, b n ≤ 365 } = {1, …, 365} n

29 Birthdays Probability model We will assume equally likely outcomes. This is a simplifying model which ignores some issues, for example: Leap years have 366 not 365 days Not all birthdays are equally represented, e.g. September is a popular month for babies Birthdays among people in the room may be related, e.g. there may be twins inside

30 Birthdays We are interested in the event that two birthdays are the same: E n = {(b 1,…, b n ) : b i = b j for some pair i ≠ j } It will be easier to work with the complement of E : E n c = {(b 1,…, b n ) : (b 1,…, b n ) are all distinct } P(E n c ) = |Sn||Sn| |Enc||Enc| 365 ⋅ 364 ⋅ … ⋅ (365 – n + 1) 365 n = P(E n ) = 1 – P(E n c )

31 Birthdays P(En)P(En) n P(E 22 ) = 0.4757… P(E 23 ) = 0.5073… Among 23 people, two have the same birthday with probability about 50%.

32 Interpretation of probability The probability of an event should equal the fraction of times that it occurs when the experiment is performed many times under the same conditions. Let’s do the birthday experiment many times and see if this is true.

33 Simulation of birthday experiment # perform t simulations of the birthday experiment for n people # output a vector indicating the times event E_n occurred def simulate_birthdays(n, t): days = 365 occurred = [] for time in range(t): # choose random birthdays for everyone birthdays = [] for i in range(n): birthdays.append(randint(1, days)) # record the occurrence of event E_n occurred.append(same_birthday(birthdays)) return occurred # check if event E_n occurs (two people have the same birthday) def same_birthday(birthdays): for i in range(len(birthdays)): for j in range(i): if birthdays[i] == birthdays[j]: return True return False randint(a,b) Choose a random integer in a range

34 Interpretation of probability t experiments n = 23 Fraction of times two people have the same birthday in the first t experiments P(E 23 ) = 0.5073…

35 Problem for you to solve You drop 3 blue balls and 3 red balls into 5 bins at random. What is the probability that some bin gets two (or more) balls of the same color?

36 Generalized inclusion exclusion P(E 1 ∪ E 2 ) = P(E 1 ) + P(E 2 ) – P(E 1 E 2 ) P(E 1 ∪ E 2 ∪ E 3 ) = P(E 2 ∪ E 3 ) = P(E 2 ) + P(E 3 ) – P(E 2 E 3 ) P(E 1 (E 2 ∪ E 3 )) = P(E 1 E 2 ∪ E 1 E 3 ) = P(E 1 E 2 ) + P(E 1 E 3 ) – P(E 1 E 2 E 3 ) P(E 1 ∪ E 2 ∪ E 3 ) = P(E 1 ) + P(E 2 ∪ E 3 ) – P(E 1 (E 2 ∪ E 3 )) – P(E 1 E 2 ) – P(E 2 E 3 ) – P(E 1 E 3 ) + P(E 1 E 2 E 3 ) P(E 1 ) + P(E 2 ) + P(E 3 )

37 Generalized inclusion exclusion P(E 1 ∪ E 2 ∪ … ∪ E n ) = ∑ 1 ≤ i ≤ n P(E i ) – ∑ 1 ≤ i ≤ j ≤ n P(E i E j ) + ∑ 1 ≤ i ≤ j ≤ k ≤ n P(E i E j E k ) … + or – P(E 1 E 2 …E n ) + if n is odd, – if n is even (-1) n+1

38

39 Hats Probability model outcome = assignment of n hats to n people The sample space S consists of all permutations p 1 p 2 p 3 p 4 of the numbers 1, 2, 3, 4 let’s do n = 4 : 1342 means 1 gets 1’s hat 2 gets 3’s hat 3 gets 4’s hat 4 gets 2’s hat

40 Hats 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2143, 2314, 2341, 2413, 2431, 3124, 3142, 3214, 3241, 3412, 3421, 4123, 4132, 4213, 4231, 4312, 4321 } S = { H : “at least someone gets their own hat” P(H) = |S||S| |H||H| = 24 15 Now let’s calculate in a different way.

41 Hats Event H “at least someone gets their own hat” H = H 1 ∪ H 2 ∪ H 3 ∪ H 4 H i is the event “person i gets their own hat”. H 1 = {p 1 p 2 p 3 p 4 : permutations such that p 1 = 1 } and so on.

42 Hats P(H 1 ∪ H 2 ∪ H 3 ∪ H 4 ) – P(H 1 H 2 ) – P(H 1 H 3 ) – P(H 1 H 4 ) – P(H 2 H 3 ) – P(H 2 H 4 ) – P(H 3 H 4 ) + P(H 1 H 2 H 3 ) + P(H 1 H 2 H 4 ) + P(H 1 H 3 H 4 ) + P(H 2 H 3 H 4 ) = P(H 1 ) + P(H 2 ) + P(H 3 ) + P(H 4 ) – P(H 1 H 2 H 3 H 4 ). We will calculate P(H) by inclusion-exclusion: Under equally likely outcomes, P(E) = |S||S| |E||E| 4! |E||E| =

43 Hats H 1 = { p 1 p 2 p 3 p 4 : permutations such that p 1 = 1} |H1||H1| = number of permutations of {2, 3, 4} = 3! |H2||H2| = number of permutations of {1, 3, 4} = 3! H 2 = { p 1 p 2 p 3 p 4 : permutations such that p 2 = 2} similarly |H 3 | = |H 4 | = 3! P(H 1 ) = P(H 2 ) = P(H 3 ) = P(H 4 ) = 3!/4!

44 Hats H 1 = { p 1 p 2 p 3 p 4 : permutations such that p 1 = 1 } H 2 = { p 1 p 2 p 3 p 4 : permutations such that p 2 = 2 } H 1 H 2 = { p 1 p 2 p 3 p 4 : permutations s.t. p 1 = 1 and p 2 = 2 } |H1H2||H1H2| = number of permutations of { 3, 4 } = 2! similarly |H 1 H 3 | = |H 1 H 4 | = … = |H 3 H 4 | = 2! P(H 1 H 2 ) = … = P(H 3 H 4 ) = 2!/4!

45 Hats P(H 1 ∪ H 2 ∪ H 3 ∪ H 4 ) – P(H 1 H 2 ) – P(H 1 H 3 ) – P(H 1 H 4 ) – P(H 2 H 3 ) – P(H 2 H 4 ) – P(H 3 H 4 ) + P(H 1 H 2 H 3 ) + P(H 1 H 2 H 4 ) + P(H 1 H 3 H 4 ) + P(H 2 H 3 H 4 ) = P(H 1 ) + P(H 2 ) + P(H 3 ) + P(H 4 ) – P(H 1 H 2 H 3 H 4 ). 3!/4! 2!/4! 1!/4! 0!/4! value number of terms C(4, 1)C(4, 2) C(4, 3) C(4, 4) × ×× × – – +

46 Hats It remains to evaluate 3!/4! 2!/4! 1!/4! 0!/4! C(4, 1)C(4, 2) C(4, 3) C(4, 4) ×× × × – – + P(H) = Each term has the form C(4, k) 4! (4 – k)! = k! (4 – k)! 4! × (4 – k)! = k!k! 1 so P(H) = 1! 1 2! 1 3! 1 4! 1 –– + = 24 15

47 Hats General formula for n men: Let E n = “at least someone gets their own hat” P(E n ) = 1! 1 2! 1 3! 1 – … + (-1) n+1 – + n!n! 1 assuming equally likely outcomes.

48 Hats P(En)P(En) n 0.63212…

49 Hats Remember from calculus P(E n ) = 1! 1 2! 1 3! 1 – … + (-1) n+1 – + n!n! 1 e x = 1 + x + 2! x2x2 + 3! x3x3 + … so P(E n ) → 1 – e -1 ≈ 0.63212 as n → ∞

50 Circular arrangements In how many ways can n people sit at a round table? 1 2 3 4 1 2 4 3 1 3 2 4 1 3 4 2 1 4 2 3 1 4 3 2 Once the first person has sat down, the others can be arranged in (n – 1)! ways relative to his position. (n – 1)! We do not distinguish between seatings that differ by a rotation of the table.

51 Round table 10 husband-wife couples are seated at random at a round table. What is the probability that no wife sits next to her husband? Probability model The sample space S consists of all circular arrangements of { H 1, W 1, …, H 10, W 10 } We assume equally likely outcomes. |S| = (n – 1)!

52 Round table The event N of interest is that no husband and wife are adjacent. Let A 1, …, A 10 be the events A i = “The husband-wife pair H i, W i is adjacent” P(N) = 1 – P(N c ) = 1 – P(A 1 ∪ … ∪ A 10 ) so We calculate this using inclusion-exclusion.

53 Round table The inclusion exclusion formula involves expressions like P(A 1 ), P(A 2 A 5 ), P(A 3 A 4 A 7 A 9 ). Let’s start with P(A 1 ), so we want H 1 and W 1 adjacent. We need to calculate |A 1 |, the number of circular arrangements in which H 1 and W 1 are adjacent.

54 Round table We use the basic principle of counting. Treating the couple H 1, W 1 as a single unordered item, we get 18! circular arrangements H1H1 W1W1 H2H2 W2W2 H1H1 W1W1 W2W2 H2H2 H1H1 H2H2 W1W1 W2W2 H1H1 H2H2 W2W2 W1W1 H1H1 W2W2 W1W1 H2H2 H1H1 W2W2 H2H2 W1W1 For each of this arrangements, the couple can sit in the order H 1 W 1 or W 1 H 1 --- 2 possibilities so |A 1 | = 2 × 18!P(A 1 ) = 2 × 18! / 19!

55 Round table In general, the events in the inclusion-exclusion formula are indexed by some set C of couples. E.g. if A 3 A 4 A 7 A 9 then C = {3, 4, 7, 9}. In how many ways can we arrange the couples so that those in C are adjacent? Treating the couples in C as single unordered items, we get (19 – |C|)! arrangements. For each such arrangement, we can order the C couples in 2 |C| possible ways. 2 |C| (19 – |C|)!

56 Round table P(A 1 ∪ A 2 ∪ … ∪ A 10 ) – ∑ 1 ≤ i ≤ j ≤ 10 P(A i A j ) + ∑ 1 ≤ i ≤ j ≤ k ≤ 10 P(A i A j A k ) … – P(A 1 A 2 …A 10 ) = ∑ 1 ≤ i ≤ 10 P(A i ) value#terms 2 × 18! / 19!10 2 2 × 17! / 19!C(10, 2) 2 3 × 16! / 19!C(10, 3) 2 10 × 9! / 19!1 × × × × 0.6605… so P(N) = 1 – 0.6605… = 0.3395…

57 Problem for you to solve You have 8 different chopstick pairs and you randomly give them to 8 guests. What is the probability that no guest gets a matching pair?


Download ppt "Andrej Bogdanov ENGG 2430A: Probability and Statistics for Engineers Spring 2016 2. Axioms of Probability."

Similar presentations


Ads by Google