Tutorial-CA2-Solutions
Tutorial-CA2-Solutions
Assessment 2
NTU, AY15/16 S2
Q1: There are 18 mathematics majors and 325 computer science majors at a college.
1. In how many ways can two representatives be picked so that one is a mathematics
major and the other is a computer science major?
Solution:18 · 325 = 5850
2. In how many ways can one representative be picked who is either a mathematics
major or a computer science major?
Solution:18 + 325 = 343
Q2: Let function f : X → Y , with |X| = m and |Y | = n.
1. How many functions f are possible ?
Solution:nm
2. How many one-to-one functions f are possible, given m ≤ n ?
Solution:P (n, m) = n!/(m − n)!
3. How many one-to-one correspondence f are possible, given m = n ?
Solution:P (n, n) = n!/(n − n)! = n!
Q3: How many positive integers less than 1000
1. are divisible by7?
Solution:⌊ 9997
⌋ = 142
2. are divisible by 7 but not by 11?
Solution:⌊ 9997
999
⌋ − ⌊ 7·11 ⌋ = 142 − 12 = 130
3. are divisible by both 7 and 11?
999
Solution:⌊ 7·11 ⌋ = 12
4. are divisible by either 7 or 11?
Solution:⌊ 9997
⌋ + ⌊ 999
11
999
⌋ − ⌊ 7·11 ⌋ = 142 + 90 − 12 = 220
5. are divisible by exactly one of 7 and 11?
Solution:⌊ 9997
⌋ + ⌊ 999
11
999
⌋ − 2 · ⌊ 7·11 ⌋ = 142 + 90 − 2 · 12 = 208
1
6. are divisible by neither 7 nor 11?
Solution:999 − 220 = 779
7. have distinct digits?
Solution:divide into 3 cases according to the number of digits the number has:
P (9, 1) + P (9, 1) · P (9, 1) + P (9, 1) · P (9, 2) = 9 + 81 + 648 = 738
8. have distinct digits and are even?
Solution:based on above, divide each of the 3 cases into 2 sub-cases according to
even/odd of the first (most significant) digit:
• 1 digit positive even number: 4
• 2 digits positive even number with the first digit odd: 5 × 5 = 25
• 2 digits positive even number with the first digit even: 4 × 4 = 16
• 3 digits positive even number with the first digit odd: 5 × 5 × (10 − 2) = 200
• 3 digits positive even number with the first digit even: 4 × 4 × (10 − 2) = 128
In total: 4 + 25 + 16 + 200 + 128 = 373.
Q4: Solve these recurrence relations together with the initial conditions given.
Q5: A bowl contains 10 red balls and 10 blue balls. A woman selects balls at random without
looking at them.
2
1. How many balls must she select to be sure of having at least three balls of the
same color?
Solution:x balls and 2 colors with ⌈ x2 ⌉ ≥ 3, hence x ≥ 5, at least 5 must she
select.
2. How many balls must she select to be sure of having at least three blue balls?
Solution:13, worst case is she selects 10 red balls, followed by 3 blue balls.
Q6: Show that whenever 25 girls and 25 boys are seated around a circular table there is
always a person both of whose neighbors are boys.
Solution: We assume that there is a sitting arrangement such that there is no one
sitting between two boys. We denote the positions a1 , a2 , . . . , a50 so that position a50 is
next to a1 . Now we split the youngsters into ”odd” and ”even” groups: (a1 , a3 , . . . , a49 )
and (a2 , a4 , . . . , a50 ) which we arrange around two smaller tables. Then, by our assump-
tion, no boys are next to each other at either table. So at each table there are at most
12 boys for a total of at most 24 boys. A contradiction. Therefore our assumption was
wrong and it is always possible to find someone sitting between two boys.
Q7: Suppose that 21 girls and 21 boys enter a mathematics competition. Furthermore,
suppose that each entrant solves at most six questions, and for every boy-girl pair,
there is at least one question that they both solved. Show that there is a question that
was solved by at least three girls and at least three boys.
Solution:optional: IMO 2001 Question. For each girl, we know that there is a boy
who solved a problem in common with her. Since a girl solves at most six problems,
for a girl and her set of six problems there are at least 11 boys who solved a problem in
common with the girl such that at least three boys solved that common problem. (This
is a simple application of the pigeon hole principle where the problems solved by the girl
are the holes and the boys are the pigeons, and the guy/pigeon enters a hole/problem
which he solved in common with the girl).
The boys have solved a total of at most 21 × 6 problems.We view this as a set with
repeated elements i.e. if a problem is solved by more than one boy it appears as many
times as the number of boys who have solved it. Let this set of problems be A. Clearly,
A has size 21 × 6.
We mark each problem in A which has been solved by at least three boys and a girl.
And we mark it the number of times that is the same as the number of girls that has
solved it. Since there are a total of 21 × 11 marks (since there are at least 11 marks
for each girl, by the discussion above), either a problem is marked at least thrice, in
which case we’re done since then it has been solved by at least three boys and three
girls. Or each problem has been marked at most twice. In this case it is clear that more
than 21 × 5 problems in A have been marked since 21 × 5 × 2 < 21 × 11 (there are a
total of 21 × 11 marks. This means that there is a boy such that all six of his problems
have been marked. But then by our discussion in the first paragraph we know there
3
must a problem that this boy has solved which has been solved by at least three girls.
Therefore it must be true that there is a problem such that it has been solved by at
least three people of each gender.
Q8: Prove that at a party where there are at least two people, there are two people who
know the same number of other people there.
Solution: If there are n people at the party, each one knows somewhere from 0 to
n − 1 of the others, which is n possibilities. But if one person knows all the others,
then all others know at at least one person (him/her) (here we assume knowing is
reflexive); or if there is one person knows nobody, then all others will know at most
n−2 persons (excluding him/her). Hence the number each person knows is either in the
range [0, n − 2] or [1, n − 1]. In either case, there are two that match by the pigeonhole
principle.
Q9: How many ordered pairs of integers (a, b) are needed to guarantee that there are two
ordered pairs (a1 , b1 ) and (a2 , b2 ) such that a1 mod 5=a2 mod 5, and b1 mod 5=b2 mod
5?
Solution:There are 5 × 5 = 25 pigeonholes, hence 26 pigeons (ordered pairs) are re-
quired.
Q10: Let (xi , yi ), i = 1, 2, 3, 4, 5, be a set of five distinct points with integer coordinates in the
xy plane. Show that the midpoint of the line joining at least one pair of these points
has integer coordinates.
Solution: we classify the points to 2 × 2 = 4 pigeonholes by the rule (xi mod 2, yi
mod 2), hence at least 2 will fall in the same pigeonholes, whose midpoint has integer
coordinates.
Q11: Let R be the relation on the set A = {1, 2, 3, 4, 5} containing the ordered pairs (1, 1),
(1, 2), (1, 3), (2, 3), (2, 4), (3, 1), (3, 4), (3, 5), (4, 2), (4, 5), (5, 1), (5, 2), and (5, 4). Find
R2 and R3 .
Solution:R2 = R ◦ R = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 1), (2, 2), (2, 4), (2, 5),
(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (4, 1), (4, 2), (4, 3), (4, 4), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5)}.
R3 = R2 ◦ R = A × A.
Q12: Let R1 and R2 be the “congruent modulo 3” and the “congruent modulo 4” relations,
respectively, on the set of integers. That is, R1 = {(a, b)|a ≡ b(mod 3)} and R2 =
{(a, b)|a ≡ b(mod 4)}. Find R1 ∩ R2 .
Solution: R1 ∩ R2 = {(a, b)|a ≡ b(mod 12)}.
Q13: Suppose that R and S are reflexive relations on a set A. Prove or disprove each of these
statements.
4
1. R ∪ S is reflexive.
Solution:True. ∀x ∈ A, (x, x) ∈ R since R is reflexive, and R ⊂ R ∪ S, so
∀x ∈ A, (x, x) ∈ R ∪ S, R ∪ S is reflexive.
2. R ∩ S is reflexive.
Solution:True. ∀x ∈ A, (x, x) ∈ R since R is reflexive, similarly (x, x) ∈ S as
well, so ∀x ∈ A, (x, x) ∈ R ∩ S, R ∩ S is reflexive.
3. R - S is NOT reflexive.
Solution:True. ∀xinA, (x, x) ∈ R and (x, x) ∈ S, hence (x, x) 6∈ R − S, R − S is
not reflexive.
4. S ◦ R is reflexive.
Solution:True. ∀xinA, (x, x) ∈ R and (x, x) ∈ S, hence (x, x) ∈ S ◦ R, S ◦ R is
reflexive.
Q14: Let R be the relation represented by the matrix
0 1 0
MR = 0 0 1 .
1 1 0
Find the matrices that represent R2 , R3 , and R4 .
Solution: R2 = R◦R = {(1, 3), (2, 1), (2, 2), (3, 2), (3, 3)}, R3 = R2 ◦R = {(1, 1), (1, 2), (2, 2), (2, 3),
R4 = R3 ◦ R = {(1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}.
Q15: Find the transitive closures of these relations on the set A = {1, 2, 3, 4}.
1. {(1, 2), (2, 1), (2, 3), (3, 4), (4, 1)}
Solution: Rt = A × A.
2. {(2, 1), (2, 3), (3, 1), (3, 4), (4, 1), (4, 3)}
Solution: Rt = {(2, 1), (2, 3), (2, 4), (3, 1), (3, 3), (3, 4), (4, 1), (4, 3), (4, 4)}.
3. {(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)}
Solution: Rt = {(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)} same as R since R itself is
already transitive.
4. {(1, 1), (1, 4), (2, 1), (2, 3), (3, 1), (3, 2), (3, 4), (4, 2)}
Solution: Rt = A × A.
Q16: Determine whether the relations represented by these zero-one matrices are partial
orders.
1.
1 0 1
1 1 0 .
0 0 1
Solution: No, R is not transitive because (2, 1), (1, 3) ∈ R but (2, 3) 6∈ R.
5
2.
1 0 0
0 1 0 .
1 0 1
Solution: Yes.
3.
1 0 1 0
0 1 1 0
.
0 0 1 1
1 1 0 1
Solution: No, R is not transitive since (1, 3), (3, 4) ∈ R, but (1, 4) 6∈ R.
Q17: Suppose that R1 and R2 are equivalence relations on the set S. Determine whether each
of these combinations of R1 and R2 must be an equivalence relation. a) R1 ∪ R2 , and
b) R1 ∩ R2 .
Solution: R1 ∪ R2 may not be equivalence relation since the “transitive” property may
not be satisfied, an example could be S = {a, b, c}, R1 = {(a, a), (a, b), (b, a), (b, b), (c, c)}
and R2 = {(a, a), (b, b), (b, c), (c, b), (c, c)}, (a, b), (b, c) ∈ R1 ∪ R2 but (a, c) 6∈ R1 ∪ R2 .
R1 ∩ R2 is equivalence relation.
Q18: Determine whether the relations represented by these zero?one matrices are equivalence
relations.
1.
1 1 1
0 1 1 .
1 1 1
Solution:NO, since M(1, 2) 6= M(2, 1) hence not symmetric
2.
1 0 1 0
0 1 0 1
.
1 0 1 0
0 1 0 1
Solution:Yes. Diagonal are all “1”s, hence “reflexive”; Matrix is symmetric with
respective to the diagonal, hence “symmetric”, “transitive” can be checked manu-
ally.
3.
1 1 1 0
1 1 1 0
.
1 1 1 0
0 0 0 1
Solution:Yes with the same reasoning as above.
6
Q19: Let Z5 = {0, 1, 2, 3, 4}, and define functions f, g : Z5 → Z5 as follows: f (x) = (x + 4)2
mod 5, and g(x) = (x2 + 3x + 1) mod 5. Is f = g ?
Solution:Yes, because f (x) = (x + 4)2 = x2 + 8x + 16 ≡ x2 + 3x + 1 mod 5 = g(x).
Q20: Determine whether the following functions defined on a set of real numbers are one-to-
one:
1. f (x) = x+1
x
, for all real numbers x 6= 0
Solution:Let x1x+1 1
= x2x+1
2
for non-zero real numbers x1 , x2 , then x2 (x1 + 1) =
x1 (x2 + 1), hence x1 = x2 , f is one-to-one.
2. f (x) = x2x+1 , for all real numbers x
Solution:Let x2x+1 1
= x2x+1
2
for some real numbers x1 , x2 , then x1 (x22 + 1) = x2 (x21 +
1 2
1) −→ (x1 −x2 )(1−x1 x2 ) = 0, hence x1 = x2 or x1 = x12 , hence f is not one-to-one.