counting and probability. counting elements of sets theorem. the inclusion/exclusion rule for two or...

15
Counting and Probability

Upload: dominic-barnett

Post on 12-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Counting and Probability

Page 2: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Counting Elements of Sets Theorem. The Inclusion/Exclusion

Rule for Two or Three Sets If A, B, and C are finite sets, then N(AB) = N(A) + N(B) – N(A B) and N(ABC) = N(A) + N(B) + N(C) –

N(AB) – N(AC) – N(BC) + N(ABC)

Page 3: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Example 1 In a class of 50 college freshmen, 30 are

studying BASIC, 25 studying PASCAL, and 10 are studying both.

How many freshmen are studying either computer language?

A: set of freshmen study BASIC B: set of freshmen study PASCAL N(AB) = N(A)+N(B)-N(AB) = 30 + 25 – 10 = 45

10

20

10

15

Page 4: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Example 2 A professor takes a survey to determine how

many students know certain computer languages. The finding is that out of a total of 50 students in the class,

30 know Java;18 know C++26 know SQL 9 know both Java and C++16 know both Java and SQL 8 know both C++ and SQL47 know at least one of the 3 languages.

Page 5: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Example 2

a. How many students know none of the three languages?

b. How many students know all three languages?

c. How many students know Java and C++ but not SQL? How many students know Java but neither C++ nor SQL

Answer:a. 50 – 47 = 3

Page 6: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Example 2

J = the set of students who know Java

C = the set of students who know C++

S = the set of students who know SQL

Use Inclusion/Exclusion rule.

Page 7: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Discrete ProbabilityThe probability of an event is the likelihood

that event will occur. “Probability 1” means that it must happen while

probability 0 means that it cannot happen E.g.: the probability of…

“Manchester United defeat Liverpool this season” is 1

“Liverpool win the Premier League this season” is 0 Events which may or may not occur are

assigned a number between 0 and 1.

Page 8: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Discrete Probability

Consider the following problems: What’s the probability of tossing a

coin 3 times and getting all heads or all tails?

What’s the probability that a list consisting of n distinct numbers will not be sorted?

Set cardinalities are useful.

Page 9: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Discrete Probability An experiment is a process that yields

an outcome. A sample space is the set of all possible

outcomes of a random process. An event is an outcome or combination

of outcomes from an experiment. An event is a subset of a sample space. Examples of experiments: - Rolling a six-sided die - Tossing a coin.

Page 10: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

ExampleEG: What’s the probability of tossing a coin 3 times and

getting all heads or all tails?Can consider set of ways of tossing coin 3 times:

S = {HHH,HHT,HTH,HTT,THH,THT,TTH,TTT}S is called a sample space. Next, consider set of ways of tossing all heads or all tails:

E = {HHH,TTT}E is called the event.Assuming all outcomes equally likely to occurDefinition: The probability of the event E is the ratio

p (E ) = |E | / |S |EG: Our case: p (E ) = 2/8 = 0.25

Page 11: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Example Five microprocessors are randomly selected

from a lot of 1000 microprocessors among which 20 are defective. Find the probability of obtaining no defective microprocessors.

There are C(1000,5) ways to select 5 micros. There are C(980,5) ways to select 5 good

micros. The prob. of obtaining no defective micros is C(980,5)/C(1000,5) = 0.904

Page 12: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Question

???

Page 13: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Probability of combinations of events Theorem. Let E1 and E2 be events in the sample space S.

Then P(E1 E2) = P(E1) + P(E2) – P(E1 E2)E.g. What is the prob. that a positive integer selected

at random from the set of positive integers not greater than 100 is divisible by either 2 or 5.

E1: event that the integer selected is divisible by 2

E2: event that the integer selected is divisible by 5

P(E1 E2) = 50/100 + 20/100 – 10/100 = 3/5

Page 14: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

Exercise

Two fair dice are rolled. What is the probability that the sum of the numbers on the dice is 10?

Page 15: Counting and Probability. Counting Elements of Sets Theorem. The Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(A

THANK YOU