1 / 29

Discrete Structures Chapter 4 Counting and Probability

Discrete Structures Chapter 4 Counting and Probability. Nurul Amelina Nasharuddin Multimedia Department. Outline. Rules of Sum and Product Permutations Combinations: The Binomial Theorem Combinations with Repetition: Distribution Probability. Combinations with Repetition. Example:

brendy
Download Presentation

Discrete Structures Chapter 4 Counting and Probability

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discrete StructuresChapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department

  2. Outline • Rules of Sum and Product • Permutations • Combinations: The Binomial Theorem • Combinations with Repetition: Distribution • Probability

  3. Combinations with Repetition Example: How many ways are there to select 4 pieces of fruits from a bowl containing apples, oranges, and pears if the order does not matter, only the type of fruit matters, and there are at least 4 pieces of each type of fruit in the bowl

  4. Answer • Some of the results:

  5. Answer The number of ways to select 4 pieces of fruit = The number of ways to arrange 4 X’s and 2 |’s, which is given by = 6! / 4!(6-4)! = C(6,4) = 15 ways.

  6. Combinations with Repetition • In general, when we wish to select, with repetition, r of n distinct elements, we are considering all arrangements of r X’s and n-1 |’s and that their number is

  7. Combinations with Repetition • An r-combination of a set of n elements is an unordered selection of r elements from the set, with repetition is:

  8. Example (1) A person throwing a party wants to set out 15 assorted cans of drinks for his guests. He shops at a store that sells five different types of soft drinks. How many different selections of 15 cans can he make? (Here n = 5, r = 15)

  9. Example (1) • 4 |’s (to separate the categories of soft drinks) • 15 X’s (to represent the cans selected) = 19! / 15!(19-15)! = C(19,15) = 3876 ways.

  10. Example (2) A donut shop offers 20 kinds of donuts. Assuming that there are at least a dozen of each kind when we enter the shop, we can select a dozen donuts in (Here n = 20, r = 12). = C(31, 12) = 141,120,525 ways.

  11. Example (3) A restaurant offers 4 kinds of food. In how many ways can we choose six of the food? C(6 + 4 - 1, 6) = C(9, 6) = C(9, 3) = 9! = 84 ways. 3! 6!

  12. Which formula to use? Different ways of choosing k elements from n

  13. Counting and Probability

  14. Discrete Probability • The 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 • Eg: 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.

  15. 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?

  16. 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

  17. Example Experiment 1: Tossing a coin. • Sample space: S = {Head or Tail} or we could write: S = {0, 1} where 0 represents a tail and 1 represents a head. Experiment 2: Tossing a coin twice • S = {HH, TT, HT, TH} where some events: • E1 = {Head}, • E2 = {Tail}, • E3 = {All heads}

  18. Definition of Probability • Suppose an event E can happen in r ways out of a total of n possible equally likely ways. • Then the probability of occurrence of the event (called its success) is denoted by • The probability of non-occurrence of the event (called its failure) is denoted by • Thus,

  19. Definition of Probabilityusing Sample Spaces • If S is a finite sample space in which all outcomes are equally likely and E is an event in S, then the probability of E, P(E), is • where N(E) is the number of outcomes in E N(S) is the total number of outcomes in S

  20. Example (1) 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: Sample space, S = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT} Next, consider set of ways of tossing all heads or all tails: Event, E = {HHH, TTT} Assuming all outcomes equally likely to occur  P(E) = 2/8 = 0.25

  21. Example (2) • 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

  22. 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) • Eg: What is the probability 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

  23. Exercise • If any seven digits could be used to form a telephone number, how many seven-digits telephone numbers would not have repeated digits? • How many seven-digit telephone numbers would have at least one repeated digit? • What is the probability that a randomly chosen seven-digit telephone number would have at least one repeated digit?

  24. Answer • 10 x 9 x 8 x 7 x 6 x 5 x 4 = 604800 • [no of PN with at least one digit] = [total no of PN] – [no of PN with no repeated digit] = 107 – 604800 = 9395200 • 9395200 / 107 = 0.93952

  25. Counting Elements of Sets The Principle of Inclusion/Exclusion Rule for Two or Three Sets If A, B, and C are finite sets, then N(AB) = N(A) + N(B) – N(A  B) and N(ABC) = N(A) + N(B) + N(C) – N(AB) – N(AC) – N(BC) + N(ABC)

  26. 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 not studying either computer language? A: set of freshmen study BASIC B: set of freshmen study PASCAL N(AB) = N(A)+N(B)-N(AB) = 30 + 25 – 10 = 45 • Not studying either: 50 – 45 =5 10 20 10 15

  27. 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 SQL; 47 know at least one of the 3 languages.

  28. 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: • 50 – 47 = 3 • ? • ?

  29. 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.

More Related