Presentation is loading. Please wait.

Presentation is loading. Please wait.

3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations.

Similar presentations


Presentation on theme: "3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations."— Presentation transcript:

1 3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations

2 Permutations Theorem 1. Suppose that two tasks T 1 and T 2 are to be performed in sequence. If T 1 can be performed in n 1 ways, and for each of these ways T 2 can be performed in n 2 ways, then the sequence T 1 T 2 can be performed in n 1 n 2 ways. Theorem 1 is sometimes called the multiplication principle of counting. Theorem 2. Suppose that tasks T 1, T 2,…,T k are to be performed in sequence. If T 1 can be performed in n 1 ways, and for each of these ways T 2 can be performed in n 2 ways, and for each of these n 1 n 2 ways of performing T 1 T 2 in sequence, T 3 can be performed in n 3 ways, and so on, then the sequence T 1 T 2 … T k can be performed in exactly n 1 n 2 …n k ways.

3 Permutations Problem 1. How many different sequences, each of length r, can be formed using elements from a set A if (a)elements in the sequence may be repeated? (b)all elements in the sequence must be distinct? A sequence of r distinct elements of A is called a permutation of n objects taken r at a time, with |A|=n When r=n, the sequence is called a permutation of A, i.e. a distinct arrangement of the elements of a set A, with |A|=n, into sequence of length n

4 Permutations Theorem 3. Let A be a set with n elements and 1  r  n. Then the number of sequences of length r that can be formed from elements of A, allowing repetition, is n r. Theorem 4. If 1  r  n, then n P r, the number of permutations of n objects taken r (distinct elements) at a time, is n·(n-1)· ··· ·(n-r+1)=n!/(n-r)! Theorem 5. The number of distinguishable permutations that can be formed from a collection of n objects where the first object appears k 1 times, the second objects k 2 times, and so on, is n! k 1 !k 2 ! ··· k t !

5 Combinations Problem 2. Let A be any set with n elements and 1  r  n. How many different subsets of A are there, each with r elements. the traditional name for an r-element subsets of an n- element set A is a combination of A, taken r at a time, where order does not matter Theorem 1. Let A be a set with |A|=n, and let 1  r  n. Then the number of combinations of the elements of A, taken r at a time, that is the number of r-element subsets of A is n! r!(n-r)! nCr = n!/r!(n-r)!, number of combinations of n objects taken r at a time.

6 Combinations Theorem 2. Suppose k selections are to be made from n items without regards to order and that repeats are allowed, assuming at least k copies of each of the n items. The number of ways these selections can be made is (n+k-1) C k. In general, when order matters, we count the number of sequences or permutations; when order does not matter, we count the number of subsets or combinations

7 Pigeonhole Principle The Pigeonhole Principle If n pigeons are assigned to m pigeonholes, and m<n, then at least one pigeonhole contains two or more pigeons. –The principle provides an existence proof The Extended pigeonhole Principle If n pigeons are assigned to m pigeonholes, then one of the pigeonholes must contain at least  (n-1)/m  +1 pigeons.

8 Elements of Probability Probabilistic experiments: do not yield exactly the same results when performed repeatedly –Deterministic experiments: whose outcome is always the same sample space A, a set consisting of all the outcomes of an experiment event E: a set of outcomes that satisfy some description –certain event A, impossible event  new events can be formed from events E and F: E  F occurs exactly when E or F occurs E  F occurs if and only if both E and F occur E occurs if and only if E does not occur events E and F are mutually exclusive or disjoint if E  F={}, i.e. E and F cannot both occur at the same time E 1,E 2,…,E k are mutually exclusive or disjoint if at most one of the events can occur on any given outcome of the experiment

9 Assigning Probabilities to Events If event E has occurred n E times after n performances of the experiment, the fraction f E = n E /n is the frequency of occurrence of E in n trials p(E), the probability of the event E, i.e. f E will tend to be p(E) when n becomes larger: the frequencies of occurrence of event E Rules for assigning probabilities: P1: 0  p(E)  1 for every event E in A P2: p(A)=1 and p(  )=0 P3: p(E 1  E 2  …  E k )=p(E 1 )+p(E 2 )+… +p(E k ) whenever the events are mutually exclusive If the probabilities are assigned to all events in such a way that P1, P2, P3 are always satisfied, then we have a probability space, and P1, P2, and P3 are called the axioms for a probability space.

10 Assigning Probabilities to Events Let A be a probability space and is finite, A={x 1, x 2, …, x m }, then each event {x k }, consisting of just one outcome, is called an elementary event elementary probability corresponding to the outcome x k is p k =p({x k }). elementary events are mutually exclusive axioms of probability for elementary events: EP1: 0  p k  1 for all k EP2: p 1 +p 2 +… +p n =1 If E is any event in A, and E={x i1, x i2, …, x im }, then E={x i1 }  {x i2 }  …  {x im } and p(E)=p i1 +p i2 +… +p im

11 Equally Likely Outcomes Assume that all outcomes in a sample space A are equally likely to occur: each has the same probability random selection is to choose an object at random if all objects have an equal probability of being chosen suppose |A|=n and these n outcomes are equally likely, then each elementary probability is 1/n, and for every event E, p(E)=|E|/|A| The expected value of an experiment is the sum of the value of each outcome times its probability –Roughly speaking, the expected value describes the ‘average’ value for a large number of trials –Useful in analyzing the efficiency of algorithms, e.g. expected number of steps that the algorithm execute on an ‘average’ run to give the output


Download ppt "3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations."

Similar presentations


Ads by Google