You are on page 1of 22

MA3004 COMBINATORICS 2016

SOLUTIONS TO 2011–2012, 2012–2013 & 2014–2015 EXAMINATIONS

2011–2012 EXAMINATION

1. (a) (i) [2] × [1] × [3] = {(1, 1, 1), (1, 1, 2), (1, 1, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3)}.
(ii) P({a, b, c}) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
(iii) P(P(∅)) = P({∅}) = {∅, {∅}}.
(iv) The elements of P([5]) of cardinality 2 are:
{1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 4}, {3, 5}, {4, 5}.
(v) The partitions of [4] into 2 blocks are:
{{1}, {2, 3, 4}}, {{2}, {1, 3, 4}}, {{3}, {1, 2, 4}}, {{4}, {1, 2, 3}},
{{1, 2}, {3, 4}}, {{1, 3}, {2, 4}}, {{1, 4}, {2, 3}}.

(b) (S \ T ) ∪ (T \ S) ∪ (S ∩ T ) is (using the definitions of the complement, union and


intersection), the set of all x such that (x ∈ S and x ∈ / T ) or (x ∈ T and x ∈
/ S)
or (x ∈ S and x ∈ T ), i.e., the set of all x such that (x is in S but not T ) or (x
is in T but not S) or (x is in both S and T ). But this is the set of all x such
that x ∈ S or x ∈ T , which (using the definition of the union) is simply S ∪ T .
Therefore, (S \ T ) ∪ (T \ S) ∪ (S ∩ T ) = S ∪ T , as required.

(c) (i) Let f : S → T have a right inverse g: T → S.


Then f ◦ g = IT .
To prove that f is surjective it needs to be shown that, for any t ∈ T , there
exists s ∈ S such that f (s) = t.
Applying f ◦ g = IT to any t ∈ T gives f ◦ g(t) = IT (t),
which gives f (g(t)) = t [using the definitions of f ◦ g and IT ].
Therefore, there does exist s ∈ S such that f (s) = t, since s can be taken
as g(t).
Therefore f is surjective, as required.
(ii) Let f : S → T be surjective.
Then f −1 (t) contains at least one element of S for each t ∈ T .
Now define g: T → S by
g(t) = (a fixed element of f −1 (t)), for each t ∈ T .

1
[Any choice for the fixed element of f −1 (t) can be made for each t ∈ T .]
Therefore, for each t ∈ T , f ◦ g(t) = f (g(t)) [using the definition of f ◦ g]
= t [using g(t) ∈ f −1 (t), and the definition of f −1 (t)].
Therefore f ◦ g = IT [using the definition of IT ],
and so f has a right inverse g, as required.
(iii) f has six right inverses:
• g: {a, b} → [5] with g(a) = 2 and g(b) = 1
• g: {a, b} → [5] with g(a) = 2 and g(b) = 3
• g: {a, b} → [5] with g(a) = 2 and g(b) = 4
• g: {a, b} → [5] with g(a) = 5 and g(b) = 1
• g: {a, b} → [5] with g(a) = 5 and g(b) = 3
• g: {a, b} → [5] with g(a) = 5 and g(b) = 4.
(iv) f has no left inverses (since it is not injective).

(d) Let S be finite and f be surjective.


Since S is finite, it follows from the definition of the range of f ,
f (S) := {f (s) | s ∈ S}, that f (S) is also finite and that |f (S)| ≤ |S|.
Since f is surjective, it follows that f (S) = T , implying that T is finite
and |T | ≤ |S| as required.

2. (a) (i) A = { {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4} }.


(ii) B = { {1, 1, 1}M , {1, 1, 2}M, {1, 2, 2}M , {2, 2, 2}M }.
(iii) The function f : A → B is given by f ({i1 , i2 , i3 }) = {i1 , i2 −1, i3 −2}M ,
for each {i1 , i2 , i3 } ∈ A with i1 < i2 < i3 .
The function g: B → A is given by g({j1 , j2 , j3 }M ) = {j1 , j2 +1, j3 +2},
for each {j1 , j2 , j3 }M ∈ B with j1 ≤ j2 ≤ j3 .
(Explicitly, f ({1, 2, 3}) = {1, 1, 1}M, f ({1, 2, 4}) = {1, 1, 2}M,
f ({1, 3, 4}) = {1, 2, 2}M and f ({2, 3, 4}) = {2, 2, 2}M.)
(iv) For each S ∈ A, f (S) can be obtained using a box diagram as follows.
• Draw 4 boxes, numbered 1 to 4 from left to right, and place a cross to the
left of box 1 and to the right of box 4.
• Leave empty the boxes labeled by the 3 elements of S, and place a cross
in the single remaining box.
• Fill in each of the 3 empty boxes according to the rule that all boxes
between the first and second crosses contain a 1, and all boxes between
the second and third crosses contain a 2.

2
• The integers placed into boxes are the elements of f (S) ∈ B.
(v) Explicitly, the box diagrams for each element of A are
{1, 2, 3}: × 1 1 1 × ×, {1, 2, 4}: × 1 1 × 2 ×,
1 2 3 4 1 2 3 4

{1, 3, 4}: × 1 × 2 2 ×, {2, 3, 4}: × × 2 2 2 ×.


1 2 3 4 1 2 3 4

   
n−1 n−1 (n−1)! (n−1)!
(b) (i) RHS = + = +
k−1 k (k−1)! (n−k)! k! (n−k−1)!
(n−1)! k (n−1)! (n−k) (n−1)! k (n−1)! (n−k)
= + = +
k (k−1)! (n−k)! k! (n−k) (n−k−1)! k! (n−k)! k! (n−k)!
 
