You are on page 1of 6

Tutorial 7 Solutions

MATH 239 Winter 2024

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

ΦS (x) = x3 + x7 + x11 + · · · + x203


= x3 (1 + x4 + x8 + · · · + x200 )
x3 (1 − x204 )
= .
1 − x4

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

T-7-3. Let n ∈ N. Give a combinatorial proof of the following identity.


  n   
2n X n n
= .
n k n−k
k=0

(Hint: Count the set S = {(A, B) | A ⊆ {1, 2, . . . , n}, B ⊆ {n + 1, n + 2, . . . , 2n}, |A ∪ B| = n}.)


Solution. Let S be as above. Partition S into S0 , S1 , . . . , Sn where Sk consists of all elements
(A, B) where |A| = k. Then A is any k-subset of {1, 2, . . . , n}, and B is any (n − k)-subset of
{n + 1, n + 2, . . . , 2n}. Therefore, |Sk | = nk n−k , and |S| = nk=0 nk n−k
 n  P  n 
.
Also, if T is the set of all n-subsets of [2n], there is a bijection f : T → S where f (X) =
(X ∩ {1, . . . , n}, X ∩ {n + 1, . . . , 2n}). So |S| = |T | = 2n

n . Hence the identity holds. □

T-7-4. Let {an } be the sequence which satisfies

an − 9an−1 + 20an−2 = 0

for n ≥ 2 with initial conditions a0 = 1, a1 = 8. Determine an explicit formula for an .


Solution. The characteristic polynomial is x2 − 9x + 20 = (x − 4)(x − 5), so the roots are 4
and 5 with multiplicity 1 each. Then the explicit formula for an has the form

an = A · 4n + B · 5n .

Substituting the initial conditions to get

a0 = 1 = A + B
a1 = 8 = 4A + 5B

Solving gives A = −3, B = 4. So an explicit formula for an is

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.

(a) Prove that


X 1 − x3
an xn = .
1 − x − x2 − x3
n≥0

Solution. Let A = {1, 4, 7, 10, . . .} = {n ∈ N | n ≡ 1 (mod 3)} and B = {2, 5, 8, 11, . . .} =


{n ∈ N | n ≡ 2 (mod 3)}. Then the set of all compositions that where each part is
congruent to 1 or 2 modulo 3 is
[
S= (A ∪ B)k .
k≥0

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

The number of compositions that sum up to n is then the coefficient of xn in this


generating series. □
(b) Using the power series in part (a), derive the following recurrence relation for n ≥ 4:
an = an−1 + an−2 + an−3 .
In addition, provide sufficient initial conditions that uniquely determine the sequence
{an }.
1−x3
Solution. Let A(x) = k≥0 ak xk = 1−x−x 2 3
P
2 −x3 . Multiply both sides by 1 − x − x − x

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

By comparing coefficients on both sides, we get


1 = a0
0 = a1 − a0 ⇒ a1 = 1
0 = a2 − a1 − a0 ⇒ a2 = 2
−1 = a3 − a2 − a1 − a0 ⇒ a3 = 3
0 = an − an−1 − an−2 − an−3 for n ≥ 4.
So for n ≥ 4, an = an−1 + an−2 + an−3 , with initial conditions a0 = 1, a1 = 1, a2 = 2, a3 =
3. □
(c) Give a combinatorial proof of the recurrence in part (b) by arguing that for n ≥ 4,
|Sn | = |Sn−1 | + |Sn−2 | + |Sn−3 |.

Solution. Let An be compositions in Sn where the last part is 1 or 2, let Bn be composi-


tions in Sn where the last part is at least 4. Then Sn = An ∪ Bn is a disjoint union. We
define two bijections:
i. Define f : An → Sn−1 ∪ Sn−2 by f (a1 , . . . , ak−1 , ak ) = (a1 , . . . , ak−1 ) (i.e. we remove
the last part). Since the last part is 1 or 2, by removing the last part, we have a
composition in Sn−1 or Sn−2 . The inverse is f −1 : Sn−1 ∪ Sn−2 where
(
(b1 , . . . , bl , 1) b1 + · · · + bl = n − 1
f −1 (b1 , . . . , bl ) =
(b1 , . . . , bl , 2) b1 + · · · + bl = n − 2

This is a bijection, so |An | = |Sn−1 | + |Sn−2 |.

3
MATH 239 Winter 2024 Tutorial 7 Solutions

ii. Define g : Bn → Sn−3 by g(a1 , . . . , ak−1 , ak ) = (a1 , . . . , ak−1 , ak − 3) (i.e. we subtract


3 from the last part). Since the last part is at least 4 and congruent to 1 or 2 mod
3, subtracting 3 results in a positive integer that is still congruent to 1 or 2 mod 3.
The inverse is g −1 : Sn−3 → Bn where g −1 (b1 , . . . , bl ) = (b1 , . . . , bl−1 , bl + 3). This is
a bijection, so |Bn | = |Sn−3 |.
The results of these two bijections give us |Sn | = |An | + |Bn | = |Sn−1 | + |Sn−2 | + |Sn−3 |.

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

{1}∗ ({0}{0}∗ {111}{111}∗ )∗ .

T-7-9. (a) For each n ≥ 0 let


7 − 17x
an = [xn ] .
1 − 4x − 5x2
Use partial fractions to find an explicit formula for an in terms of n for all n ≥ 0.
Solution. The denominator can be factored as (1 − 5x)(1 + x). So using partial fractions,
there exist constants A, B such that
7 − 17x A B
= + .
1 − 4x − 5x2 1 − 5x 1 + x
This means that
7 − 17x A(1 + x) + B(1 − 5x) (A + B) + (A − 5B)x
= = .
1 − 4x − 5x2 (1 − 5x)(1 + x) (1 − 5x)(1 + x)

By comparing the numerator, we see that A + B = 7 and A − 5B = −17. Solving this


system of equations gives A = 3, B = 4. So

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.

Solution. One possible isomorphism is f : V (G) → V (H) where

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. □

You might also like