+ All Categories

Ch05

Date post: 29-Oct-2014
Category:
Upload: akhilesh-bhura
View: 436 times
Download: 1 times
Share this document with a friend
Description:
 
Popular Tags:
28
CMSC 203 Discrete Structures 1 Now it’s time to look at… Now it’s time to look at… Discrete Probability Discrete Probability (Chapter 5) (Chapter 5)
Transcript
Page 1: Ch05

CMSC 203 Discrete Structures 1

Now it’s time to look at…Now it’s time to look at…

Discrete ProbabilityDiscrete Probability

(Chapter 5)(Chapter 5)

Page 2: Ch05

CMSC 203 Discrete Structures 2

Discrete ProbabilityDiscrete Probability

Everything you have learned about counting Everything you have learned about counting constitutes the basis for computing the constitutes the basis for computing the probabilityprobability of events to happen. of events to happen.

In the following, we will use the notion In the following, we will use the notion experimentexperiment for a procedure that yields one of for a procedure that yields one of a given set of possible outcomes.a given set of possible outcomes.

This set of possible outcomes is called the This set of possible outcomes is called the sample spacesample space of the experiment. of the experiment.

An An eventevent is a subset of the sample space. is a subset of the sample space.

Page 3: Ch05

CMSC 203 Discrete Structures 3

Discrete ProbabilityDiscrete Probability

If all outcomes in the sample space are equally If all outcomes in the sample space are equally likely, the following definition of probability likely, the following definition of probability applies:applies:

The probability of an event E, which is a subset The probability of an event E, which is a subset of a finite sample space S of equally likely of a finite sample space S of equally likely outcomes, is given by p(E) = |E|/|S|.outcomes, is given by p(E) = |E|/|S|.

Probability values of event range from 0 (for an event that will never happen) to 1 (for an event that will always happen whenever the experiment is carried out).

Page 4: Ch05

CMSC 203 Discrete Structures 4

Discrete ProbabilityDiscrete Probability

Example I:Example I:

An urn contains 4 blue balls and 5 red balls. An urn contains 4 blue balls and 5 red balls. What is the probability that a ball chosen at What is the probability that a ball chosen at random from the urn is blue?random from the urn is blue?

Solution:Solution:

There are 9 possible outcomes, and the event There are 9 possible outcomes, and the event “blue ball is chosen” comprises four of these “blue ball is chosen” comprises four of these outcomes. Therefore, the probability of this outcomes. Therefore, the probability of this event is 4/9 or approximately 44.44%.event is 4/9 or approximately 44.44%.

Page 5: Ch05

CMSC 203 Discrete Structures 5

Discrete ProbabilityDiscrete Probability

Example II:Example II:

What is the probability of winning the lottery What is the probability of winning the lottery 6/49, that is, picking the correct set of six 6/49, that is, picking the correct set of six numbers out of 49?numbers out of 49?

Solution:Solution:

There are C(49, 6) possible outcomes. Only There are C(49, 6) possible outcomes. Only one of these outcomes will actually make us one of these outcomes will actually make us win the lottery.win the lottery.

p(E) = 1/C(49, 6) = 1/13,983,816 p(E) = 1/C(49, 6) = 1/13,983,816

Page 6: Ch05

CMSC 203 Discrete Structures 6

Complimentary EventsComplimentary Events

Let E be an event in a sample space S. The Let E be an event in a sample space S. The probability of an event –E = S - E, the probability of an event –E = S - E, the complimentary eventcomplimentary event of E, is given by of E, is given by

p(-E) = 1 – p(E).p(-E) = 1 – p(E).

This can easily be shown:This can easily be shown:

p(-E) = (|S| - |E|)/|S| = 1 - |E|/|S| = 1 – p(E).

This rule is useful if it is easier to determine the probability of the complimentary event than the probability of the event itself.

Page 7: Ch05

CMSC 203 Discrete Structures 7

Complimentary EventsComplimentary Events

Example I:Example I: A sequence of 10 bits is randomly A sequence of 10 bits is randomly generated. What is the probability that at least generated. What is the probability that at least one of these bits is zero?one of these bits is zero?