(n−1)! (k+n−k) n (n−1)! n! n
= = = =
k! (n−k)! k! (n−k)! k! (n−k)! k
= LHS, as required.
(ii) Let A be the set of all selections of k elements from [n] with order unimportant
and repetition not allowed, A1 be the set of elements of A which contain n,
and A2 be the set of elements of A which do not contain n.
(In fact, any other fixed element of [n] could be used here instead of n, although
slight modifications would then be needed in the rest of the proof.)
Thus, A = {S ⊂ [n] | |S| = k},
A1 = {S ∈ A | n ∈ S} and
A2 = {S ∈ A | n ∈ / S} = {S ⊂ [n−1] | |S| = k}.
   
n n−1
Therefore, |A| = and |A2 | = .
k k
It also follows that A = A1 ∪ A2 and A1 ∩ A2 = ∅, so that |A| = |A1 |+|A2|.
Now let B be the set of all selections of k−1 elements from [n−1] with order
unimportant and repetition not allowed, i.e., B = {T ⊂ [n−1] | |T | = k−1}.
 
n−1
Therefore, |B| = .
k−1
Finally, define functions f and g by f : A1 → B with f (S) = S \ {n} for
each S ∈ A1 , and g: B → A1 with g(T ) = T ∪ {n} for each T ∈ B.
It can be seen that f and g are well-defined, and that g is an inverse of f .
Therefore, using the standard results that if a function has an inverse then
it is a bijection, and that if a function is a bijection between two finite sets
then those sets have the same size, it follows that f is a bijection, and that
|A1 | = |B|.
     
n n−1 n−1
Hence, = |A| = |A1 | + |A2 | = |B| + |A2 | = + , as
k k−1 k
required.

3
(iii) For n = 4 and k = 3, A is the set of all selections of 3 elements from [4] with
order unimportant and repetition not allowed, A1 is the set of elements of A
which contain 4, A2 is the set of elements of A which do not contain 4, and B
is the set of all selections of 2 elements from [3], again with order unimportant
and repetition not allowed.
The functions f and g are given by f : A1 → B with f (S) = S \ {4} for each
S ∈ A1 , and g: B → A1 with g(T ) = T ∪ {4} for each T ∈ B.
Diagrammatically:
A

A1 B
f
{1,2,4} • • {1,2}
g
f
{1,3,4} • • {1,3}
g
f
{2,3,4} • • {2,3}
g

A2
{1,2,3}

3. (a) (i) Number of strings = 5 . 262 = 3380.


 
5
(ii) Number of strings = = 60.
1, 1, 1, 2
(iii) Number of ways = number of selections of 7 elements from [5] with order
   
5+7−1 11
unimportant and repetition allowed = = = 330.
7 7
(iv) Number of ways = number of selections of 8 elements from [3] with order
   
3+8−1 10
unimportant and repetition allowed = = = 45.
8 8
(v) Number of solutions = number of weak compositions of 6 into 5 parts =
   
6+5−1 10
= = 210.
6 6
 
12−1
(vi) Number of solutions = number of compositions of 12 into 4 parts =
4−1
 
11
= = 165.
3
 
8
(vii) Coefficient = = 168.
1, 5, 2

4
(viii) Number of partitions of [3] is 5.
(ix) Number of partitions of 3 is 3.
(x) Number of functions = 6 . 5 . 4 = 120.

(b) (i) Such functions f and g can be defined by


f : A → B with f ({s1 , . . . , sk−1}) = (s1 , s2−s1 , s3−s2 , . . . , sk−1−sk−2 , n − sk−1),
for each {s1 , . . . , sk−1} ∈ A with s1 < s2 < . . . < sk−1, and
g: B → A with g((a1 , . . . , ak )) = {a1 , a1 +a2 , . . . , a1 +a2 +. . .+ak−1 },
for each (a1 , . . . , ak ) ∈ B.
(ii) For each S ∈ A, f (S) can be obtained as follows.
• Draw n adjacent dots, numbered 1 to n from left to right.
• Place a bar to the right of each dot labeled by an element of S.
• The number of dots to the left of the first bar is the first part a1 of f (S),
the number of dots between the first and second bar is a2 , and so on, with
the number of dots to the right of the last bar being ak .

(iii) For n = 5 and k = 4, A is the set of selections of 3 elements from [4], with
order unimportant and repetition not allowed, and B is the set of composi-
tions of 5 into 4 parts. The functions f and g are given by f : A → B with
f ({s1 , s2 , s3 }) = (s1 , s2 − s1 , s3 − s2 , 5 − s3 ), for each {s1 , s2 , s3 } ∈ A with
s1 < s2 < s3 , and g: B → A with g((a1 , a2 , a3 , a4 )) = {a1 , a1 +a2 , a1 +a2 +a3 },
for each (a1 , a2 , a3 , a4 ) ∈ B.
Diagrammatically:
A B
f
{1,2,3} • • (1,1,1,2)
g
f
{1,2,4} • • (1,1,2,1)
g
f
{1,3,4} • • (1,2,1,1)
g
f
{2,3,4} • • (2,1,1,1)
g

(iv) For n = 5 and k = 4, the diagrams for each element of A are explicitly
{1, 2, 3} : • • • • • ,
1 2 3 4 5

{1, 2, 4} : • • • • • ,
1 2 3 4 5

{1, 3, 4} : • • • • • ,
1 2 3 4 5

{2, 3, 4} : • • • • • .
1 2 3 4 5

5
4. (a) (i) S(n, k) is the number of partitions of [n] (or any finite set of size n) into k
blocks.
(ii) S(n, 1) = 1, since there is only the single partition { {1, . . . , n} } of [n] into 1
block.
(iii) S(n, n) = 1, since there is only the single partition { {1}, {2}, . . . , {n} } of [n]
into n blocks.
(iv) Let A be the set of all selections of 2 elements from [n] with order unimportant
and repetition not allowed (i.e., subsets of [n] of size 2), and let B be the set
of all partitions of [n] into n−1 blocks.
 
