Professional Documents
Culture Documents
Test 1 - Solutions
Test 1 - Solutions
05-09-2017
1. a. Sum all positive integers less than 10, 000 made up using only the digits 1, 5, and 9 (repetition
allowed).
Solution. Positive integers less than 10, 000 can have one, two, three, or four digits. In each
such integer, in each place (unit’s place, ten’s place, etc.), the possible digits are 1, 5, and 9.
Consider all four digit integers with 1, 5, and 9 as its digits. To sum all these integers, we
may separately sum their unit’s places, then sum their ten’s places and multiply this by
10, then sum their hundred’s places and multiply this by 100, then sum their thousand’s
places and multiply by 1000, and then find the total. The number of such integers with 1
in the unit’s place is 33 = 27, since the other two places can have any of the three digits.
Similarly, the number of such integers with 5 in the unit’s place, and with 9 in the unit’s
place, is also 33 = 27 each. Thus, the if we add all the unit’s place of these integers, we
get 27 × (1 + 5 + 9) = 405. The same reasoning holds for the ten’s and hundred’s places as
well. Thus, the sum of all three digit positive integers formed using the digits 1, 5, and 9 is
405 + 10 × 405 + 100 × 405 + 1000 × 405 = 449955.
Similarly, for finding the sum of all three digit numbers formed using these digits, first
observe that 9 × (1 + 3 + 5) = 135. Then the total is 135 + 10 × 135 + 100 × 135 = 14985.
Since 3 × (1 + 5 + 9) = 45, the sum of all two digit numbers formed using these digits is
45 + 10 × 45 = 495.
The sum of all one digit numbers formed using these digits is 1 + 5 + 9 = 15.
Thus, the required sum is 15 + 495 + 14985 + 449955 = 465450.
b. How many ways can you select 12 flowers for a bouquet from roses, lilacs, tulips, and lilies,
with between 2 and 5 of each kind?
Solution. The (ordinary) generating function for the selections has four brackets, one for
each kind of flower, of the form x2 + x3 + x4 + x5 , since at least two and at most five of each
kind should be selected. Therefore, the generating function is
g(x) = (x2 + x3 + x4 + x5 )4
= x8 (1 + x + x2 + x3 )4
= x8 (1 − x4 )−4 (1 − x)−4 .
The answer is then the coefficient of x12 in the expansion of g(x), which equals the coefficient
1
VM
b. Enumerate the n-digit ternary sequences with total number of 0s and 1s odd.
Solution. In a ternary sequence, the total number of 0s and 1s is odd if and only if it has
either an even number of 0s and an odd number of 1s, or else, an odd number of 0s and
an even number of 1s. Since a sequence is an arrangement, the generating function will be
exponential.
Corresponding to an even number of 0s, the generating function will have a factor of the
form
x2 x4 ex + e−x
1+ + + ··· = .
2! 4! 2
2
VM
Corresponding to an odd number of 1s, the generating function will have a factor of the form
x3 x5 ex − e−x
x+ + + ··· = .
3! 5! 2
Since there is no restriction on the number of 2s in the sequence, the corresponding factor is
x2
1+x+ + · · · = ex .
2!
Thus, the term of the generating function corresponding to the first case, i.e, an even number
of 0s and an odd number of 1s, is
e + e−x ex − e−x x e3x − e−x
x
e = .
2 2 4
The term of the generating function corresponding to the second case, i.e., an odd number
of 0s and an even number of 1s, will just have the first and second factors interchanged, but
this gives us the same term.
Thus, the exponential generating function is
!
e3x − e−x e3x − e−x
g(x) = 2 = .
4 2
xn
Then the required number of sequences is the coefficient of in the expansion of g(x), which
n!
is
3n − (−1)n
.
2
3
VM
Solution. Since each friend is a different person, we need to use an exponential generating
function. The factor of the generating function corresponding to each flower is
x2 x3 x4
+ + + · · · = ex − x − 1,
2! 3! 4!
considering that we have to give at least two of each flower. Thus, the generating function is
x12
The required answer is then the coefficient of in the expansion of g(x), which is
12!
412 − 4 × 312 + 6 × 212 − 4 − 4 × 12(311 − 3 × 211 + 3) + 6 × 12 × 11(210 − 2) − 4 × 12 × 11 × 10
= a mildly interesting number.
11! 10! 9
− = × 10!.
3! × 2! 3! 12
b. Show that the number of partitions of n with k parts is equal to the number of partitions of
n with largest part k.
Solution. The Ferrers diagram of any partition of n with k parts has n dots and exactly k
rows. In particular, this means that the first column of the diagram has k dots. The conjugate
of this diagram will have exactly k dots in the first row, which represents the largest part of
the corresponding partition. Thus, the conjugate of a partition of n into k parts is a partition
of n in which the largest part is k. Since conjugation is an invertible operation, there is
a one-to-one correspondence between partitions of n into k parts and partitions of n with
largest part k, which shows that they are equinumerous.