Professional Documents
Culture Documents
Week of March 4
These are some of the problems that have appeared in previous midterms. These are good for practice purposes,
however they are not necessarily an indication of the length nor the difficulty of the midterm you will be
writing. Feel free to discuss these problems on Piazza or during office hours. The TA will choose a subset of
these to cover in the in-person tutorial.
T-7-1. Consider the set S = {0, 1, 2, . . . , 50} and the weight function w(a) = 4a + 3. Determine
the generating series for S with respect to w, and express the series as a simplified rational
expression.
Solution. The weights of 0, 1, 2, . . . , 50 are 3, 7, 11, . . . , 203 respectively. So the generating
series is
T-7-2. Determine the following coefficient. (You do not need to evaluate large exponents or binomial
coefficients.)
1 1
[x10 ] .
1 − x10 (1 − 10x)10
n+k−1
Solution. Using the formula (1 − x)−k = xn , we get
P
n≥0 k−1
X j + 9 X X j + 9
1 1 X
10i j
= x (10x) = 10j x10i+j .
1 − x10 (1 − 10x)10 9 9
i≥0 j≥0 i≥0 j≥0
There are two ways to obtain x10 : (i, j) = (0, 10), (1, 0). The corresponding coefficients are
19 10 is 19 1010 + 1.
10
9 10 and 1 respectively. So the coefficient of x 9 □
1
MATH 239 Winter 2024 Tutorial 7 Solutions
an − 9an−1 + 20an−2 = 0
an = A · 4n + B · 5n .
a0 = 1 = A + B
a1 = 8 = 4A + 5B
an = (−3) · 4n + 4 · 5n .
T-7-5. For any integer n ≥ 0, let Sn the set of all compositions of n where each part is congruent
to 1 or 2 modulo 3 (in other words, no part is a multiple of 3). Let an = |Sn |. For example,
S3 = {(1, 2), (2, 1), (1, 1, 1)}, so a3 = 3.
2
MATH 239 Winter 2024 Tutorial 7 Solutions
Using the sum of the parts as the weight of a composition, we see that
x x2 x + x2
ΦA∪B (x) = ΦA (x) + ΦB (x) = + = .
1 − x3 1 − x3 1 − x3
So then by using the sum and product lemmas,
X X x + x2 k 1 1 − x3
k
ΦS (x) = (Φ( A ∪ B)(x)) = = 2 = .
1 − x3 1 − x+x 1 − x − x2 − x3
k≥0 k≥0 1−x3
to get
1 − x3 = A(x)(1 − x − x2 − x3 )
X
= a0 + (a1 − a0 )x + (a2 − a1 − a0 )x2 + (a3 − a2 − a1 − a0 )x3 + (an − an−1 − an−2 − an−3 )xn
n≥4
3
MATH 239 Winter 2024 Tutorial 7 Solutions
T-7-6. (a) Let S be the set of binary strings with the following decomposition:
S = (0∗ 111∗ )∗
Explain why this is an ambiguous expression for S.
Solution. The string 1111 can be expressed in two ways.
1111 = ({0}0 {11}{1}2 ), ({0}0 {11}{1}0 )({0}0 {11}{1}0 ).
Hence this is an ambiguous expression. □
(b) Suppose the weight of a string is its length. Let ΦS (x) be the generating series for S.
Suppose we obtain Φ′S (x) by applying the product and sum lemmas for strings using
the ambiguous expression in part (a). Which of the following are true?
i. For all n ≥ 1, [xn ]ΦS (x) > [xn ]Φ′S (x).
ii. For all n ≥ 1, [xn ]ΦS (x) < [xn ]Φ′S (x).
iii. There exists an n ≥ 1 such that [xn ]ΦS (x) > [xn ]Φ′S (x).
iv. There exists an n ≥ 1 such that [xn ]ΦS (x) < [xn ]Φ′S (x).
Circle all that are true, and briefly justify your answer.
Solution. Only iv is true. For n = 4, we saw that the string 1111 contributes at least 2
to the coefficient of x4 in Φ′S (x), however, it only contributes 1 to the same coefficient
in ΦS (x). Hence [x4 ]ΦS (x) < [x4 ]Φ′S (x). (Note: Choice ii is not true since for n = 1, the
coefficient is 0 for both series.) □
T-7-7. The following is an unambiguous expression for a certain set of strings. Determine the
generating series of this set with respect to the lengths of the strings, and express your answer
as a simplified rational expression.
∗
S = (000)∗ 1(0 ⌣ 00)(000)∗ .
Solution. Since the expression for S is unambiguous, using the Sum and Product Lemmas
for strings, we get
1 1
ΦS (x) = 3
·
1 − x 1 − x · (x + x2 ) · 1
1−x3
1 1 − x3
= ·
1 − x3 (1 − x3 ) − (x2 + x3 )
1
= .
1 − x − 2x3
2
4
MATH 239 Winter 2024 Tutorial 7 Solutions
T-7-8. Write an unambiguous expression for the set of all strings where every block of 0’s must be
followed by a block of 1’s of length divisible by 3.
Solution. Consider the block decomposition {1}∗ ({0}{0}∗ {1}{1}∗ )∗ {0}∗ . The last {0}∗ must
be removed since it is not followed by any block of 1’s. The block of 0’s {0}{0}∗ must be
followed by a block of 1’s of length divisible by 3, which can be expressed as {111}{111}∗ . So
an unambiguous expression for our set of strings is
3 4
an = [xn ] + [xn ] = 3 · 5n + 4 · (−1)n .
1 − 5x 1+x
□
(b) Could {an }n≥0 be the sequence of coefficients of the generating series for a set S of
binary strings (where the weight of each string is its length)? Justify your answer.
Solution. No. There are at most 2n binary strings of length n, so the coefficient of xn
cannot exceed 2n in the generating series. We see that an > 2n for any n ≥ 0 (in particular,
a0 = 7, which is greater than 1), so it is not possible that these are coefficients for the
generating series of the strings. □
5
MATH 239 Winter 2024 Tutorial 7 Solutions
T-7-10. The following two graphs G and H are isomorphic. Find an isomorphism.
v 1 2 3 4 5 6 7
f (v) G A F E D C B
T-7-11. Suppose G is a graph with 10 vertices of degree 3, 20 vertices of degree 2, x vertices of degree
1, and no vertices of other degrees. In addition, G has 40 edges. Determine the value of x.
Solution. The sum of the degrees of all vertices in G is
10 · 3 + 20 · 2 + x · 1 = 70 + x.
By the handshaking lemma, this is equal to twice the number of edges, which is 80. So we
have 70 + x = 80, this gives us x = 10. □
T-7-12. The complement of a graph G is the graph G where V (G) = V (G), and uv ∈ E(G) if and only
if uv ̸∈ E(G). Suppose that G is a graph with at least 5 vertices. Prove that G and G cannot
both be bipartite graphs.
Solution. If G is not bipartite, then we are done. Suppose G is bipartite. Let (A, B) be a
bipartition of G. Since G has at least 5 vertices, at least one of A and B has at least 3 vertices,
say it is A. Let x, y, z be three vertices in A. Then xy, yz, xz are not edges in G, hence they
are edges in G, which forms a cycle of length 3, which is not bipartite. Since G contains a
non-bipartite subgraph, G is not bipartite. □