n
Therefore, |A| = and |B| = S(n, n−1).
2
Now let the function f : A → B be given, for each T ∈ A, by f (T ) =
{ T, {x1 }, . . . , {xn−2 } }, where {x1 , . . . , xn−2 } = [n] \ T . In other words, for
each T ∈ A, f places the 2 elements of T into a single block of size 2, and
places the remaining n−2 elements of [n] into individual blocks, each of size 1.
It can be checked that f is well-defined and a bijection. Therefore, using the
standard result that if a function is a bijection between two finite sets then
 
n
those sets have the same size, S(n, n−1) = |B| = |A| = , as required.
2
(v) For the case of n = 4, the sets A and B, and the function f , are given by:

T ∈A f (T ) ∈ B
{1, 2} { {1, 2}, {3}, {4} }
{1, 3} { {1, 3}, {2}, {4} }
{1, 4} { {1, 4}, {2}, {3} }
{2, 3} { {2, 3}, {1}, {4} }
{2, 4} { {2, 4}, {1}, {3} }
{3, 4} { {3, 4}, {1}, {2} }

(vi) Each surjective function f : [n] → [k] corresponds to a permutation (S1 , . . . , Sk )


of a partition of [n] into k blocks in which




1, s ∈ S1
2,

s ∈ S2
f (s) = ..




.

k, s ∈ Sk
i.e., a bijection can be formed between the set of surjective functions from [n]
to [k], and the set of permutations of partitions of [n] into k blocks.

6
Therefore, since there are S(n, k) partitions of [n] into k blocks, and k! per-
mutations of each partition, there are k! S(n, k) surjective functions from [n]
to [k].

5.4
(b) (i) Number of graphs = 2 2 = 210 = 1024.
 5.4   
2 10
(ii) Number of graphs = = = 252.
5 5

 
0 1 0 1
1 0 1 1
 
(c) (i) The adjacency matrix is  .
0 1 0 1
1 1 1 0
 3  
0 1 0 1 2 5 2 5
1 0 1 1 5 4 5 5
   
(ii) Number of paths of length 3 from 3 to 2 =   =  
0 1 0 1 2 5 2 5
1 1 1 0 32 5 5 5 4 32

= 5 (only this entry needed to be obtained explicitly).

(iii) The paths of length 3 from 3 to 2 are: (3, 2, 1, 2), (3, 2, 3, 2), (3, 2, 4, 2),
(3, 4, 1, 2) and (3, 4, 3, 2).

7
2012–2013 EXAMINATION

1. (a) (i) {2, 4, 6} × {5} × {1, 3} =


{(2, 5, 1), (2, 5, 3), (4, 5, 1), (4, 5, 3), (6, 5, 1), (6, 5, 3)}
(ii) P({x}) = {∅, {x}}
(iii) P(P({x})) = {∅, {∅}, {{x}}, {∅, {x}}}
(iv) The partitions of {a, b, c} are:
{{a, b, c}}, {{a}, {b, c}}, {{b}, {a, c}}, {{c}, {a, b}}, {{a}, {b}, {c}}

(b) (i) Let S and T be nonempty sets with S ×T = T ×S.


Consider any s ∈ S and t ∈ T , where the fact that S and T are nonempty
guarantees the existence of such s and t.
Using the definition of S ×T , it follows that (s, t) ∈ S ×T .
Using S ×T = T ×S, it now follows that (s, t) ∈ T ×S.
Therefore, using the definition of T ×S, it follows that s ∈ T and t ∈ S.
It has thus been shown that s ∈ T for any s ∈ S, so that S ⊂ T ,
and it has also been shown that t ∈ S for any t ∈ T , so that T ⊂ S.
Hence, S = T (since S ⊂ T and T ⊂ S), as required.
(ii) Consider the case in which S = ∅ and T 6= ∅.
Then, S ×T = ∅×T = {(s, t) | s ∈ ∅, t ∈ T } = ∅,
and T ×S = T ×∅ = {(t, s) | t ∈ T, s ∈ ∅} = ∅.
Therefore, in this case S ×T = T ×S (= ∅), but S 6= T .
(Note that the case S 6= ∅ and T = ∅ also gives S×T = T×S = ∅, but S 6= T .)

(c) A composite function g ◦ f exists if the range of f is a subset of the domain of g.


The range of f : S → T is {f (s) | s ∈ S}, which is a subset of T since f (s) ∈ T for
each s ∈ S. Also, the domain of g: T → U is T .
Therefore, the range of f is a subset of the domain of g, and so g ◦ f exists.
Now, let f and g both be surjective, and consider any u ∈ U.
Since g is surjective, there exists t ∈ T such that g(t) = u.
Then, since f is surjective, there exists s ∈ S such that f (s) = t.
Combining the previous two equations gives g(f (s)) = u,
and so (using the definition of g ◦ f ) g ◦ f (s) = u.
Therefore, g ◦ f is surjective (since for any u ∈ U there exists s ∈ S with
g ◦ f (s) = u), as required.

8
(d) (i) Let f : S → T be injective.
Then f −1 (t) contains at most one element of S for each t ∈ T .
More specifically, f −1 (t) contains a single element if t is in the range of f (i.e.,
if t ∈ f (S)) and is empty if t is not in the range of f (i.e., if t ∈ T \f (S)).
Now define g: T → S by




the single element of f −1 (t), t ∈ f (S)
g(t) = an arbitrarily-chosen element of S


 [different choices being possible for each t], t ∈ T \f (S).
It then follows that g(f (s)) = s for any s ∈ S [since f (s) ∈ f (S), so that
g(f (s)) is the single element of f −1 (f (s)), which is simply s].
Therefore, g ◦ f (s) = s [using the definition of g ◦ f ],
and so g ◦ f = IS [where IS is the identity function on S].
Therefore f has a left inverse g, as required.
(ii) It can be seen that, if S and T are finite, then the different choices for each
t ∈ T \f (S) in the expression for g in (i) give all possible left inverses of f .
Therefore, since g(t) is uniquely determined for each t ∈ f (S), and there
are |S| choices for g(t) for each t ∈ T \ f (S), the number of left inverses is
|S||T \f (S)| = |S||T |−|f (S)|. But since f is injective, it follows that |f (S)| = |S|,
and hence that the number of left inverses is |S||T |−|S|.