Solution:Solution: There are 2 There are 21010 = 1024 possible = 1024 possible outcomes of generating such a sequence. The outcomes of generating such a sequence. The event –E, event –E, “none of the bits is zero”“none of the bits is zero”, , includes only one of these outcomes, namely includes only one of these outcomes, namely the sequence 1111111111.the sequence 1111111111.

Therefore, p(-E) = 1/1024.Therefore, p(-E) = 1/1024.

Now p(E) can easily be computed as Now p(E) can easily be computed as p(E) = 1 – p(-E) = 1 – 1/1024 = 1023/1024.p(E) = 1 – p(-E) = 1 – 1/1024 = 1023/1024.

Page 8: Ch05

CMSC 203 Discrete Structures 8

Complimentary EventsComplimentary Events

Example II:Example II: What is the probability that at least What is the probability that at least two out of 36 people have the same birthday?two out of 36 people have the same birthday?

Solution:Solution: The sample space S encompasses all The sample space S encompasses all possibilities for the birthdays of the 36 people,possibilities for the birthdays of the 36 people,so |S| = 365so |S| = 3653636..

Let us consider the event –E (“no two people Let us consider the event –E (“no two people out of 36 have the same birthday”). –E includes out of 36 have the same birthday”). –E includes P(365, 36) outcomes (365 possibilities for the P(365, 36) outcomes (365 possibilities for the first person’s birthday, 364 for the second, and first person’s birthday, 364 for the second, and so on). so on).

Then p(-E) = P(365, 36)/365Then p(-E) = P(365, 36)/3653636 = 0.168, = 0.168,so p(E) = 0.832 or 83.2%so p(E) = 0.832 or 83.2%

Page 9: Ch05

CMSC 203 Discrete Structures 9

Discrete ProbabilityDiscrete Probability

Let ELet E11 and E and E22 be events in the sample space S. be events in the sample space S.Then we have:Then we have:

p(Ep(E11 E E22) = p(E) = p(E11) + p(E) + p(E22)) - p(E- p(E11 E E22) )

Does this remind you of something?Does this remind you of something?

Of course, the principle of Of course, the principle of inclusion-inclusion-exclusionexclusion..

Page 10: Ch05

CMSC 203 Discrete Structures 10

Discrete ProbabilityDiscrete Probability

Example:Example: What is the probability of a positive What is the probability of a positive integer selected at random from the set of all integer selected at random from the set of all positive integers not exceeding 100 to be positive integers not exceeding 100 to be divisible by 2 or 5? divisible by 2 or 5?

Solution:Solution: S = {1, 2, …, 100}, |S| = 100S = {1, 2, …, 100}, |S| = 100

EE22: “integer is divisible by 2”: “integer is divisible by 2”EE55: “integer is divisible by 5”: “integer is divisible by 5”

EE22 = {2, 4, 6, …, 100} = {2, 4, 6, …, 100}

|E|E22| = 50| = 50

p(Ep(E22) = 50/100 = 0.5) = 50/100 = 0.5

Page 11: Ch05

CMSC 203 Discrete Structures 11

Discrete ProbabilityDiscrete Probability

EE55 = {5, 10, 15, …, 100} = {5, 10, 15, …, 100}

|E|E55| = 20| = 20

p(Ep(E55) = 20/100 = 0.2) = 20/100 = 0.2

EE22 E E55 = {10, 20, 30, …, 100} = {10, 20, 30, …, 100}

|E|E22 E E55| = 10| = 10

p(Ep(E22 E E55) = 0.1) = 0.1

p(Ep(E22 E E55) = p(E) = p(E22) + p(E) + p(E55)) – p(E– p(E22 E E5 5 ))

p(Ep(E22 E E55) = 0.5 + 0.2 – 0.1 = 0.6) = 0.5 + 0.2 – 0.1 = 0.6

Page 12: Ch05

CMSC 203 Discrete Structures 12

Discrete ProbabilityDiscrete ProbabilityWhat happens if the outcomes of an experiment What happens if the outcomes of an experiment are are notnot equally likely? equally likely?

In that case, we assign a probability p(s) to each In that case, we assign a probability p(s) to each outcome soutcome sS, where S is the sample space.S, where S is the sample space.

Two conditions have to be met:Two conditions have to be met:(1): 0 (1): 0 p(s) p(s) 1 for each s 1 for each sS, andS, and

(2): (2): ssSS p(s) = 1 p(s) = 1

