0% found this document useful (0 votes)
13 views43 pages

Tut Solutions

This document discusses discrete structures and their solutions. It contains questions and solutions related to predicate logic, prime numbers, games, and other topics. Predicate logic is used to express statements about primes, and famous conjectures involving primes are expressed using predicate logic. A game played on a matrix is analyzed, and it is proved that the first player can always win except in a 1x1 matrix.

Uploaded by

Abhijeet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views43 pages

Tut Solutions

This document discusses discrete structures and their solutions. It contains questions and solutions related to predicate logic, prime numbers, games, and other topics. Predicate logic is used to express statements about primes, and famous conjectures involving primes are expressed using predicate logic. A game played on a matrix is analyzed, and it is proved that the first player can always win except in a 1x1 matrix.

Uploaded by

Abhijeet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Discrete Structures

Tutorial Solutions

Ashwin Abraham
Rishabh RP

September 24th, 2023


Contents

1 Predicate Logic 2

2 Induction and the Peano Axioms 8

3 Divisibility and GCD 20

4 Modular Arithmetic 23

5 Euler Totient Function 25

6 Boolean Algebra 27

7 Sets, Relations and Functions 29

8 Equivalence Relations and Countability 32

9 Partial Orders and Lattices 35

10 Counting and Recurrences 37

11 Counting with Symmetries 39

12 Undirected Graphs 41

1
Chapter 1

Predicate Logic

Question 1
Assume the predicate prime(n) is defined over positive integers, which is true if and
only if n is a prime number. Express the following statements in predicate logic:

1. There exist infinitely many prime numbers.

2. There exists arbitrarily long sequences of consecutive numbers such that none
of them are prime.

3. A number n is prime if and only if (n − 1)! + 1 is divisible by n (Wilson’s


Theorem).

4. For all positive integers n, there exists a prime number p such that n ≤ p ≤ 2n.

Solution:
Author: Ashwin Abraham
A predicate is true for infinitely many natural numbers if and only if the set of numbers
for which the predicate is true has no upper bound. This is as any subset of the natural
numbers that has k as an upper bound can have at most k elements, and therefore
cannot be infinite. Taking the subset of natural numbers as the numbers for which the
predicate is true, the result follows. Using this, we can express statements including
terms such as ”infinitely many” and ”arbitrary long” using first order predicate logic.
While expressing the statements, we assume that arithmetic relations and operators
over the natural numbers such as +, ·, <, etc have already been defined. The domain
of all variables is assumed to be the set of natural numbers.

2
1. ∀n∃m(m > n ∧ prime(m))

2. ∀n∃m∃a∀x(x ≥ a ∧ x < a + m =⇒ ¬prime(x))

3. ∀n(prime(n) ⇐⇒ ∃k((n − 1)! + 1 = kn))

4. ∀n(n > 0 =⇒ ∃p(prime(p) ∧ n ≤ p ∧ p ≤ 2n))

Question 2
These are some famous problems involving primes, some of which are still unsolved.
Express them using predicate logic. Do NOT attempt to prove them or read the
proofs, where available.

1. There exist infinitely many prime numbers p such that p + 2 is also a prime.
This is also called the twin primes conjecture.

2. Every even number > 2 can be written as a sum of two (not necessarily distinct)
prime numbers. This is called the Goldbach conjecture.

3. There exist arbitrarily long arithmetic progressions of prime numbers. This was
proved in the early 2000’s by Ben Green and Terrence Tao.

4. There exists a constant c such that there are infinitely many pairs of distinct
prime numbers that differ by at most c. This was proved by Yitan Zhang in
2013 for c around 70 million. The value has now been reduced considerably.
More generally, for every k ≥ 2, there exists a constant c such that there are
infinitely many k-tuples of distinct prime numbers such that any two differ by
at most c.

Solution
Author: Ashwin Abraham
Again, the domain of all the variables is assumed to be N.

1. ∀n∃p(p > n ∧ prime(p) ∧ prime(p + 2))

2. ∀n(n > 2 ∧ ∃k(n = 2k) =⇒ ∃p∃q(prime(p) ∧ prime(q) ∧ n = p + q))

3. ∀n∃a∃d(d > 0 ∧ ∀i(i ≥ 0 ∧ i < n =⇒ prime(a + id)))

4. ∃c∀n∃p∃q(p > q ∧ p > n ∧ prime(p) ∧ prime(q) ∧ p ≤ q + c)

3
Question 3
This was observed by someone after the last class, and generalizes some properties
that were used. Let P be a predicate over some domain. Consider the following two
statements.
1. For all predicates Q, the statement ”for all x P (x) implies Q(x)” is equivalent
to the statement ”there exists x P (x) and Q(x)”.
2. ”There exists a unique x P (x)”.
Are the two statements equivalent to each other? If so, prove it, otherwise, give an
example of a predicate P for which one is true but not the other.

Solution
Author: Ashwin Abraham
NB: The person who observed this is in fact the author :)
If (2) is true, ie there exists a unique x (call it x0 ) such that P (x) is true, then we
will show that (1) is true. For any predicate Q, if there exists x such that P (x) ∧ Q(x)
is true, that x must be x0 , and Q(x0 ) must be true as well. Now, for x = x0 , since P (x)
and Q(x) are both true, we have P (x) =⇒ Q(x), and for x 6= x0 , P (x) is false, and
we therefore have P (x) =⇒ Q(x) irrespective of Q(x). Therefore, P (x) =⇒ Q(x)
is true for all x. On the other hand, if there doesn’t exist an x such that P (x) ∧ Q(x)
holds, then Q(x0 ) must be false. In this case, for x = x0 , P (x) is true but Q(x) is
false, and hence P (x) =⇒ Q(x) is false, which means P (x) =⇒ Q(x) does not hold
for all x (in fact it fails to hold only at x = x0 , as P (x) is false for other x). As you
can see, in both cases ”for all x P (x) implies Q(x)” is equivalent to the statement
”there exists x P (x) and Q(x)” and therefore (1) is true.
If (2) is false, then either there are no x such that P (x) is true, or there are distinct
x1 and x2 such that P (x1 ) and P (x2 ) are both true true. If there are no x such that
P (x) is true, then for any predicate Q, ”there exists x P (x) and Q(x)” is clearly false,
while ”for all x P (x) =⇒ Q(x)” is true, as P (x) is always false. Therefore those
two statements are not equivalent, ie (1) is false. If there are distinct x1 and x2 such
that P holds for both of them, then let us choose Q as the predicate x = x1 . For this
predicate, there does exists an x such that P (x) ∧ Q(x) hold (x1 ) but at x = x2 , P (x)
is true whereas Q(x) is false (since x1 6= x2 ). Therefore, the two statements are not
equivalent for all predicates Q.
We therefore have that (1) is true precisely when (2) is true, and therefore they
are equivalent. Notice how the universal quantification on Q was critical to prove the
theorem.

4
If we were to express this theorem in predicate logic, it would be:

∀P ([∀Q(∀x(P (x) =⇒ Q(x)) ⇐⇒ ∃x(P (x) ∧ Q(x)))] ⇐⇒ ∃u xP (x))

where ∃u xP (x) represents that there exists a unique x such that P (x) holds. In
normal predicate logic, this would be written as ∃x [P (x) ∧ ∀y(P (y) =⇒ y = x)].
Note that this is a sentence in second order logic, as we quantify over predicates.

Question 4
Consider a game played between two players on an n × m matrix with 0,1 entries.
Initially the matrix is all 0’s. The two players take turns and play alternately. In each
move, a player must select a 0 entry in some position (i, j) and convert all entries in
positions (x, y) for x ≥ i and y ≥ j to 1, if they are not already 1. At each move at
least one 0 gets converted to a 1. The player who selects the 0 in the position (1, 1),
after which the matrix has only 1 entries, loses the game. Prove that for all (n, m)
except (1, 1) the first player can win the game. It is possible to prove this without
actually finding what the winning move is. Can you find this move for general n, m?

Solution
Author: Ashwin Abraham
This game is known as the game of Chomp. It is usually framed in terms of an n × m
bar of chocolate where the piece at (1, 1) is poisoned. The players have to eat parts
of the chocolate in the way mentioned in the question - by choosing some piece at
(i, j) and eating all the pieces (x, y) where x ≥ i and y ≥ j. The person who eats the
poisoned piece loses (clearly!).
First of all, observe that this game is guaranteed to terminate in at most mn
moves, as in each move at least one 0 is converted to a 1. Also, one of the players
is guaranteed to lose - the one who selects (0, 0) in the end, when no other position
is available. The other is then guaranteed to win. Let us establish some results for
two player alternating games that are guaranteed to terminate in a win for one of the
players.
We construct something known as the Game Tree, where the nodes correspond to
possible histories of the game, where the history of the game is the sequence of states
the game has been in, from the starting state to the current state. We connect one
history to another if it is possible to go from the first history to the second by making
a valid move. Note that the first history will then be a prefix of the second history.
It is clear that this structure indeed corresponds to a tree, as cycles are not possible