2. (a) (i) The right inverses of f are:


• g: {a, b, c} → {a, b, c, d, e} with g(a) = c, g(b) = a, g(c) = b
• g: {a, b, c} → {a, b, c, d, e} with g(a) = c, g(b) = d, g(c) = b,
• g: {a, b, c} → {a, b, c, d, e} with g(a) = c, g(b) = e, g(c) = b.

(ii) The selections of 2 elements from {a, b} with order important and repetition
allowed are (a, a), (a, b), (b, a), (b, b).
(iii) The selections of 2 elements from {a, b, c} with order important and repetition
not allowed are (a, b), (a, c), (b, a), (b, c), (c, a), (c, b).
(iv) The injective functions f from {a, b} to {a, b, c} are:
• f : {a, b} → {a, b, c} with f (a) = a, f (b) = b,
• f : {a, b} → {a, b, c} with f (a) = a, f (b) = c,
• f : {a, b} → {a, b, c} with f (a) = b, f (b) = a,
• f : {a, b} → {a, b, c} with f (a) = b, f (b) = c,
• f : {a, b} → {a, b, c} with f (a) = c, f (b) = a,
• f : {a, b} → {a, b, c} with f (a) = c, f (b) = b.

9
(v) The selections of 2 elements from {a, b, c} with order unimportant and repe-
tition allowed are {a, a}M , {a, b}M , {a, c}M , {b, b}M , {b, c}M , {c, c}M .
(vi) The selections of 4 elements from {a, b, c, d, e} with order unimportant and
repetition not allowed are {a, b, c, d}, {a, b, c, e}, {a, b, d, e}, {a, c, d, e},
{b, c, d, e}.
(vii) The permutations of {a, a, b, b}M are (a, a, b, b), (a, b, a, b), (a, b, b, a), (b, a, a, b),
(b, a, b, a), (b, b, a, a).
(viii) The compositions of 5 into 3 parts are (1, 1, 3), (1, 2, 2), (1, 3, 1), (2, 1, 2),
(2, 2, 1), (3, 1, 1)
(ix) The partitions of 5 into 3 parts are {1, 1, 3}M, {1, 2, 2}M.

(b) (i) |F −1 (t)| = a1 ! a2 ! . . . ak !, for any t ∈ B (i.e., any permutation of M),


since F −1 (t) consists of all of the elements of A (i.e., the permutations of
[n]) obtained by arranging 1, 2, . . . , a1 in all a1 ! possible ways among the a1
positions in which d1 appears in t, arranging a1 +1, a1 +2, . . . , a1 +a2 in all a2 !
possible ways among the a2 positions in which d2 appears in t, and so on, up
to arranging a1 +. . .+ak−1 +1, a1 +. . .+ak−1 +2, . . . , n in all ak ! possible ways
among the ak positions in which dk appears in t.
(ii) F −1 ((3, 1, 2, 3, 1)) = {(4, 1, 3, 5, 2), (4, 2, 3, 5, 1), (5, 1, 3, 4, 2), (5, 2, 3, 4, 1)}

(c) (i) The identity can be proved algebraically by setting x = y = 1 in the binomial
n  
n
X n k n−k
theorem (x + y) = x y . In particular, this gives:
k=0
k
n   n  
X n X n
LHS = = 1k 1n−k = (1+1)n = 2n = RHS, as required.
k=0
k k=0
k
(ii) A selection of k elements from [n] with order unimportant and repetition not
 
n
allowed is a subset of [n] of size k, and the number of these is .
k
Therefore, the LHS is the total number of subsets of [n] of any size between 0
and n. But the total number of subsets of [n] is |P([n])| = 2n (using the
formula for the size of a power set), which gives the RHS, as required.

10
3. (a) (i) Number of subsets = |P([7])| − |P({1, 3, 5, 7})| = 27 − 24 = 128 − 16 = 112.
(ii) Number of terms = number of weak compositions of 5 into 3 parts =
   
5+3−1 7
= = 21.
5 5
 
6−1
(iii) Number of ways = number of compositions of 6 into 4 parts = =
4−1
 
5
= 10.
3
(iv) Number of ways = number of selections of 4 elements from [6] with order
important and repetition not allowed = 6 . 5 . 4 . 3 = 360.
(v) In any path, there are 1 − (−2) = 3 horizontal steps and 4 − (−1) = 5 vertical
       
3+5 3+5 8 8
steps. So the total number of paths is = = = =
3 5 3 5
56.
(vi) Number of ‘words’ = 4 . 3 . 2 . 1 + 4 . 3 . 2 + 4 . 3 + 4 = 24 + 24 + 12 + 4 = 64.
(vii) Number of surjective functions = 5! = 120.
4.3
(viii) Number of graphs = 2 2 = 26 = 64.
 6.5   
2
15
(ix) Number of graphs = = = 455.
3 3
 
5
(x) Number of edges = = 10.
2
(xi) Number of edges = 5 . 8 = 40.

   
n+k−1 n+k−1
(b) (i) |A| = |B| = |C| = =
k−1 n
(ii) f ((a1 , . . . , ak )) = (a1 −1, . . . , ak −1), for each (a1 , . . . , ak ) ∈ A
g((c1 , . . . , ck )) = (c1 +1, . . . , ck +1), for each (c1 , . . . , ck ) ∈ C

(iii) For n = 4 and k = 2:


A C
f
(1,5)• •(0,4)
g
f
(2,4)• •(1,3)
g
f
(3,3)• •(2,2)
g
f
(4,2)• •(3,1)
g
f
(5,1)• •(4,0)
g

