Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Chapter 1

Fundamental Principles of Counting


1 The Rule of Sum and Product
The Rule of Sum: If a first task can be performed in m ways, while a second task can be performed
in n ways, and the two tasks cannot be performed simultaneously, then performing either task can be
accomplished in any one of m + n ways.

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

1. The number of permutations of letters in the word COMPUTER is 8!.

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

1. P(n, r ): the # of linear arrangements in which the objects cannot be repeated.

2. If repetitions are allowed, there are n r possible arrangements (r 0).

Example 3 The # of arrangements of four letters in BALL is 12.

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

1. there are no restrictions?

2. he must answer three questions from the first five and four questions from the last five?

3. he must answer at least three of the first five questions?

Example 3 TALLAHASSEE

1. The # of arrangements

2. How many of these arrangements have no adjacent As?

+ Sigma Notation: m
X +n
a m + a m +1 + + a m +n = ai
i =m

i : index, m : lower limit, m + n: upper limit


7
X 7
X
1. ai = a3 +a4 +a5 +a6 +a7 = aj
i =3 j =3

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.

Theorem 1. (The Binomial Theorem)


If x and y are variables and n is a positive integer, then
        n  
n 0 n n 1 n1 n 2 n2 n n 0 X n k n k
(x + y ) =
n
x y + x y + x y + + x y = x y
0 1 2 n k =0
k

Example 5

1. (x + y )7 , the coefficient of x 5 y 2 :

2. (2a 3b )7 , the coefficient of a 5b 2 :

Corollary 1. For each integer n > 0,


n n n
1. 0 + 1 + + n = 2n
n n n n
2. 0 1 + 2 + (1)n n = 0

Theorem 2. (Multinomial Coefficient)


n
For positive integers n, t , the coefficient x 1n 1 x 2n 1 x t t in the expansion of (x 1 + x 2 + + x t )n is

n!
n 1 !n 2 ! n t !

where each n 1 is an int with 0 n i n , for all 1 i t and n 1 + n 2 + + n t = n .

Example 6

1. The coefficient of x 2 y 2 z 3 in the expansion of (x + y + z )7 :

2. The coefficient of a 2b 3 c 2 d 5 in the expansion of (a + 2b 3c + 2d + 5)16 :

6
4 Combinations with Repetition
Example 1
Seven people, four choices : cheeseburger, hot dog, fish sandwich,taco.
How many different purchases are possible?

+ Select, with repetition, r of n distincts:


Consider all arrangements of r xs and n-1 1s and that their number is

(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:

b) each person receive at least $100:

c) each person receive at least $100 and Mona gets at least $500:

Example 4 seven bananas & six oranges four kids.


Each kid receives at least one banana.

Example 5 Determine the # of integer solutions to the equation.


x 1 + x 2 + x 3 + x 4 = 7 where x i 0 for all 1 i 4

+ 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

b) The # of selections, with repetition, of size r from a collection of size n.

c) The # of ways r identical objects can be distributed among n distinct containers.

Example 6 How many integer solutions are there to the inequality?


x 1 + x 2 + x 3 + + x 6 < 10 where x i 0 for all 1 i 6

Example 7 How many terms there are in the expansion of (w + x + y + z )10

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

2. Consider the number 7

(a) Only one summand:


(b) Two summands:
(c) Three summands:
(d) Four summands:
..
.

Example 9 How many times is the "print" executed?


for i := 1 to 20 do
for j := 1 to i do
for k := 1 to j do
print (i*j+k)

Example 10 Determine the value of counter.


count := 0
for i := 1 to n do
for j := 1 to i do
count := count +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

b) Limitation: any path can not rise above the line x = y . 1 2 3 4 5

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

* The number of ways to parenthesize the product x 1 x 2 x n

b0 = 1 : x1

b 1 = 1 : x 1x 2

b 2 = 2 : ((x 1 x 2 )x 3 ) (x 1 (x 2 x 3 ))

b 3 = 5 : (((x 1 x 2 )x 3 )x 4 ) ((x 1 (x 2 x 3 ))x 4 ) ((x 1 x 2 )(x 3 x 4 )) (x 1 ((x 2 x 3 )x 4 )) (x 1 (x 2 (x 3 x 4 )))

You might also like