5
(the length of the history increases by one each move) and each node - other than
the root (which corresponds to the starting state) - has a unique parent (its prefix).
Now, this tree is finite, as the game is guaranteed to terminate. The leaf nodes of the
tree therefore correspond to its terminal states.
We know that at the terminal states, either player A has won or player B has won.
Let us label1 the leaf nodes corresponding to the wins of player A as A and those
corresponding to the wins of player B as B. Note that every leaf node is labelled as
exactly one of A and B. We extend this labelling to all the nodes of the tree, where
nodes, from which A has a strategy with which he is guaranteed to win, no matter
what B plays (this is called a winning strategy - note that the strategy itself may
depend on what B plays) are labelled as A, and those where B has a winning strategy
are labelled as B. Note that a node cannot be labelled with both A and B, as both
A and B cannot have winning strategies at the same node. Claim: Every node in
the tree will end up labelled by either A or B, ie at every node either A or B have
winning strategies.
We prove this by strong induction on the depth of the game tree (the maximum
distance from root to a leaf node). As we induct, we consider gameplay starting not
just from the original starting state, but from any arbitrary (reachable) state. If the
depth of the game tree is 1, then this game tree corresponds to a starting state that
is already terminal, ie where no move can be made. We already know that terminal
states can be labelled with A or B, as in the terminal states, one of the players must
have one (for our game this is the player whose turn it is currently and who has
no move to make). Assume that for all game trees of depth at most d, every node
can be labelled as either A or B. A game tree of depth d + 1 is made up of a root
connected to multiple subtrees, each of height at most d. Each subtree corresponds
to a subgame starting at a different state. Since the previous state of the game does
not affect further gameplay, we can apply the inductive hypothesis on the subtrees, ie
all their nodes are labelled as either A or B, including their root nodes. This means
that all the children of the root node are labelled as either A or B. Now, if all the
children are labelled as B, this means that whatever move A makes, he will end up in
a state from which B can win. This means that the root should be labelled as B, as
B has a winning strategy for any move that A makes. However, if one of the children
of the root is labelled as A, then A can make the move that moves the state of the
game to that node, from which A has a winning strategy. Therefore in this case A
will have a winning strategy. In either case, the root node ends up labelled as either
A or B, completing our inductive proof. The player with whom the root is labelled
therefore has a winning strategy no matter what the other player plays2 .
1
An alternative way to label the nodes would be as 1 if the player whose turn it is has a winning
strategy, and 0 if the other player has a winning strategy.
2
This analysis was originally done by Von Neumann on the game of chess, where he proved that

6
For the game corresponding to non-leaf node u, if the first player (say p) has
a winning strategy, this means that there exists a child node of u winning for p.
Since it isn’t p’s turn at the child node, this means that either the child node is a
terminal state or every child node of this child is winning for p. Formally writing
down the condition (ignoring the case where the child is terminal), we get ∃v ∈
children(u)∀w ∈ children(v) [win(w) = p]. Such a game is called a ∃∀ game. If the
second player has a winning strategy, we get the condition ∀v ∈ children(u)∀w ∈
children(v) [win(w) 6= p]. These are ∀∃ games. This ∀∃ alternation is characteristic
of two player terminating games.
Since Chomp is a alternating two player game that always terminates in a win for
one of the players, the result we’ve just proven implies that one of the players (either
A the one who moves first or B who moves second) has a winning strategy no matter
what the other player plays. If m = n = 1, then clearly the first player always loses
and the second player always wins. Henceforth, we will assume that m and n are not
both 1. We then have to show that the first player A, has a winning strategy (ie we
have to show that Chomp is a ∃∀ game).
We will prove this by contradiction. Assume Chomp is a ∀∃ game. Now, the
root r is not a terminal state and the only child of the root that is terminal is
the one that corresponds to choosing (1, 1) - call this t. We therefore have ∀u ∈
children(r) [win(u) = B], and to be more specific, ∀u ∈ children(r) − {t}∃v ∈
children(u) [win(u) = B]. Let us consider the move where the first player chooses
(m, n). Since m and n are not both 1, this results in a transition to some u 6= t that
is not terminal. Now this node should have a child v that has win(v) = B. Now, v is
a node in which it is A’s turn to move but has win(v) = B. Notice that if the current
state at node v is S, then A could have made a move directly taking the game to
state S! The move A would make would be the same as the move that B just made.
Formally speaking there is some node w ∈ children(u) such that w and v have the
same current state. At node v, it was A’s turn, and we had win(v) = B. Since node
w has the same current state as v, but instead it is B’s turn, we have win(w) = A
(this is as the gameplay depends only on current state and not the entire history).
This leads to a contradiction, as we had obtained ∀u ∈ children(r) [win(u) = B].
Therefore, the first player must have a winning strategy in Chomp, for m and n not
both 1 (ie it is a ∃∀ game). Arguments like the one we made are known as strategy
stealing arguments.
For m = 1 or n = 1 it is easy to see the winning move is to choose the position
adjacent to (1, 1). For m = n > 1, the winning strategy is to first choose (2, 2) and
thereafter if the other player plays (p, q), play (q, p). The winning move for general
m, n has not yet been found by us.

either one of the players can force a win or both players can force a draw.

7
Chapter 2

Induction and the Peano Axioms

Question 1
Define the addition and multiplication operation of numbers using the basic assump-
tions. Prove the basic properties of the addition and multiplication operations on
numbers, such as commutativity, associativity and distributivity. Write your proof
as a sequence of statements, and write down the rule used to derive the statement
from the preceding statements. Henceforth, we will be assuming these properties of
arithmetic operations.

Solution
Author: Ashwin Abraham
The definitions of addition and multiplication will be recursive. To show that recursive
definitions are valid (ie there exists a unique function satisfying the definition), we
shall prove the following theorem.
Recursion Theorem:
For every set1 X, function g : X → X, and element x ∈ X, there exists a unique
function f : N → X such that f (0) = x and ∀n ∈ N, f (next(n)) = g(f (n)).
Proof:
Consider the set A of relations R from N to X that satisfy (0, x) ∈ R and
∀n ∈ N, ∀y ∈ X, (n, y) ∈ R =⇒ (next(n), g(y)) ∈ R. This is basically the set of
relations that satisfy the required recursion condition. Note that this set is non-empty
as N × X ∈ A. T
Let f be the intersection of all the relations in A, ie f = R. Since A is non-
R∈A

1
For the empty set, this will be vacuously true

8
empty, f is well-defined. We will show that f is a function that satisfies the recursion
condition. Firstly, since every R ∈ A has (0, x) ∈ R, we have (0, x) ∈ f . For any
n ∈ N, y ∈ X, if we have (n, y) ∈ f , then we have (n, y) ∈ R for every R ∈ A. This
means that we have (next(n), g(y)) ∈ R for every R ∈ A, ie (next(n), g(y)) ∈ f . This
means that f satisfies the recursive definition, ie f ∈ A. We also have that f ⊆ R,
for every R ∈ A.
We now show that f is a function. For this, we need to show that for every
n ∈ N, there exists a unique y ∈ X such that (n, y) ∈ f . We prove this by induction.
For n = 0, we have already established that (0, x) ∈ f . Consider the relation R =
{(0, x)} ∪ (N − {0}) × X. This relation has (0, x) ∈ R, and ∀n ∈ N, ∀y ∈ X, (n, y) ∈
R =⇒ (next(n), g(y)) ∈ R (the consequent is always true), ie R ∈ A. We therefore
have f ⊆ R, from which we can show that for any y ∈ X, (0, y) ∈ R =⇒ y = x.
Therefore, x is the unique element of X that 0 is mapped to. Now assume that for
some n ∈ N, there is a unique y ∈ X such that (n, y) ∈ f . We show that there is a
unique z ∈ X such that (next(n), z) ∈ f . Furthermore, this z = g(y). Since f ∈ A,
and (n, y) ∈ f , we have that (next(n), g(y)) ∈ f . Assume there is some z 6= g(y)
such that (next(n), z) ∈ f . Consider the relation f 0 = f − {(next(n), z)}. We clearly
have (0, x) ∈ f 0 . For any m, p ∈ N, if (m, p) ∈ f 0 , then (m, p) ∈ f , which means that
(next(m), g(p)) ∈ f . If m 6= n, then next(m) 6= next(n), and so (next(m), g(p)) ∈ f 0
as well. If m = n, by the inductive hypothesis, we have p = y, ie g(p) = g(y) 6= z.
Therefore (next(m), g(p)) ∈ f 0 . Therefore, f 0 too satisfies the recursive condition, ie
f 0 ∈ A. But then we have f ⊆ f 0 , which is a contradiction. Therefore, our assumption
must have been incorrect, ie g(y) is the unique element to which next(n) is mapped
to in f . This completes the induction, and shows that f is a function. We have
therefore shown existence.
Uniqueness is comparatively easier to show, and also follows from induction. Say
that f1 and f2 are two functions satisfying the given condition. By induction, we show
that f1 (n) = f2 (n) for every n ∈ N. We have f1 (0) = f2 (0) = x, and for any n ∈ N,
if f1 (n) = f2 (n) = k (for some k ∈ X), then f1 (next(n)) = f2 (next(n)) = g(k). This
completes the induction and shows uniqueness.