11
(iv) F (b) = (number of 1’s in b, number of 2’s in b, . . . , number of k’s in b),
for each b = {b1 , b2 . . . , bn }M ∈ B
G((c1 , . . . , ck )) = {1, . . . , 1 , 2, . . . , 2 , . . . , k, . . . , k }M ,
| {z } | {z } | {z }
c1 times c2 times ck times
for each (c1 , . . . , ck ) ∈ C

(v) For n = 4 and k = 2:


B C
F
{1,1,1,1}M • •(4,0)
G
F
{1,1,1,2}M • •(3,1)
G
F
{1,1,2,2}M • •(2,2)
G
F
{1,2,2,2}M • •(1,3)
G
F
{2,2,2,2}M • •(0,4)
G

4. (a) (i) S(n, k) is the number of partitions of a finite set of size n into k blocks.
(ii) Let A be the set of partitions of [n] into k blocks, A1 be the set of elements
of A which contain the block {n}, and A2 be the set of elements of A which
do not contain the block {n}. (In fact, {m}, for any fixed m ∈ [n], could be
used instead of {n}, with certain modifications then being necessary to the
rest of the proof.) It follows that A = A1 ∪ A2 , A1 ∩ A2 = ∅ and S(n, k) =
|A| = |A1 | + |A2 |.
First, |A1 | will be determined. Let B1 be the set of partitions of [n−1] into
k −1 blocks, so that |B1 | = S(n−1, k −1), and define functions f and g by
f : A1 → B1 with f (P ) = P \ {{n}}, for each P ∈ A1 , and g: B1 → A1 with
g(Q) = Q ∪ {{n}}, for each Q ∈ B1 .
It can be seen that f and g are well-defined, and that g is an inverse of f .
Therefore, f is a bijection and |A1 | = |B1 | = S(n−1, k−1).
Next, |A2 | will be determined. Let B2 be the set of partitions of [n−1] into k
blocks, so that |B2 | = S(n−1, k), and define a function h by
 
the partition of [n−1] obtained from P
with h(P ) = by replacing T by T \ {n}, where T
 
h: A2 → B2 ,
is the block of P which contains n
for each P ∈ A2 (i.e., h simply removes n from the partition P ).

12
It can be seen that h is well-defined, and that, for each Q ∈ B2 , |h−1 (Q)| = k,
since h−1 (Q) consists of the k different partitions of [n] into k blocks in which n
is inserted into one of the k different blocks of Q. Therefore, |A2 | = k |B2 | =
k S(n − 1, k).
Finally, it now follows from previous equations that
S(n, k) = |A| = |A1 | + |A2 | = |B1 | + k |B2 | = S(n−1, k−1) + k S(n−1, k), as
required.
(iii) For n = 4 and k = 2:
A is the set of partitions of [4] into 2 blocks, A1 is the set of elements of A
which contain {4}, A2 is the set of elements of A which do not contain {4}, B1
is the set of partitions of [3] into 1 block, and B2 is the set of partitions of [3]
into 2 blocks.
Diagrammatically, these sets and the functions f , g and h are:

A1 B1
f
{{4}, {1,2,3}} • • {{1,2,3}}
g

A2 B2
h
{{1}, {2,3,4}} •
• {{1}, {2,3}}
{{1,4}, {2,3}} • h

h
{{2}, {1,3,4}} •
• {{2}, {1,3}}
{{1,3}, {2,4}} • h

h
{{3}, {1,2,4}} •
• {{3}, {1,2}}
{{1,2}, {3,4}} • h

(b) (i) A path of length m from i to j is an an (m+1)-tuple (i, v1 , v2 , v3 , . . . , vm−1 , j) ∈