This means that (1) each probability must be a This means that (1) each probability must be a value between 0 and 1, and (2) the probabilities value between 0 and 1, and (2) the probabilities must add up to 1, because one and only of the must add up to 1, because one and only of the outcomes is outcomes is guaranteedguaranteed to occur in an to occur in an experiment.experiment.

Page 13: Ch05

CMSC 203 Discrete Structures 13

Discrete ProbabilityDiscrete ProbabilityHow can we obtain these probabilities p(s) ?How can we obtain these probabilities p(s) ?

The probability p(The probability p(ss) assigned to an outcome ) assigned to an outcome ss equals the limit of the number of times equals the limit of the number of times ss occurs divided by the number of times the occurs divided by the number of times the experiment is performed.experiment is performed.

occurs in which sexperiment ofnumber theis sexperiment ofnumber total theis

wherelim)(

smn

n

msp n

We call function p: S We call function p: S [0, 1] a probability [0, 1] a probability distribution of S. distribution of S.

Page 14: Ch05

CMSC 203 Discrete Structures 14

Discrete ProbabilityDiscrete Probability

Once we know the probability distribution p(s), we can compute the Once we know the probability distribution p(s), we can compute the probability of an event Eprobability of an event E as follows: as follows:

p(E) = p(E) = ssEE p(s) p(s)

Example I:Example I: A die is biased so that the number 3 appears twice as A die is biased so that the number 3 appears twice as often as each other number.often as each other number.What are the probabilities of all possible outcomes?What are the probabilities of all possible outcomes?

Page 15: Ch05

CMSC 203 Discrete Structures 15

Discrete ProbabilityDiscrete Probability

Solution:Solution: There are 6 possible outcomes s There are 6 possible outcomes s11, …, s, …, s66. .

p(sp(s11) = p(s) = p(s22) = p(s) = p(s44) = p(s) = p(s55) = p(s) = p(s66))

p(sp(s33) = 2p(s) = 2p(s11))

Since the probabilities must add up to 1, we have:Since the probabilities must add up to 1, we have:

5p(s5p(s11) + 2p(s) + 2p(s11) = 1) = 1

7p(s7p(s11) = 1) = 1

p(sp(s11) = p(s) = p(s22) = p(s) = p(s44) = p(s) = p(s55) = p(s) = p(s66) = 1/7, p(s) = 1/7, p(s33) = 2/7) = 2/7

Page 16: Ch05

CMSC 203 Discrete Structures 16

Discrete ProbabilityDiscrete Probability

Example II:Example II: For the biased die from Example For the biased die from Example I, what is the probability that an odd number I, what is the probability that an odd number appears when we roll the die?appears when we roll the die?

Solution:Solution:

EEoddodd = {s = {s11, s, s33, s, s55}}

Remember the formula Remember the formula p(E) = p(E) = ssEE p(s). p(s).

p(Ep(Eoddodd) = ) = ssEEoddodd p(s) = p(s p(s) = p(s11) + p(s) + p(s33) + p(s) + p(s55))

p(Ep(Eoddodd) = 1/7 + 2/7 + 1/7 = 4/7 = 57.14%) = 1/7 + 2/7 + 1/7 = 4/7 = 57.14%

Page 17: Ch05

CMSC 203 Discrete Structures 17

Conditional ProbabilityConditional Probability

If we toss a fair coin three times, what is the If we toss a fair coin three times, what is the probability that an odd number of tails probability that an odd number of tails appears appears (event E)(event E), if the first toss is a tail , if the first toss is a tail (event F)(event F) ? ?

If the first toss is a tail, the possible sequences If the first toss is a tail, the possible sequences are TTT, TTH, THT, and THH. are TTT, TTH, THT, and THH.

In two out of these four cases, there is an odd In two out of these four cases, there is an odd number of tails. number of tails.

Therefore, the probability of E, Therefore, the probability of E, under the under the conditioncondition that F occurs, is 0.5. that F occurs, is 0.5.

We call this We call this conditional probabilityconditional probability. .

Page 18: Ch05

CMSC 203 Discrete Structures 18

Conditional ProbabilityConditional Probability

If we want to compute the conditional probability If we want to compute the conditional probability of E given F, we use F as the sample space.of E given F, we use F as the sample space.

For any outcome of E to occur under the condition For any outcome of E to occur under the condition that F also occurs, this outcome must also be inthat F also occurs, this outcome must also be inE E F. F.

Definition:Definition: Let E and F be events with p(F) > 0. Let E and F be events with p(F) > 0.The conditional probability of E given F, denoted The conditional probability of E given F, denoted by p(E | F), is defined asby p(E | F), is defined as

p(E | F) = p(E p(E | F) = p(E F)/p(F) F)/p(F)

Venn diagramVenn diagram

Page 19: Ch05

CMSC 203 Discrete Structures 19

Conditional ProbabilityConditional ProbabilityExample:Example: What is the probability of a random What is the probability of a random bit string of length four contains at least two bit string of length four contains at least two consecutive 0s, given that its first bit is a 0 ?consecutive 0s, given that its first bit is a 0 ?

Solution:Solution: E: “bit string contains at least two consecutive E: “bit string contains at least two consecutive 0s”0s”F: “first bit of the string is a 0”F: “first bit of the string is a 0”

We know the formula We know the formula p(E | F) = p(E p(E | F) = p(E F)/p(F) F)/p(F)..

E E F = {0000, 0001, 0010, 0011, 0100} F = {0000, 0001, 0010, 0011, 0100}p(E p(E F) = 5/16 F) = 5/16p(F) = 8/16 = 1/2p(F) = 8/16 = 1/2p(E | F) = (5/16)/(1/2) = 10/16 = 5/8 = 0.625p(E | F) = (5/16)/(1/2) = 10/16 = 5/8 = 0.625

Page 20: Ch05

CMSC 203 Discrete Structures 20

Bayes’ TheoremBayes’ Theorem

Since p(E | F) = p(E Since p(E | F) = p(E F)/p(F), we have F)/p(F), we have p(E | F)p(F) = p(E p(E | F)p(F) = p(E F) F)Symmetrically we haveSymmetrically we have p(F | E)p(E) = p(E p(F | E)p(E) = p(E F) F)Therefore,Therefore, p(E | F)p(F) = p(F | E)p(E)p(E | F)p(F) = p(F | E)p(E)and p(F | E) = p(E | F)p(F)/p(E).and p(F | E) = p(E | F)p(F)/p(E).

This is called This is called Bayes’ theoremBayes’ theorem, where, where – p(E | F) is the p(E | F) is the conditional conditional probability, probability, – p(E) and p(F) p(E) and p(F) priorprior probabilities, and probabilities, and – P(F | E) P(F | E) posteriorposterior probability probability

Page 21: Ch05

CMSC 203 Discrete Structures 21

IndependenceIndependence

Let us return to the example of tossing a coin Let us return to the example of tossing a coin three times.three times.

Does the probability of event E (odd number of Does the probability of event E (odd number of tails) tails) dependdepend on the occurrence of event F on the occurrence of event F (first toss is a tail) ?(first toss is a tail) ?

In other words, is it the case thatIn other words, is it the case thatp(E | F) p(E | F) p(E) ? p(E) ?

We actually find that p(E | F) = 0.5 and p(E) = We actually find that p(E | F) = 0.5 and p(E) = 0.5,0.5,so we say that E and F are so we say that E and F are independent independent eventsevents..

Page 22: Ch05

CMSC 203 Discrete Structures 22

IndependenceIndependence

Because we have p(E | F) = p(E Because we have p(E | F) = p(E F)/p(F), F)/p(F),p(E | F) = p(E) if and only if p(E p(E | F) = p(E) if and only if p(E F) = p(E)p(F). F) = p(E)p(F).

Definition:Definition: The events E and F are said to be The events E and F are said to be independent if and only if p(E independent if and only if p(E F) = p(E)p(F). F) = p(E)p(F).

Obviously, this definition is Obviously, this definition is symmetricalsymmetrical for E for E and F. If we have p(E and F. If we have p(E F) = p(E)p(F), then it is F) = p(E)p(F), then it is also true that p(F | E) = p(F).also true that p(F | E) = p(F).

Page 23: Ch05

CMSC 203 Discrete Structures 23

IndependenceIndependenceExample:Example: Suppose E is the event that a Suppose E is the event that a randomly generated bit string of length four randomly generated bit string of length four begins with a 1, and F is the event that a begins with a 1, and F is the event that a randomly generated bit string contains an even randomly generated bit string contains an even number of 0s. Are E and F independent?number of 0s. Are E and F independent?

Solution:Solution: Obviously, p(E) = p(F) = 0.5. Obviously, p(E) = p(F) = 0.5.

E E F = {1111, 1001, 1010, 1100} F = {1111, 1001, 1010, 1100}

p(E p(E F) = 0.25 F) = 0.25

p(E p(E F) = p(E)p(F) F) = p(E)p(F)

Conclusion: E And F are Conclusion: E And F are independentindependent..

Page 24: Ch05

CMSC 203 Discrete Structures 24

IndependenceIndependence

If E and F are independent of each other, thenIf E and F are independent of each other, then

P(E P(E F) = p(E) + p(F) - p(E F) = p(E) + p(F) - p(E F) F)

= p(E) + p(F) - p(E)p(F)= p(E) + p(F) - p(E)p(F)

= 1 – (1 – p(E))(1 – p(F))= 1 – (1 – p(E))(1 – p(F))

In general, if EIn general, if E11, E, E22, …, E, …, Enn are independent of are independent of each other, theneach other, then

))(1(1)( 121 inin EpEEEp

Page 25: Ch05

CMSC 203 Discrete Structures 25

Bernoulli TrialsBernoulli Trials

Suppose an experiment with Suppose an experiment with two possible two possible outcomesoutcomes, such as tossing a coin. , such as tossing a coin.

Each performance of such an experiment is Each performance of such an experiment is called a called a Bernoulli trialBernoulli trial..

We will call the two possible outcomes a We will call the two possible outcomes a successsuccess or a or a failurefailure, respectively., respectively.

If If p p is the probability of a success and is the probability of a success and qq is the is the probability of a failure in a single Bernoulli probability of a failure in a single Bernoulli trial, it is obvious thattrial, it is obvious thatp + q = 1p + q = 1..

Page 26: Ch05

CMSC 203 Discrete Structures 26

Bernoulli TrialsBernoulli Trials

Often we are interested in the probability of Often we are interested in the probability of exactly k successesexactly k successes when an experiment when an experiment consists of consists of n independent Bernoulli trialsn independent Bernoulli trials..

Example:Example: A coin is biased so that the probability of head A coin is biased so that the probability of head is 2/3. What is the probability of exactly four is 2/3. What is the probability of exactly four heads to come up when the coin is tossed heads to come up when the coin is tossed seven times?seven times?

Page 27: Ch05

CMSC 203 Discrete Structures 27

Bernoulli TrialsBernoulli Trials

Solution:Solution: There are 2There are 277 = 128 possible outcomes (e.g., = 128 possible outcomes (e.g., HHHHTTT, HHHTHTT, …, TTTHHHHHHHHTTT, HHHTHTT, …, TTTHHHH).).The number of possible ways for four heads The number of possible ways for four heads among the seven trials is C(7, 4). among the seven trials is C(7, 4). The seven trials are independent, so the The seven trials are independent, so the probability of each of these outcomes isprobability of each of these outcomes is(2/3)(2/3)44(1/3)(1/3)33..Consequently, the probability of exactly four Consequently, the probability of exactly four heads to appear isheads to appear isC(7, 4)(2/3)C(7, 4)(2/3)44(1/3)(1/3)33 = 560/2187 = 25.61% = 560/2187 = 25.61%

Page 28: Ch05

CMSC 203 Discrete Structures 28

Bernoulli TrialsBernoulli TrialsTheorem:Theorem: The probability of k successes in n The probability of k successes in n independent Bernoulli trials, with probability independent Bernoulli trials, with probability of success p and probability of failure q = 1 – of success p and probability of failure q = 1 – p, isp, isC(n, k)pC(n, k)pkkqqn-kn-k ..

See the textbook for the proof.See the textbook for the proof.

We denote by b(k; n, p) the probability of k We denote by b(k; n, p) the probability of k successes in n independent Bernoulli trials successes in n independent Bernoulli trials with probability of success p and probability of with probability of success p and probability of failure q = 1 – p.failure q = 1 – p.Considered as function of k, we call b the Considered as function of k, we call b the binomial distributionbinomial distribution..


Recommended