We can now define addition and multiplication recursively. We denote these func-
tions in infix notation, ie +(a, b) is written as a + b and ×(a, b) is written as a × b.
We define + as the unique function from N2 to N that satisfies:

1. ∀a ∈ N, a + 0 = a

2. ∀a, b ∈ N, a + next(b) = next(a + b)

To show that such a function exists and is unique, for any function + : N2 → N,
we define a function f+ : N → NN such that f+ (b)(a) = a + b for any two naturals

9
a, b. Note that this is clearly a bijective mapping. Now if + satisfies the conditions
mentioned above, then f+ must satisfy f+ (0) = I, where I is the identity function on N
satisfying I(a) = a for every natural N, and f+ (next(n)) = next(f+ (n)), where for any
function g : N → N, next(g) is defined such that ∀n ∈ N, next(g)(n) = next(g(n)).
By the recursion theorem, there exists a unique such f+ , and hence (since our mapping
was bijective) there exists a unique function + satisfying our conditions.
We define × as the unique function from N2 to N that satisfies:

1. ∀a ∈ N, a × 0 = 0

2. ∀a, b ∈ N, a × next(b) = a + a × b

We define a similar bijective mapping from functions × : N2 → N to functions


f× : N → NN , where f× (b)(a) = a × b, for every natural a and b. If × satisfies the
above conditions, clearly f× satisfies f× (0) = 0 (where 0 is the function on N that is
identically 0), and ∀n ∈ N, f× (next(n)) = g(f× (n)), where g is defined such that for
any function f on N and any natural n, g(f )(n) = n+f (n). By the recursion theorem,
there exists a unique such f× , and therefore (since our mapping was bijective), there
exists a unique function × satisfying those conditions.
We will prove that + and × are associative and commutative, and that × dis-
tributes over +.
Proof that + is associative:
We have to prove that ∀a, b, c ∈ N, (a + b) + c = a + (b + c). We induct on c. For c = 0,
the two are equal (by condition 1 on +). For any c ∈ N, if (a + b) + c = a + (b + c)
(say both equal k), then (a + b) + next(c) = a + (b + next(c)) = next(k). Therefore,
by induction, associativity is proven. We can therefore uniquely refer to a + b + c,
without bracketing.

Proof that + is commutative:


We have to prove that ∀a, b ∈ N, a + b = b + a. We will first prove this for b = 0,
ie ∀a ∈ N, 0 + a = a. This can easily be proven by induction on a. Next, we prove
that ∀a, b ∈ N, next(a) + b = next(a + b). This can be proven by induction on b.
Now, to prove our original statement, we induct on b. For b = 0, we have that for
every natural a, a + 0 = 0 + a = a, and for every b, if a + b = b + a = k, then
a + next(b) = next(b) + a = next(k). Therefore, by induction, commutativity is
proven.

Proof that × distributes over +:


We have to prove that ∀a, b, c ∈ N, a × (b + c) = a × b + a × c. We induct over c.
For c = 0, both terms equal a × b. For any c, if a × (b + c) = a × b + a × c, then

10
a×(b+next(c)) = a×next(b+c) = a+a×(b+c) = a+a×b+a×c = a×b+a+a×c =
a × b + a × next(c). Therefore, by induction, distributivity is proven.

Proof that × is associative:


We have to prove that ∀a, b, c ∈ N, a×(b×c) = (a×b)×c. We prove this by induction
over c. Both of the terms are equal to 0 at c = 0. For any c, if a × (b × c) = (a × b) × c,
then a × (b × next(c)) = a × (b + b × c) = a × b + a × (b × c) = a × b + (a × b) × c =
(a × b) × next(c). Therefore, by induction, associativity is proven. We can therefore
uniquely refer to a × b × c, without bracketing.

Proof that × is commutative:


We have to prove that ∀a, b ∈ N, a × b = b × a. We first prove that for every natural
a, 0 × a = 0. This can be done by induction on a. We then prove that for all naturals
a, b, next(b) × a = a + b × a. We induct on a. For a = 0, both terms are 0. For
any a, if next(b) × a = a + b × a, then next(b) × next(a) = next(b) + next(b) × a =
next(b) + a + b × a = a + next(b) + b × a = next(a + b) + b × a = next(b + a) + b × a =
b + next(a) + b × a = next(a) + b + b × a = next(a) + b × next(a). Therefore, this
is proven by induction. Now, we prove the original statement by induction on b. For
b = 0, both terms are 0. For any b, if a × b = b × a, then a × next(b) = a + a × b
and next(b) × a = a + b × a. Since a × b = b × a, the two are equal. Therefore, by
induction, commutativity is proven.

Some of the other properties of + and × that can be proven (usually by induction)
are:

1. ∀a, b, c ∈ N, a + c = b + c ⇐⇒ a = b

2. ∀a, b, c ∈ N, a × c = b × c ⇐⇒ a = b ∨ c = 0

We usually denote next(0) by 1. We then have next(a) = a + 1 for all naturals a. We


stop using the next function explicitly and refer to next(a) as a + 1. We also have

3. ∀a ∈ N, a × 1 = 1 × a = a

We stop using × explicitly as well, and refer to a × b as ab. Henceforth, we assume


these, and all other arithmetical properties of numbers.

Question 2
Define the usual < relation on natural numbers using induction. Note that this is
just a predicate < (m, n) which is true if m < n in the usual sense. Instead of the

11
induction principle, numbers can also be defined using the < relation and the next
function. The induction principle is replaced by the statement ”for any predicate P ,
if there exists an n such that P (n) is true, then there exists an n such that P (n) is
true and for all m < n, P (m) is false”. In other words, this says that if P (n) is true
for some n, then there is a smallest n for which it is true. This is known as the well
ordering principle. What properties of the < relation and next are needed so that
this defines exactly the properties of natural numbers.

Solution
We define the relation ≤ on N (infix notation is again used everywhere). < is defined
to be the relation such that a < b iff a ≤ b ∧ a 6= b. ≤ is defined such that for all
naturals a, b, a ≤ b ⇐⇒ ∃c ∈ N, a + c = b. It can be shown (by induction) that ≤
is a total order2 on N. The other arithmetic properties of ≤ can be shown too.
This is a non-recursive definition of ≤, in which we used +. However, if we are to
replace the induction principle by the well ordering principle, we will have to define
≤ recursively. We define ≤ as the unique relation on N satisfying:

1. ∀n ∈ N, 0 ≤ n

2. ∀n ∈ N, n ≤ 0 =⇒ n = 0

3. ∀m, n ∈ N, m ≤ n ⇐⇒ next(m) ≤ next(n)

Again, for any relation ≤ on N, we define f≤ : N → 2N such that for any natural x,
f (x) = {y ∈ N : x ≤ y}. It is easy to verify that this is a bijective mapping. For any
relation ≤ satisfying the above conditions, we have f≤ (0) = N and for every natural
n, f≤ (next(n)) = next(f≤ (n)), where next : 2N → 2N is defined such that for any
S ⊆ N, next(S) = {next(x) : x ∈ S}. By the recursion theorem, there exists a unique
such function f≤ , and therefore there exists a unique relation ≤ satisfying the above
conditions.
It is easy to show that the two definitions of ≤ are equivalent. First show by
induction on a that ∀a, b ∈ N, a ≤ a + b. Therefore, ∃c ∈ N, a + c = b =⇒ a ≤ b, for
all naturals a, b. We can show by induction on a that a ≤ b =⇒ ∃c ∈ N, a + c = b.
Now, the well ordering principle principle says that for all predicates P , ∃n ∈
N, P (n) =⇒ ∃m ∈ N [P (m) ∧ ∀n ∈ N, n < m =⇒ ¬P (n)], ie if P holds for some n,
then there is a minimal n for which it holds.
2
To show that the order is total (∀a, b ∈ N, a ≤ b ∨ b ≤ a), we show something stronger -
∀a, b ∈ N, a ≤ b ∨ next(b) ≤ a by induction on a. This means that for every natural b, there is no
natural strictly in between b and next(b).

12
Before we proceed, let us also state the principle of strong induction (the usual
principle of induction we’ve used so far is referred to as the principle of weak induc-
tion). The principle of strong induction states that for any predicate3 P , if for all
naturals n assuming P (m) is true for all m < n implies P (n), then P (n) holds for all
naturals n. This can be written formally as:

∀P [(∀n (∀m, m < n =⇒ P (m)) =⇒ P (n)) =⇒ ∀n P (n)]

We shall show that the Principle of Strong Induction is equivalent to the Well Or-
dering Principle, and both are strictly weaker than the Principle of Weak Induction4 .
Precisely speaking, we will prove the following:

1. Given the other (non-inductive) Peano axioms, and the definition of ≤, we can
show that strong induction is equivalent to the well ordering principle.5

2. Given the other Peano axioms, the definition of ≤, and the principle of weak
induction, we can derive the principle of strong induction and the well ordering
principle.

3. We can construct a system that satisfies the other Peano axioms, the principle
of strong induction, the well ordering principle and the definition of ≤, but does
not satisfy the principle of weak induction.