[n]m+1 such that {i, v1 }, {v1 , v2 }, {v2 , v3 }, . . . , {vm−1 , j} are all in E.
(ii) The adjacency matrix A is the n×n matrix with entries defined by
(
1, {i, j} ∈ E
Aij =
0, {i, j} ∈
/ E,
for each i, j ∈ [n].
(iii) For any integers i and j in [n], {i, j} = {j, i}. Therefore, using the definition
of A from (ii), Aij = Aji for any i, j ∈ [n], and so A is symmetric.

13
By the definition of a graph (as used in this module), each edge must contain
two distinct vertices. Therefore, {i, i} = {i} ∈/ E for any i ∈ [n], which implies
that Aii = 0 for all i ∈ [n], i.e., that A has only zeros on the main diagonal.
(iv) Using the definition of matrix multiplication, the ij entry of the mth power
of A is
n
X n
X n
X n
X
(Am )ij = ... Aiv1 Av1 v2 . . . Avm−2 vm−1 Avm−1 j .
v1 =1 v2 =1 vm−2 =1 vm−1 =1

First note that, using the definition of a Cartesian product, the multiple sums
over v1 , . . . , vm−1 are equivalent to a single sum over all (v1 , . . . , vm−1 ) ∈ [n]m−1 ,
i.e.,
X
(Am )ij = Aiv1 Av1 v2 . . . Avm−2 vm−1 Avm−1 j .
(v1 ,...,vm−1 )∈[n]m−1

Now, since each entry of A is 0 or 1, the product Aiv1 Av1 v2 . . . Avm−1 j is 1 if


and only if each of its m terms is 1, and therefore (using the definition of an
adjacency matrix from (ii)) if and only if {i, v1 }, {v1 , v2 }, . . . , {vm−1 , j} are
all edges, and therefore (using the definition of a path from (i)) if and only if
(i, v1 , v2 , . . . , vm−1 , j) is a path of length m on the graph from i to j.
Hence, by summing Aiv1 Av1 v2 . . . Avm−1 j over all (v1 , . . . , vm−1 ) ∈ [n]m−1 , each
corresponding tuple (i, v1 , v2 , . . . , vm−1 , j) which is a path from i to j gives 1,
while each corresponding tuple which is not such a path gives 0. Therefore,
the overall sum is the number of paths of length m from i to j, as required.

14
2014–2015 EXAMINATION

1. (a) (i) {1, 3} × {2, 4} = {(1, 2), (1, 4), (3, 2), (3, 4)}.
Therefore, the elements of P({1, 3} × {2, 4}) of cardinality 2 are
{(1, 2), (1, 4)}, {(1, 2), (3, 2)}, {(1, 2), (3, 4)}, {(1, 4), (3, 2)},
{(1, 4), (3, 4)} and {(3, 2), (3, 4)}.
(ii) The partitions of [4] into 3 blocks are
{{1}, {2}, {3, 4}}, {{1}, {3}, {2, 4}}, {{1}, {4}, {2, 3}},
{{2}, {3}, {1, 4}}, {{2}, {4}, {1, 3}} and {{3}, {4}, {1, 2}}.

(b) A composite function g ◦ f exists if the range of f is a subset of the domain of g.


The range of f : S → T is {f (s) | s ∈ S}, which is a subset of T since f (s) ∈ T for
each s ∈ S. Also, the domain of g: T → U is T .
Therefore, the range of f is a subset of the domain of g, as required.
Now, let f and g both be injective, and consider any s1 , s2 ∈ S with
g ◦ f (s1 ) = g ◦ f (s2 ).
Then, by the definition of g ◦ f , g(f (s1)) = g(f (s2 )).
Therefore, using the injectivity of g, f (s1 ) = f (s2 ).
Therefore, using the injectivity of f , s1 = s2 .
Therefore, g ◦ f is injective (since g ◦ f (s1 ) = g ◦ f (s2 ) implied that
s1 = s2 , for any s1 , s2 ∈ S).

(c) (i) Let f : S → T be surjective.


Then f −1 (t) contains at least one element of S for each t ∈ T .
Now define g: T → S by
g(t) = (a fixed element of f −1 (t)), for each t ∈ T .
[Any choice for the fixed element of f −1 (t) can be made for each t ∈ T .]
Therefore, for each t ∈ T , f ◦ g(t) = f (g(t)) [using the definition of f ◦ g]
= t [using g(t) ∈ f −1 (t), and the definition of f −1 (t)].
Therefore f ◦ g = IT [using the definition of IT ],
and so f has a right inverse g, as required.
(ii) Let S and T be nonempty finite sets and f : S → T be surjective.
It can be seen that the different choices for the element of f −1 (t) for each
t ∈ T in (i) give all possible right inverses g: T → S of f .
Therefore, since there are |f −1 (t)| choices for g(t) for each t ∈ T , an expression
for the number of right inverses is
Y
|f −1 (t)|.
t∈T

15
(In fact, this expression remains valid even if f is not surjective, since in that
case there are no right inverses, and there exists some t ∈ T with f −1 (t) = ∅,
so that |f −1 (t)| = 0 and the product gives zero as required.)

(d) (i) f has four left inverses:


• h: [4] → [2] with h(1) = 1, h(2) = 2, h(3) = 1, h(4) = 1
• h: [4] → [2] with h(1) = 1, h(2) = 2, h(3) = 2, h(4) = 1
• h: [4] → [2] with h(1) = 2, h(2) = 2, h(3) = 1, h(4) = 1
• h: [4] → [2] with h(1) = 2, h(2) = 2, h(3) = 2, h(4) = 1
f has no right inverses (since it is not surjective).
(ii) g has no left inverses (since it is not injective).
g has four right inverses:
• k: [3] → [5] with k(1) = 4, k(2) = 1, k(3) = 3
• k: [3] → [5] with k(1) = 4, k(2) = 1, k(3) = 5
• k: [3] → [5] with k(1) = 4, k(2) = 2, k(3) = 3
• k: [3] → [5] with k(1) = 4, k(2) = 2, k(3) = 5

2. (a) (i) Let S be finite and f : S → T be surjective.


Now consider the range of f , f (S) = {f (s) | s ∈ S}.
Since S is finite, it follows that f (S) is also finite, since each element f (s)
of f (S) arises from an element s of S.
Furthermore, several distinct elements of S could give the same element
of f (S), which implies that |f (S)| ≤ |S|.
Since f is surjective, it follows that its codomain and range are equal, i.e.,
that T = f (S), and therefore that T is finite and |T | ≤ |S|, as required.
(ii) Let T be finite and f : S → T be injective.
Since f is injective, it has a left inverse g: T → S (i.e., g ◦ f = IS ).
Therefore, g has a right inverse f , and so g is surjective.
Therefore, since T is finite and g is surjective, it follows from (i)
that S is finite and |S| ≤ |T |, as required.

(b) (i) The selections of 2 elements from {2, 4} with order important and repetition
allowed are (2, 2), (2, 4), (4, 2), (4, 4).
(ii) The selections of 2 elements from {2, 4, 6} with order important and repetition
not allowed are (2, 4), (2, 6), (4, 2), (4, 6), (6, 2), (6, 4).
(iii) The selections of 3 elements from {2, 4} with order unimportant and repetition
allowed are {2, 2, 2}M, {2, 2, 4}M, {2, 4, 4}M, {4, 4, 4}M.

16
(iv) The selections of 2 elements from {2, 4, 6, 8} with order unimportant and
repetition not allowed are {2, 4}, {2, 6}, {2, 8}, {4, 6}, {4, 8}, {6, 8}.
(v) The permutations of {2, 2, 4, 4}M are (2, 2, 4, 4), (2, 4, 2, 4), (2, 4, 4, 2), (4, 2, 2, 4),
(4, 2, 4, 2), (4, 4, 2, 2).
(vi) The weak compositions of 5 into 2 parts are (0, 5), (1, 4), (2, 3), (3, 2), (4, 1),
(5, 0).
(vii) The compositions of 5 into 2 parts are (1, 4), (2, 3), (3, 2), (4, 1).
(viii) The partitions of 5 into 2 parts are {1, 4}M, {2, 3}M.
   
n−1 n−1 (n−1)! (n−1)!
(c) (i) RHS = + = +
k−1 k (k−1)! (n−k)! k! (n−k−1)!
(n−1)! k (n−1)! (n−k) (n−1)! k (n−1)! (n−k)
= + = +
k (k−1)! (n−k)! k! (n−k) (n−k−1)! k! (n−k)! k! (n−k)!
 
(n−1)! (k+n−k) n (n−1)! n! n
= = = =
k! (n−k)! k! (n−k)! k! (n−k)! k
= LHS, as required.
(ii) Let A be the set of all selections of k elements from [n] with order unimportant
and repetition not allowed, A1 be the set of elements of A which contain n,
and A2 be the set of elements of A which do not contain n.
(In fact, any other fixed element of [n] could be used here instead of n, although
slight modifications would then be needed in the rest of the proof.)
Thus, A = {S ⊂ [n] | |S| = k},
A1 = {S ∈ A | n ∈ S} and
A2 = {S ∈ A | n ∈ / S} = {S ⊂ [n−1] | |S| = k}.
   
n n−1
Therefore, |A| = and |A2 | = .
k k
It also follows that A = A1 ∪ A2 and A1 ∩ A2 = ∅, so that |A| = |A1 |+|A2|.
Now let B be the set of all selections of k−1 elements from [n−1] with order
unimportant and repetition not allowed, i.e., B = {T ⊂ [n−1] | |T | = k−1}.
 
n−1
Therefore, |B| = .
k−1
Finally, define functions f and g by f : A1 → B with f (S) = S \ {n} for
each S ∈ A1 , and g: B → A1 with g(T ) = T ∪ {n} for each T ∈ B.
It can be seen that f and g are well-defined, and that g is an inverse of f .
Therefore, using the standard results that if a function has an inverse then
it is a bijection, and that if a function is a bijection between two finite sets
then those sets have the same size, it follows that f is a bijection, and that

17
|A1 | = |B|.
     
n n−1 n−1
Hence, = |A| = |A1 | + |A2 | = |B| + |A2 | = + , as
k k−1 k
required.
(iii) For n = 4 and k = 3, A is the set of all selections of 3 elements from [4] with
order unimportant and repetition not allowed, A1 is the set of elements of A
which contain 4, A2 is the set of elements of A which do not contain 4, and B
is the set of all selections of 2 elements from [3], again with order unimportant
and repetition not allowed.
The functions f and g are given by f : A1 → B with f (S) = S \ {4} for each
S ∈ A1 , and g: B → A1 with g(T ) = T ∪ {4} for each T ∈ B.
Diagrammatically:
A

A1 B
f
{1,2,4} • • {1,2}
g
f
{1,3,4} • • {1,3}
g
f
{2,3,4} • • {2,3}
g

A2
{1,2,3}

   
m+n m+n
3. (a) (i) Number of paths = = .
m n
   
m+n−1 m+n−1
(ii) Number of solutions = = .
n m−1
   
m+n−1 m+n−1
(iii) Number of terms = = .
n m−1
(iv) Number of functions = n(n − 1) . . . (n − m + 1).
 
n(n−1)/2
(v) Number of graphs = .
m

(b) (i) The identity can be proved algebraically by simply setting x = −1 and y = 1
n  
n
X n k n−k
in the binomial theorem (x + y) = x y .
k=0
k
This gives LHS = (−1+1)n = 0n = 0 and

18
n   n   n   n  
X n k n−k
X n k
X n X n
RHS = (−1) 1 = (−1) = − ,
k=0
k k=0
k k=0
k k=0
k
k even k odd
n   n  
X n X n
which gives = , as required.
k=0
k k=0
k
k even k odd

(ii) Let A be the union of the sets of selections of k elements from [n] over all even
integers k between 0 and n, and let B be the union of the sets of selections
of k elements from [n] over all odd integers k between 0 and n, where in all
cases the selections are with order unimportant and repetition not allowed.
n   n  
X n X n
Then |A| = and |B| = .
k=0
k k=0
k
k even k odd

Equivalently, A is simply the set of all even-sized subsets of [n] and B is simply
the set of all odd-sized subsets of [n], i.e.,
A = {S ⊂ [n] | |S| is even} and B = {T ⊂ [n] | |T | is odd}.
Now define functions f : A → B and g: B → A by
( (
S \{n}, n∈S T \{n}, n∈T
f (S) = and g(T ) =
S ∪ {n}, n ∈
/S T ∪ {n}, n ∈
/ T,
for each S ∈ A and each T ∈ B.
Thus, f or g take a subset of [n] and if in n is in the subset, then it is removed,
whereas if n is not in the subset then it is added.
It follows that f and g are well-defined since adding or removing n from a
subset of [n] changes the parity of the size of the subset. It also follows that g
and f are respective inverses, since g ◦ f and f ◦ g are both identity functions,
as they involve taking a subset of [n], and then both adding and removing n
in one or other order, thereby giving back the original subset.
Therefore, using the standard results that if a function has an inverse then
it is a bijection, and that if a function is a bijection between two finite sets
then those sets have the same size, it follows that f is a bijection, and that
|A| = |B|.
n   n  
X n X n
Hence, = as required.
k=0
k k=0
k
k even k odd

[Note that any other fixed element of [n], instead than n, could have been
used in the definitions of f and g. Also, for the case of n odd, there is another
bijection f : A → B defined by f (S) = [n] \ S, for each S ∈ A.]

19
(iii) For n = 4:
A B
f
∅• g
• {4}
f
{1,2} • • {1,2,4}
g
f
{1,3} • • {1,3,4}
g
f
{1,4} • • {1}
g
f
{2,3} • • {2,3,4}
g
f
{2,4} • • {2}
g
f
{3,4} • • {3}
g
f
{1,2,3,4} • • {1,2,3}
g

(c) (i) Such functions f and g can be defined by


f : A → B with f ({s1 , . . . , sk−1}) = (s1 , s2−s1 , s3−s2 , . . . , sk−1−sk−2 , n − sk−1),
for each {s1 , . . . , sk−1} ∈ A with s1 < s2 < . . . < sk−1, and
g: B → A with g((a1 , . . . , ak )) = {a1 , a1 +a2 , . . . , a1 +a2 +. . .+ak−1 },
for each (a1 , . . . , ak ) ∈ B.
(ii) For each S ∈ A, f (S) can be obtained as follows.
• Draw n adjacent dots, numbered 1 to n from left to right.
• Place a bar to the right of each dot labeled by an element of S.
• The number of dots to the left of the first bar is the first part a1 of f (S),
the number of dots between the first and second bar is a2 , and so on, with
the number of dots to the right of the last bar being ak .
(iii) For n = 5 and k = 4, A is the set of selections of 3 elements from [4], with
order unimportant and repetition not allowed, and B is the set of composi-
tions of 5 into 4 parts. The functions f and g are given by f : A → B with
f ({s1 , s2 , s3 }) = (s1 , s2 − s1 , s3 − s2 , 5 − s3 ), for each {s1 , s2 , s3 } ∈ A with
s1 < s2 < s3 , and g: B → A with g((a1 , a2 , a3 , a4 )) = {a1 , a1 +a2 , a1 +a2 +a3 },
for each (a1 , a2 , a3 , a4 ) ∈ B.
Diagrammatically:
A B
f
{1,2,3} • • (1,1,1,2)
g
f
{1,2,4} • • (1,1,2,1)
g
f
{1,3,4} • • (1,2,1,1)
g
f
{2,3,4} • • (2,1,1,1)
g

20
(iv) For n = 5 and k = 4, the diagrams for each element of A are explicitly
{1, 2, 3} : • • • • • ,
1 2 3 4 5

{1, 2, 4} : • • • • • ,
1 2 3 4 5

{1, 3, 4} : • • • • • ,
1 2 3 4 5

{2, 3, 4} : • • • • • .
1 2 3 4 5

4. (a) (i) S(n, k) is the number of partitions of [n] (or any finite set of size n) into k
blocks.
(ii) Let A be the set of all nonempty subsets of [n−1], i.e., A = P([n−1])\{∅},
and let B be the set of all partitions of [n] into 2 blocks.
Then |A| = 2n−1 −1 and |B| = S(n, 2).
Now let the function f : A → B be given by f (T ) = { T, [n]\T },
for each T ∈ A.
It can be checked that f is well-defined and a bijection.
Therefore, using the standard result that if a function is a bijection
between two finite sets then those sets have the same size,
S(n, n−1) = |B| = |A| = 2n−1 −1, as required.
(iii) For the case of n = 4, the sets A and B, and the function f , are given by the
table:
T ∈A f (T ) ∈ B
{1} { {1}, {2, 3, 4} }
{2} { {2}, {1, 3, 4} }
{3} { {3}, {1, 2, 4} }
{1, 2} { {1, 2}, {3, 4} }
{1, 3} { {1, 3}, {2, 4} }
{2, 3} { {2, 3}, {1, 4} }
{1, 2, 3} { {1, 2, 3}, {4} }

(iv) Each surjective function f : [n] → [k] corresponds to a permutation (S1 , . . . , Sk )


of a partition of [n] into k blocks in which




1, s ∈ S1
2,

s ∈ S2
f (s) = ..




.

k, s ∈ Sk

21
i.e., a bijection can be formed between the set of surjective functions from [n]
to [k], and the set of permutations of partitions of [n] into k blocks.
Therefore, since there are S(n, k) partitions of [n] into k blocks,
and k! permutations of each partition, there are k! S(n, k) surjective
functions from [n] to [k].
 
0 1 0 1
1 0 1 0
(b) (i) For C4 , V = [4], E = {{1, 2}, {2, 3}, {3, 4}, {1, 4}} and A = 
0
.
1 0 1
1 0 1 0
 
0 0 1 1
0 0 1 1
(ii) For K2,2 , V = [4], E = {{1, 3}, {1, 4}, {2, 3}, {2, 4}} and A = 
1
.
1 0 0
1 1 0 0

(c) (i) Two graphs with vertex sets V1 and V2 , and respective edge sets E1 and E2 , are
defined to be isomorphic if there exists a bijection f : V1 → V2 which satisfies
{ {f (u), f (v)} | {u, v} ∈ E1 } = E2 .
(ii) The first graph has vertex set V1 = [5] and edge set
E1 = {{1, 2}, {1, 4}, {1, 5}, {2, 3}, {3, 4}, {3, 5}}, and
the second graph has vertex set V2 = [5] and edge set
E2 = {{1, 2}, {1, 3}, {1, 4}, {2, 5}, {3, 5}, {4, 5}}.
A bijection f : [5] → [5] which satisfies { {f (u), f (v)} | {u, v} ∈ E1 } = E2 is
f (1) = 1, f (2) = 4, f (3) = 5, f (4) = 3 and f (5) = 2. This can be explicitly
checked using the table
{u, v} ∈ E1 {f (u), f (v)}
{1, 2} {1, 4}
{1, 4} {1, 3}
{1, 5} {1, 2}
{2, 3} {4, 5}
{3, 4} {3, 5}
{3, 5} {2, 5}
where the edges of the first column are taken to be all those of E1 , and it is
then found that the edges of the second column comprise all those of E2 .
Therefore, the graphs are isomorphic.
(Note that there are other functions which satisfy the required condition. For
example, f : [5] → [5] with f (1) = 5, f (2) = 4, f (3) = 1, f (4) = 2 and f (5) = 3
is also a bijection which satisfies { {f (u), f (v)} | {u, v} ∈ E1 } = E2 .)

22

You might also like