Professional Documents
Culture Documents
DM Chap1
DM Chap1
Example 1
How many ways can you choose a 9, a red card with value greater than 9, or black card with a value
less than 6 from a standard deck of cards?
The Rule of Product: If a procedure can be broken down into first and second stages, and if there
are m possible outcomes for the first stage and if, for each of these outcomes, there are n possible
outcomes for the second stage, then the total procedure can be carried out in m n ways.
Example 2
How many different characters can be formed?
Example 3
How many license plates can be made using two uppercase letters followed by a 4-digit number?
1
Example 4
Consider the following program segment, where i, j and k are integer variables. Determine the value
of counter.
counter :=0;
for i := 1 to 12 do
counter := counter + 1;
for j := 5 to 10 do
counter := counter + 2;
for k := 15 downto 8 do
counter := counter + 3;
Example 5
Consider the following program segment, where i, j and k are integer variables. How many times the
print executed?
for i := 1 to 12 do
for j := 5 to 10 do
for k := 15 downto 8 do
print (i-j)*k;
Example 6
A pizza shop advertised that it offers over 500 varieties of pizza. At the pizza shop, it is possible to have
on a pizza a choice of any combination of the following toppings:
pepperoni, mushrooms, peppers, olives, sausage, anchovies, salami, onions, bacon.
Is the pizza shop telling the truth in its advertisements?
2
2 Permutation
Definition 1
For an integer n 0, n factorial (denoted n!) is defined by
0! = 1,
n! = n (n 1) (n 2) 2 1, for n 1.
n 0 1 2 3 4 5 6 7 8 9 10
Example 1
n! 1 1 2 6 24 120 720 5, 040 40, 320 362, 880 3, 628, 800
Definition 2 (Permutation)
Given a collection of n distinct objects, any (linear) arrangement of these objects is called a permuta-
tion of the collection.
Example 2
2. If only five of letters are used, the # of permutations (of size 5) is 6720.
+ r -Permutation
If there are n distinct objects and r is an integer, with 1 r n, the # of permutation of size r for n
objects is
P(n, r ) = n (n 1) (n 2) (n r + 1)
(n r )(n r 1) 3 2 1
= n (n 1)(n 2) (n r + 1)
(n r )(n r 1) 3 2 1
n!
=
(n r )!
Remark
If there are n objects with n 1 indistinguishable objects of a first type, n 2 indistinguishable objects
of a second type, , and n r indistinguishable objects of an r -th type, where n 1 +n 2 + +n r = n, then
there are
n!
n 1 !n 2 ! n r !
arrangements of the given n objects.
Example 4 MASSASAUGA
3
Example 5
Determine the # of paths from (2, 1) to (7, 4). Up or Right
4
3
2
1
1 2 3 4 5 6 7
Example 6
If six people are seated about a round table, how many different circular arrangements are possible,
if arrangements are considered the same when one can be obtained from the other by rotation?
Example 7
If six people are three married couples, we want to arrange the six people around the table so that the
sexes alternate.
4
3 Combinations: The Binomial Theorem
Definition 1 (Combination/Selection)
Given a collection of n distinct objects, each combination of r of these objects, with no reference to
order, corresponds to r ! permutation of size r from the n objects.
+ r -Combination: C (n, r ) or n
r
P(n , r ) n!
C(n, r ) = = , 0 r n.
r! r !(n r )!
Example 1
How many 8-bit strings contain exactly three 0s?
Example 2
A student is to answer seven out of 10 questions on an exam. In how many ways can he make his
selection if
2. he must answer three questions from the first five and four questions from the last five?
Example 3 TALLAHASSEE
1. The # of arrangements
+ Sigma Notation: m
X +n
a m + a m +1 + + a m +n = ai
i =m
4
X 4
X
2. i 2 = 12 + 22 + 32 + 42 = k2
i =1 k =1
100
X 101
X 99
X
3. i = 11 + 12 + + 100 =
3 3 3 3
(j 1) =
3
(k + 1)3
i =11 j =12 k =10
P10 P10
4. i =7
2i = 2 7 + 2 8 + 2 9 + 2 10 = 2(7 + 8 + 9 + 10) = 2 i =7
i
P5 P5
5. i =1
a =a +a +a +a +a =a i =1
1
5
Example 4
String: alphabet 0, 1, 2 length: # of alphabet
How many strings of length 10 have even weight?
+ n
r
n
= n r , n r 0.
Example 5
1. (x + y )7 , the coefficient of x 5 y 2 :
n!
n 1 !n 2 ! n t !
Example 6
6
4 Combinations with Repetition
Example 1
Seven people, four choices : cheeseburger, hot dog, fish sandwich,taco.
How many different purchases are possible?
(n + r 1)! n +r 1
= = C (n + r 1, r )
r !(n 1)! r
Example 2 20 kinds of donuts. Assuming that there are at least a dozen of each kind, we can select
a dozen donuts in C (20 + 12 1, 12) = C (31, 12)
Example 3 Betty, Goldie, Mary Lou, Mona. $1000 bonus checks $100 10 checks.
a) no restriction:
c) each person receive at least $100 and Mona gets at least $500:
+ Equivalence:
a) The # of int solutions of the equ.
x 1 + x 2 + + x n = r where x i 0 for all 1 i n
7
Example 8
1. Determine all the different ways in which we can write 4 as a sum of positive integers, where
the order of the summand is considered relevant.
4 , 3+1 , 2+2 , 2+1+1 , 1+3 , 1+2+1 , 1+1+2 , 1+1+1+1
8
5 Catalan Numbers
Example
x y plane. (0, 0) (5, 5) 5
R: (x , y ) (x + 1, y ) U: (x , y ) (x , y + 1) 4
3
a) Five Rs and five Us. 2
10
5
paths. 1
5 Rs and 5 Us.
At any point, # of Rs # of Us.
STEPS:
1. Locate the first move where the path rose above the line y = x
2. interchange: RU and UR
bad arrangement : 4 Rs and 6 Us
(4, 6)
6
5
R U U U R R R U U R
4
3
2
R U U R U U U R R U
1
1 2 3 4 5
Thus,
10 10 10! 10!
= = 42
5 4 5!5! 4!6!
+ b ,b , : Catalan numbers
0 1
2n 2n 1 2n
bn = =
n n 1 n +1 n
where n 1,b 0 = 1
b0 = 1 : x1
b 1 = 1 : x 1x 2
b 2 = 2 : ((x 1 x 2 )x 3 ) (x 1 (x 2 x 3 ))