230 likes | 429 Views
Menu Traditional Menu Other Menu Nasi Lemak Beef Burger Roti Canai Potatoes Chip Capati French Bread Mee Goreng Drink : Coffee, Tea, Coke and Pepsi. Questions?. How many different breakfast consists of traditional menu and drink.
E N D
Menu Traditional Menu Other Menu Nasi Lemak Beef Burger Roti Canai Potatoes Chip Capati French Bread Mee Goreng Drink : Coffee, Tea, Coke and Pepsi
Questions? • How many different breakfast consists of traditional menu and drink. • How many different breakfast consists of other menu and drink. • How many different breakfast consists of traditional, other menu and drink. • How many different breakfast consists of traditional menu and an optional drink.
Basic principles Multiplication principle If an activity can be performed in k successive steps, • Step 1 can be done in n1 ways • Step 2 can be done in n2 ways • … • Step k can be done in nk ways Then: the number of different ways that the activity can be performed is the product n1n2…nk
More Questions • How many strings of length 4 can be formed using the letter ABCDE if repetitions are not allowed b. How many strings of part (a) begin with the letter B? c. How many strings of part (a) do not begin with the letter B?
Virus Attack • After the virus sent the email to the first 50 addresses each of those recipients then sent email to 50 addresses. This means 50 *50 =2500 additional recipients. Each of the recipients then sent email to 50 addresses. This means 50*50*50=125000 additional recipients. Thus after three iterations 125000+2500+50+1=127551 copies of the message had been sent.
Examples • How many eight-bit strings begin either 101 and 111? • How many eight-bit strings begin 1100? • How many eight-bit strings begin and end with 1?
Addition principle Let X1, X2,…, Xk be a collection of k pair-wise disjoint sets, each of which has nj elements, 1 < j < k, then the union of those sets k X = Xj j =1 has n1 + n2 + … + nk elements
Example • A six-person committee composed of A, B, C, D, E and F is to select a chairperson, secretary and treasurer. • How many ways can this be done? • How many ways can this be done if either A or B must be chairperson? • How many ways can this be done if E must hold one of the offices? • How many ways can this be done if both D and F must hold office?
Example 2 • How many ways can we select two books from different subjects among five distinct computer science books, three distinct mathematics books and two distinct art books?
A permutation of n distinct elements x1, x2,…, xn is an ordering of the n elements. There are n! permutations of n elements. Example: there are 3! = 6 permutations of three elements a, b, c: abc bac cab acb bca cba Permutations and combinations
Examples • How many permutations of the letter ABCDEF contain the substring DEF? • How many permutations of the letter ABCDEF contain the letter DEF in any order?
r-permutations An r-permutation of n distinct elementsis an ordering of an r-element subset of the n elements x1, x2,…, xn For r < n the number of r-permutations of a set with n distinct objects is P(n,r) = n(n-1)(n-2)…(n-r+1)
Examples • The number of 2-permutations of X={a, b, c} is P(3,2)=3!/(3-2)!=3!/1!=3*2*1/1=6 • ab, ac, ba, bc, ca, cb • How many 3-permutations are there of a, b, c, d? P(5,3)=5!/(5-2)!=5!/3!=20 • How many 5-permutations are there of 11 distinct object2? P(11,5)=11!/(11-5)!
More Examples • How many different ways are there to select 4 different players from 10 players on a team to play four tennis matches where the matches are ordered? • P(10,4)=10!/(10-4)!=5040 • Let S={1,2,3,4,5} • List all the 3-permutations of S? P(5,3)=5!/(5-3)!=5.4.3=60
Combinations Let X = {x1, x2,…, xn} be a set containing n distinct elements • An r-combination of X is an unordered selection of r elements of X, for r < n • The number of r-combinations of X is the C(n,r) = n! / r!(n-r)!
Examples • Let S={1,2,3,4,5} • List all the 3-combinations of S • C(5,3)=5!/(3!)(5-3)! • How many ways are there to select 5 players from a 10-members tennis team to make a trip to a match? • C(10,5) • How many ways can we select a committee of two women and three men from a group of five women and six men? • First task : C(5,2) Second Task : C(6,3)
Exercise • A club consisting of six men and seven women. • How many ways can we select a committee of five persons? • How many ways can we select a committee of three men and four women?
The pigeonhole principle • First form: If k < n and n pigeons fly into k pigeonholes, some pigeonhole contains at least two pigeons.
Example • Show that if any five numbers from 1 to 8 are chosen, then two of them will add to 9. • Construct four different sets, A={1,8} B={2,7}, C={3,6}, D={4,5}. Each of the five numbers chosen must belong to one of these sets. Since there are only four sets the pigeonhole principle tells us that two of the chosen number belong to the same set and these numbers add up to 9
Examples • If eight people are chosen in any way from some group at least two of them will have been born on the same day of the week. • Shirt numbered consecutively from 1 to 20 are worn by the 20 members of a bowling league. When any three of these numbers are chosen to be a team the league proposes to use the sum of their numbers as a code number for the team. Show that if any eight of the 20 are selected then these eight one may form at least two different teams having the same code number.
Examples • Show that if 30 dictionaries in a library contains a total of 61327 pages, then one of the dictionaries must have at least 2045. • Show that if any 30 people are selected then one may choose a subset of five so that all five were born on the same day of the week
Second form of the pigeonhole principle • If X and Y are finite sets with |X| > |Y| and f : X Y is a function, then f(x1) = f(x2) for some x1, x2 X, x1 x2.
Third form of the pigeonhole principle • If X and Y are finite sets with |X| = n, |Y| = m and k = n/m, then there are at least k values a1, a2,…, ak X such that f(a1) = f(a2) = … f(ak). • Example: n = 5, m = 3 k = n/m = 5/3 = 2.