21-127 Final Exam Practice Problems Solutions
Mary Radcliffe
1 Logic and Proof Techniques
1. Let p, q be logical propositions. Prove that (¬(p ∧ q)) ∧ (p ∨ q) is logically
equivalent to (p ∧ ¬q) ∨ (q ∧ ¬p).
Solution:
(¬(p ∧ q)) ∧ (p ∨ q) ≡ (¬p ∨ ¬q) ∧ (p ∨ q) (by De Morgan’s Laws)
≡ [(¬p ∨ ¬q) ∧ p] ∨ [(¬p ∨ ¬q) ∧ q] (by distributivity)
≡ (¬p ∧ p) ∨ (¬q ∧ p) ∨ (¬p ∧ q) ∨ (¬q ∧ q) (by distributivity)
≡ (¬q ∧ p) ∨ (¬p ∧ q) (since ¬p ∧ p and ¬q ∧ q are false)
√
2. Prove that p is irrational for any prime p > 0.
√
Solution: Suppose, to the contrary, that p is rational. Write
√
p = ab for a, b ∈ Z where a and b share no factors. Then
2
p = ab2 , and hence pb2 = a2 . Since p is prime and p|a2 , we
must have p|a, and hence there exists k ∈ Z with a = pk. Thus,
pb2 = p2 k 2 , and hence b2 = pk 2 . As above, p|b, and hence a and
b share the factor p. This is a contradiction, since it was assumed
√
that a and b share no factors. Therefore, p is irrational.
3. Find the smallest n > 0 such that n! is divisible by 990.
Solution: Note, 990 = 2 ∗ 5 ∗ 9 ∗ 11. We claim that the smallest
n > 0 having n! divisible by 990 is n = 11. Note, indeed, that
11! is divisible by 990, as 11! = 1∗2∗3∗4∗5∗6∗7∗8∗9∗10∗11 =
(2 ∗ 5 ∗ 9 ∗ 11) ∗ 3 ∗ 4 ∗ 6 ∗ 7 ∗ 8 ∗ 10, and is thus divisible by 990.
Moreover, if n < 11, then n! is not divisible by 11, since 11 is
prime. Therefore, if n < 11, then n! is not divisible by 990.
4. Let p and q be logical propositions.
(a) Prove that p ⇒ q is logically equivalent to ¬q ⇒ ¬p.
(b) Explain in words why the above statement makes sense.
Solution:
(a) Consider:
p⇒q ≡ ¬p ∨ q
≡ ¬(¬q) ∨ ¬p
≡ ¬q ⇒ ¬p.
1
(b) The statement p ⇒ q means that if p is true, we must also
have q to be true. That means if we know q is not true,
we can’t have p to be true either, since p being true would
force q to be true. Thus, if p ⇒ q is true, it must also be
that ¬q ⇒ ¬p is true.
5. Let p, q, r be logical propositions. Prove that
[p ⇒ (q ⇒ r)] ⇒ [(p ⇒ q) ⇒ (p ⇒ r)]
is tautologically true (that is, it is true regardless of the truth values of
p, q, r).
Solution: Consider:
[p ⇒ (q ⇒ r)] ⇒ [(p ⇒ q) ⇒ (p ⇒ r)] ≡ [p ⇒ (¬q ∨ r)] ⇒ [(¬p ∨ q) ⇒ (¬p ∨ r)]
≡ ¬p ∨ (¬q ∨ r) ⇒ ¬(¬p ∨ q) ∨ (¬p ∨ r)
≡ ¬(¬p ∨ (¬q ∨ r)) ∨ (p ∧ ¬q) ∨ (¬p ∨ r)
≡ [p ∧ (q ∧ ¬r)] ∨ (p ∧ ¬q) ∨ (¬p ∨ r).
Note, if the first term is true, then we have p is true, q is true, and r is
false. If it is not, then we have three cases:
Case 1: r is true. Then ¬p ∨ r is true, and the statement is true.
Case 2: p is false. Then ¬p ∨ r is true, and the statement is true.
Case 3: q is false. If p is also false, then see Case 2. If p is true, then
p ∧ ¬q is true, and the statement is true.
Hence, in any case, the statement is true. Therefore, it is a tautology.
2 Induction
Pk
1. Use induction to prove that i=1 (2i − 1) = k 2 .
Solution: We work by induction on k.
Pk
For the base case, consider k = 1. Then we have i=1 (2i − 1) =
2 ∗ 1 − 1 = 1 = 12 , and the result holds.
Pk
Now, suppose that for some k ∈ N, we have i=1 (2i − 1) = k 2 .
Then
k+1
X k
X
(2i − 1) = (2i − 1) + (2(k + 1) − 1)
i=1 i=1
2
= k + 2k + 2 − 1 (by the inductive hypothesis)
= k 2 + 2k + 1
= (k + 1)2 .
Therefore, the result holds by induction.
2
2. Let n ∈ N be written, in base 10, as 111 · · · 11, where there are 3k 1s in
the base expansion. Prove that n is divisible by 3k .
Solution: We work by induction on k. If k = 1, then we have
n = 111 = 3 ∗ 37, so n is divisible by 3k .
Now, suppose that for some k ∈ N, if n = 111 · · · 11 with 3k 1s
in the expansion, then n is divisible by 3k . Write n = 3k t for
t ∈ Z.
Consider m = 111 · · · 111, having 3k+1 1’s in its expansion. Note
that this is precisely 3 times as many 1s as in the expansion for
n, and so we can think of the base expansion for m as the
concatenation of 3 copies of that of m. In particular, we can
k k k
write m = n + 103 n + 103 +3 n, where in the second term the
k
coefficient 103 moves the copy of n over 3k positions, and in the
k k
third term the coefficient 103 +3 moves the copy of n over 3k
k k k
positions, twice. Thus, we can write m = n(1 + 103 + 103 +3 ).
k k k
Note that 1 + 103 + 103 +3 has a base expansion containing
exactly 3 1s, and hence it is divisible by 3, as the sum of the base
k
10 digits is 3. Therefore, there is some s ∈ Z with 1 + 103 +
k k k k k
103 +3 = 3s. Thus, m = n(1 + 103 + 103 +3 ) = 3k t3s =
k+1 k+1
3 st, and thus m is divisible by 3 .
Hence, the result holds by induction on k.
3. Suppose you draw n straight lines in the plane, where no two lines are
parallel and no three lines meet at a point. How many regions have you
divided the plane into? Prove that your answer is correct.
Solution: This process divides the plane into n(n+1)
2 +1 regions.
We prove this by induction on n.
First, suppose that n = 0. Then there are no lines, and one
region. Moreover, n(n+1)
2 + 1 = 0 + 1 = 1, so the formula is true.
Now, suppose that for some n ∈ N, it is known that drawing n
such lines in the plane divides the plane into n(n+1)
2 + 1 regions.
Suppose we draw n + 1 such lines. Note that first, we draw n
lines, so that we have n(n+1)
2 + 1 regions before the (n + 1)st
line is drawn. Now, this new line must cross each of the existing
n lines. Each time it does so, it enters a region and divides it
in half. Hence, it starts in one region (dividing it in two), and
enters and cuts n additional regions, one each time it crosses
an existing line. Thus, the (n + 1)st line adds n + 1 additional
regions. We therefore have that with n + 1 lines, we obtain
n(n + 1) n (n + 1)(n + 2)
+ 1 + n + 1 = (n + 1) + 1 +1 = +1
2 2 2
regions in the plane.
Therefore, the result holds by induction.
3
4. Define a sequence by a0 = 0, a1 = 1, and an = 3an−1 − 2an−2 for n ≥ 2.
Derive and prove a nonrecursive formula for an .
Solution: Let us consider some terms.
a0 = 0
a1 = 1
a2 = 3a1 − 2a0 = 3 ∗ 1 − 0 = 3
a3 = 3a2 − 2a1 = 3 ∗ 3 − 2 ∗ 1 = 7
a4 = 3a3 − 2a1 = 3 ∗ 7 − 2 ∗ 3 = 21 − 6 = 15
We conjecture that an = 2n −1. Let’s prove this with induction.
Note that for n = 0 and n = 1, we have an = 2n − 1 is true.
Suppose for some n ∈ N that ak = 2k − 1 for every k ≤ n.
Consider
an+1 = 3an − 2an−1
= 3(2n − 1) − 2(2n−1 − 1) (by the inductive hypothesis)
n n
= 3∗2 −3−2 +2
= 2n (3 − 1) − 1
= 2n+1 − 1.
Therefore, the result holds for all n ∈ N by induction.
5. Prove that for x1 , x2 , . . . , xn ∈ R, with xi ≥ 0 for all i,
x1 + x2 + · · · + xn √
≥ n x1 x2 . . . xn .
n
Solution: Let’s work by induction on n. For n = 1, we have
x1 +x2 +···+xn √ √
n = x1 and n x1 x2 . . . xn = 1 x1 = x1 , and hence
the result is true, since we obtain equality.
x1 +x2 +···+xn √
Suppose that for some n ∈ N, we have n ≥ n x1 x2 . . . xn
for any nonnegative xi ∈ R.
Let x1 , x2 , . . . , xn+1 be nonnegative real numbers. Put
x1 + x2 + · · · + xn+1
m= .
n+1
First note that if xi = m for all i, then the result is immediate,
since both the right and left hand sides equal m. If not all
xi = m, then since m is the average of the xi , there exists some
i with xi > m and there exists some j with xj < m. Wolog,
suppose that these are xn and xn+1 , respectively.
Set y1 = x1 , y2 = x2 , . . . , yn−1 = xn−1 , yn = xn + xn+1 − m.
Then by the inductive hypothesis, we have that
y1 + y2 + · · · + yn √
≥ n y1 y2 . . . yn .
n
4
We first note that
y1 + y2 + · · · + yn x1 + x2 + · · · + xn−1 + xn + xn+1 − m
=
n n
(n + 1)m − m
=
n
= m.
We next note that
x1 x2 . . . xn−1 (xn + xn+1 − m) = y1 y2 . . . yn
n
y1 + y2 + · · · + yn
≤ (by the inductive hypothesis)
n
= mn .
Therefore, we have
n+1
x1 + x2 + · · · + xn + xn+1
= mn+1
n+1
= mn m
≥ x1 x2 . . . xn−1 (xn + xn+1 − m)m.
Finally, consider (xn + xn+1 − m)m − xn xn+1 = (xn − m)(m −
xn+1 ). Note that by our wolog above, we have xn − m > 0
and m − xn+1 > 0, so this is positive. Therefore, (xn + xn+1 −
m)m − xn xn+1 > 0 ⇒ (xn + xn+1 − m)m > xn xn+1 . Making
this substitution, then, we have
n+1
x1 + x2 + · · · + xn + xn+1
> x1 x2 . . . xn−1 xn xn+1 .
n+1
1
Raising both sides to the n+1 power yields the result.
6. Let k ∈ N, with k 6= 0. Prove that k(k + 1)(k + 2) is divisible by 3.
Solution: If k = 1, then k(k + 1)(k + 2) = 1(2)(3) = 6 which is
divisible by 3.
Suppose that for some k ∈ N, we have k(k + 1)(k + 2) is divisible
by 3. Write k(k + 1)(k + 2) = 3t for some t ∈ Z.
Consider
(k + 1)(k + 2)(k + 3) = (k + 1)(k + 2)k + (k + 1)(k + 2)3
= 3t + 3(k + 1)(k + 2) (by the inductive hypothesis)
= 3(t + (k + 1)(k + 2)).
Therefore, (k + 1)(k + 2)(k + 3) is also divisible by 3.
Thus, by induction, the result holds for all k ∈ N.
5
3 Set Theory and functions
1. Let U1 , U2 , . . . , Uk be a finite partition of a set X, and let A ⊆ X. Prove
[ k
that A = (A ∩ Ui ).
i=1
Solution: We work by induction on k. If k = 1, then U1 = X
and A = A ∩ X = A ∩ U1 is true.
Suppose, now, that if U1 , U2 , . . . , Uk is a finite partition of X
k
[
and A ⊆ X, then A = (A ∩ Ui ).
i=1
Let V1 , V2 , . . . , Vk+1 be a finite partition of X, and set A ⊆ X.
Set U1 = V1 , U2 = V2 , . . . , Uk−1 = Vk−1 , and Uk = Vk ∪ Vk+1 .
Then U1 , U2 , . . . , Uk is also a finite partition of X, and by the
inductive hypothesis we have
k
[
A= (A ∩ Ui ).
i=1
Therefore,
k
[
A = (A ∩ Ui )
i=1
"k−1 #
[
= (A ∩ Ui ) ∪ (A ∩ Uk )
i=1
"k−1 #
[
= (A ∩ Ui ) ∪ (A ∩ (Vk ∪ Vk−1 ))
i=1
"k−1 #
[
= (A ∩ Ui ) ∪ (A ∩ Vk ) ∪ (A ∩ Vk−1 )) (by distributivity)
i=1
k+1
[
= (A ∩ Vi )
i=1
Therefore, the result holds for all k by induction.
2. Let X and Y be sets. Prove that X ⊆ Y if and only if X = Y \(Y \X).
Solution:
(⇒) Suppose that X ⊆ Y . Then x ∈ X implies x ∈ Y and
x∈/ Y \X, and hence x ∈ Y \(Y \X). Likewise, if x ∈ Y \(Y \X),
then x ∈ Y and x ∈/ Y \X, so x ∈ X. Therefore, X = Y \(Y \X).
(⇐) Suppose that X = Y \(Y \X). Then x ∈ X ⇒ x ∈
Y \(Y \X), so in particular, x ∈ Y . Therefore, X ⊆ Y .
3. Define a function f : R → R by the following: for every a ∈ R, let f (a) = x,
where x2 + 2ax + a2 = 0. Prove that this function is well-defined.
Solution: In order to prove that this function is well-defined,
we must show that for each a ∈ R, there is a unique choice
of x ∈ R satisfying x2 + 2ax + a2 = 0. Note, however, that
6
x2 + 2ax + a2 = (x + a)2 , and hence x2 + 2ax + a2 = 0 if and
only if x = −a. Therefore, for all a ∈ R, ∃!x ∈ R such that
f (a) = x, and therefore f is well-defined.
4. Let X and Y be sets, and let f : X → Y be a function.
(a) For A, B ⊆ X, prove that f (A ∪ B) = f (A) ∪ f (B).
(b) For A, B ⊆ X, prove that f (A ∩ B) ⊆ f (A) ∩ f (B), but that some-
times these sets may not be equal.
Solution:
(a) Let A, B ⊆ X. Suppose y ∈ f (A ∪ B). Then there exists
x ∈ A∪B with f (x) = y. If x ∈ A, then y = f (x) ∈ f (A) ⇒
y ∈ f (A) ∪ f (B). Likewise, if x ∈ B, then y ∈ f (A) ∪ f (B).
Therefore, f (A ∪ B) ⊆ f (A) ∪ f (B).
On the other hand, suppose that y ∈ f (A) ∪ f (B). Then
y is in at least one of f (A) or f (B); suppose wolog that
y ∈ f (A). Then ∃x ∈ A with f (x) = y. Since x ∈ A,
we also have x ∈ A ∪ B, and hence y = f (x) ∈ f (A ∪ B).
Therefore, f (A) ∪ f (B) ⊆ f (A ∪ B).
Combining these two containments, we obtain f (A ∪ B) =
f (A) ∪ f (B).
(b) Let A, B ⊆ X. Suppose y ∈ f (A ∩ B). Then there exists
x ∈ A ∩ B having f (x) = y. Since x ∈ A ∩ B, we have x ∈ A
and x ∈ B. Thus, y = f (x) ∈ f (A) and y = f (x) ∈ f (B),
so y ∈ f (A) ∩ f (B).
However, these sets may not be equal. Consider, for exam-
ple f : Z → Z defined by f (n) = n2 . Put A = {1} and B =
{−1}. Then f (A) = {1} = f (B), so f (A) ∩ f (B) = {1}.
However, A ∩ B = ∅, and thus f (A ∩ B) = ∅. Therefore,
f (A ∩ B) 6= f (A) ∩ f (B).
5. Let f : X → Y be a function. Prove that f is injective if and only if
f (A\B) = f (A)\f (B) for every A, B ⊆ X.
Solution: First, suppose that f is injective, and let A, B ⊆ X.
Then
y ∈ f (A\B) ⇔ ∃x ∈ A\B with f (x) = y
⇔ y = f (x) ∈ f (A) and y = f (x) ∈
/ f (B) (∗∗)
⇔ y ∈ f (A)\f (B).
where line (∗∗) follows since by injectivity no other x-value can
output y under f .
Therefore, the forward direction is true.
For the converse, suppose that f is not injective. Then there
exist x1 , x2 ∈ X with x1 6= x2 and f (x1 ) = f (x2 ) = y. Put
A = {x1 , x2 } and B = {x2 }. Then f (A) = f (B) = {y}, and
f (A\B) = f ({x1 }) = {y} also. But then f (A\B) 6= f (A)\f (B),
and hence we do not have f (A\B) = f (A)\f (B) for every
A, B ⊆ X. By contrapositive, then, if f (A\B) = f (A)\f (B)
for every A, B ⊆ X, then f is injective.
7
6. Let f : X → X be a function, where X is a finite set. Prove that f is
injective if and only if f is surjective. Explain why this is not true in the
case that X is infinite.
Solution: Suppose that f is injective. Then |X| = |f (X)|.
Moreover, f (X) ⊆ X, and since X is finite we therefore have
f (X) = X. Thus, ∀y ∈ X, we have that y ∈ f (X), so ∃x ∈ X
with f (x) = y. Thus, f is surjective.
For the converse, suppose that f is surjective. Then we have
f (X) = X, so |f (X)| = |X|. Since X is finite, this implies that
f is injective by the Pigeonhole Principle.
In the case that X is infinite, this result is no longer true because
f (X) ⊆ X and |f (X)| = |X| does not require that f (X) = X,
as it does in the finite case. Consider, for example, f : N → N
by f (x) = x2 . Then |X| = |f (X)|, but f (X) 6= X.
7. We know that function composition is associative. Is it also commutative?
Why/why not?
Solution: No. Indeed, we may not even be allowed to change
the order of composition, since if f : X → Y and g : Y → Z, we
can compose g ◦ f but not f ◦ g.
4 Counting: finite
1. (a) How many ways are there to rearrange the letters in the word “VEC-
TOR”?
(b) How many ways are there to rearrange the letters in the word “TRUST,”
in such a way that the two Ts are not next to each other?
(c) How many ways are there to rearrange the letters in the word “MATH-
EMATICS” so that no two consecutive letters are the same?
Solution:
(a) 6!
(b) First, we consider the number of ways to rearrange the let-
ters in general. We can first choose the positions of the
two Ts, in 52 ways. We then order the remaining elements
in3! ways into the remaining spots. This yields a total of
5 5!3!
2 3! = 2!3! = 60 possible rearrangements.
Now, we consider rearrangements in which the two Ts are
next to each other. If this is the case, we can treat the Ts as
a block, and consider permutations of the set {TT, R, U, S},
of which there are 4! = 24 permutations.
Together, this yields 60 − 24 = 36 rearrangements for which
the two Ts are not next to each other.
(c) Let us consider the number of duplicates: there are two Ms,
two As, and two Ts. There are 5 letters (H, E, I, C, S) that
are not duplicates.
First, we note that the total number of rearrangements of
11!
the letters is 2∗2∗2 , since there are 11! permutations of the
8
11 letters, but switching each of the Ms, As, or Ts results
in the same permutation, so each
is counted twice. (This
could also be counted as 112
9 7
2 2 5!)
Let SM denote those permutations for which the Ms are
consecutive, SA those for which the As are consecutive, and
ST those for which the Ts are consecutive. Then by using
the counting procedures above, we have
|SM ∪ SA ∪ ST | = |SM | + |SA | + |ST | − |SM ∩ SA | − |SM ∩ ST |
−|SA ∩ ST | + |SM ∩ SA ∩ ST |
10! 10! 10! 9! 9! 9!
= + + − − − + 8!
2∗2 2∗2 2∗2 2 2 2
Taken all together, we have that the number of permuta-
tions for which no consecutive letters are the same is
11! 3 ∗ 10! 3 ∗ 9!
− + − 8!
8 4 2
2. Let n ∈ N, with n ≥ 1. How many surjective functions are there from
[n + 1] to [n]?
Solution: If we have a surjective function f : [n + 1] → [n], it
must be the case that there exists exactly one k ∈ [n] such that
|f −1 (k)| = 2. Let S = {f : [n + 1] → [n] | f is surjective}, and
let Ak ⊆ S be the set of surjective functions having |f −1 (k)| = 2.
Then A1 , A2 , . . . , An is a pairwise disjoint partition of S, so
|S| = |A1 | + |A2 | + · · · + |An |.
Let us consider |Ak |. First, there are exactly two elements i, j ∈
[n + 1] having f (i) = f (j) = k. These can be selected in n+1 2
ways. The remaining n − 1 elements of [n + 1] are mapped in a
one-to-one fashion to the remaining n − 1 elements of [n]; this
can be done in (n − 1)! ways. Hence, there are n+1 2 (n − 1)! =
(n+1)!(n−1)! (n+1)! (n+1)!
2!(n−1)! = 2 such mappings, and |A k | = 2 .
Therefore, |S| = n (n+1)!
2 .
3. Prove that for all n, m, k ∈ N, we have
k
X n m n+m
=
` k−` k
`=0
Solution: Suppose there is a group of n men and m women,
and we must choose k of them to sit on a committee. Clearly,
this can be done in n+m
k ways.
On the other hand, we could also choose the men first and
women second. There is some number of men between 0 and
k; denote this by `. Then we wish to assign ` men and k − `
women to the committee, sothat we have a total of k members.
This can be done in n` k−`
m
ways. Letting ` range from 0 to k
forms a finite partition of all committee assignments, and hence
we have that the number of ways to select the committee is
k
X n m
.
` k−`
`=0
9
Since both the right and left hand sides of the equation count
the same thing (the number of ways to assign the committee),
they are equal.
4. Use counting in two ways to prove that for all n, k ∈ N with n ≥ k > 0,
we have
n n
X n X j−1
= 2n−j .
j n−k−1
j=n−k j=n−k
Solution: Let us count the number of subsets of [n] of size at
least n − k. Note that such subsets can have any
Psize from n − k
n
to n, and hence the number of such subsets is j=n−k nj .
Let us count in a different way. Since each subset has size at
least n − k, let j denote the (n − k)th element of the subset;
note that j can take any value between n − k and n. Then there
are n − k − 1 elements of the subset less than j, which can be
j−1
chosen in n−k−1 ways. The n − j elements larger than j can
either be in the subset or not; choosing whether to include such
elements can be done in 2n−j ways. Hence, for any particular
j−1
n−j
j, there are n−k−1 2 subsets of size at least n − k for which
j is the (n − k)th element of the set. As every set has a unique
(n−k)th element, this is a finite partition of the sets in question,
and hence the number of such sets is
n
X j−1
2n−j .
n−k−1
j=n−k
Therefore, by counting in two ways, we obtain
n n
X n X j−1
= 2n−j .
j n−k−1
j=n−k j=n−k
5. Use Inclusion-Exclusion to determine the number of subsets of [20] that
contain a multiple of 5.
Solution: Let Ad denote the set of subsets of [20] that contain
d; we wish to count |A5 ∪ A10 ∪ A15 ∪ A20 |. Using inclusion-
exclusion, we have
|A5 ∪ A10 ∪ A15 ∪ A20 | = |A5 | + |A10 | + |A15 | + |A2 0| − |A5 ∩ A10 |
−|A5 ∩ A15 | − |A5 ∩ A20 | − |A10 ∩ A15 |
−|A10 ∩ A20 | − |A15 ∩ A20 | + |A5 ∩ A10 ∩ A15 |
+|A5 ∩ A10 ∩ A20 | + |A5 ∩ A15 ∩ A20 |
+|A10 ∩ A15 ∩ A20 | − |A5 ∩ A10 ∩ A15 ∩ A20 |
= 4 ∗ 219 − 6 ∗ 218 + 4 ∗ 217 − 216
10
6. Suppose we have a box containing a set of standard chess pieces. You
select three pieces from the box. In how many ways can you select the
pieces so that
(a) all three are the same color.
(b) all three are the same color and all three are pawns.
(c) all three are rooks.
Solution:
(a) Given a choice of color, there are 16
3 waysto select 3 pieces
of the same color. Hence, there are 2 ∗ 163 ways to select 3
pieces of the same color.
(b) Given a choice of color, there are 83 ways to select 3 pawns
of that color. Hence, there are 2 ∗ 83 ways to select three
pawns of the same color.
(c) There are 4 rooks in the box, so there are 43 ways to select
3 rooks.
7. From a standard deck of cards, you deal out a five-card poker hand. How
many different hand have at least three cards of the same type (i.e., a
3-of-a-kind or 4-of-a-kind).
Solution: First, we have 13 different types of cards that could
have a 3-of-a-kind or a 4-of-a-kind. From these, there are 4 ways
to choose 3 of these cards. Once these 3 are chosen, there are 49
remaining cards in the deck, two of which must be added to the
hand (this will sometimes produce a 4-of-a-kind). Hence there
are 13 ∗ 4 ∗ 49
2 such hands.
5 Counting: infinite
1. Suppose that A, B, C are countably infinite disjoint sets. Prove that A ∪
B∪C is countably infinite directly, by finding a bijection between A∪B∪C
and N.
Solution: Let f : N → A, g : N → B, and h : N → C be
bijections. Define a function F : N → A ∪ B ∪ C by
f ( k+2
3 ) k ≡ 1 (mod 3)
F (k) = g( k+1
3 ) k ≡ 2 (mod 3)
k
h( 3 ) k ≡ 0 (mod 3)
Note then that F (1) = f (1), F (4) = f (2), F (7) = f (3), etc, so
that F ([1]3 ) = A, where [1]3 denotes the equivalence class of 1
modulo 3. Likewise, F ([2]3 ) = B and F ([3]3 ) = C. Thus, F
is surjective. Moreover, F is injective, since each of f, g, h are
injective.
Therefore F is a bijection, so |A ∪ B ∪ C| is countably infinite.
11
2. Let F = {f : X → {0, 1}}, where X is any set. Carefully go through the
Cantor diagonalization argument to show that |F| > |X|.
Solution: Suppose, to the contrary, that |F| ≤ |X|. For each
x ∈ X, note that we can define a function fx by fx (x) = 1
and fx (y) = 0 for y 6= x. Hence, we can produce an injection
G : X → F by G(x) = fx , so |X| ≤ |F|. Therefore, we must
have that |X| = |F|.
Therefore, there exists a bijection H : X → F. For simplicity
of notation, put H(x) = Hx : X → {0, 1}. Define a function
f : X → {0, 1} by
0 if Hx (x) = 1
f (x) =
1 if Hx (x) = 0
Since f is a function from X → {0, 1} we have that f ∈ F.
Since H is a bijection, there exists x ∈ X such that f ≡ Hx .
But f (x) 6= Hx (x), and hence f 6≡ Hx . This is a contradiction,
and hence we cannot have that |F| ≤ |X|.
Therefore, we must have |F| > |X|.
3. Let X, Y be nonempty sets of positive real numbers. Define
XY = {xy | x ∈ X, y ∈ Y }.
Prove that XY is infinite if and only if at least one of X or Y is infinite.
Solution:
(⇒) Suppose, for the sake of contrapositive, that neither X nor
Y is infinite, so that both are finite. Define a function F :
X × Y → XY by F ((x, y)) = xy. By definition of XY , we have
that F is surjective, and therefore |XY | ≤ |X × Y | = |X||Y |,
which is finite (by theorem from class). Hence, XY is finite.
Therefore, if XY is infinite, we must have at least one of X or
Y is infinite.
(⇐) Suppose at least one of X or Y is infinite, wolog say that
X is infinite. Let y0 ∈ Y be any element of Y . Then consider
{xy0 | x ∈ X} ⊆ XY . For x 6= x0 , we also have xy0 6= x0 y0 ,
and hence h : X → {xy0 | x ∈ X} defined by h(x) = xy0 is
a bijection. Therefore, |{xy0 | x ∈ X}| = |X|, and thus XY
contains an infinite subset. Therefore XY is infinite.
4. Let A be a collection of sets. We say that A has the finite intersection
property if the intersection of any finite number of sets in A is nonempty.
\ collection of sets A that have the finite
Give an example of an infinite
intersection property, but A is empty.
A∈A
Solution: There are MANY answers here.
Define A = {A1 , A2 , A3 , . . . }, where Ak = {k, k + 1, k2 , . . . }.
Then for k1 , k2 , . . . , kn , we have Ak1 ∩Ak2 ∩· · ·∩Akn = Amax{k1 ,k2 ,...,kn } ,
so any finite intersection of the Ak is nonempty.
12
\ ∞
\
On the other hand, A= Ak is empty. Indeed, suppose
A∈A k=1
∞
\
that N ∈ Ak . This would imply that N ∈ Ak for all k ∈ N.
k=1
∞
\
But N ∈
/ AN +1 , which is a contradiction. Hence, Ak is
k=1
empty.
6 Divisibility and Number Theory
1. Use the Euclidean Algorithm to prove that for all n ∈ N, the fraction
12n+1
30n+2 is in lowest terms.
Solution: Let us consider gcd(12n + 1, 30n + 2). Since n ∈ N,
we have 30n + 2 > 12n + 1. Following the Euclidean Algorithm:
30n + 2 = 2 ∗ (12n + 1) + 6n,
so gcd(30n + 2, 12n + 1) = gcd(12n + 1, 6n). But 12n + 1 ≡
1 (mod 6), and 6n ≡ 0 (mod 6), so 12n + 1 ⊥ 6n. Therefore,
gcd(30n + 2, 12n + 1) = 1, so 30n + 2 and 12n + 1 share no
common factors, and thus the fraction is in lowest terms.
2. Suppose that a, b, c, d ∈ N with ab − cd divides each of a, b, c, and d. Prove
that ab − cd = ±1.
Solution: First, if ab − cd = 0, note that this is impossible,
since a ∈ N, so a > 0 and 0 is therefore not a factor of a. Hence,
we can assume that ab − cd 6= 0.
Then we have integers k, j, n, m such that a = k(ab − cd), b =
j(ab − cd), c = n(ab − cd), d = m(ab − cd). Therefore, by sub-
stitution, we have
ab − cd = k(ab − cd)j(ab − cd) − n(ab − cd)m(ab − cd)
= (ab − cd)2 (kj − nm).
Since ab − cd 6= 0, we can divide by ab − cd to obtain 1 =
(ab − cd)(kj − nm). Moreover, both ab − cd and kj − nm are
integers, and hence as we have the product of integers equalling
1, we must have that ab − cd = kj − nm = ±1.
3. Find the set of all integer solutions to the equation 3x + 4y = 5.
Solution: First, notice that we have one solution x = −1, y =
2. Moreover, we have gcd(3, 4) = 1, so we have that other
solutions can be constructed as (−1 + 4k, 2 − 3k) for k ∈ Z.
Hence, we have the set of all such solutions is
{(x, y) ∈ Z × Z | x = −1 + 4k, y = 2 − 3k for some k ∈ Z}.
13
7 Modular arithmetic
1. Suppose that a ≡ b (mod n), and c ≡ d (mod n). Prove that ac ≡
bd (mod n).
Solution: Let k, j ∈ N be such that a = b + kn and c = d + jn.
Then
ac = (b + kn)(d + jn)
= bd + n(kd + bj + kjn),
and thus ac ≡ bd (mod n).
2. Calculate the remainder of 31000 when divided by 7.
Solution: Note that ϕ(7) = 6, so 36 ≡ 1 (mod 7). Therefore,
31000 ≡ 36∗166+4 ≡ (36 )166 34 ≡ 34 ≡ 92 ≡ 22 ≡ 4 (mod 7)
3. Suppose that a, b, c ∈ Zn , and a + b ≡ a + c (mod n). Is it true that
b ≡ c (mod n)? If so, prove it. If not, explain why not.
Solution: Yes, this is true. Since a + b ≡ a + c (mod n), we
have a + b − a ≡ a + c − a (mod n), so b ≡ c (mod n).
4. Find the set of all solutions to the congruences
x ≡ 7 (mod 1)1
x ≡ 3 (mod 5)
x ≡ 1 (mod 6)
Solution: By the Chinese Remainder Theorem, we know that
solutions must exist, since 11, 5, and 6 are coprime.
Put m1 = 5 ∗ 6 = 30 ≡ 8 (mod 1)1, m2 = 11 ∗ 6 = 66 ≡
1 (mod 5), and m3 = 11 ∗ 5 = 55 ≡ 1 (mod 6). Note then that
m1 has inverse y1 = 7 modulo 11, since 8∗7 = 56 ≡ 1 ( mod 1)1.
Moreover, m2 and m3 both have inverse y2 = y3 = 1. Therefore,
by the CRT, we have that solutions x satisfy
x ≡ 7 ∗ 7 ∗ 30 + 3 ∗ 1 ∗ 66 + 1 ∗ 1 ∗ 55 ≡ 1723 (mod 330).
Therefore, the set of all solutions is
{1723 + 330k | k ∈ Z}.
5. Suppose n > 1 is an integer such that 4((n − 1)! + 1) ≡ 0 ( mod n). Prove
that n = 4 or n is prime.
Solution: First, suppose that n is composite, so n = ab for
some a, b 6= 1 in N. We claim that (n − 1)! + 1 shares no factors
with n. Indeed, suppose that d|n. If d < n, then d|(n − 1)!, and
therefore d cannot divide (n − 1)! + 1. Therefore, a does not
divide (n − 1)! + 1 and neither does b. As a result, n does not
divide (n − 1)! + 1 either, and hence (n − 1)! + 1 is coprime to
n. Let y be the inverse of (n − 1)! + 1 modulo n. Then we have
4((n − 1)! + 1) ≡ 0 (mod n) ⇒ 4((n − 1)! + 1)y ≡ 0y (mod n)
⇒ 4 ≡ 0 (mod n).
14
Since n is assumed to be composite, and 4 ≡ 0 (mod n), we
must have that n = 4.
Therefore, if n is composite and 4((n − 1)! + 1) ≡ 0 (mod n),
we have n = 4. Thus,
4((n − 1)! + 1) ≡ 0 (mod n) ⇒ n is prime or n = 4.
6. Let S ⊆ [2n] with |S| ≥ n + 1. Prove that there exist a, b ∈ S, a 6= b, with
a|b.
Solution: Upon further reflection, this problem is probably in
the wrong section in this review. Sorry about that.
For each number x ∈ [2n], there is a unique choice of a, b such
that b is odd and x = 2a b, by the Fundamental Theorem of
Arithmetic. Let O = {x ∈ [2n] | x is odd}.
Define a function f : S → O by f (x) = b, where x = 2a b as
described above. By the observation above, f is well-defined.
Moreover, |O| = n and |S| ≥ n + 1, and hence there exists
x1 , x2 ∈ S having f (x1 ) = f (x2 ). Therefore, x1 = 2a1 b and
x2 = 2a2 b for some a1 6= a2 ∈ N. Wolog, suppose that a2 > a1 .
Then x1 |x2 .
8 Posets
1. Define a relation on N by x y if and only if x ≤ y and x and y have
the same parity. Is N a poset under ? If so, prove it. If not, explain why
not.
Solution: Yes, this is a poset.
Reflexivity: Note that ∀x ∈ N, x ≤ x and x has the same
parity as itself, so x x.
Transitivity: Suppose that x y and y z. Then x ≤ y and
y ≤ z, so x ≤ z. Moreover, x and y have the same parity, and
y and z have the same parity, so x and z also have the same
parity. Thus, x z.
Antisymmetry: Suppose that x y and y x. Then in
particular, x ≤ y and y ≤ x, so x = y.
2. Define a relation on N by x y if and only if x ≤ y and x ⊥ y. Is N a
poset under ? If so, prove it. If not, explain why not.
Solution: No, this is not a poset. It is not transitive. Consider
x = 2, y = 3, and z = 4. Then x ⊥ y, so x y, and y ⊥ z, so
y z, but x shares a factor with z, so x 6 z.
15