Chapter 3 Plus
Chapter 3 Plus
First method
We first indicate three Es as E 1 , E 2 , E 3 and two Ss as S1 , S2 . Thus ‘JESSEE’
can be written as ‘JE 1 S1 S2 E 2 E 3 ’. If all the three Es and two Ss are treated as
distinct, we know that the number of permutations of length 6 is 6!. Now note
that ‘JE 1 S1 S2 E 2 E 3 ’ and ‘JE 1 S2 S1 E 2 E 3 ’ are the same. Therefore, the number
lists using the letters of ‘JE 1 SSE 2 E 3 ’ is 6! 1 2 3
2! . Similarly, in ‘JE SSE E ’ reordering
the ‘E 1 , E 2 , E 3 ’ will result in the same list, the number of lists using the letters of
6!
‘JESSEE’ is 3!2! .
Second Method
The word ’JESSEE’ contains 3 Es, 2Ss and one J. We note that 3Es can be
placed among the six positions in C(6, 3) different ways. There are three more
1
positions to be filled once Es are placed. Two of these positions will be oc-
cupied by two Ss. There are C(3, 2) ways to fill in these positions. We are
left with just one position, after 3 Es and 2Ss are placed, which is occupied
by J. The number of ways to place J is C(1, 1). Using the product rule we
can conclude that the number of different odds using the letters of ’JESSEE’
6! 3! 1! 6!
is C(6, 3).C(3, 2).C(1, 1) = 3!3! × 2!1! × 1!0! = 3!2!1! .
2 Combinations
A k-combination of elements of a set is an unordered selection of k elements
from the set. When repetitions are not allowed, a k-combination is a size-k subset
of the set. Thus, for any k, 0 ≤ k ≤ n, the number of k-combination of a set of n
elements is
n!
C(n, k) = k!(n−k)! .
Note the identities C(n, k) = P(n,k)
k! , and C(n, k) = C(n, n −k). The Pascal trian-
gle identity C(n + 1, k) = C(n, k − 1) +C(n, k) is very well known, and important.
We can prove these identities analytically by applying the properties of factorial.
We should also be able to prove these identities using combinatorial arguments.
A combinatorial proof of an identity is a proof that uses the counting arguments
to prove that both sides of the identity realize the same number.
2
We have n pennies that we want to distribute to k kids. Each child gets at least
one penny. How many ways can we distribute the money?
Note that the pennies are not distinct. There will be only one way of dis-
tributing n1 pennies to the first kid, n2 pennies to the second kid, and so on where
n1 + n2 + ... + nk = n.
Let us consider the following experiment.
• Line up the pennies, order doesn’t matter; they are all alike
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
• Let the first child pick them from left to right. After a while we stop the kid.
x x x x x x x x x x x x x stop x x x x x x x x x x x x x x x x x
kid 1 gets these coins
There are three kids. The first kid gets 13 pennies, the second kid gets 6
pennies and the last one gets the remaining 11 pennies.
3
x1 + x2 + ... + xk = n, xi ≥ 0 ——————–(A)
is the same as the number of ways to distribute n pennies to k kids with no restric-
tions. Consider a solution (α1 , α2 , ...., αk ) where ∑ki=1 αi = n. Moreover αi ≥ 0 ∀i.
This solution corresponds to a solution of distributing n pennies to k kids, with no
restrictions, where kid i gets αi pennies. Similarly, a solution of distributing n pen-
nies to k kids with no restrictions corresponds to a solution to the integral equation
where the value of xi is the number of gifts kid i gets. Thus we can conclude that
the number of integral solutions to equation (A) is C(n + k − 1, k − 1) which is the
same as the number of distributing n pennies to k kids with no restrictions.
What happens when we place the restriction that each kid must receive at least
one penny? This is equivalent to the problem of determining the number of inte-
gral solutions to
x1 + x2 + ... + xk = n, xi ≥ 1 ——————–(B)
for i= 1 to 100 do
for j= 1 to i do
for k= 1 to j do
print(i*j+k)
There is another way to count this. This count can be converted into placing three
indistinguishable balls into 100 distinguishable bins without any constraints. Let
a, b and c be the bins where three balls are placed, a ≤ b ≤ c. Note that bins need
not be distinct. Since 1 ≤ k ≤ j ≤ i ≤ 100, we assign k = a, j = b and i = c.
4
We can also see that any i, j and k in the code is also a solution to distributing 3
balls to 100 bins. Thus the number of times the print statement will be executed
is exactly the same as placing three balls into 100 bins without restrictions, which
3+100−1 102 102
is 100−1 = 99 = 3 = 102.101.100 3.2.1 times.
We can now summarize permutations and combinations without and with repeti-
tion in the following table.
n!
k-permutations No P(n, k) = (n−k)!
k-permutations Yes nk
n!
k-combinations No C(n, k) = k!(n−k)!
(n+k−1)!
k-combinations Yes C(n + k − 1, n − 1) = (n−1)!k!
5
Example: Consider the set {a, b, c, d}. Suppose we select two letter from these
four. We now have the following four cases.
A. Permutations with repetitions: In this case there are 42 = 16 possible cases.
6
D. Combinations without repetitions: There are C(4, 2) = 6 possible combina-
tions.
7
4. ***How many ways can the 11 distinct horses be lined up in a cycle?
Note that (in case of 3 horses) < a, b, c > order is the same as < b, c, a >
and < c, a, b >. In this case, there is no position 1, position 2 or position 3.
The correct answer is 11!
11 which is 10!.
(a) 25 10
7 × 3 .
(b) 2n .
(c) 2n − 2.
8
(a) both 4 and 8.
(b) neither 4 nor 8.
(c) either 3 or 4 or both.
(d) no odd numbers.
(e) exactly 4 elements, one of which is 0.
(f) exactly five elements including, the sum of which is even.
10. ***Let A be the set of all words of length 6 of letters of the alphabet with
no repeated letters (counting lists).
(a) How many elements of A has exactly one vowel?
(b) How many elements of A that begins and ends with a vowel.
11. ***Use binomial theorem to prove the following:
10
(a) ∑10
i=0 i = 2 .
10
100 100
(b) ∑50
i=0 2i = ∑ 50
i=1 2i−1 .
12. ***Find:
(a) the coefficient of x9 y3 in the expansion of (4x − 2y)12 .
(b) the coefficient of x5 in (2 + x2 )9 .
(c) the coefficient of x3 y4 z2 in the expansion of (x + y + z)10 .
(d) largest coefficient in the expansion of (1 + x)8 .
(e) largest coefficient in the expansion of (1 + x)9 .
13. Determine the number of integer solutions to the following:
(a) equation x1 + x2 + x3 = 6, xi ≥ 0, 1 ≤ i ≤ 3.
(b) equation x1 + x2 + x3 + x4 + x5 = 15, xi ≥ 0, 1 ≤ i ≤ 5.
(c) equations x1 + x2 + x3 = 6 and x1 + x2 + x3 + x4 + x5 = 15, xi ≥ 0, 1 ≤
i ≤ 5.
9
(d) equations x1 + x2 + x3 ≤ 6 and x1 + x2 + x3 + x4 + x5 ≤ 15, xi ≥ 0, 1 ≤
i ≤ 5.
14. ***Four connecting rooms are to be painted with k district colors so that no
two adjacent rooms have the same color. Room A is connected to room B
(by door 1) and room C (by door 2). Room B is connected to room C (by
door 3). Room C is connected to room D by door 4. How many ways can
one paint the rooms so that no two adjacent rooms (shared by a door) cave
the same colour.
(a) (10 points) Consider selecting 4 objects from the set A = {1, 2, 3, 4, 5, 6, 7, 8}.
i. How many ordered sequences without repetition can be chosen
from A? ans= P(8,4)
ii. How many ordered sequences with repetition can be chosen from
A? ans= 84 ; there are 8 choices for each position.
10
iii. How many unordered sequences without repetition can be chosen
from A? ans= C(8,4)
iv. How many unordered sequences with repetition can be chosen
from A? 8+4−1
8−1 ; this r-combinations with repetitions.
v. How many strictly increasing sequences can be chosen from A?
{ < 2, 4, 4, 7 > is not a strictly increasing sequence.}
It is the same as the number of 4−combinations without repe-
titions, since every such 4−element combination, there is only
one strictly increasing sequence. Hence the answer is C(8,4).
(b) (10 points) Consider a eight letter word aeemrryt.
i. How many different arrangements of these seven letters are there?
8!
no constraint: 2!2!
ii. How many such arrangements are there that contain eye?
Arrangements with eye: use {eye, a, r, m, r,t} : 6!
2!
iii. How many such arrangements are there that contain eye and ram?
Arrangements with eye and ram: use {ram, eye, r,t} : 4!
iv. How many such arrangements are there that do not contain either
eye or ram?
8!
Arrangements with neither eye nor ram = 2!2! − 6! 6!
2! − 2! + 4!
(c) (10 points) Suppose you are interested in buying pizzas, and each pizza
gets up to 10 distinct toppings.
i. How many ways can you choose toppings for a pizza?
There are 210 different pizzas.
ii. How many ways can you choose two pizzas with the same top-
pings?
It is the same as the number of different pizzas. The answer
is 210 .
iii. How many ways can you choose toppings for two pizzas?
Since we can have two pizzas with the same toppings, the
problem is combination with repetitions. There are 210 differ-
ent pizzas, and we need to select two of them where repetitions
10 −1 210 +1
are allowed. Therefore, the answer is 2+2 10
2 −1 = 2
iv. How many ways can you choose toppings for n pizzas?
We now select n pizzas from 210 different toppings ones. The
10 −1
answer is n+22 −1 .
10
11
(d) (10 points) We have seen that the following problem captures many
counting problems.
Determine the number of non-negative integer solutions to
x1 + x2 + .... + xk = n
xi ≥ 0, i = 1, 2, ..., k.
Formulate each of the following problems as a variation of the above
problem.
i. Determine the number of ways to select k objects with replace-
ments from a set of n objects.
Ans:
x1 + x2 + .... + xn = k
xi ≥ 0, i = 1, 2, ..., n.
ii. Determine the number of ways to place n nondistinguisable balls
in k boxes.
Ans:
x1 + x2 + .... + xk = n
xi ≥ 0, i = 1, 2, ..., k.
iii. Determine the number of ways to distribute n pennies to k kids
such that each kid gets at least 1 penny.
Ans:
x1 + x2 + .... + xk = n
xi ≥ 1, i = 1, 2, ..., k.
iv. Determine the number of times the following pseudocode prints
the PRINT statement:
for i = 1 to 20
for j = i to 20
for k = j to 20
PRINT(i,j,k)
Ans:
x1 + x2 + .... + x20 = 3
xi ≥ 0, i = 1, 2, ..., 20.
Once the three integers are selected, we assign the largest one to
k, the smallest one to i and the third one to j.
12