Title: From Chapter 1 of Discrete and Combinatorial Mathematics, 4th ed, by R' P' Grimaldi
1Fundamental Principles of Counting
- From Chapter 1 of Discrete and Combinatorial
Mathematics, 4th ed, by R. P. Grimaldi
2Introduction
- Enumeration does not end up with arithmetic.
- It also has applications in such areas as coding
theory, probability and statistics, and in the
analysis of algorithms. - Be sure to learn and understand the basic
formulas -- but do not rely on them to heavily. - For without an analysis of each problem, a mere
knowledge of formulas is next to useless.
31.1 The Rules of Sum and Product
- We want to develop the ability to decompose
such problems and piece together our partial
solutions in order to arrive at the final answer. - The Rule of Sum If a first task can be be
performed in m ways, while a second task can be
performed in n ways, and the two task can be
performed simultaneously, then performing either
task can be accomplished in any one of mn ways.
41.1 The Rules of Sum and Product
- Example 1.1 40 textbooks on sociology and 50
textbooks on anthropology - Example 1.2 Five introductory books each on C,
FORTRAN, Java, and Pascal - Example 1.3 Two colleagues, one has three
textbook on the analysis of algorithms, and the
other has five. , n denotes the
maximum number of different books on this topic
that an instructor can borrow.
51.1 The Rules of Sum and Product
12 employees
Committee A 5
Committee B 7
Should the administrator decide to speak to just
one committee member before making her decision,
then 12 employee she can call upon for input.
A member of Committee A on Monday, a member of
Committee B on Tuesday, then .
61.1 The Rules of Sum and Product
- 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 the designated order, in mn, ways.
71.1 The Rules of Sum and Product
- Example 1.6 License plate consisting of two
letters followed by four digits - No letter or digit cab be repeated
26?25?10?9?8?7 32760 - With repetitions of letters and digits allowed
26?26?10?10 ?10?106760000 - Example 1.7
- 1-byte address 2?2?2?2?2?2?2?2 256
- 2-byte address 256?25665536 available addresses
- 32-bite architecture 28?28?28?284,294,967,296
- 8-byte
81.1 The Rules of Sum and Product
- Example 1.8 Six kinds of muffins, eight kinds of
sandwiches, and five beverages (hot coffee, hot
tea,iced tea, cola, and orange juice). Want a
lunch either a muffin and a hot beverage or a
sandwich and a cold beverage. - There are 6?2? 8?336 ways
91.2 Permutations
- Permutations
- Counting linear arrangements of objects
- We shall develop some systematic methods for
dealing with linear arrangements.
101.2 Permutations
- Example 1.9 In a class of 10 students, five are
to be chosen and seated in a row for a picture.
How many such linear arrangements are possible?
10
9
8
7
6
?
?
?
?
30,240
111.2 Permutations
- Given a collection of n distinct objects, any
(linear) arrangements of these objects is called
a permutation of the collection. - In general, if there are n distinct objects, the
number of permutations of size r for the n
objects is
We denote this number by P(n,r).
121.2 Permutations
- Example 1.11 The number of arrangements of four
letters, BALL, is 12, not 4!. - 2?(Number of arrangements of the letters, B, A,
L, L) - (Number of arrangements of the
letters, B, A, L1, L2 ) - Example 1.12 The number of arrangements of four
letters, PEPPER - (2!)?(3!)(Number of arrangements of the letters
in PEPPER) - (Number of permutations of the symbols
P1,E1,P2,P3,E2 ,R) - ? (Number of arrangements of the letters in
PEPPER) - 6!/(2!)(3!)60
131.2 Permutations
- In general, if there are n objects with n1 of a
first type, n2 of a second type, , nr of an rth
type, where n1 ? n2 ?? nr n, then there are n!/
n1!n2 ! nr! Arrangements of the n given objects.
141.2 Permutations
- How many paths from (2,1) to (7,4)?
- Each path corresponds with a list of five Rs
and three Us. - 8!/(5!)(3!)56.
5
4
3
2
1
3
4
5
6
7
1
2
151.2 Permutations
- Example 1.16 If six people, designated A, B, ,
F, are seated around table, how many different
circular arrangement are possible, if
arrangements are considered the same when one can
be obtained from the other by rotation?
- 6?(Number of circular arrangements of A, B, ,
F) (Number of linear arrangements of A, B, ,
F) 6! - ?6!/6120
A
C
D
B
D
F
E
A
C
E
F
B
161.2 Permutations
- Example 1.17 Suppose now that the six people of
Example 1.16 are three married couples and that
A, B, and C are the females. We want to arrange
the six people around the table so that the sexes
alternate.
171.3 Combinations The Binomial Theorem
- Draw three cards from a standard deck, in
succession without replacement, then by the rule
of product, there are
possibilities.
181.3 Combinations The Binomial Theorem
- Each selection, or combination, of three cards,
with no reference to order, corresponds to 3!
permutations of three cards.
(3!)?(Number of selection of size 3 from a deck
of 52) Number of permutation of size 3 from
the 52 cards
191.3 Combinations The Binomial Theorem
- In general, if we start with n objects, each
selection, or combination, of r of these objects,
with no reference to order, corresponds to r!
permutations of size r from the n objects. - Thus the number of combinations of size r from a
collection of size n, denoted C(n,r), where 0?r
?n, satisfies (r!)?C(n,r)P(n,r) and
201.3 Combinations The Binomial Theorem
- When dealing with any counting problem, we should
ask ourselves about the importance of order in
the problem. - When order is relevant, we think in terms of
permutations, and arrangements and the rule of
product. - When order is not relevant, combination should
play a key role in solving the problem,
211.3 Combinations The Binomial Theorem
- Example 1.18 Invite 11 of the 20 committee
member. Order is not important, so she can invite
the the lucky 11 in C(20,11)20!/(11!9!) ways. - Example 1.19
- Answer any 7 of 10 questions
- Answer 3 from the first 5 and 4 from the last 5.
- Answer 7 of the 10 question, where at least 3 are
selected from the first 5. - Answer 3 of the first 5 and 4 of the last 5.
- Answer 4 of the first 5 and 3 of the last 5.
- Answer all 5 of the first 5 and 2 of the last 5.
221.3 Combinations The Binomial Theorem
- Example 1.20
- Select 9 from 28 juniors and 25 seniors.
- If two juniors and one senior are the best
spikers and must be on the team, then the rest of
the team can be chosen in - For a tournament the team must comprise 4 juniors
and 5 seniors. She can select her team in
231.3 Combinations The Binomial Theorem
- Example 1.21 Make up four teams, termed A, B, C
and D, of nine girls each from the 36 freshman
girls.
- Team A
- Team B
- Team C
- Team D
- Distribute 9 As, 9 Bs, 9Cs, and 9 Ds in the
36 spaces. - The number of way is the number of arrangements
of 36 letters comprising 9 each of A, B, C and D.
241.3 Combinations The Binomial Theorem
- Example 1.22
- The number of arrangements of letters in
TALLAHASSEE is 11!/3!2!2!1!1!. - How many of these arrangements have no adjacent
As? - Disregarding the As, there are
8!/2!2!2!1!1!5040 ways - Insert 3 As in 9 possible locations
- Each of the insertion is for all other 5039
arrangements of other letters. By the rule of
product, there are 5040?84423,360 ways.
251.3 Combinations The Binomial Theorem
- Example 1.23
- String made up of prescribed alphabets
- E.g. 01, 11, 21, 12, 22, 000, 012,202, 110 of 0,1
and 2 - In general, if n is any positive integer, then
by the rule of product there are 3n strings of
length n for alphabet 0, 1, and 2. - Define weight of x, wt(x), by wt(X)x1x2x3xn.
- Among the 310 strings of length 10, we wish to
determine how many even weight. - Such a string has even weight precisely when the
number of 1s in the string is even.
Continued
261.3 Combinations The Binomial Theorem
- Example 1.23
- Six different cases to consider.
- If the string contains no 1s, then each of the
10 positions can be filled with either 0 or 2
210. - Two 1s 28.
- Four 1s 26.
- Six 1s 24.
- Eight 1s 22.
- Ten 1s .
- By the rule of sum,
271.3 Combinations The Binomial Theorem
- Example 1.24
- Draw five cards from a standard deck of 52 cards.
In how many ways can her selection result in a
hand with no clubs? - Ellen is restricted to selecting her five cards
from the 39 - cards in the deck that are not clubs.
Continued
281.3 Combinations The Binomial Theorem
- We want to count the number of Ellens five card
selection that contain at least one club. - These are precisely the selections that were not
counted in part (a). - There are possible five-card hands in
total, we find that
Continued
291.3 Combinations The Binomial Theorem
- Can we obtain the result in part (b) in another
way? - For example, since Ellen wants to have at least
one club in the five-card hand, let her first
selection a club. - Now she does not care what comes up for other
four cards.
3? 5? K? 7? J?
Continued
5? 3? K? 7? J?
Over-counting
K? 3? 5? 7? J?
301.3 Combinations The Binomial Theorem
- Any other way to arrive at the answer in part (b)?
311.3 Combinations The Binomial Theorem
- Theorem 1.1 The Binomial Theorem. If x and y are
variables and n is a positive integer, then
Continued
321.3 Combinations The Binomial Theorem
- In n4, the coefficient of x2y2 in the expansion
of the product (xy)(xy)(xy)(xy) is the number
of ways in which we can select two xs from the
four xs, one of which is available in each
factor. - For example, among the possibilities, we can
select (1) x from the first two factors and y
from the last two factors or (2) x from the first
and third factors and y from the second and
fourth.
- Factor selected for x
- 1,2
- 1,3
- 1,4
- 2,3
- 2,4
- 3,4
- Factor selected for y
- 3,4
- 2,4
- 2,3
- 1,4
- 1,3
- 1,2
Continued
331.3 Combinations The Binomial Theorem
- Consequently, the coefficient of x2y2 in the
expansion of (xy)4 is 6, the number of ways
to select two distinct objects from a collection
of four distinct objects.
Continued
341.3 Combinations The Binomial Theorem
- Proof In the expansion of the product
The coefficient of xkyn-k, where 0?k?n, is the
number of different ways in which we can select k
xs from the n available factors. The total
number of such selections of size k from a
collection of size n is C(n,k) , and from
this the binomial theorem follows.
351.3 Combinations The Binomial Theorem
- Example 1.25
- From the binomial theorem it follows that the
x5y2 coefficient of (xy)7 in the expansion of is - To obtain the coefficient of a5b2 in the
expansion of (2a-3b)7, replace 2a by x and 3b by
y.
361.3 Combinations The Binomial Theorem
- Corollary 1.1 For each integer ngt0,
371.3 Combinations The Binomial Theorem
- Theorem 1.2 For positive integers n, t, the
coefficient of in the
expansion of - is
-
- where each ni is an integer with 0? ni ? n, for
all 1 ? i ? t, and
.
381.3 Combinations The Binomial Theorem
- Example 1.26
- (xyz)7
- x2y2z3
- xyz5
- We need to know the coefficient of a2b3c2d5 in
the expansion of (a3b-3c2d5)16.
391.4 Combinations with Repetition
- When repetitions are allowed, we have seen that
for n distinct objects an arrangement of size r
of these objects can be obtained in nr ways, for
an integer r?0. - We now turn to the comparable problem for
combinations and once again obtain a related
problem whose solution follows from out previous
enumeration principles.
401.4 Combinations with Repetition
- Example 1.27 Seven high school freshmen, each
wants one of the following a cheeseburger (c), a
hot god (h), a taco (t), or a fish sandwich (f).
How many different purchases are possible? - Here we are concerned with how many of each item
are purchased, not with the order in which they
are purchased, so the problem is one of
selections, or combinations, with repetition.
Enumerating all arrangements of 10 symbols
consisting of 7 xs and 3 s
411.4 Combinations with Repetition
- In general, when we wish to select, with
repetition, r of n distinct objects, we find that
we are considering all arrangements of r xs and
n-1 s and that this number is
Consequently, the number of combination of n
objects taken r at a time, with repetition, is
C(nr-1,r).
421.4 Combinations with Repetition
- Example 1.28 A donut shop offer 20 kinds of
donuts. Assuming that there are at least a dozen
of each kind when we enter the shop, we can
select a dozen in C(2012-1,12)C(31,12)141,120,5
25 ways.
431.4 Combinations with Repetition
- Example 1.29 President wishes to distribute
among four vice presidents 1000 in Christmas
bonus checks, where each check will be written
for a multiple of 100. - One or more presidents get nothing.
C(410-1,10)C(13,10) - Each president should receive at least 100.
C(46-1,6)C(9,6) - If each vice president must get at least 100 and
Mona gets at least 500, then - C(32-1,2)C(31-1,1)C(30-1,0)10C(42-1,1)
Mona gets exactly 600
Mona gets exactly 600
Mona gets exactly 500
441.4 Combinations with Repetition
- Example 1.30 In how many ways can we distribute
7 apples and 6 oranges among 4 children so that
each children receives at least one apple? - Given each child an apple, we have C(43-1,3)20
ways to distribute the other 3 apples. - There are C(46-1,6)84 ways to distribute 6
oranges. - By the rule of product, 20?841680 ways
451.4 Combinations with Repetition
- Example 1.31 A message is made up of 12
different symbols and is to be transmitted
through a communication channel. In addition to
12 symbols, the transmitter will also send a
total of 45 spaces between the symbols, with at
least three spaces between each pair of
consecutive symbols. In how many ways can the
transmitter send such a message?
12!
C(1112-1,12)
?
45-11?312 A selection of size 12 from a
collection of size 11
arrangement of 12 different symbols
461.4 Combinations with Repetition
- Example 1.32Determine all integer solutions to
the equation
where xi?0 ? 1?i ?4. - A selection, with repetition, of size 7 from a
collection of size 4, so there are C(47-1,7)
solutions. - At this point it is crucial that we recognize the
equivalence of the following - The number of integer solutions of the equation
- The number of selections, with repetition, of
size r from a collection of size n. - The number of ways r identical objects can be
distributed among n containers.
471.4 Combinations with Repetition
- Example 1.33 In how many ways can one distribute
10 (identical) white marbles among 6 distinct
containers? - C(610-1,10)3003
481.4 Combinations with Repetition
- Example 1.34How many solutions are there to the
inequality - One approach is to determine the number of such
solutions to
where k is an integer and
0?k?9. - Transform the problem by noting the
correspondence between the the nonnegative
integer solutions of the above equation and the
integer solution of - The number of solutions is the same as
- where yixi, for 1?i ?6, and y7x7-1.
C(79-1,9)
491.4 Combinations with Repetition
- Example 1.36
- Let us determine all the different ways in which
we can write the number 4 as a sum of positive
integers, where the order of summands is
considered relevant.
dont care order
501.4 Combinations with Repetition
- Example 1.36
- We wish to count the number of compositions for
the number 7. - Consider the number of possible summands.
- One summand 1
- If there are two (positive) summands, we want to
count the number of integer solutions for
w1w27, where w1,w2 gt0. - This is equal to the number integer solutions
for x1x25, where x1,x2 ?0.
Continued
511.4 Combinations with Repetition
- In general, one finds that for each positive
integer m, there are -
- compositions.
521.4 Combinations with Repetition
- Example 1.37 How many time is the print
statement executed?
for i1 to 20 do for j1 to i do for
k1 to j do print(ijk)
- For the print statement to be executed, it must
satisfy the condition 1?k?j?i?20. - In fact, any selection a, b, c(a?b?c) of size 3,
with repetition allowed, from the list 1, 2, 3,
, 20 results in one of the correct selection
here ka, jb, ic.