Proof of 1:
Let us assume that strong induction holds. Now we shall show that for any predicate
P , if P does not have a minimal element n that satisfies P , then no element can
satisfy P . We show this by strong induction on ¬P . For any n, if we assume that
∀m < n, ¬P (m) holds, ie P (m) does not hold, then P (n) cannot hold, as if it did,
n would be a minimal element that satisfied P . Therefore, ¬P (n) holds. By the
principle of strong induction, ∀n, ¬P (n), ie P does not hold for any n. This means
that if P holds for some n, there must be a minimal n for which it holds. Therefore,
strong induction =⇒ well ordering principle.
Now, let us assume that well ordering holds, ie for every predicate P , if there
exists an element n such that P (n) holds, then there exists a minimal element m such
that P (m) holds, and for all k < m, P (k) does not hold. Now, consider any predicate
P that satisfies the strong induction condition, ie ∀n (∀m < n P (m)) =⇒ P (n).
3
Note that all of these principles can be rephrased in terms of subsets instead of predicates.
4
Yes, the Principle of Weak Induction is the stronger one.
5
As you shall see, we actually don’t need the other Peano Axioms or the definition of ≤ to show
this - Strong Induction and Well Ordering are fundamentally equivalent! In fact, for any set that
can be well ordered, we can apply strong induction to prove predicates on it - in this context, strong
induction is known as transfinite induction.

13
There cannot exist a minimal element k that satisfies ¬P . If there did exist such an
element, then for all n < k, P (n) would hold, and by the strong induction condition,
this would mean P (k) holds, contradicting the fact that k satisfies ¬P . By well
ordering, this means that ¬P doesn’t hold for any element, ie ∀n P (n). Therefore,
well ordering principle =⇒ strong induction.
Therefore, the two are equivalent.

Proof of 2:
Since we have shown that strong induction is equivalent to the well ordering principle,
we just need to show that weak induction (along with the other Peano axioms and the
definition of ≤) implies one of them. We will show that strong induction is implied.
Assume that P is some predicate that satisfies the strong induction condition, ie
∀n (∀m < n P (m)) =⇒ P (n). Consider the predicate Q such that, Q(n) ≡
(∀m < n P (m)). Q(0) is vacuously true, and Q(next(n)) ⇐⇒ Q(n) ∧ P (n). The
strong induction condition becomes Q(n) =⇒ P (n). We therefore have Q(n) =⇒
Q(next(n)) for any natural n. By weak induction, we therefore have ∀n Q(n), ie
∀n ∀m < n P (m). Now, to show that this implies ∀n P (n), put m ← n and
n ← next(m) in the previous statement.
Therefore, weak induction =⇒ strong induction ⇐⇒ well ordering.

