Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Mathematics Lecture 6 Alexander Bukharovich New York University.

Similar presentations


Presentation on theme: "Discrete Mathematics Lecture 6 Alexander Bukharovich New York University."— Presentation transcript:

1 Discrete Mathematics Lecture 6 Alexander Bukharovich New York University

2 Counting and Probability Coin tossing Random process Sample space is the set of all possible outcomes of a random process. An event is a subset of a sample space Probability of an event is the ratio between the number of outcomes that satisfy the event to the total number of possible outcomes Rolling a pair of dice and card deck as sample random processes

3 Possibility Trees Teams A and B are to play each other repeatedly until one wins two games in a row or a total three games. –What is the probability that five games will be needed to determine the winner? Suppose there are 4 I/O units and 3 CPUs. In how many ways can I/Os and CPUs be attached to each other when there are no restrictions?

4 Multiplication Rule Multiplication rule: if an operation consists of k steps each of which can be performed in n i ways (i = 1, 2, …, k), then the entire operation can be performed in  n i ways. Number of PINs Number of elements in a Cartesian product Number of PINs without repetition Number of Input/Output tables for a circuit with n input signals Number of iterations in nested loops

5 Multiplication Rule Three officers – a president, a treasurer and a secretary are to be chosen from four people: Alice, Bob, Cindy and Dan. Alice cannot be a president, Either Cindy or Dan must be a secretary. How many ways can the officers be chosen?

6 Permutations A permutation of a set of objects is an ordering of these objects The number of permutations of a set of n objects is n! An r-permutation of a set of n elements is an ordered selection of r elements taken from a set of n elements: P(n, r) P(n, r) = n! / (n – r)! Show that P(n, 2) + P(n, 1) = n 2

7 Exercises How many odd integers are there from 10 through 99 have distinct digits? How many numbers from 1 through 99999 contain exactly one each of the digits 2, 3, 4, and 5? Let n = p 1 k1 p 2 k2 …p m km. –In how many ways can n be written as a product of two mutually prime factors? –How many divisors does n have? –What is the smallest integer with exactly 12 divisors?

8 Addition Rule If a finite set A is a union of k mutually disjoint sets A 1, A 2, …, A k, then n(A) =  n(A i ) Number of words of length no more than 3 Number of integers divisible by 5 If A is a finite set and B is its subset, then n(A – B) = n(A) – n(B) How many students are needed so that the probability of two of them having the same birthday equals 0.5?

9 Inclusion/Exclusion Rule n(A B) = n(A) + n(B) – n(A B) Derive the above rule for 3 sets How many integers from 1 through 1000 are multiples of 3 or multiples of 5? How many integers from 1 through 1000 are neither multiples of 3 nor multiples of 5?

10 Exercises Suppose that out of 50 students, 30 know Pascal, 18 know Fortran, 26 know Cobol, 9 know both Pascal and Fortran, 16 know both Pascal and Cobol, 8 know Fortran and Cobol and 47 know at least one programming language. –How many students know none of the three languages? –How many students know all three languages –How many students know exactly 2 languages?

11 Exercises Calculator has an eight-digit display and a decimal point which can be before, after or in between digits. The calculator can also display a minus sign for negative numbers. How many different numbers can the calculator display? A combination lock requires three selections of numbers from 1 to 39. How many combinations are possible if the same number cannot be used for adjacent selections?

12 Exercises How many integers from 1 to 100000 contain the digit 6 exactly once / at least once? What is a probability that a random number from 1 to 100000 will contain two or more occurrences of digit 6? 6 new employees, 2 of whom are married are assigned 6 desks, which are lined up in a row. What is the probability that the married couple will have non-adjacent desks?

13 Exercises Consider strings of length n over the set {a, b, c, d}: –How many such strings contain at least one pair of consecutive characters that are the same? –If a string of length 10 is chosen at random, what is the probability that it contains at least on pair of consecutive characters that are the same? How many permutations of abcde are there in which the first character is a, b, or c and the last character is c, d, or e? How many integers from 1 through 999999 contain each of the digits 1, 2, and 3 at least once?

14 Combinations An r-combination of a set of n elements is a subset of r elements: C(n, r) Permutation is an ordered selection, combination is an unordered selection Quantitative relationship between permutations and combinations: P(n, r) = C(n, r) * r! Permutations of a set with repeated elements Double counting

15 Team Selection Problems There are 12 people, 5 men and 7 women, to work on a project: –How many 5-person teams can be chosen? –If two people insist on working together (or not working at all), how many 5-person teams can be chosen? –If two people insist on not working together, how many 5- person teams can be chosen? –How many 5-person teams consist of 3 men and 2 women? –How many 5-person teams contain at least 1 man? –How many 5-person teams contain at most 1 man?

16 Poker Problems What is a probability to contain one pair? What is a probability to contain two pairs? What is a probability to contain a triple? What is a probability to contain straight? What is a probability to contain flush? What is a probability to contain full house? What is a probability to contain caret? What is a probability to contain straight flush? What is a probability to contain royal flush?

17 Exercises An instructor gives an exam with 14 questions. Students are allowed to choose any 10 of them to answer: –Suppose 6 questions require proof and 8 do not: How many groups of 10 questions contain 4 that require a proof and 6 that do not? How many groups of 10 questions contain at least one that require a proof? How many groups of 10 questions contain at most 3 that require a proof? A student council consists of 3 freshmen, 4 sophomores, 3 juniors and 5 seniors. How many committees of eight members contain at least one member from each class?

18 Combinations with Repetition An r-combination with repetition allowed is an unordered selection of elements where some elements can be repeated The number of r-combinations with repetition allowed from a set of n elements is C(r + n –1, r) How many monotone triples exist in a set of n elements?

19 Integral Equations How many non-negative integral solutions are there to the equation x 1 + x 2 + x 3 + x 4 = 10? How many positive integral solutions are there for the above equation?

20 Algebra of Combinations and Pascal’s Triangle The number of r-combinations from a set of n elements equals the number of (n – r)- combinations from the same set. Pascal’s triangle: C(n + 1, r) = C(n, r – 1) + C(n, r)

21 Exercises Show that: 1 * 2 + 2 * 3 + n * (n + 1) = 2 * C(n + 2, 3) Prove that C(n, 0) 2 + C(n, 1) 2 + … + C(n, n) 2 = C(2n, n)

22 Binomial Formula (a + b) n =  C(n, k)a k b n-k Show that  C(n, k) = 2 n Show that  (-1) k C(n, k) = 0 Express  kC(n, k)3 k in the closed form


Download ppt "Discrete Mathematics Lecture 6 Alexander Bukharovich New York University."

Similar presentations


Ads by Google