Professional Documents
Culture Documents
DM-Test-1-Sol-SS2021
DM-Test-1-Sol-SS2021
(b) is allowed.
Answer: {{a, a}}, {{a, b}}, {{a, c}}, {{b, b}}, {{b, c}}, {{c, c}}.
2. (1pt) (Pascal triangle) Knowing that the 10th row of Pascal’s triangle representing
the values of 10
k
, 0 ≤ k ≤ 10, is given as follows
1
(a) Write down all partitions of the set [4] into 2 blocks such that each block
contains exactly 2 elements.
Answer: {1, 2} t {3, 4}; {1, 3} t {2, 4}; {1, 4} t {2, 3}.
(b) A tennis club has 2n members. We want to pair up the members by twos for
single matches. In how many ways we pair up all the members of the club.
Answer: It is equal to the number of partitions of the set [2n] into n blocks
and each block contains exactly 2 elements.
• Choose 2 elements for the first block: Since it is un-ordered in each block
2
of partition, there are C2n ways;
• Choose 2 elements from the rest 2n − 2 elements for the second block:
2
Since it is un-ordered in each block of partition, there are C2n−2 ways;
• etc;
• Choose 2 elements from the rest 2 elements for the nth block: there are
2
C2n−4 ways;
2 2
By the product counting rule, there are C2n · C2n−2 · · · · · C42 · C22 ways for
choosing n ordered blocks, each block contains 2 elements.
However, by definition of partition into blocks, there is no order for those
blocks in each partition. Notice that each tuple of n blocks, which is un-
ordered, gives exactly n! blocks ordered. Hence, by the division counting
rule, there are
2 2
C2n C2n−2 · · · C22 (2n)!
=
n! n!2n
partitions satisfying the hypothesis.
5. (3pts) (Finite functions) How many functions are there from [5] to [7] such that
it maps 1 to 5 and it is
(a) arbitrary?
Answer: 74
(b) one-to-one (injective)?
6!
Answer: P (6, 4) = 2!
(c) onto (surjective)?
Answer: 0 since the cardinality of the sink set is greater than the cardinality
of the source set.
2
6. (2pts) (Generating functions:)
(a) What is the reduced formula for the generating function for the following
sequence:
(0, 0, 0, 1, 3, 9, 27, . . . )
x3
Answer: f (x) = 1−3x
.
(b) What is the closed formula for the nth term of the sequence whose generat-
1 1
2
ing function is given by x 1−3x + 1−2x ?
7. (1pt) (Linear Recurrence) The characteristic polynomial for the linear recursion
a0 = 0, an = 3an−1 + 2n−1 is equal to P (x) = (x − 3)(x − 2)
8. (1pt)(The principle of inclusion and exclusion.) How many positive integers not
exceeding 2017 that are divisible by 5 or 7?
Answer: Denote by A and B the sets of positive integers not exceeding 2016
divisible by 5 and divisible by 7 respectively. Hence, numbers divisible by 5 or 7
are in the set A or B. We need to find |A ∪ B|. Thus, by the PIE, we get
2017 2017 2017
|A ∪ B| = |A| + |B| − |A ∩ B| = + − = 634.
5 7 5.7
2 Applications: 05 questions
9. (1.5 pts) How many binary strings of length 2019 with at least 2017 occurrences
of 0 are there? Answer: C(2019, 2017) + C(2019, 2018) + C(2019, 2019).
10. (3pts) How many ways to choose 5 objects from the set of 8 distinct boxes of
objects (each box contains a large enough number of identical objects) if
(a) (1pt) the order of chosen objects does not matter, and all chosen objects are
different?
3
(b) (1pt) the order of chosen objects is significant and chosen objects may be
identical?
11. (3pts)
(a) How many different words can be obtained by permuting the letters of the
word banana?
Answer:
it is equal to the number of permutations with repetition on the multiset
6!
{{b, a, n, a, n, a}} which gives 1!3!2! , where 6 is the cardinality of the multiset
and 1, 3, 2 are the number of occurrences of letters b, a, n respectively in the
multiset.
(b) Same question such that each obtained word does not contain two consecu-
tive n.
Answer:
Using the complementary rule:
6!
• The number of words with no restriction: 1!3!2!
• The number of words with two consecutive n is equal to the number
of permutations with repetition on the multiset {{b, a, nn, a, a}} which
5!
gives 1!3!1! , where 1, 3, 1 are the occurrence numbers of b, a, nn in the
multiset and 5 is the total number of occurrences.
• By the complementary rule: the number of words with no consecutive n
is
6! 5!
− .
1!3!2! 1!3!1!
(c) Same question such that each obtained word does not contain two consec-
utive n nor three consecutive a (Hint: Use the principle of inclusion and
exclusion).
Answer:
4
5!
• the number of words containing two consecutive n is 1!3!1!
4!
• the number of words containing 3 consecutive a is 1!2!1!
• the number of words containing 2 consecutive n and 3 consecutive a is
3!
1!1!1!
• by the PIE, the number of words not containing 2 consecutive n nor 3
6! 5! 4! 3!
consecutive a is 1!2!3! − 1!3!1! − 1!2!1! + 1!1!1! .
12. (5pts) Let An be the set of all tilings (or covers) of an n × 1 rectangle with three
kind pieces: a square one of size 1 × 1; a white one of size 2 × 1; and a black one
of size 2 × 1. For example, A1 = { }, A2 = { , , }
(a) Find A3 ;
Answer: On the white board!
(b) Let an = |An |. Give a recursive formula for an ;
Answer: an = an−1 + 2an−2 for n ≥ 2. Details are on the white board!
(c) Give a reduced form for the generating function of the sequence {an }∞
n=0 in
part (12b). By convention, a0 = 1.
Note: In case we cannot solve part (12b), please assume that an satisfies
the recursion
a0 = 0, an = 3an−1 + 3n−1 , for n ≥ 1.
1
Answer: f (x) = 1−x−2x2
. Details are on the white board!
5
• choose 2 elements from n elements of B: There are n2 ways;
Hence, 2n = 2 n2 + n2 .
2