Proof of 3:
Now, we show that weak induction is strictly stronger than strong induction and well
ordering, by constructing a set that satisfies all the (non-inductive) Peano Axioms,
the definition of ≤, the principle of strong induction, and the well ordering principle,
but not the principle of weak induction.
Our set is S = N ∪ {∞}6 . nextS : S → S is defined such that for any x ∈ S,
(
next(x) x ∈ N
nextS (x) =
∞ x=∞

≤S is defined as {(a, b) ∈ N2 : a ≤ b} ∪ {(a, ∞) : a ∈ N}. It is easy to verify that


S, nextS , ≤S satisfy all of the Peano axioms and S is well ordered under ≤S , which
means strong induction must also hold on S. However, weak induction does not hold.
An example of a predicate that violates weak induction is the predicate x 6= ∞.
Intuitively, weak induction states that every element can be reached from 0 by finite
applications of next - this is violated here by ∞.

6
Some of you may recognize this as the ordinal ω + 1.

14
To be able to replace weak induction with strong induction or well ordering, we
need to add two more axioms7 :

1. ∀x, (x = 0) ∨ ∃y, x = next(y)

2. ∀x, x < next(x)

Note that these are provable theorems if weak induction is allowed, but must be added
as axioms if it is replaced by strong induction or well ordering.
With these new axioms, we can derive weak induction from (say) well ordering.
Say P is a predicate that satisfies the conditions for weak induction, ie P (0) holds,
and for all n, P (n) =⇒ P (next(n)). Assume there exists some n such that P (n)
does not hold, ie ¬P (n) holds. By well ordering, there must be a minimal m such
that ¬P (m) holds, and for all n < m, P (n) holds. m cannot be 0, as we know P (0)
holds. Therefore, by our new axiom, m = next(k) for some k. By the contrapositive
of the inductive condition, we have ¬P (next(k)) =⇒ ¬P (k). Therefore, ¬P (k)
holds. This however, contradicts the minimality of m (as k < m). Therefore, there
cannot exist any n such that P (n) doesn’t hold, ie ∀n P (n). Thus weak induction
holds.

Question 3
The principle of strong induction states that for any predicate P , if for all n, assuming
P (m) is true for all m < n implies P (n), then P (n) is true for all n. Express this
using propositional logic and show that this is equivalent to the usual principle of
induction. Use this to show that every number greater than 1 can be written as a
product of prime numbers.

Solution
In the previous question we have expressed the principle of strong induction in pred-
icate logic and shown that it is strictly weaker than the principle of weak induction.
They become equivalent only when the Peano axioms are augmented with two addi-
tional axioms.
To show that every number greater than 1 can be expressed as a product of primes,
we can use strong induction. Assume that for all m < n, if m > 1 then m can be
expressed as a product of primes. If n > 1 can only be factorized into 1 and n,
then it itself must be a prime - otherwise, if it can be factorized as n = pq, where
7
As an exercise, you can show that neither of these are redundant.

15
1 < p, q < n, then by the inductive hypothesis, p and q can be written as products of
primes, and hence n = pq can also be written as a product of primes.

Question 4
Prove that for every natural number m > 0, for every number n, there exist unique
natural numbers q and r such that n = qm + r and 0 ≤ r < m. This is called the
division property of numbers (ie Euclid’s Lemma) and is the starting point for many
basic results in number theory.

Solution
This can be proven by induction on n. The case n = 0 is trivial. For any natural n,
if there exist unique natural numbers q and r with 0 ≤ r < m such that n = qm + r,
then let us take two cases.

1. r = m − 1. In this case, n + 1 = (q + 1)m. Say n + 1 = q 0 m + r0 . If r0 > 0, then


n = q 0 m + (r0 − 1). By the inductive hypothesis, q = q 0 and r0 − 1 = r = m − 1,
ie r0 = m, which is a contradiction, as 0 ≤ r0 < m. Therefore, r0 = 0, ie
n + 1 = q 0 m. Clearly q 0 6= 0, and so n = (q 0 − 1)m + m − 1 = qm + r, ie
q 0 = q + 1. Therefore, we must have q 0 = q + 1 and r0 = m − 1, ie q 0 and r0 are
unique.

2. r < m − 1. Note that this can only occur when m ≥ 2. In this case n + 1 =
qm + r + 1, and 0 ≤ r + 1 < m. Say n + 1 = q 0 m + r0 . If r0 > 0, then
n = q 0 m + r0 − 1 = qm + r. By the inductive hypothesis, r0 = 1 + r and q 0 = q.
If r0 = 0, then q 0 6= 0, so n = (q 0 − 1)m + m − 1. By the inductive hypothesis,
q 0 − 1 = q and m − 1 = r. However, we assumed that r < m − 1, so this case
therefore cannot occur. Therefore, we must have q 0 = q and r0 = 1 + r, ie q 0
and r0 are unique.

Therefore, by induction, Euclid’s Lemma is proven.

Question 5
Prove that for all positive integers k, the product of any k consecutive numbers is
divisible by k!. There is a simple one line ”combinatorial” proof of this using a
counting argument, but try to prove it using only the basic properties of numbers.

16
Solution
k−1
Q
We have to show that for every positive integer k, and natural number n, k!| (n+i).
i=0
We induct on k. For k = 0 and k = 1, the product is 0 and n respectively both of
k−1
Q
which are clearly divisible by n. Assuming that for all naturals n, k!| (n + i),
i=0
k
Q
we have to show that for all naturals n, (k + 1)!| (n + i). We now induct on n.
i=0
For n = 0 and n = 1, the products are 0 and (k + 1)! which are clearly divisible
k k k
(n + 1 + i) = n+1+k
Q Q Q
by (k + 1)!. If (k + 1)!| (n + i), then we have n
(n + i) =
i=0 i=0 i=0
k
Q k−1
Q k−1
Q
(n+i)+(1+k) (n+1+i). The first term is divisible by (k +1)!, and (n+1+i)
i=0 i=0 i=0
k−1
Q
is divisible by k!, which means (1+k) (n+1+i) is also divisible by (1+k)!, making
i=0
k
Q
the whole thing divisible by (1 + k)!. Therefore, (k + 1)!| (n + i) for every natural
i=0
k−1
Q
n, and therefore k!| (n + i) for every natural n and positive integer k. This was an
i=0
example of nested induction. Qk−1
i=0 (n+i)
 (n+k−1)!
The combinatorial solution for this is observing that n+k−1
k
= k!(n−1)!
= k!
is an integer, corresponding to the number of ways of choosing k objects from n+k −1
distinct objects.

Question 6
The axioms of numbers defines the ”unary” representation of a number n, where n
is considered to be obtained by adding 1 to 0 n times. An equivalent set of axioms
can be defined using the ”binary” representation. Instead of the next function, we
assume two functions on numbers, double(n) and then double(n) + 1. Write down
the axioms needed using these two functions, to define the natural numbers. Show
that these are equivalent to the Peano axioms. Define the addition and multiplication
operations using these axioms.

17
Solution
We denote double by S0 and double + 1 by S1 . We will have S0 (n) = 2n + 28 and
S1 (n) = 2n + 1. The equivalent of the Peano axioms for this binary representation
will be:
1. 0 ∈ N

2. ∃S0 , S1 : N → N such that:

(a) S0 and S1 are injections


(b) ∀n, m ∈ N, S0 (m) 6= S1 (m)
(c) ∀n ∈ N, S0 (n) 6= 0, S1 (n) 6= 0

3. For all predicates P on N, if:

(a) P (0) holds


(b) ∀n ∈ N, P (n) =⇒ P (S0 (n))
(c) ∀n ∈ N, P (n) =⇒ P (S1 (n))

then ∀n ∈ N, P (n), ie P holds for all naturals.


The natural numbers under the usual Peano axioms with S0 (n) = 2n + 2 and S1 (n) =
2n+1 can be easily shown to satisfy axioms 1 and 2 of this new system, using Euclid’s
Lemma. Now, by a straightforward application of Euclid’s Lemma, for any n > 0,
either there exists k < n such that n = 2k + 1 or there exists k < n such that
n = 2k + 2. Say some predicate P satisfies the condition in axiom 3. We show that
P (n) holds for all naturals n, ie that axiom 3 holds. We do this by strong induction.
Assume that for some n, P (m) holds for all m < n. If n = 0, we already know that
P (0) is true, so ∀m < 0 P (m) =⇒ P (0). If n > 0, then there are two cases: either
there exists k < n such that n = 2k + 1, in which case P (n) holds, because P (k)
holds and P (k) =⇒ P (2k + 1), or there exists k < n such that n = 2k + 2, in which
case also P (n) holds, as P (k) holds and P (k) =⇒ P (2k + 2). Therefore, P (n) holds
in both cases, and by the principle of strong induction, P (n) holds for all naturals n.
Therefore, the normal Peano axioms imply this new set of axioms
To show the converse, we have to show that our new system satisfies the old set of
Peano Axioms. Note that first Peano axiom is automatically satisfied. For the other
axioms, we will have to construct a next function that satisfies the Peano axioms.
We define next as the unique function from N to itself satisfying:
8
This is just to make the axiomatization easier while keeping 0 ∈ N, as if S0 (n) = 2n, then we
would have S0 (0) = 0. However, the axiomatization can still be done with S0 (n) = 2n and 0 ∈ N.

18
1. next(0) = S1 (0)

2. ∀n ∈ N, next(S0 (n)) = S1 (next(n))

3. ∀n ∈ N, next(S1 (n)) = S0 (n)

The existence and uniqueness of this function can be shown via a proof along the
lines of that of the recursion theorem9 .
We have to show that ∀n ∈ N, next(n) 6= 0 and that next is an injection. This
can be done by application of axiom 3, which is the equivalent of induction for this
system.
Finally, we have to show that the principle of induction holds, ie for any predicate
P , if P (0) holds, and ∀n ∈ N, P (n) =⇒ P (next(n)), then ∀n ∈ N, P (n).

Question 7
Let a, b be natural numbers. Consider the following statement. For all predicates
P (n), (P (a) and P (b) and for all n, m ((P (n) and P (m)) implies P (n + m)) implies
(P (n) is true for sufficiently large n)). Write down a simple statement equivalent to
this, without using quantification over predicates, and prove that your statement is
equivalent to this.

9
The appropriate generalization of the recursion theorem is the Unique Homomorphic Extension
Theorem.

19
Chapter 3

Divisibility and GCD

Question 1
Let a, b be positive numbers and let X be the set of all positive numbers r such that
xa = yb + r for some natural numbers x, y. Prove that the set X is exactly the set of
all multiples of gcd(a, b). First show that the smallest element must be gcd(a, b) and
any other element must be a multiple of it.

Question 2
Let a, b be positive numbers such that a 6= 0 mod b. Let g > 0 be the smallest
number such that xa = g mod b for some number x. Prove that g = gcd(a, b). This
implies that a has a multiplicative inverse mod b if and only if gcd(a, b) = 1.

Question 3
Consider the following definition of a function f (n, m). Define f (0, n) = n for all n,
f (n, m) = f (m, n) for all m, n and f (n, m) = f (n mod m, m). Prove using strong
induction that this defines f uniquely and that for all n, m, f (n, m) = gcd(n, m).
This gives an algorithm to compute gcd(n, m) known as Euclid’s Algorithm. If n
and m are numbers with k bits in their binary representations, find an upper bound
on the number of arithmetic operations required to compute their gcd. Modify the
algorithm to find x, y such that xn = ym + gcd(n, m).

20
Question 4
Another algorithm for finding the gcd is given by a different definition. Again define
f (0, n) = f (n, 0) = n for all n, and for any n, m the following hold: f (2n, 2m) =
2f (n, m), f (2n, 2m + 1) = f (n, 2m + 1), f (2n + 1, 2m) = f (2n + 1, m), and f (2n +
1, 2m + 1) = f (2m + 1, n − m) if m ≤ n and f (2n + 1, m − n) otherwise. Prove that
this function is uniquely defined and gives exactly gcd(n, m) for all n, m. This needs
the fact that any n > 0 is either 2m or 2m + 1 for some m < n. This algorithm
has the advantage that it uses only subtraction and division by two, and is easier to
implement in hardware.

Question 5
Prove that if 2n − 1 is prime then n must be prime. Give an example to show that
converse is not true. Prove that gcd(2m −1, 2n −1) = 2gcd(m,n) −1. More generally, show
that if gcd(a, b) = 1 and 0 ≤ m < n, then gcd(am − bm , an − bn ) = agcd(m,n) − bgcd(m,n) .
Hint: Use Euclid’s algorithm.

Question 6
Let n > m >0 be positive integers. Prove that if gcd(n, m) = 1, then the binomial
n
coefficient m is divisible by n. Is the converse of this statement true? (Hint: There
is a simple combinatorial proof for this.) Use this to prove Fermat’s Little Theorem
that for any prime p and for all x, xp − x is divisible by p. Prove that 2n − 1 is not
divisible by n for any n > 1.

Question 7
Let m, n be positive integers such that m divides n. Show that there exist numbers
a, b such that a ≤ b, gcd(a, b) = m and lcm(a, b) = n. Find a necessary and sufficient
condition on m and n such that there exists a unique such pair of numbers. Prove
that in general the number of solutions is a power of 2.

Question 8
0
Consider two fractions mn
and mn0
in lowest terms. In other words, gcd(m, n) =
0
0 0
gcd(m , n ) = 1. Prove that when the sum m n
+m
n0
is reduced to lowest terms, the
0 0
denominator will be nn if and only if gcd(n, n ) = 1.

21
Question 9
Let a and b be positive irrational numbers such that a1 + 1b = 1. Prove that for every
positive integer n there exists a positive integer k such that n = bkac or n = bkbc.

Question 10
Consider an m×n matrix A with integer entries. Let L be the set of all m-dimensional
vectors v such that v = Ax for some n-dimensional vector x with integer entries. The
set L is called a lattice. Prove that for any such matrix A there exists an m×m matrix
B such that L is exactly the set of vectors By, where y is any integral
 m-dimensional
vector. Note that when  A is the
 1 × 2 dimensional matrix a b , then B is the 1 × 1
dimensional matrix gcd(a, b) . B is called a basis for L. A challenging problem
is to find a basis with ”smallest” possible entries and a vector in L with smallest
possible magnitude. This is equivalent to finding gcd when m = 1 but is much more
difficult for arbitrary m. Try to do it for m = 2. The dimension of L is the smallest
k such that every vector in L can be written as an integral linear combination of k
m-dimensional vectors. The dimension of L is at most m but may be less than m.
Given the matrix A, can you give an efficient algorithm to find the dimension of L.

22
Chapter 4

Modular Arithmetic

Question 1
Let m, n be positive integers such that gcd(m, n) = 1. Prove that for all a ∈ Zm
and b ∈ Zn there exists a unique number x in Zmn such that x = a mod m and
x = b mod n. This is known as the Chinese Remainder Theorem. Suppose now that
gcd(m, n) = d for some number d. Find a necessary and sufficient condition on a and
b for such a number x to exist. If it exists, how many distinct such numbers exist in
Zmn ? Can you find an explicit description of all possible solutions?

Question 2
A number a such that 1 ≤ a < n is called a quadratic residue modulo n iff the
congruence x2 = a mod n has a solution. If n is a prime number, how many quadratic
residues are there modulo n? If n = pq is a product of two distinct odd prime numbers,
how many quadratic residues are there modulo n?

Question 3
Let n be a prime number and P (x) = a0 + a1 x + a2 x2 + · · · + ad−1 xd−1 + xd be a monic
polynomial of degree d with coefficients ai ∈ Zn for 0 ≤ i < d. An element a ∈ Zn
is called a root of the polynomial iff P (a) = 0 mod n. Prove that a polynomial of
degree d ≥ 1 has at most d roots in Zn . For all primes n, prove that there exists a
polynomial of degree 2 that has no roots in Zn . Such a polynomial is called irreducible
modulo n. Try to explicitly construct such a polynomial for a general prime n. Try
to generalize this to polynomials of degree d for d ≥ 2.

23
Question 4
Let n be a prime number and a a number not divisible by n. The order of a modulo
n is the smallest positive number k such that ak = 1 mod n. Prove that the order
of a divides n − 1. The number a is said to be a primitive root modulo n iff it’s order
is n − 1. Prove that for all primes p, there exists a primitive root modulo n. Find
all primitive roots modulo n for n = 3, 5, 11, 13. Prove that n is prime if and only
n−1
if there exists a number a ∈ Zn such that an−1 = 1 mod n and a p 6= 1 mod n
for any prime p that divides n − 1. Hint: Try to find for each divisor d of n − 1 the
number of elements in Zn of order d. This may need some results from the previous
problem.

Question 5
While Wilson’s Theorem gives a necessary and sufficient condition for a number to
be prime, Fermat’s Little Theorem only gives a necessary condition which is not
sufficient. There exist composite numbers n such that for all a, gcd(a, n) = 1 implies
an−1 = 1 mod n. Such numbers are called Carmichael numbers. Prove that a number
n is a Carmichael number if and only if n is a product of distinct primes and for
every prime p that divides n, p − 1 divides n − 1. The smallest Carmichael number
is 561 = 3 × 11 × 17, and it is known that there are infinitely many of them. Find
small values of a for which 561 is declared to be composite by the Miller-Rabin test.

24
Chapter 5

Euler Totient Function

Question 1
P
Prove that φ(d) = n for all positive integers n. Give a combinatorial proof of this
d|n
by showing that there is a one-to-one and onto function from {1, 2, . . . , n} to the set
of ordered pairs (d, e) where d is a divisor of n and 1 ≤ e ≤ d with gcd(e, d) = 1.

Question 2
Use the previous result to prove that if p is a prime number, then for every divisor d
of p − 1, Z∗p contains exactly φ(d) elements of order d. Prove that Z∗n has an element
of order φ(n) (a generator) iff n is one of 2, 4, pk or 2pk for some odd prime p and
integer k ≥ 1.

Question 3
Prove that if m divides n, then φ(m) divides φ(n). Give a combinatorial proof of
this by showing that Z∗n can be partitioned into φ(m) parts of equal size or into some
number of parts of size φ(m).

Question 4
The Mobius function µ(n) is defined as µ(1) = 1, µ(n) = 0 if n is divisible by p2 for
some prime p and µ(n) = (−1)k if n = p1 p2 . . . pk is a product of k distinct
P primes.
Suppose f (n) and g(n) are functions such that for all n ≥ 1, g(n) = f (d). Prove
d|n

25
g(d)µ( nd ). This is called Mobius inversion and is a special case of a
P
that f (n) =
d|n
P
more general result. Use this and the earlier proven result that φ(d) = n to derive
d|n
the expression for φ(n).

Question 5
n
n(n+1)
φ(k)b nk c =
P
Prove that 2
. Hint: Consider all possible rational numbers in
k=1
(0, 1) with denominator at most n, and consider their reduced forms.

26
Chapter 6

Boolean Algebra

Question 1
Prove that in any Boolean algebra B, (xy)c = xc + y c and (x + y)c = xc y c , for all
x, y ∈ B. These are called De Morgan’s Laws. Also prove that x + xc y = x + y.

Question 2
A Boolean expression with n variables {x1 , x2 , · · · , xn } over a Boolean algebra B is
defined recursively as follows. A single variable xi is a Boolean expression. If e1 , e2
are Boolean expressions then e1 + e2 , e1 e2 and ec1 are also Boolean expressions. Given
an assignment of values bi ∈ B to each variable xi , the value of an expression is
defined recursively as v(xi ) = bi , v(e1 + e2 ) = v(e1 ) + v(e2 ), v(e1 e2 ) = v(e1 )v(e2 ) and
v(ec1 ) = v(e1 )c . A Boolean expression e with n variables therefore defines a function
f : B n → B as f (b1 , b2 , · · · , bn ) = v(e) for the assignment of values v(xi ) = bi . Prove
that every function f : B n → B can be represented by a Boolean expression if B is
a Boolean algebra with 2 elements. Is this true for any finite Boolean algebra? If
so, prove it, otherwise give an example for which it is not possible. Say we modify
the definition of an expression by allowing any constant a ∈ B to be also considered
an expression. These expressions are known as polynomial expressions. Show that
for 2 element Boolean algebras, the set of polynomial expressions is the same as the
set of Boolean expressions. For finite Boolean algebras B, can the set of polynomial
expressions represent every function from B n to B? If so, prove it, if not, find a
counterexample. How will you modify the definition of an expression, so that all
functions over any finite Boolean algebra can be represented? For 2 element Boolean
algebras, the representation of a function as a Boolean expression is not unique, and a
challenging problem is to find the ”smallest” possible expression representing a given

27
function. We can define arithmetic expressions using + and × over N in a similar
way. Can the set arithmetic expression with n-variables represent every function from
Nn to N? What about the set of polynomial arithmetic expressions?

Question 3
Suppose e1 and e2 are two Boolean expressions with n variables over the Boolean
algebra with two elements {0, 1} that represent the same function {0, 1}n → {0, 1}.
Prove that they represent the same function over any Boolean algebra. Show that
the statement for all x1 , x2 , · · · , xn (e1 = e2 ) can be formally proven using just the
axioms of Boolean algebras. De Morgan’s Laws are examples of this. Can you think
of a systematic way of finding such proofs that use only the axioms?

Question 4
We have seen that for any set S, its power set 2S is a Boolean algebra with X + Y =
X ∪ Y , XY = X ∩ Y and X c = S − X, for any X, Y ⊆ S. 0 here corresponds to ∅
and 1 to S. Now, show that for any finite Boolean algebra B there is an isomorphism
from B to the power set of some finite set S. An isomorphism here refers to a
bijection f : B → 2S that satisfies f (x + y) = f (x) ∪ f (y), f (xy) = f (x) ∩ f (y) and
f (xc ) = S − f (x), for all x, y ∈ B. For a finite Boolean algebra B, suppose we drop
the axiom of existence of a complement but instead add the axioms a + 1 = 1 and
a · 0 = 0 for all a ∈ B. As we have seen, the set of divisors of a number n, with
+ as lcm and · as gcd is an example of such a structure, with 0 corresponding to
1 and 1 corresponding to n. This is equivalent to the set of multisubsets of a finite
multiset, which is another example of a set satisfying these axioms with + as ∪ and
· as ∩. Show that any finite Boolean algebra with the modified axioms is isomorphic
to the set of multisubsets of a multiset, with + as ∪ and · as ∩. Hint: Try to find the
”atoms” and a ”multiplicity” for each ”atom”. Suppose we also drop the assumptions
a + 1 = 1 and a · 0 = 0 along with the axiom of complement and also drop the axioms
of distributivity, and add the axioms a(a + b) = a and a + ab = a for all a, b in
the Boolean algebra. There are many other mathematical objects that satisfy these
weaker properties, with appropriate definitions of + and · operations. Such structures
are called lattices. Some examples are partitions of a finite set, subspaces of a vector
space, rectangles with horizontal and vertical sides in the plane and many others. Try
to appropriately define the + and · operations for these lattices so that they satisfy
the axioms.

28
Chapter 7

Sets, Relations and Functions

Question 1
For a relation R ⊆ A × B, we define R−1 = {(b, a)|(a, b) ∈ R} (called the converse of
R). For any two relations R1 ⊆ A×B and R2 ⊆ B×C, we define R1 ·R2 = {(a, c)|∃b ∈
B : (a, b) ∈ R1 ∧ (b, c) ∈ R2 }. The operation · is known as composition. Prove that
· is an associative operation, ie (R1 R2 )R3 = R1 (R2 R3 ) for all relations R1 , R2 and
R3 . A relation from a set A to itself is known as a relation on A. Prove that if R1
and R2 are functions/injections/surjections/bijections on A, R1 R2 satisfies the same
property. Do the converses of these properties hold? A left identity is a relation A that
satisfies AR = R for all relations R, and a right identity is a relation B that satisfies
RB = R for all relations R. Prove that the identity relation I = {(a, a)|a ∈ A} is
both left indentity and a right identity for the composition operator. R0 is said to be
a left inverse of R iff R0 R = I and a right inverse of R iff RR0 = I. Do right inverses
and left inverses exist for every relations R on A? Is R−1 always a right inverse or
left inverse for R? Show that for any relation R on A, R has both a left inverse and a
right inverse if and only if R is a bijection, and in this case the left inverse and right
inverse are both unique and equal to R−1 . For relations R1 , R2 , R3 on a set A, do the
following statements hold? Give proofs or counterexamples as appropriate.

1. (R1 R2 )−1 = R2−1 R1−1

2. (R1 ∪ R2 )R3 = R1 R3 ∪ R2 R3

3. R3 (R1 ∪ R2 ) = R3 R1 ∪ R3 R2

4. (R1 ∩ R2 )R3 = R1 R3 ∩ R2 R3

5. R3 (R1 ∩ R2 ) = R3 R1 ∩ R3 R2

29
6. R1 R2 is a function if and only if R1 and R2 are functions

7. R1 ⊆ R2 implies that R1 R3 ⊆ R2 R3 and R3 R1 ⊆ R3 R2

Question 2
Suppose R is a relation from A to B such that R contains an injection f from A to
B and R−1 contains an injection g from B to A. Prove that R contains a bijection
from A to B. This is a stronger form of the Schröder-Bernstein Theorem, which is a
particular case when R = A × B. Note that your argument should hold for any sets
A and B, not only finite sets. What properties of sets are used in the proof? Using
this, show there exists a bijection from the real numbers to the power set of natural
numbers.

Question 3
This is another (non-constructive) proof of Hall’s Theorem by induction on |R|. Let
R be a relation from A to B that satisfies Hall’s condition |R(X)| ≥ |X| for all
X ⊆ A. Suppose there exists a pair (a, b) ∈ R such that R − (a, b) saitsfies Hall’s
condition. Then we can find an injection in R − (a, b). Suppose that for every pair
(a, b) R − (a, b) does not satisfy Hall’s condition. Then prove that R itself must be
an injection from A to B.

Question 4
Let R be a relation from A to B for finite sets A and B, such that there exists a
number k ≥ 1 such that |R(a)| ≥ k for all a in A and |R−1 (b)| ≤ k for all b ∈ B.
Prove that R contains an injection from A to B. Let A be the set of all subsets of
size k of {1, 2, . . . , n} where k < n2 . Let B be the set of all subsets of size k + 1 of
{1, 2, . . . , n}. The relation R from A to B is defined by (X, Y ) ∈ R iff X ⊆ Y , for
subsets X ∈ A and Y ∈ B. Prove that R contains an injective function from A to
B. Describe one such function f explicitly by showing how to calculate f (X) given
X ∈ A. Try to extend this to the set of all multisubsets of size k of a multiset of size
n.

30
Question 5
Suppose there are n students and m companies. A relation R from students to
companies is defined by (s, c) ∈ R iff student s is to be interviewed by company c.
The interviews are conducted in slots of 15 minutes. A student can be interviewed by
at most one company in a slot and a company can interview at most one student in
a slot. Suppose that every student is to be interviewed by at most D companies and
every company has to interview at most D students. Prove that it is always possible
to schedule interviews such that at most D slots are required. Is it always possible
to find such a schedule such that the slots for every company are consecutive, though
they may start at different times? If so prove it, else find a counterexample.

31
Chapter 8

Equivalence Relations and


Countability

Question 1
Prove that if A is a finite set, then any function on A is injective if and only if it
is surjective. Use induction on the number of elements of A. Give examples of an
injective function that is not surjective and a surjective function that is not injective
for some set A. Show that if A is not finite, then there exists an injective function
on A that is not surjective. Prove that every set is either finite or there exists an
injection from N to A.

Question 2
Let R be a relation on a set A. We define Rk such that R0 = I, and Rk+1 = Rk R
for k ≥ 0. For k < 0, we define Rk = (R−1 )−k . Do we have Rp+q = Rp Rq for all
p, q ∈ Z? Show that for all p, q ∈ Z, Rp+q ⊆ Rp Rq , and when p and q are either both
non-negative or both non-positive, we have equality. Now, suppose there exists k > 0
such that Rk = I. Prove that R must be a bijection. You may use results from the
previous question. Prove that if R is a bijection and A is finite, then there must exist
a k such that Rk = I. Give an example to show that this may not be true if A is
infinite. For a finite set A with n elements, what is the smallest number k such that
for every bijection R on A, Rk = I? Prove your answer.

32
Question 3
Prove that the set of all finite subsets of N has the same cardinality as N. Find an
explicit bijection between these sets.In other words, given a finite subset of natural
numbers, show how to compute a natural number from it, so that the original set
can be recovered uniquely from the computed number. Do the same for all finite
sequences of natural numbers. Note that there is no fixed bound on the size of the
finite subset or the length of the finite sequence. All that is known is that it is some
natural number.

Question 4
Let A0 , A1 , . . . be a countably infinite sequence of sets such that the intersection of
any finite number of sets in the sequence is non-empty. Is it true that the intersection
of all the sets is non-empty, ie there exists an x such that for all i x ∈ Ai ? If so
prove it, otherwise give a counterexample. What if one of the sets is finite? Suppose
a0 , a1 , . . . is an infinite sequence of positive integers such that the gcd of any finite
subsequence is greater than 1. Prove that there exists a prime p such that for all i, p
divides ai .

Question 5
Let R be an arbitrary relation defined on a set A. Write down an expression for the
smallest equivalence relation E containing R. You can use the standard set theory
operations along with the composition operation to obtain this expression. E is the
smallest in the sense that any equivalence relation that contains R must also contain
E. Suppose E is an equivalence relation on a finite set A with n elements and k
equivalence classes. What is the minimum number of elements in a relation R on
A such that the smallest equivalence relation containing R is the given relation E?
Prove your answer using induction.

Question 6
Prove that the intersection of two equivalence relations on a set A (considered as a
collection of ordered pairs) is also an equivalence relation. For any relation R on A,
the smallest equivalence relation containing R, called the closure of R and denoted
by Rc is the intersection of all equivalence relations containing R. Show that this is
equivalent to the definition in the previous question. Let E be the set of all equivalence

33
relations on a set A. Define two operations · and + on E as: E1 · E2 = E1 ∩ E2 and
E1 +E2 = (E1 ∪E2 )c . Which axioms of a Boolean algebra do these operations satisfy?
If they do not, give counterexamples, otherwise prove it. Prove that for all E1 and
E2 , E1 · (E1 + E2 ) = E1 and E1 + E1 · E2 = E1 . These operations define a lattice
called the lattice of partitions of A. An equivalence relation E2 covers the equivalence
relation E1 iff E1 ⊂ E2 and there is no equivalence relation E such that E1 ⊂ E ⊂ E2 .
Prove that if E1 covers E1 · E2 then E2 is covered by E1 + E2 . Is the converse of this
statement true?

34
Chapter 9

Partial Orders and Lattices

Question 1
Let (A, ≤) be a partial order defined on a finite set A. Prove that there exists a total
order on A that contains the ≤ relation. This is essentially topological sorting of a
directed acyclic graph. Whether this holds for infinite sets or not is independent of
the standard axioms of set theory. It depends on what is called the ”axiom of choice”
which is not a standard axiom. Can you think of how this could be proved for an
infinite set? The dimension of a partial order is the minimum number of total orders
whose intersection is the given partial order. In other words, a ≤ b holds in the
partial order if and only if it holds in all the total orders. Prove that the dimension
of any partial order on a set with n elements is at most b n2 c + 1. Give an example of
a partial order on n elements whose dimension is b n2 c + 1.

Question 2
Let a1 , a2 , . . . , an be a sequence of numbers. Prove that for any number k ≥ 1, either
the sequence can be partitioned into k non-decreasing subsequences, or there exists
a decreasing subsequence of k + 1 numbers (but not both). Using this or otherwise,
give an efficient algorithm to find the longest subsequence that can be partitioned
into k non decreasing subsequences.

Question 3
Let L be a lattice and let ∨ and ∧ denote the lub and glb operations, also called the
join and meet. Prove that these operations are commutative, associative and satisfy

35
the absorption laws a ∨ (a ∧ b) = a and a ∧ (a ∨ b) = a, for all a, b ∈ L. Conversely,
given two operations satisfying these properties, show that they define a lattice where
∧ is the glb and ∨ is the lub. Note that it is not necessary to assume the existence
of 1 and 0, as these may not exist for infinite lattices. The distributive property is
not satisfied by many lattices. In particular, show that the partition lattice does not
satisfy distributivity.

Question 4
Let (A, ≤) be a partial order on a finite set A. A subset I ⊆ A is called an ideal iff
for all a1 , a2 ∈ A, a1 ≤ a2 and a2 ∈ I implies a1 ∈ I. In other words, if an element
belongs to I then all elements ”smaller” than it belong to I. Prove that the union
and intersection of any two ideals is an ideal. Let C be the collection of all ideals in A
with the ⊆ relation defined on it. Then C is a lattice with glb as intersection and lub
as union, and therefore satisfies the distributivity property. Conversely, prove that
if L is a finite distributive lattice, that is ∧ and ∨ satisfy distributivity apart from
the other lattice axioms, then it is isomorphic to a collection of ideals of some finite
partially ordered set. First show that any such lattice is isomorphic to a collection
of sets that is closed under union and intersection, and then show that any such
collection is isomorphism to the collection of ideals of some poset.

Question 5
This problem was given to me by a past student, now a faculty member in NUS, (also
a visiting faculty here, Kuldeep Meel) and considered one of the ”rising stars” in AI. I
don’t know the application but the problem is on the Boolean lattice and is interesting
by itself. I don’t know the answer either (and neither did he, last I checked). Suppose
I is an ideal in a finite Boolean lattice (set of all subsets of a k-element set for some k)
with |I| = n. What is the minimum number of maximal elements in I? An element
in I is maximal if it is not strictly less than any order element in I. For example, if
n = 2k , then a single maximal element is sufficient. Take any set with k elements,
the ideal containing it will have 2k elements (all subsets of the set), and the set will
be the only maximal element. If n = 2k + 2l − 1 then 2 maximal elements, a subset
of size k and a disjoint subset of size l, suffice. The −1 is because the empty set
is counted twice. n = 13 is the smallest n for which 3 are needed, and a program,
if correct, seemed to suggest that 419 is the smallest for which 4 are needed. It is
not difficult to show that O(log n) elements suffice, but it seems like O(log log n) are
sufficient. Show that there are values of n for which Ω(log log n) are required. If you
can prove the upper bound, write to him.

36
Chapter 10

Counting and Recurrences

Question 1
An involution is a bijection f from [n] to itself such that f 2 is the identity function. A
derangement is a bijection f such that f (i) = i for all i ∈ [n]. Write down recurrence
relations for the number of involutions and derangements. Given a bijection f on [n]
define an equivalence relation on [n] by i ≡ j iff there exists a number k such that
f k (i) = j. Let Sn,m denote the number of bijections such that the corresponding
equivalence relation has exactly m classes. Write down a recurrence relation for this
in terms of n and m.

Question 2
Consider an arrangement of balls in layers such that the balls in each layer are placed
consecutively touching each other, and except for the bottom layer, each ball is placed
between two balls in the layer below. If there are n balls in the bottom layer, how
many distinct arrangements are possible? For n = 1, there is only one, for n = 2,
there are two, one in which there is only one layer and the other with a single ball
in layer 2. For n = 3 there are 5, with distributions (3), (3, 1), (3, 1), (3, 2) or (3, 2, 1)
of balls in layers. Prove that the number of possible arrangements is the Fibonacci
number F2n−2 . Prove it using a recurrence and also by showing a bijection with the
set of bit strings of length 2n − 3 not containing 11, for n > 1.

37
Question 3
Prove that the number of bit strings of length n that do not contain any occurrence
of 010 or 101 is 2Fn . Prove it using a recurrence relation and also by giving a 1 to 2
function from the set of such bit strings to the set of bit strings of length n − 1 not
containing any occurrence of 11.

Question 4
Suppose a fair coin is tossed n times. Given that two consecutive heads did not occur
in the n trials, what is the expected number of heads that have occurred? Let S be
the set of sequences in which each entry is either +1 or -1 and the sum of entries in
any prefix of the sequence is at least -2 and at most 2. How many such sequences of
length n are possible? If each entry in the sequence is generated randomly with equal
probability, and the sequence terminates as soon as the prefix condition is violated,
what is the expected length of the sequence?

Question 5
The number of binary trees with n nodes Tn satisfies the recurrence T0 = 1 and
n−1
P
Tn = Ti Tn−1−i . These numbers are called Catalan numbers. Find the generating
i=0
function T (x) of these numbers. Prove that Tn is odd if and only if n = 2k −1 for some
k ≥ 0. One way of doing it is by showing that binary trees can be paired up so that
exactly one is left unpaired when n = 2k − 1 and otherwise all are paired up. Ideally,
the pairing should be such that only trees that are close to each other are paired up.
The Catalan numbers also count a number of other objects (more than 200). For
example, number of valid bracket strings, number of ways of partitioning a convex
polygon into triangles (called triangulation), number of non-decreasing sequences a1 ≤
a2 ≤ · · · ≤ an such that ai ≤ i for each 1 ≤ i ≤ n. In each case, the notion of
”close” pairing may be different. In the bracket case, a string can be paired with one
obtained by swapping some adjacent pair of characters. In the triangulation case,
allow replacing one diagonal by another, in the sequence case, increase or decrease a
number by 1. In each case, can you find such a ”close pairing” with only one object
left out when n = 2k − 1?

38
Chapter 11

Counting with Symmetries

Question 1
Consider the problem of counting necklaces taking into account rotational symmetry.
This can also be considered as counting the number of distinct ways of colouring the
corners of a regular polygon with n sides, where each corner is assigned one of k
colours. Suppose k = 2 and the colours are black and white. Find the polynomial
Nn (b) in one variable b such that the coefficient of bk is the number of necklaces
with exactly k corners coloured black. If rotational symmetry is not considered, this
polynomial is just (1 + b)n . Do the same if colourings obtained by reflection are also
considered to be equivalent.

Question 2
Consider the 3-dimensional unit cube whose corners are the points (x, y, z) where
each of x, y, z are either 0 or 1. How many different ways of colouring the corners
are there with at most k colours, if colourings that can be obtained by applying any
rotations of the cube are considered equivalent? Do the same if reflections are also
allowed. Also find the number of distinct ways of colouring the 12 edges and 6 faces of
the cube. In general, many different groups of bijections arise by considering different
symmetries of different geometrical objects.

Question 3
Let A be a set with 3 elements and R1 and R2 relations defined on A. Suppose R1
is equivalent to R2 iff there exists a bijection f from A to A such that (a1 , a2 ) ∈ R1

39
if and only if (f (a1 ), f (a2 )) ∈ R2 . In other words, the relation R2 can be obtained
from R1 by simply relabeling the elements of A. Find the number of distinct relations
on A. Do the same for relations from A to B where both A and B have 3 elements
each. In this case, R1 is equivalent to R2 iff there are bijections f from A to A and
g from B to B such that (a, b) ∈ R1 iff (f (a), g(b)) ∈ R2 . Try to extend to sets with
n elements. The second problem is the same as trying to find the number of distinct
n × n matrices with 0, 1 entries, where two matrices are considered to be the same if
one can be obtained from the other by permuting the rows and columns.

Question 4
Consider the set of strings of length 2n over an alphabet that contains k letters. A
string a0 a1 . . . a2n−1 is equivalent to the string b0 b1 . . . b2n−1 iff for all 0 ≤ i < n, either
a2i = b2i and a2i+1 = b2i+1 or a2i = b2i+1 and a2i+1 = b2i . In other words, two strings
are said to be equivalent if one can be obtained from the other by swapping a letter in
an even position with the letter in the next position. Find the number of equivalence
classes of this relation. Find the number of inequivalent strings in which a particular
letter a appears exactly m times. Can you find this answer without using Burnside’s
Lemma?

40
Chapter 12

Undirected Graphs

Question 1
Give an example of a graph G for which the only automorphism is the identity
function. An automorphism of G is a bijection from V (G) to itself that preserves
adjacency, that is, a bijection f : V (G) → V (G) such that vertex u is adjacent
to vertex v if and only if f (u) is adjacent to f (v). How many automorphisms are
there of the graphs Pn (path with n vertices), Cn (cycle with n vertices) and Kn
(complete graph with n vertices)? If Tn is a tree with n vertices, what is the maximum
possible number of automorphisms of Tn ? Why? For which tree is the maximum value
achieved?

Question 2
An edge e in a graph G is called a bridge if the graph G − e obtained by deleting
the edge e has more connected components than G. Prove that e is a bridge if and
only if it is not contained in a cycle. Prove that if e is a bridge, then G − e has
exactly one more connected component than G and the endpoints of e are in different
components of G − e. Prove that if for some vertices u, v there exists a path of odd
length between u and v, and also a path of even length, then the graph must contain
a cycle of odd length.

Question 3
Prove that every graph with n vertices and n + 4 edges must contain 2 cycles that
have no edge in common with each other. Give examples of graphs with n vertices

41
and n + 3 edges that do not contain two edge-disjoint cycles for n ≥ 6. Prove that
if n ≥ 6, any graph with more than 3n − 6 edges must contain two vertex disjoint
cycles. Give an example of a graph with n vertices and 3n − 6 edges that does not
contain such cycles.

Question 4
Suppose G is a connected graph such that for any pair of vertices u and v all paths
between u and v have the same length. The length may be different for different
pairs of vertices. Prove that the graph must be a tree. Suppose now the path lengths
can take at most two different values for each pair. What is the maximum possible
number of edges in G, assuming it has n vertices?

Question 5
Prove that every graph with n vertices and more than k(n−1) 2
edges contains a path
of length k. A famous conjecture of Erdős and Sős states that any such graph must
contain as a subgraph any tree with k edges. This is known to be true for some
special kinds of trees and for all trees when n is very large compared to k. Show that
there are infinitely many n for which there are graphs with k(n−1)
2
edges that do not
contain any tree with k edges. Try to find the minimum number of edges that an n
vertex graph must have in order to contain a cycle of length at least k.

42

You might also like