Mathematical Problem Solving
Mathematical Problem Solving
Mathematical Problem Solving
Solving
Darij Grinberg*
December 25, 2021 (unfinished!)
Contents
1. Introduction 11
1.1. Homework set #0: Diagnostic . . . . . . . . . . . . . . . . . . . . . . . 11
2. Induction I 14
2.1. Standard induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2. Fibonacci numbers I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3. Strong induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.4. Recitation #1: More induction problems . . . . . . . . . . . . . . . . . 35
1
Math 235 notes page 2
Preface
This is the text accompanying my Math 235 (Mathematical Problem Solving) class
at Drexel University in Fall 2020. The website of this class can be found at
http://www.cip.ifi.lmu.de/~grinberg/t/20f .
This document is a work in progress. It might become a textbook one day, but
for now is a construction zone.
Please report any errors you find to [email protected] .
What is this?
This course is an introduction to the art of mathematical problem solving. This
means solving the type of problems that usually are posed in competitions (like
the Putnam Competition or the International Mathematical Olympiad) or in jour-
nals (like the American Mathematical Monthly or Crux Mathematicorum): self-
contained mathematical questions that do not require any specialized knowledge
(beyond the basic undergraduate curriculum) to understand, but often a significant
amount of ingenuity, creativity and effort to solve, although the resulting solutions
again are readable without specialized knowledge.
There is no panacea for solving such problems; the hardest ones constitute seri-
ous challenges for even the most well-trained solvers. Yet there is a variety of ideas,
techniques and tools that can help attacking these problems; while they offer no
guarantee of success, they are sufficiently useful that they nowadays get systemat-
ically taught to olympiad participants in many countries and universities. Most of
these techniques are also helpful in mathematical research – even though the typi-
cal research question poses a rather different kind of challenge than a competition
problem.1
Some of these techniques are very basic. Mathematical induction, for example, is
fundamental to all of mathematics. The Pigeonhole Principle says (roughly speak-
ing) that if you put 6 or more pigeons into 5 pigeonholes, then at least two pigeons
will be roommates. The Extremal Principle says that (at least) one of the pigeons
has the longest beak. These principles are neither surprising nor deep; but they can
often be applied in unexpected and surprising ways. We will study them mainly
by exploring their applications, as there is little to say about these principles them-
selves.
Another part of the problem solving toolkit is a selection of “little” theories (“lit-
tle” in the sense of not going deep; typically, the main results and their proofs fit
on 20 pages at most). The most well-known such theory is elementary number
theory, due to a large extent to Euclid (or to whoever discovered the results in
his Elements) and expanded somewhat by Fermat, Euler and Gauss. The lore of
polynomials (commonly over the rational or complex numbers) can be regarded
as another such theory, with results like Viete’s theorems. The art of elementary
inequalities (like Cauchy–Schwarz, Hölder, rearrangement), too, can be counted as
a theory.
The tools and theories we will see are thus a cross-section of elementary math-
ematics. This text will omit most of analysis (which will only appear in some
exercises; see [GelAnd17] for a lot more) and all of elementary geometry (which is
its own subject, worthy of its own books; see [Honsbe12] for a selection of neat re-
sults and [Hadama09] for a systematic introduction). We will also not use abstract
algebra beyond a few basic ideas that can be explained from scratch. As to linear
algebra, we will occasionally make use of it, but we will not introduce it, as there
are enough good texts for that.
This is not the first introductory text on mathematical problem solving, and
has no ambitions to be the last. The classics in this genre are Polya’s [Polya81]
and Engel’s [Engel98]2 ; many other sources have been published since, including
1 For starters, a researcher attacking a research question does not know whether it has an answer
and, if it has one, how difficult it will be to find; meanwhile, questions posed in competitions
have been “pre-solved” by their proposers and/or the selection committees, and usually have a
somewhat predictable level of difficulty. Also, one of the frequent challenges in research is asking
the right question; but competitions preempt this challenge (although it tends to resurface in the
solving process, as one looks for useful auxiliary results).
However, competition problems can (and often do) have a lot in common with research ques-
tions; in particular, several have crystallized out of the research of their proposers. For the solver,
mathematical competitions can provide inspiration and training for proper research; when de-
signed well, they are research “writ small”.
2 The even earlier book [Polya73] by Polya is, in some ways, a harbinger of this kind of book,
although in itself it is too short (just a few dozen solved problems), too philosophical (replete
Prerequisites
I expect you, the reader, to be familiar with mathematical proofs. In particular, you
should be able to
If not, there is a whole industry of texts from which these skills can be learned
(such as [LeLeMe16, Chapters 1–5], [Day16], [Hammac15], [Newste20, Part I and
with didactical comments and Socratic dialogues) and too basic (typical strategies suggested are
“do you know a related problem?” and “introduce suitable notations”). Even in the much more
content-rich and concrete [Polya81], Polya spends quite a lot of space attempting to construct
a general theory of mathematical problem solving, with input from philosophy and psychol-
ogy (two chapters are called “Rules of Discovery?” and “On Learning, Teaching, and Learning
Teaching”, although they are more hands-on than the names may suggest).
Engel’s main innovation in [Engel98] was to scrap the philosophy and fill as much of his book
as possible with actual problems and solutions. The problem solving strategies he presents
are mathematical ones, and they are taught by doing (worked examples, then problems). The
occasional personal story or heuristical remark gives some variety (but the mathematics itself
is already pretty varied, as one and the same strategy often has applications in very different
fields).
In the notes you are now reading, I intend to stick to Engel’s paradigm (but aim at a higher
level of detail).
3 also, various books in foreign languages: e.g., [Grinbe08] and [Carl17] (in German) and [Jarvin20]
Appendices A–B] and [Swanso20, Chapters 1–3], just to mention a few freely avail-
able ones6 ).
Acknowledgments
I thank Natalia Grinberg, Sam Hopkins, Pasha Pylyavskyy, Tom Roby and David
Speyer for helpful conversations on the problem solving literature.
6I recommend the MIT text [LeLeMe16] in particular for its lively writing and its enjoyable exer-
cises. It is long and goes far beyond the basics; it has significant overlap with what I will be
doing in this class.
Newstead’s [Newste20] (work in progress) is also far more than an introduction to proofs. It
covers a lot of the “no man’s land” between such an introduction and advanced courses.
Swanson’s [Swanso20] is focussed on setting up the prerequisites for a rigorous treatment of
analysis.
1. Introduction
1.1. Homework set #0: Diagnostic
This is a special problem set: Its main purpose is to give you an idea of what is to
come in this course, and to give me an idea of your level of familiarity with certain
things (including proof writing). Do not expect to solve all these problems.
This problem set (and only this one!) will be graded on completion – each
problem will be graded out of 2; any serious work on a problem (e.g., a partial
solution, a particular case solved, or even an attempt that shows you have thought
about it) will get 2 points. (All future problem sets will be graded on correctness,
with a correct and well-written solution worth 10 points.)
Tips:
Exercise 1.1.1. Let n be an even positive integer. Find a q ∈ {1, 2, . . . , 2n} such
that
1! · 2! · · · · · (2n)!
is a perfect square.
q!
7 E.g.,
a problem about a polynomial always has an “implicit n”, namely the degree of the polyno-
mial involved. Thus one can start by considering polynomials of degrees 1, 2, 3.
t0 = 1, t1 = 1, t2 = 1, and
1 + t n −1 t n −2
tn = for each n ≥ 3.
t n −3
1 + t2 t1 1+1·1 1 + t3 t2 1+2·1
(For example, t3 = = = 2 and t4 = = = 3.)
t0 1 t1 1
(a) Prove that tn+2 = 4tn − tn−2 for each n ≥ 2.
(b) Prove that tn is a positive integer for each integer n ≥ 0.
The next exercise uses the floor function, which is defined as follows:
Definition 1.1.1. For every real x, we let b x c denote the largest integer that is
≤ x. This integer b x c is called the floor (or the integer part) of x.
For example, b3c = bπ c = 3 and b−π c = −4. It is easy to see8 that for every
x ∈ R, we have
b x c ≤ x < b x c + 1. (1)
(Note that the chain of inequalities (1) determines b x c uniquely, and thus can be
used as an alternative definition of b x c. This is how b x c is defined in [Grinbe16,
Definition 1.1.1], for example.) Older sources use the notation [ x ] for b x c; this
notation, however, can mean many other things.
Exercise 1.1.5. A mountain ridge has the form of a (finite) line segment, bordered
on each end by a cliff. Several (finitely many) lemmings are walking along the
ridge, with equal speeds (but not necessarily in the same direction). Whenever
two lemmings meet, they “bounce off” one another, keeping their respective
speeds but reversing their directions. Whenever a lemming arrives at an end-
point of the ridge, it falls off the cliff. Prove that eventually, all lemmings will
fall off the cliff.
(with 1, 2, 3, 4, 5 being the lemmings, and the arrows signifying their walking
directions). The first two lemmings to meet here will be 1 and 2, after which
they both change their directions:
←
−−→ ←
− −
→ ←
−
1 2 3 4 5
Now lemming 1 is on its way to the cliff, which it will reach without interference
from other lemmings.]
Exercise 1.1.6. You have 20 white socks and 20 black socks hanging on a clothes-
line, in some order.
(a) Prove that you can pick 10 consecutive socks from the clothesline such that
5 of them are black and the other 5 white. (You can call such a pick color-balanced.)
(b) Prove the same if the number 20 is replaced by 13 (so you have 13 white
and 13 black socks).
[Example: If the number 20 is replaced by 7, then the claim does not hold.
For example, the configuration B3 W 7 B4 (standing for “3 black socks, followed
by 7 white socks, followed by 4 white socks”) has no color-balanced pick of 10
consecutive socks.]
bc (b − c) (b + c) + ca (c − a) (c + a) + ab ( a − b) ( a + b)
Exercise 1.1.10. Briefly review the problems above: Which ones did you like?
Which ones did you not like? Why? How long did they take you? Which parts
did you get stuck on? Did you learn anything from solving (or trying to solve)
them? If you knew the solution already (nothing wrong with that!), where did
you learn it? (No need to rate every exercise; just say some words about some 4
of them.)
2. Induction I
Mathematical induction is essentially the main strategy for proving theorems in
mathematics: Any statement that involves a natural number (even implicitly, such
as by talking of a finite set) potentially lends itself to be proved by induction. This
does not mean induction is always the best way to go, or even a viable one, but it
is a method you should certainly not be surprised to see working. Only recently,
two long books [AndCri17] and [Gunder10] (with 400 and 850 pages, respectively)
entirely devoted to applications of induction have appeared9 . We will not go into
this depth or detail; but we will show examples for the most frequent ways in
which induction can be applied.
Theorem 2.1.1. Let g ∈ Z. For each integer n ≥ g, let A (n) be a logical state-
ment. Assume the following:
Theorem 2.1.1 is one of the facts known as the principle of mathematical induction.
Some consider it to be an axiom; others use essentially equivalent axioms that it
can easily be derived from.10 We will not dwell on its logical status, but rather
explore its use.
Theorem 2.1.1 provides a way to prove any result that can be stated in the form
“some statement A (n) holds for each integer n ≥ g” (commonly, g is taken to be
0 or 1, but any integer is fine). All one needs to do is to prove Assumption 1 and
Assumption 2. The proof of Assumption 1 is commonly called the induction base
(or base case), while the proof of Assumption 2 is commonly called the induction
step. In the induction step, the assumption that A (m) holds is called the induction
hypothesis (or induction assumption). The whole proof is called an “induction on n”
(or “induction over n”). Here is a simple example:
9 This is not to say that the method has not been appreciated before; it is just that the idea of
gathering mathematical results by their method of proof (as opposed to their objects of concern)
is fairly new.
10 You may have seen it stated for g = 0 only (or for g = 1 only). But the general case of Theorem
2.1.1 easily follows from these particular cases (see, e.g., [Grinbe15, proof of Theorem 2.53]).
Solution to Exercise 2.1.1. We will prove (2) by induction on n (that is, we shall apply
Theorem 2.1.1 to g = 0 and to A (n) being the statement
(2)).
Induction base: We have (b − 1) b0 + b1 + · · · + b0−1 = 0 = b0 − 1 (since b0 = 1).
| {z }
=(empty sum)=0
In other words, (2) holds for n = 0. This completes the induction base.
Induction step: Let m ≥ 0 be an integer. Assume (as the induction hypothesis)
that (2) holds for n = m. We must prove that (2) holds for n = m + 1. In other
words, we must prove that (b − 1) b0 + b1 + · · · + b(m+1)−1 = bm+1 − 1.
Our induction hypothesis says that (2) holds for n = m. In other words,
m −1
0 1
( b − 1) b + b + · · · + b = bm − 1. (3)
Now, (m + 1) − 1 = m, so that
(b − 1) b0 + b1 + · · · + b(m+1)−1 = (b − 1) b0 + b1 + · · · + bm
| {z }
=(b0 +b1 +···+bm−1 )+bm
= ( b − 1 ) b 0 + b 1 + · · · + b m −1 + b m
= ( b − 1 ) b 0 + b 1 + · · · + b m −1 + ( b − 1 ) b m
| {z } | {z m m
}
= b m −1 =bb −b
(by (3))
m
bbm −1 = bm+1 − 1.
= bm − 1 + bb − b = |{z} m
= b m +1
But this is precisely what we need to prove. Thus, the induction step is complete.
Hence, (2) is proved. Thus, Exercise 2.1.1 is solved.
We note that if b is a real number distinct from 1, then the claim of (2) entails
bn − 1 1 − bn
b 0 + b 1 + · · · + b n −1 = = (4)
b−1 1−b
for each integer n ≥ 0. This is the classical formula for the sum of a (finite) geo-
metric progression. There are other proofs of this formula (in particular, we shall
11 Note that if n = 0, then the sum b0 + b1 + · · · + bn−1 is an empty sum and thus equals 0 by
definition.
prove something slightly more general in a later chapter), but the induction proof
that we gave above has the advantage of being entirely straightforward.
A particularly simple particular case of Exercise 2.1.1 is the following: Each inte-
ger n ≥ 0 satisfies
20 + 21 + · · · + 2n−1 = 2n − 1. (5)
Indeed, this follows by applying Exercise 2.1.1 to b = 2 (since 2 − 1 = 1).
Here is another basic example for a proof by induction (which appears, e.g., in
[Grinbe15, Proposition 2.164], in [Gunder10, Exercise 74] and in [AndCri17, Prob-
lem 2.2]):
1 1 1 1 1 1 1 1 1
− + − +···+ − = + +···+ . (6)
1 2 3 4 2n − 1 2n n+1 n+2 2n
Solution to Exercise 2.1.2. Let us denote the left hand side of (6) by L (n), and let us
denote the right hand side by R (n). That is, we set
1 1 1 1 1 1
L (n) = − + − +···+ − and
1 2 3 4 2n − 1 2n
1 1 1
R (n) = + +···+
n+1 n+2 2n
for each n ≥ 0. Thus, we need to prove that L (n) = R (n) for each n ≥ 0. We
shall do this by induction on n (that is, we shall apply Theorem 2.1.1 to g = 0 and
A (n) = (“L (n) = R (n) ”)).
Induction base: The equality L (0) = R (0) holds, since both L (0) and R (0) are
empty sums (and thus 0). In other words, L (n) = R (n) holds for n = 0. This
completes the induction base.
Induction step: Let m ≥ 0 be an integer. Assume (as the induction hypothesis)
that L (m) = R (m). We must prove that L (m + 1) = R (m + 1).
The definition of L (n) shows that L (m + 1) is the same sum as L (m) except with
1 1
the two extra addends and − added to it. Thus,
2 ( m + 1) − 1 2 ( m + 1)
1 1
L ( m + 1) = L ( m ) + − . (7)
2 ( m + 1) − 1 2 ( m + 1)
The definition of R (n) shows that R (m + 1) is the same sum as R (m) except with-
1 1 1
out the addend but with the two new addends and added
m+1 2m + 1 2m + 2
to it. Thus,
1 1 1
R ( m + 1) = R ( m ) − + + . (8)
m + 1 2m + 1 2m + 2
Now it is clear what to do: We need to show that the left hand sides of the two
equalities (7) and (8) are equal, but we know that the L (m) and R (m) terms on
their right hand sides are equal (since L (m) = R (m) by assumption). So we need
to show that the remaining terms on the right hand sides are also equal – i.e., that
we have
1 1 1 1 1
− =− + + .
2 ( m + 1) − 1 2 ( m + 1) m + 1 2m + 1 2m + 2
But this can be checked by a straightforward computation (which is simplified by
the facts that 2 (m + 1) − 1 = 2m + 1 and 2m + 2 = 2 (m + 1)). Thus, the right hand
sides of (7) and (8) are equal (since L (m) = R (m)), and therefore so are the left
hand sides. In other words, L (m + 1) = R (m + 1). This completes the induction
step. Exercise 2.1.2 is thus solved.
Equalities between finite sums (such as in Exercise 2.1.2) provide lots of exercise
in using induction; for example, you can use induction to prove the equalities
n ( n + 1)
1+2+···+n = ; (9)
( 2
n/2 + 1, if n is even;
1 − 2 + 3 − 4 ± · · · + (−1)n (n + 1) =
− (n + 1) /2, if n is odd;
n (n + 1) (2n + 1)
12 + 22 + · · · + n2 = ;
6
n ( n + 1) 2
3 3 3
1 +2 +···+n = ;
2
2−1
n ( 2n + 1 ) ( n + 1 ) 3n + 3n
14 + 24 + · · · + n4 =
30
for each integer n ≥ 0 (see [Grinbe15, §2.4] and [Grinbe15, Exercise 2.9], respec-
tively, for detailed proofs of the first two equalities).
We shall now come to a more combinatorial application. Recall that a bit is
defined to be an element of the 2-element set {0, 1}.
Exercise 2.1.3. Fix a positive integer n. An n-bitstring shall mean an n-tuple
( a1 , a2 , . . . , an ) ∈ {0, 1}n of bits. Prove that there exists a list (b1 , b2 , . . . , b2n ) con-
taining all n-bitstrings (each exactly once) such that for every i ∈ {1, 2, . . . , 2n },
the two n-bitstrings bi and bi−1 differ in exactly one entry. Here, we understand
b0 to mean b2n .
[Example: For n = 3, one such list is (b1 , b2 , . . . , b8 ), where
“Gray codes are used in linear and rotary position encoders (absolute
encoders and quadrature encoders) in preference to weighted binary
encoding. This avoids the possibility that, when multiple bits change in
the binary representation of a position, a misread will result from some
of the bits changing before others.”
That is, the property that bi and bi−1 differ in exactly one entry ensures that bi−1
can be turned into bi by only changing a single bit, which removes the need for
changing several bits simultaneously to prevent unintended intermediate states.
Another way to think of Exercise 2.1.3 is as follows: Imagine a combination lock
with n dials, where each dial has exactly 2 disks labeled 0 and 1. Then, a Gray
code provides a way to cycle through all 2n possible combinations in a way that
getting from each combination to the other (and from the last back to the first) only
requires rotating a single dial. Variants of Gray codes exist for dials with more
than 2 disks, and for various other similar situations; a comprehensive discussion
of various such contraptions can be found in [TAoCP4A, §7.2.1.1].12
Solution to Exercise 2.1.3 (sketched). We define an n-Gray code to be a list (b1 , b2 , . . . , b2n )
containing all n-bitstrings (each exactly once) such that for every i ∈ {1, 2, . . . , 2n },
the two n-bitstrings bi and bi−1 differ in exactly one entry, where b0 means b2n .
Thus, the exercise wants us to prove that there exists an n-Gray code.
We shall prove this by induction on n, so we forget that we fixed n. Note that
we have to start our induction at n = 1 (that is, we must apply Theorem 2.1.1 to
g = 1), since the exercise is stated for all positive integers n (rather than for all
integers n ≥ 0, as the two previous exercises were).
Induction base: There exists a 1-Gray code – namely, the list ((0) , (1)). Thus,
Exercise 2.1.3 is proved13 for n = 1. This completes the induction base.
Induction step: Let m ≥ 1 be an integer. Assume (as the induction hypothesis)
that there exists an m-Gray code. We must show that there exists an (m + 1)-Gray
code.
We introduce a notation: For any m-bitstring a = ( a1 , a2 , . . . , am ), we let 0a denote
the (m + 1)-bitstring (0, a1 , a2 , . . . , am ), and we let 1a denote the (m + 1)-bitstring
(1, a1 , a2 , . . . , am ). Thus, 0a and 1a are the two possible (m + 1)-bitstrings that can
be obtained from a by inserting a new bit at the front. For example, if a = (1, 1, 0)
(so m = 3), then 0a = (0, 1, 1, 0) and 1a = (1, 1, 1, 0).
We have assumed that there exists an m-Gray code; let (b1 , b2 , . . . , b2m −1 , b2m ) be
this m-Gray code. Then,
(0b1 , 0b2 , . . . , 0b2m −1 , 0b2m , 1b2m , 1b2m −1 , . . . , 1b2 , 1b1 )
12 We note that Exercise 2.1.3 is also a popular contest problem. For instance, Problem A3 on the
Putnam Mathematical Competition 1968 is a thinly-veiled restatement of Exercise 2.1.3 (more
precisely, of a weaker version of this exercise, which requires bi and bi−1 differ in exactly one
entry only for i ∈ {1, 2, . . . , 2n − 1} rather than for all i ∈ {1, 2, . . . , 2n }).
13 Here, we are being slightly sloppy with our language: When we say “Exercise 2.1.3”, we mean
“the claim of Exercise 2.1.3”. Thus, “Exercise 2.1.3 is proved” means “the claim of Exercise 2.1.3
is proved”. We shall use this sloppy language occasionally, as it saves us space.
(note that the subscripts first go up from 1 to 2m , then go back down from 2m to
1) is an (m + 1)-Gray code (check this!). Thus, there exists an (m + 1)-Gray code.
This completes the induction step. Thus, Exercise 2.1.3 is solved by induction.
The verb “induct” is often used to mean “perform an induction”. Thus, for in-
stance, in the above proof, we could have said “We induct on n” instead of “We
shall prove this by induction on n”. A proof by induction is also known as an
inductive proof.14
As mentioned above, when one inducts on n to prove a statement, the n needs
not explicitly appear in the statement; it suffices that the statement can be restated
in a way that contains an n. As an example, let us show the following (seemingly
evident) fact:
change.
16 This said, [Grinbe15, first proof of Theorem 2.35] is organized somewhat differently (in particular,
most of the argument is relegated into a lemma), and uses the nonnegative integer |S| − 1 instead
of the positive integer |S| to do the induction.
Induction base: Every 1-element set of integers has a maximum (namely, its unique
element). In other words, Claim 2 holds for n = 1. This completes the induction
base.
Induction step: Let m be a positive integer. Assume (as the induction hypothesis)
that Claim 2 holds for n = m. We must prove that Claim 2 holds for n = m + 1.
In other words, we must prove that every (m + 1)-element set of integers has a
maximum.
So let S be an (m + 1)-element set of integers. Then, |S| = m + 1 ≥ 1 > 0, so
that S is nonempty. Hence, there exists some s ∈ S. Consider such an s. The set
S \ {s} then must be an m-element set (since S is an (m + 1)-element set), and thus
has a maximum (because our induction hypothesis says that every m-element set
of integers has a maximum). Let t be this maximum.
Now, we can see that S has a maximum: Indeed, if t ≥ s, then t is a maximum
of S, whereas otherwise, s is a maximum of S. (Check this!)
Forget that we fixed S. We thus have proved that every (m + 1)-element set S
of integers has a maximum. In other words, Claim 2 holds for n = m + 1. This
completes the induction step. Claim 2 is thus proved.]
Since Claim 2 is equivalent to Claim 1, we thus conclude that Claim 1 also holds,
i.e., Proposition 2.1.2 is proved.
In advanced mathematics, most inductions are of the kind we just showed (al-
though usually more complicated) – i.e., the n that is being inducted upon does
not explicitly appear in the claim that is being proved, but rather is a “derived
quantity” (like the size |S| of the set S in the above proof). Commonly, this is done
quickly and tacitly – that is, instead of restating the claim in terms of n as we did
above, one simply says that one is doing an induction on the derived quantity (i.e.,
in the above example, an induction on |S|). See [Grinbe15, §2.5.3] for the exact
convention that is being used here; let me just show how the above proof could be
rewritten using this convention:
Proof of Proposition 2.1.2 (short version). (See [Grinbe15, second proof of Theorem
2.35] for details.) Forget that we fixed S. Notice that |S| is a positive integer
whenever S is a nonempty finite set. Hence, we induct on |S|:
Induction base: If S is a nonempty finite set of integers satisfying |S| = 1, then
S has a maximum (namely, its unique element). In other words, Proposition 2.1.2
holds for |S| = 1. This completes the induction base.
Induction step: Let m be a positive integer. Assume (as the induction hypothesis)
that Proposition 2.1.2 holds for |S| = m. We must prove that Proposition 2.1.2 holds
for |S| = m + 1. In other words, we must prove that every nonempty finite set S of
integers satisfying |S| = m + 1 has a maximum.
So let S be a nonempty finite set of integers satisfying |S| = m + 1. Then, |S| =
m + 1 ≥ 1 > 0, so that S is nonempty. Hence, there exists some s ∈ S. Consider
such an s. The set S \ {s} then satisfies |S \ {s}| = |S| − 1 = m (since |S| = m + 1),
and thus is nonempty (since m is a positive integer); hence, this set S \ {s} has a
maximum (because our induction hypothesis says that every nonempty finite set
of integers that has size m has a maximum). Let t be this maximum.
Now, we can see that S has a maximum: Indeed, if t ≥ s, then t is a maximum
of S, whereas otherwise, s is a maximum of S. (Check this!)
Forget that we fixed S. We thus have proved that every nonempty finite set S of
integers satisfying |S| = m + 1 has a maximum. In other words, Proposition 2.1.2
holds for |S| = m + 1. This completes the induction step. Proposition 2.1.2 is thus
proved.
We shall see more complicated examples of induction on a derived quantity soon.
f 0 = 0, f 1 = 1, f 2 = 1, f 3 = 2, f 4 = 3, f 5 = 5,
f 6 = 8, f 7 = 13, f 8 = 21, f 9 = 34, f 10 = 55,
f 11 = 89, f 12 = 144, f 13 = 233.
Some authors17 prefer to start the sequence at f 1 rather than f 0 ; of course, the
recursive definition then needs to be modified to require f 2 = 1 instead of f 0 = 0.
The first property of Fibonacci numbers that we prove is the following:
Exercise 2.2.1. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Prove that each inte-
ger n ≥ 0 satisfies
f 1 + f 2 + · · · + f n = f n+2 − 1. (10)
f 1 + f 2 + · · · + f m +1 = ( f 1 + f 2 + · · · + f m ) + f m +1 = f m +2 − 1 + f m +1
| {z }
= f m +2 −1
with
f − 1 = f m +2 + f m +1 − 1 = f m +2 − 1 + f m +1 .
|m{z+}3
= f m +2 + f m +1
(by the recursive definition
of the Fibonacci sequence)
So we have shown that (10) holds for n = m + 1. This completes the induction step,
and thus proves (10). Hence, Exercise 2.2.1 is solved.
Let us briefly discuss two notational aspects of induction. So far, we have always
been using the letter m for the integer that is introduced in the induction step,
because it was called m in the statement of Theorem 2.1.1. Clearly, we can use any
other letter (for example, k) instead, as long as that letter does not already have
a different meaning. It is also perfectly fine to use k − 1 for it – i.e., instead of
assuming that the claim holds for n = m and proving that it holds for n = m + 1,
we can just as well assume that the claim holds for n = k − 1 and prove that it
holds for n = k. (Of course, if we do this, then we need to assume k > g instead of
k ≥ g.) This just boils down to substituting k − 1 for m in Theorem 2.1.1. Here is
how Theorem 2.1.1 looks like after this substitution:
Theorem 2.2.2. Let g ∈ Z. For each integer n ≥ g, let A (n) be a logical state-
ment. Assume the following:
18 Wewill no longer write this sentence at the end of an induction base, since the “Induction step:”
that follows it should make it clear enough that the induction base ends here.
As an example for an induction proof written in this way, let us prove another
property of the Fibonacci sequence (the so-called Cassini identity):
Exercise 2.2.2. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Prove that
so that f k+1 f k−1 − f k2 = (−1)k . This is exactly what we wanted to prove. This
completes the induction step, and with it the solution to Exercise 2.2.2.
Some writers shorten their induction proofs even further by reusing the letter n itself
(instead of m or k as we did above) in the induction step. That is, instead of fixing a k > g
and assuming that the claim holds for n = k − 1 and proving that it holds for n = k, they
fix an n > g and assume that the claim holds “for n − 1 instead of n” (i.e., the claim holds
if n is replaced by n − 1 in it) and prove that it holds for n as well. This saves a letter and
a bit of writing, at the cost of being potentially more confusing and slippery (as it requires
you to check that you have properly replaced n by n − 1 in the induction hypothesis); thus
I do not recommend it. But you should be aware that it is a commonly used “figure of
speech”.19
The next exercise (a particular case of [Grinbe15, Theorem 2.26 (a)]) illustrates a
point about choosing the right claim when doing induction.
19 For example, here is how the above solution to Exercise 2.2.2 could be rewritten using this con-
f n + m +1 = f n f m + f n +1 f m +1 (11)
We have two nonnegative integer variables here (n and m), so we can try to do
induction on either. As to the other, it appears reasonable to just fix it beforehand.
So we try the following:
First attempt at solving Exercise 2.2.3. Let us fix m and induct on n (using Theorem
2.1.1).
Induction base: The equality (11) holds for n = 0. Indeed, for n = 0, this equality
boils down to f 0+m+1 = f 0 f m + f 1 f m+1 , which follows easily from f 0 = 0 and
f 1 = 1.
Induction step: Let k be a nonnegative integer.20 Assume (as the induction hy-
pothesis) that (11) holds for n = k. We must show that (11) holds for n = k + 1.
In other words, we must show that f (k+1)+m+1 = f k+1 f m + f (k+1)+1 f m+1 . In other
words, we must show that f k+m+2 = f k+1 f m + f k+2 f m+1 .
Our induction hypothesis says that (11) holds for n = k, that is, we have f k+m+1 =
f k f m + f k +1 f m +1 .
The recursive definition of the Fibonacci sequence yields
f k + m +2 = f k + m +1 + f k + m .
vention:
We induct on n (using Theorem 2.2.2):
Induction base: We have f 0 = 0, f 1 = 1 and f 2 = 1. Thus, f 2 f 0 − f 12 = 1 · 0 − 12 = −1 = (−1)1 .
In other words, Exercise 2.2.2 holds for n = 1.
Induction step: Let n be an integer such that n > 1. Assume (as the induction hypothesis) that
Exercise 2.2.2 holds for n − 1 instead of n. We must show that Exercise 2.2.2 holds for n. In other
words, we must show that f n+1 f n−1 − f n2 = (−1)n .
Our induction hypothesis says that Exercise 2.2.2 holds for n − 1 instead of n. In other words,
it says that f n f n−2 − f n2−1 = (−1)n−1 . But the recursive definition of the Fibonacci sequence
yields f n+1 = f n + f n−1 (since n > 1). Hence,
so that f n+1 f n−1 − f n2 = (−1)n . This is exactly what we wanted to prove. This completes the
induction step, and with it the solution to Exercise 2.2.2.
20 This k will play the role of the m in Theorem 2.1.1, since we cannot use the letter m for it here
Now, our induction hypothesis lets us decompose the f k+m+1 on the right hand side
as f k f m + f k+1 f m+1 ; but how do we decompose the f k+m ? The induction hypothesis
does not help us here, and we are stuck.
This suggests that we need a better induction hypothesis. The easiest way to get
one is to not fix m before starting the induction. The result is that we have to carry
a “for all nonnegative integers m” through our induction; but this extra weight
turns out to be useful:
Second attempt at solving Exercise 2.2.3. Let us induct on n.
Induction base: The equality (11) holds for n = 0 and every nonnegative integer
m. Indeed, for n = 0, this equality boils down to f 0+m+1 = f 0 f m + f 1 f m+1 , which
follows easily from f 0 = 0 and f 1 = 1.
Induction step: Let k be a nonnegative integer. Assume (as the induction hypoth-
esis) that (11) holds for n = k and every nonnegative integer m. We must show that
(11) holds for n = k + 1 and every nonnegative integer m. In other words, we must
show that f (k+1)+m+1 = f k+1 f m + f (k+1)+1 f m+1 for every nonnegative integer m. In
other words, we must show that f k+m+2 = f k+1 f m + f k+2 f m+1 for every nonnegative
integer m.
Our induction hypothesis says that (11) holds for n = k and every nonnegative
integer m. In other words, we have
f k + m +1 = f k f m + f k +1 f m +1 (12)
f k + m = f k f m −1 + f k +1 f m . (14)
But this is exactly what we wanted to show. Thus, the induction step is complete,
and Exercise 2.2.3 is solved.
The solution we just gave is not the simplest possible; there is a different one,
which avoids having to special-case the m = 0 case (as we did above). The trick is
to rewrite f k+m+2 not as f k+m+1 + f k+m , but rather as follows:
f k+m+2 = f k+(m+1)+1 = f k f m+1 + f k+1 f m+2
(by (12), applied to m + 1 instead of m). It is a nice exercise for the reader to finish
this argument (see [Grinbe15, proof of Theorem 2.26 (a)] for the answer).
Another version of induction is tailored to proving theorems about integers n
in a finite interval21 rather than about all integers n ≥ g. Instead of relying on
Theorem 2.1.1, it relies on the following theorem ([Grinbe15, Theorem 2.74]):
Theorem 2.2.3 can easily be derived from Theorem 2.1.1, by applying the latter
to the statement “if n ≤ h, then A (n)” instead of A (n). (See [Grinbe15, proof
of Theorem 2.74] for the details of this derivation.) It is clear how to perform
induction using Theorem 2.2.3: It differs from standard induction only in that we
assume g ≤ m ≤ h − 1 (instead of only assuming m ≥ g) in the induction step.
Here is an example of an induction proof using Theorem 2.2.3:
Proposition 2.2.4 is often called the “discrete intermediate value theorem” or the
“discrete continuity principle”. Its intuitive meaning is that if a finite list of nonzero
integers starts with a nonnegative integer, and every further entry of this list differs
from its preceding entry by at most 1 (you can think of this as a discrete version
of continuity), then all entries of this list must be positive.23 Intuitively, this is
obvious: It just says that it isn’t possible to go from a nonnegative integer to a
negative integer by steps of 1 without ever stepping at 0. The following proof is
just a rigorous restatement of this intuitive argument:
Proof of Proposition 2.2.4 (sketched). (See [Grinbe15, proof of Proposition 2.75] for de-
tails.) We induct on n using Theorem 2.2.3 (that is, we apply Theorem 2.2.3 to the
statement A (n) = (“bn > 0”)):
Induction base: We must prove that if g ≤ h, then the statement bg > 0 holds. So
let us assume that g ≤ h. (Actually, we have already assumed so in the statement of
the proposition.) Recall that bg , bg+1 , . . . , bh are nonzero; thus, in particular, bg 6= 0.
But we also have bg ≥ 0. Combining these, we find bg > 0. This completes the
induction base.
Induction step: Let m ∈ { g, g + 1, . . . , h − 1} be such that bm > 0 holds. We must
show that bm+1 > 0 also holds.
Applying (15) to i = m, we find |bm+1 − bm | ≤ 1. But it is well-known (and easy
to see) that every integer x satisfies − x ≤ | x |. Applying this to x = bm+1 − bm ,
we obtain − (bm+1 − bm ) ≤ |bm+1 − bm | ≤ 1. In other words, 1 ≥ − (bm+1 − bm ) =
bm − bm+1 . In other words, 1 + bm+1 ≥ bm . Hence, 1 + bm+1 ≥ bm > 0, so that
1 + bm+1 ≥ 1 (since 1 + bm+1 is an integer). In other words, bm+1 ≥ 0. However,
bm+1 6= 0 (since bg , bg+1 , . . . , bh are nonzero). Combining this with bm+1 ≥ 0, we
obtain bm+1 > 0. This completes the induction step. Hence, Proposition 2.2.4 is
proved.
22 The “If g ≤ h” in this assumption is a bit silly: If we don’t have g ≤ h, then the claim we are
proving is vacuous to begin with (because the set { g, g + 1, . . . , h} is empty in this case). But
sometimes it is good to have vacuous cases covered, too.
23 An example of such a list is (2, 3, 3, 2, 3, 4, 4, 3, 2, 3, 2, 3, 2, 1).
In the future, we will no longer say “We induct on n using Theorem 2.2.3”,
but instead just say “We induct on n”. Indeed, it is clear that we must be using
Theorem 2.2.3 if we are inducting on a variable that is bound to an interval (like
the n in Proposition 2.2.4).
Theorem 2.3.1 is an explicit formula for Fibonacci numbers, and what a surpris-
ing one – would you have expected the irrational numbers ϕ and ψ √ to appear in
1+ 5
a formula for an integer sequence? Note that the number ϕ = ≈ 1. 618
2
in Theorem 2.3.1 is known as the golden ratio (although it shares that distinction
1
with its reciprocal ≈ 0.618), and the number ψ is what is known as a conjugate
ϕ
of ϕ (although the notion is only properly understood in abstract algebra24 ). The
golden ratio is famous for appearing in various places in mathematics, and this is
one of them.
How can we prove Theorem 2.3.1? It appears reasonable to induct on n (using
Theorem 2.2.2); the base case (n = 0) is easy, and the induction step would have
us assume that (16) holds for n = k − 1 and try to prove that (16) holds for n = k.
Unfortunately, here we hit a wall: While the induction hypothesis lets us compute
f k−1 , it would not let us compute f k−2 , but we would need both f k−1 and f k−2 in
order to simplify f k = f k−1 + f k−2 .
24 Ina nutshell: If a (real or complex) number ζ is a root of an irreducible polynomial P with rational
coefficients,
√ then√all roots√ of P are called the conjugates of ζ. For example, the conjugates of the
number
√ 2 are 2 and − 2, since they are the roots of the irreducible polynomial x2 − 2 whose
root 2 is. One of the ideas of Galois theory is that conjugates of a number “belong together
with it”; while we will not formalize this idea in this class, we will see its manifestations several
times.
Thus we are in want of a stronger induction hypothesis: one that claims (16) not
only for n = k − 1, but also for n = k − 2. Better yet, why not claim that (16) holds
for all n < k ?
This is what strong induction does: It strengthens the induction hypothesis from
“the claim holds for n = k − 1” to “the claim holds for all n < k”. The underlying
principle is the following:25
Theorem 2.3.2. Let g be an integer. For each integer n ≥ g, let A (n) be a logical
statement.
Assume the following:
then A (k ) holds.
This looks a bit tortuous, so let us unravel what it means to prove something
using Theorem 2.3.2. This will be called a proof by strong induction.
Let g be an integer (which is typically taken to be 0 or 1, as in standard induction).
Say that we want to prove that some statement A (n) holds for every integer n ≥ g.
Doing this via standard induction (i.e., using Theorem 2.2.2) would require us to
prove (in the induction step) that A (k ) follows from A (k − 1) (whenever k > g
is an integer). (It would also require an induction base, which we disregard for
now.) On the other hand, doing this via strong induction (i.e., using Theorem
2.3.2) would instead require us to prove that A (k) follows from (17) – that is, from
A ( g) ∧ A ( g + 1) ∧ · · · ∧ A (k − 1). Obviously, when k > g, then A ( g) ∧ A ( g + 1) ∧
· · · ∧ A (k − 1) is a stronger statement than A (k − 1); thus, when we are applying
strong induction, we have a stronger induction hypothesis than when applying
standard induction.
There is one more difference between standard and strong induction: A strong
induction needs no induction base. Indeed, in Theorem 2.2.2 there are two assump-
tions, but in Theorem 2.3.2 there is only one. This might appear strange, because
how comes we can afford omitting the induction base? However, this is not as fishy
as it looks like; it turns out that Assumption 1 in Theorem 2.3.2 already contains a
“base case” in it. To be more precise, I claim that if Assumption 1 in Theorem 2.3.2
is satisfied, then A ( g) must hold. Indeed, Assumption 1 in Theorem 2.3.2 (applied
to k = g) says that if
satisfying n < g), and thus is vacuously true26 ; therefore, the previous sentence
entails that A ( g) holds. This argument might appear like a sleight of hand, but it
is logically sound.
All of this theoretical chatter is probably less useful than an actual example of a
proof by strong induction; so let us have one now:
Proof of Theorem 2.3.1. Let us try to prove Theorem 2.3.1 by strong induction on n.
This means that we apply Theorem 2.3.2 to g = 0 and to the statement
1 n 1 n
A (n) = “ f n = √ ϕ − √ ψ ” .
5 5
Theorem 2.3.2 holds. As we just discussed, a strong induction needs no induction base, so the
induction step is the only real part of it. Thus, many writers don’t even bother to say “Induction
step:”.
(Note that we have used k − 1 ≥ 0 and k − 2 ≥ 0 here; this is another reason why
we needed to handle the case k < 2 separately.)
But ϕ is a solution of the quadratic equation X 2 − X − 1 = 0; thus, ϕ2 − ϕ − 1 = 0,
so that ϕ + 1 = ϕ2 . Likewise, ψ + 1 = ψ2 . Now,
fk = f k −1 + f k −2
|{z} |{z}
1 1 1 1
= √ ϕ k −1 − √ ψ k −1 = √ ϕ k −2 − √ ψ k −2
5 5 5 5
(by (21)) (by (22))
1 1 1 1
= √ ϕ k −1 − √ ψ k −1 + √ ϕ k −2 − √ ψ k −2
5 5 5 5
1
k −1 k −2
1
k −1 k −2
=√ ϕ +ϕ −√ ψ +ψ
5| {z } 5| {z }
= ϕ k −2 ( ϕ +1 ) = ψ k −2 ( ψ +1 )
1 1
= √ ϕ k −2 ( ϕ + 1 ) − √ ψ k −2 ( ψ + 1 )
5 | {z } 5 | {z }
= ϕ2 = ψ2
1 1 1 1
= √ ϕ k −2 ϕ 2 − √ ψ k −2 ψ 2 = √ ϕ k − √ ψ k .
5 | {z } 5 | {z } 5 5
= ϕk =ψk
In other words, (20) holds. In other words, A (k ) holds. Thus, the induction step is
complete, and we are done proving Theorem 2.3.1.
A few general remarks are in order. First of all, as we already saw in the proof
of Theorem 2.3.1, the statement (17) that is being assumed in the induction step of
a strong induction plays the role of an induction hypothesis; thus it is commonly
referred to as the induction hypothesis. Second, while (technically speaking) our
strong induction had no induction base, we nevertheless had to treat some “small-
k” cases by hand (in our case, the case k < 2, which split into k = 0 and k =
1). Thus, we had a “de-facto” induction base in our induction step, even though
we didn’t call it an induction base. This is fairly common for proofs by strong
induction.
Strong induction is a standard method for proving properties of Fibonacci num-
bers. Indeed, the latter are defined by a recursion ( f k = f k−1 + f k−2 ) that refers back
not just to the previous entry f k−1 but to the entry f k−2 as well; thus, when proving
a claim about f k , it is useful to have not just the corresponding claim about f k−1 ,
but also the corresponding claim about f k−2 at one’s disposal. With its stronger
induction hypothesis, strong induction is uniquely suited to providing both claims
in its induction step.
Our proof of Theorem 2.3.1 was fairly straightforward, but it does nothing to
demystify it. In particular, if you didn’t know this formula, how could you come
up with it in the first place? We will see an answer to this question in Subsection
For example, the sets {1, 4} and {3, 5} and {3, 7, 9} are lacunar, while the sets
{1, 2, 5} and {3, 4} are not. (The empty set is lacunar, and so is any 1-element set
of integers.)
We can now state the result we want to prove:
• The only lacunar subset of [0] is ∅ (since the set [0] itself is empty). Thus,
the number of all lacunar subsets of [0] is 1, which is precisely what Theo-
rem 2.3.4 says for n = 0 (since f 0+2 = f 2 = 1).
• The only lacunar subsets of [1] are ∅ and {1} (since [1] = {1}). Thus, the
number of all lacunar subsets of [1] is 2, which is precisely what Theorem
2.3.4 says for n = 1 (since f 1+2 = f 3 = 2).
• The only lacunar subsets of [2] are ∅, {1} and {2} (since [2] = {1, 2}).
Thus, the number of all lacunar subsets of [2] is 3, which is precisely what
Theorem 2.3.4 says for n = 2 (since f 2+2 = f 4 = 3).
• The only lacunar subsets of [3] are ∅, {1}, {2}, {3} and {1, 3} (since [3] =
{1, 2, 3}). Thus, the number of all lacunar subsets of [3] is 5, which is
precisely what Theorem 2.3.4 says for n = 3 (since f 3+2 = f 5 = 5).
28 A rather elementary answer is found in [Grinbe15, Remark 4.3], but note that linear algebra
(specifically, the notion of eigenvalues and diagonalization) provides some more motivation.
Proof of Theorem 2.3.4 (sketched). Apply strong induction on n. (That is, apply The-
orem 2.3.2 with g = 0.)
Induction step:29 Let k ∈ N. Assume (as the induction hypothesis) that Theorem
2.3.4 holds for each integer n ≥ 0 satisfying n < k. (This is precisely the assumption
(17) in Theorem 2.3.2.) We must show that Theorem 2.3.4 holds for n = k. In other
words, we must prove that the number of all lacunar subsets of [k ] is f k+2 .
Here is a sketch of how this is done (see [19fco, first proof of Proposition 1.4.9]
for details): If k < 2, then this has already been done in Example 2.3.5; thus, we
WLOG assume that k ≥ 2. (We will see later why this assumption is needed.30 ) We
shall call a subset of [k ]
• red if it contains k;
Thus, each subset of [k] is either red or green (but not both). Hence, in order to
count the lacunar subsets of [k ], we can count the red ones and the green ones
separately, and then add the results.
Our induction hypothesis says that Theorem 2.3.4 holds for each integer n ≥ 0
satisfying n < k. In other words, for each integer n ≥ 0 satisfying n < k, we have
Counting the green lacunar subsets of [k ] is easy: They are plainly the lacunar
subsets of [k − 1]. Thus,
Theorem 2.3.6. If P and Q are two disjoint finite sets, then the set P ∪ Q is finite
as well, and satisfies
| P ∪ Q| = | P| + | Q| . (27)
Theorem 2.3.6 is known as the sum rule for two sets; it is the reason why the
equality (26) holds. Indeed, since each lacunar subset of [k ] is either red or green,
we have
respectively.
because the sets {red lacunar subsets of [k]} and {green lacunar subsets of [k ]} are
disjoint); but this is precisely the equality (26).
Discussion of Exercise 2.4.1. There is no “n” here to induct over, so one might won-
der whether induction really can help. But let’s not give up. Induction can be very
useful for computing finite sums; but an infinite sum is the limit of its partial sums,
which are finite. So let us consider some partial sums.
n 1
For each integer n ≥ 0, let S (n) denote the sum ∑ . This is a partial sum
i =1 i ( i + 1 )
∞ 1
of the infinite sum ∑ ; thus,
i =1 i ( i + 1 )
∞
1
∑ i (i + 1) = nlim
→∞
S (n) . (28)
i =1
(This assumes that the limit lim S (n) exists in the first place; we don’t know this
n→∞
yet, but it will fall out of our argument in the end.)
To get a feeling for the S (n), let us compute the first few values:
1 2 3
S (0) = 0, S (1) = , S (2) = , S (3) = .
2 3 4
This suggests a conjecture: Namely, we suspect that
n
S (n) = for every integer n ≥ 0. (29)
n+1
But this conjecture can easily be verified by induction:
[Proof of (29): Induct on n.
0 1
Base case: The definition of S (0) yields S (0) = ∑ = (empty sum) =
i =1 i ( i + 1 )
0
0 = . In other words, (29) holds for n = 0.
1
Note: The infinite nested fraction on the right hand side of (30) is called an
(infinite) continued fraction. It is rigorously defined as the limit of the sequence of
Discussion of Exercise 2.4.2. Let us first restate the claim without scary-looking nested
fractions. Define a sequence ( x1 , x2 , x3 , . . .) of rational numbers recursively by
1
x1 = 1, and xn = 1 + for all n ≥ 2.
x n −1
Thus,
1 1 1
x1 = 1, x2 = 1 + , x3 = 1 + , x4 = 1 + , ....
1 1 1
1+ 1+
1 1
1+
1
Thus, ( x1 , x2 , x3 , . . .) is the sequence of finite initial segments of the infinite con-
tinued fraction on the right hand side of (30). The latter fraction is thus defined
as lim xn . Hence, our claim rewrites as ϕ = lim xn . So we need to prove that
n→∞ n→∞
ϕ = lim xn .
n→∞
There are many ways to go about this; let us outline two:
First approach. Computing the first few entries of the sequence ( x1 , x2 , x3 , . . .)
shows that
3 5 8 13
x1 = 1, x2 = 2, x3 = , x4 = , x5 = , x6 = .
2 3 5 8
Both the numerators and the denominators in these fractions belong to the Fi-
bonacci sequence ( f 0 , f 1 , f 2 , . . .) introduced in Definition 2.2.1. A quick comparison
suggests the conjecture that
f n +1
xn = for each n ≥ 1. (31)
fn
This is indeed true; indeed, (31) can easily be shown by induction on n (exercise!).
Better yet, even if you forgot about the Fibonacci sequence, you could easily discover the
formula (31) as follows: The values of x1 , x2 , . . . , x6 we computed above do not look very
random; they are fractions32 , with the numerator of each xi reappearing as the denominator
32 Here 1 2
we rewrite x1 = 1 as , and x2 = 2 as .
1 1
of xi+1 . (This is not surprising, given the recursive definition of ( x1 , x2 , x3 , . . .).) This
a n +1
suggests that the numbers xn have the form xn = for some sequence ( a1 , a2 , a3 , . . .)
an
of integers. And indeed, we can try to define such a sequence ( a1 , a2 , a3 , . . .) by setting
ai = x1 x2 · · · xi−1 for each i ≥ 1 (which, in particular, entails that a1 = x1 x2 · · · x0 =
(empty product) = 1, because empty products are defined to be 1). Now, the recursive
1
equation xn = 1 + can be restated in terms of the sequence ( a1 , a2 , a3 , . . .) as follows:
x n −1
1
xn = 1 +
x n −1
a n +1 1 a n +1 an
⇐⇒ = 1+ since xn = and xn−1 =
an an an a n −1
a n −1
a n +1 a n −1
⇐⇒ = 1+
an an
⇐⇒ ( an+1 = an + an−1 ) (here, we multiplied both sides by an ) .
Thus, the sequence ( a1 , a2 , a3 , . . .) must satisfy the recursive equation an+1 = an + an−1
for each n ≥ 2. But this is the same recursive equation that the Fibonacci sequence
( f 0 , f 1 , f 2 , . . .) satisfies! Moreover, the first two entries a1 and a2 of the sequence ( a1 , a2 , a3 , . . .)
are the second and third entries f 1 and f 2 of the Fibonacci sequence ( f 0 , f 1 , f 2 , . . .) (since
a1 = 1 = f 1 and a2 = x1 = 1 = f 2 ). Thus, the sequence ( a1 , a2 , a3 , . . .) is precisely the
“shifted” Fibonacci sequence ( f 1 , f 2 , f 3 , . . .) (“shifted” in the sense that the first entry f 0 = 1
a n +1 f n +1
is discarded). Now, xn = becomes xn = , so we have arrived at (31) without
an fn
relying on our integer sequence identification skills.
What can we do with (31)? We still need to prove that ϕ = lim xn . While (31)
n→∞
gives a formula for xn in terms of Fibonacci numbers, we still need to find lim xn
n→∞
somehow. √
1− 5
Binet’s formula (Theorem 2.3.1) comes to our help now. Set ψ = . Note
2
that our ϕ and ψ here are precisely the ϕ and ψ from Theorem 2.3.1. Thus, for
every nonnegative integer n, we have
1 1
f n = √ ϕn − √ ψn (by Theorem 2.3.1)
5 5
n
ψn
1 n n 1 n 1 n ψ
= √ (ϕ − ψ ) = √ ϕ 1 − n = √ ϕ 1 −
5 5 ϕ 5 ϕ
1
= √ ϕ n (1 − ρ n ) , (32)
5
√
ψ 1− 5
where we have set ρ := . Note that this ρ is explicitly given by ρ = √ =
ϕ 1+ 5
√
5−3
≈ −0.381 97 . . ..
2
Now, for each n ≥ 1, we have
f n +1
xn = (by (31))
fn
= f n +1 / fn
|{z} |{z}
1 1
= √ ϕ n +1 ( 1 − ρ n +1 ) = √ ϕ n (1− ρ n )
5 5
(by (32)) (by (32))
1 − ρ n +1
1
1 n +1 n +1 n n
= √ ϕ 1−ρ / √ ϕ (1 − ρ ) = ϕ · .
5 5 1 − ρn
Hence,
1 − ρ n +1 1 − ρ n +1
lim xn = lim ϕ· = ϕ · lim . (33)
n→∞ n→∞ 1 − ρn n→∞ 1 − ρn
The limit on the right hand side is now easy to find: Since |ρ| < 1, we have ρn → 0
1 − ρ n +1 1−0
as n → ∞, and therefore also ρn+1 → 0 as n → ∞. Hence, n
→ =1
1−ρ 1−0
1 − ρ n +1
as n → ∞. In other words, lim = 1. Hence, (33) becomes
n→∞ 1 − ρn
1 − ρ n +1
lim xn = ϕ · lim = ϕ.
n→∞ n→∞ 1 − ρn
| {z }
=1
While this alone would not suffice to solve the exercise, it seems like a good step
forward, so let us try to prove this. We need to show the following two statements:
and
How can we solve these two equalities for a and b ? The simplest way is perhaps
1
the following: Multiplying the equation a = 1 + by b, we find ab = b + 1; on
b
33 Forexample, let us prove the first statement. So let i ≥ 1 be an integer satisfying xi > ϕ. We must
1 1
prove that xi+1 < ϕ and xi+2 < xi . The recursive definition of xi+1 yields xi+1 = 1 + < 1+
xi ϕ
1 1
(since xi > ϕ). But a straightforward computation shows that 1 + = ϕ. Hence, xi+1 < 1 + =
ϕ ϕ
ϕ. Furthermore, the recursive definition of xi+2 yields
1 1 1
x i +2 = 1 + = 1+ since xi+1 = 1 +
x i +1 1 xi
1+
xi
xi
= 1+ < xi ,
1 + xi
where the last inequality is a consequence of the fact that xi > ϕ and the (straightforward) fact
x
that 1 + < x for every real x > ϕ. Thus, both xi+1 < ϕ and xi+2 < xi are proved.
1+x
xi
The second statement is proved similarly, except that this time 1 + > xi follows from
1 + xi
xi < ϕ and xi ≥ 0. We leave the details to the reader.
1
the other hand, multiplying the equation b = 1 + by a, we find ab = a + 1.
a
Comparing ab = a + 1 with ab = b + 1, we find a + 1 = b + 1, thus a = b. However,
b = lim x2n ≤ lim ϕ = ϕ and a = lim x2n+1 ≥ lim ϕ = ϕ, so that ϕ ≤ a.
n→∞ |{z} n→∞ n→∞ | {z } n→∞
<ϕ >ϕ
(by (34)) (by (34))
Combined with a = b ≤ ϕ, this yields a = ϕ. Similarly, b = ϕ.
Now, we know that both subsequences ( x1 , x3 , x5 , . . .) and ( x2 , x4 , x6 , . . .) of the
sequence ( x1 , x2 , x3 , . . .) converge to ϕ (since lim x2n+1 = a = ϕ and lim x2n = b =
n→∞ n→∞
ϕ). By basic properties of limits, this implies that the whole sequence ( x1 , x2 , x3 , . . .)
converges to ϕ. In other words, ϕ = lim xn . Again, the exercise is solved.
n→∞
Here is another exercise that does not look like an induction problem, yet is one:
Exercise 2.4.3. We say that a number is funny if it can be written in the form
±12 ± 22 ± 32 ± · · · ± m2
for some nonnegative integer m and some choice of ± signs. For example, 4 is
funny because 4 = −12 − 22 + 32 , whereas 5 is funny because 5 = +12 + 22 .
Also, 0 is funny since 0 = (empty sum) (this corresponds to choosing m = 0).
Prove that every integer is funny.
Discussion of Exercise 2.4.3. I will not give a full solution, but here is a sequence of
hints that should suffice:
1. First, let’s try to solve the “little brother” of the problem, which is obtained
by replacing the squares by 1-st powers: We say that a number is giggly if it
can be written in the form
±1 ± 2 ± 3 ± · · · ± m
for some nonnegative integer m and some choice of ± signs. Prove that every
integer is giggly.
2. It suffices to prove that every positive integer is giggly (resp. funny), since
flipping all the ± signs will flip the sign of the number.
4. So much for the “little brother”. What about the original problem? We need
an analogue of the formula − (m + 1) + (m + 2) = 1 that we just used.
9. Do it!
This ends our first excursion into the uses of induction. We will see more uses,
and even more variants of induction, in the following chapters.
Definition 3.1.1. The symbol N will denote the set {0, 1, 2, . . .} of all nonnegative
integers.
Definition 3.1.2. Let a and b be two integers. We say that a | b (or “a divides b”
or “b is divisible by a” or “b is a multiple of a” or “a is a divisor of b”) if there exists
an integer c such that b = ac.
We furthermore say that a - b if a does not divide b.
This definition, too, is a bit controversial: It implies that 0 | 0. Some authors don’t
like this (arguing that a | b should mean that b/a is uniquely determined, which
0/0 is not); while I understand their thinking, I believe that forbidding 0 from
dividing itself would create more headaches than it would prevent. The words
“divides” and “divisor”, too, can mean different things depending on whom you
ask; in particular, Knuth (e.g. in [GrKnPa94]) likes to define them differently from
how I do34 .
Note that 1 | b holds for any b ∈ Z; but 0 | b holds only for b = 0. Note also that
a | − a for each a ∈ Z.
34 He defines “a divides b” to mean “b > 0, and there exists an integer c such that b = ac”. This
is to be distinguished from “b is a multiple of a”, which he (like me) defines to mean only
“there exists an integer c such that b = ac”. Thus, quoting [GrKnPa94, §4.1]: “Every integer
is a multiple of −1, but no integer is divisible by −1 (strictly speaking)”. Again, I understand
the reasons for this (e.g., this way, the divisors of 6 are 1, 2, 3, 6 rather than the unnecessarily
duplicated −6, −3, −2, −1, 1, 2, 3, 6), but I am not convinced that it is worth the headache.
Here are some basic properties of divisibility (all of which are easy to prove35 ):
Proposition 3.1.4. (a) We have a | a for every a ∈ Z. (This is called the reflexivity
of divisibility.)
(b) If a, b, c ∈ Z satisfy a | b and b | c, then a | c. (This is called the transitivity
of divisibility.)
(c) If a1 , a2 , b1 , b2 ∈ Z satisfy a1 | b1 and a2 | b2 , then a1 a2 | b1 b2 .
(d) If a, b ∈ Z satisfy a | b, then ak | bk for any nonnegative integer k.
We shall use these facts many times (and often without saying). They provide
basic rules for manipulating divisibilities36 . For example, Proposition 3.1.4 (c) al-
lows multiplying two divisibilities, while Proposition 3.1.5 allows multiplying both
sides of a divisibility by a nonzero integer c or, conversely, cancelling the factor
c from both sides. Proposition 3.1.3 (a) ensures that both sides of a divisibility
can be replaced by their absolute values, which is why it often suffices to consider
nonnegative integers in divisibility arguments.
The next fact ([19s, Theorem 2.6.1]) is significantly more important:
Theorem 3.1.8. Let n be a positive integer. Let u ∈ Z. Then, there exists a unique
pair (q, r ) ∈ Z × {0, 1, . . . , n − 1} such that u = qn + r.
Theorem 3.1.8 essentially says that any integer u can be uniquely divided with
remainder by any positive integer n. The entries q and r of the pair (q, r ) in Theorem
3.1.8 are called the quotient and the remainder of this division.
35 For what it’s worth: Proposition 3.1.3 is a combination of [19s, Proposition 2.2.3 and Exercise
2.2.2]. Proposition 3.1.4 is a combination of [19s, Proposition 2.2.4 and Exercise 2.2.6]. Propo-
sition 3.1.5 is [19s, Exercise 2.2.3]. Proposition 3.1.6 is [19s, Exercise 2.2.4]. Finally, Proposition
3.1.7 follows easily from [19s, Proposition 2.3.4 (d)] or can be straightforwardly proved using the
definition of divisibility.
36 A divisibility means a statement of the form “a | b”.
We shall not prove Theorem 3.1.8 in detail, but the reader is advised to recall (or
construct) at least one proof – as it is a nice exercise on induction. One detailed
proof (using strong induction) is given in [19s, §2.6]; another appears in [Grinbe15,
proof of Theorem 2.153]. Let me say a few words about the second proof, as it
illustrates a little variation on standard induction: two-sided induction. This means
using the following two-sided induction principle ([Grinbe15, Theorem 2.149]):
Theorem 3.1.9. Let g ∈ Z. For each integer n, let A (n) be a logical statement.
Assume the following:
While standard induction (Theorem 2.1.1) and strong induction (Theorem 2.3.2) are
tailored for proving theorems about nonnegative (or positive) integers, two-sided
induction (Theorem 3.1.9) is best suited for proving theorems about all integers.
Thus, a two-sided induction has an induction base and two induction steps, one
of which goes “upwards” (from A (m) to A (m + 1)) while the other goes “down-
wards” (from A (m) to A (m − 1)). Now, Theorem 3.1.8 can be proved by two-sided
induction on u (for fixed n). More precisely, we can use two-sided induction on u
to prove the existence of a pair (q, r ) ∈ Z × {0, 1, . . . , n − 1} such that u = qn + r;
the uniqueness of this pair is easiest to prove directly. (See [Grinbe15, proof of
Theorem 2.153] for details.)
a1 + a2 ≡ b1 + b2 mod n; (36)
a1 − a2 ≡ b1 − b2 mod n; (37)
a1 a2 ≡ b1 b2 mod n. (38)
Proposition 3.2.8. Let n be an integer. Let S be a finite set. For each s ∈ S, let as
and bs be two integers. Assume that
Then,
∑ as ≡ ∑ bs mod n (40)
s∈S s∈S
and
∏ as ≡ ∏ bs mod n. (41)
s∈S s∈S
Proposition 3.2.6 (d) shows that any two congruences can be added, subtracted
and multiplied like equalities (as long as their moduli are equal; e.g., we cannot
add the congruences 1 ≡ 3 mod 2 and 1 ≡ 4 mod 3, because their moduli 2 and 3
are distinct)37 . Proposition 3.2.8 extends this to any (finite) number of congruences
(instead of just two). Proposition 3.2.7 says that a congruence can be taken to the
k-th power for every k ∈ N (again like an equality).38 There is yet another way in
which congruences behave like equalities: Namely, they can be chained together
like equalities. To state this precisely, we need a definition:
(In other words, it shall mean that a1 ≡ a2 mod n and a2 ≡ a3 mod n and a3 ≡
a4 mod n and · · · and ak−1 ≡ ak mod n. This is vacuously true when k ≤ 1. If
k = 2, then it simply means that a1 ≡ a2 mod n.)
Such a statement will be called a chain of congruences modulo n.
Proposition 3.2.10 follows easily from Proposition 3.2.6 by induction. (See [Grinbe15,
proof of Proposition 2.16] for the details of this proof.)
Proposition 3.2.10 allows chaining congruences (with equal moduli) together.
Thus, for example, we can quickly see that 715 ≡ 7 mod 8 via the following compu-
37 That said, congruences cannot be divided. That is, if we have a1 ≡ b1 mod n and a2 ≡ b2 mod n,
then we cannot conclude that a1 /a2 ≡ b1 /b2 mod n, even if we assume something like a2 6≡
0 mod n and b2 6≡ 0 mod n. (Most of the time, the congruence a1 /a2 ≡ b1 /b2 mod n will be
meaningless, since a1 /a2 and b1 /b2 are usually not integers. But even if they are integers, the
congruence need not hold.)
38 Note, however, that a ≡ b mod n does not imply k a ≡ k b mod n.
(In other words, it shall mean that a1 | a2 and a2 | a3 and a3 | a4 and · · · and
ak−1 | ak . Again, this is vacuously true when k ≤ 1.)
Such a statement will be called a chain of divisibilities.
(since 2n · 7 is clearly divisible by 7). In other words, 7 | 32n+1 + 2n+2 . This solves
Exercise 3.2.1.
Congruences can not only be added, subtracted, multiplied and chained together,
but they can also be substituted into one another, in the following sense:41
Example 3.2.13. Let n be an integer. Assume you have two integers a and b
that are congruent modulo n (that is, they satisfy a ≡ b mod n). Then, if you
have any polynomial expression P involving a, then you can substitute b for a in
this expression, and obtain a new expression Q that satisfies P ≡ Q mod n. For
example,
a + 2 ≡ b + 2 mod n;
a5 ≡ b5 mod n;
( a + 2) ( a + 9) − a ≡ (b + 2) (b + 9) − b mod n;
a2 + c2 + ac ≡ b2 + c2 + bc mod n for any integer c;
k k
∑a i
≡ ∑ bi mod n for every k ∈ N.
i =0 i =0
This is called the substitution principle for congruences. I will not formalize this
principle (see [19s, §2.5] for a more detailed treatment, which too stops short of
properly formalizing it), but I will make four comments:
First, you don’t have to replace every a by b when substituting; you can choose
some a’s to replace by b’s while leaving the remaining a’s unchanged. Thus, for
example, a ≡ b mod n yields a7 + a4 + a ≡ b7 + a4 + b mod n and a7 + a4 + a ≡
b7 + a4 + a mod n and various other such congruences.
Second, it is worth stressing that the only powers that can appear in a poly-
nomial expression are powers with constant exponents. In particular, we can-
not have “2a ” in a polynomial expression. This is important because we could
not substitute b for a in 2a ; it is not usually true that a ≡ b mod n implies
2a ≡ 2b mod n.
Third, when using the substitution principle for congruences, I will use un-
derbraces to point out what is being replaced by what. Thus, for example, when
substituting b’s for the three a’s in ( a + 2) ( a + 9) − a, I will write
a
|{z} +2 |{z}
a +9 − |{z}
a ≡ (b + 2) (b + 9) − b mod n.
≡b mod n ≡b mod n ≡b mod n
(This is the same convention that I am using when substituting equal things in
an equality.)
41 Here, a “polynomial expression” means an expression that contains only variables, integers, the
symbols “+”, “−” and “·” and powers with constant exponents (i.e., things like “a3 ” or “a9 ”,
but never “2a ” or “ab ”) such that all exponents are nonnegative integers (so “a−1 ” is not allowed
either).
The following exercise is a slightly more intricate example of the use of congru-
ences:
if a | b, then f a | f b . (42)
(The first three of these four propositions are proved in [19s, §2.6]; all four are
easy to prove.)
Note that Proposition 3.3.4 can be viewed as another definition of congruence
modulo n (at least when n is a positive integer).
Recall that an integer is said to be even if it is divisible by 2, and odd if it is not.
The following exercise illustrates how remainders interact with congruence:
Exercise 3.3.1. Prove that the sum of any two odd integers is even.
Solution to Exercise 3.3.1. Let a and b be two odd integers. We must prove that a + b
is even.
The integer a is odd, i.e., not divisible by 2 (by the definition of “odd”). In other
words, we don’t have 2 | a.
Proposition 3.3.2 (b) (applied to n = 2 and u = a) yields that we have 2 | a if
and only if a%2 = 0. Thus, we don’t have a%2 = 0 (since we don’t have 2 | a).
But Proposition 3.3.2 (a) (applied to n = 2 and u = a) yields that a%2 ∈ {0, 1} and
a%2 ≡ a mod 2. From a%2 ∈ {0, 1}, we obtain a%2 = 1 (since we don’t have a%2 =
0). But from a%2 ≡ a mod 2, we obtain a ≡ a%2 mod 2 (by Proposition 3.2.6 (c)).
This rewrites as a ≡ 1 mod 2 (since a%2 = 1). Similarly, b ≡ 1 mod 2. Adding these
two congruences45 , we obtain a + b ≡ 1 + 1 mod 2. But 1 + 1 = 2 ≡ 0 mod 2 (since
2 | 2 − 0). Hence, a + b ≡ 1 + 1 ≡ 0 mod 2. In other words, 2 | ( a + b) − 0 = a + b.
In other words, a + b is divisible by 2. In other words, a + b is even. This solves
Exercise 3.3.1.
The following simple exercises (see [19s, §2.7] for solutions) collect various basic
properties of even and odd integers:
Exercise 3.3.3. (a) Prove that each even integer u satisfies u2 ≡ 0 mod 4.
(b) Prove that each odd integer u satisfies u2 ≡ 1 mod 4.
(c) Prove that no two integers x and y satisfy x2 + y2 ≡ 3 mod 4.
(d) Prove that if x and y are two integers satisfying x2 + y2 ≡ 2 mod 4, then x
and y are both odd.
As an application of these simple facts, let us prove something a little bit less
trivial:
Solution to Exercise 3.3.4. Exercise 3.3.2 (d) (applied to u = n) shows that n is odd
if and only if n ≡ 1 mod 2. Hence, n ≡ 1 mod 2 (since n is odd). In other words,
2 | n − 1. In other words, there exists an integer c such that n − 1 = 2c. Consider
this c. From n − 1 = 2c, we obtain n = 2c + 1, hence n2 = (2c + 1)2 = 4c2 + 4c + 1
and therefore n2 − 1 = 4c2 + 4c = 4c (c + 1). But Exercise 3.3.2 (g) (applied to
u = c) yields c (c + 1) ≡ 0 mod 2; in other words, 2 | c (c + 1). Hence, there exists
an integer d such that c (c + 1) = 2d. Consider this d. Now,
n2 − 1 = 4 c (c + 1) = 4 · 2d = 8d.
| {z }
=2d
Solution to Exercise 3.3.5. Proposition 3.3.2 (a) (applied to 3 and n instead of n and
u) yields that n%3 ∈ {0, 1, 2} and n%3 ≡ n mod 3. Symmetry of congruence yields
n ≡ n%3 mod 3 (since n%3 ≡ n mod 3).
Proposition 3.3.2 (b) (applied to 3 and n instead of n and u) yields that we have
3 | n if and only if n%3 = 0. Since we don’t have 3 | n (because we assumed 3 - n),
we thus conclude that we don’t have n%3 = 0.
Thus we know that n%3 ∈ {0, 1, 2}, but we don’t have n%3 = 0. Hence, n%3 ∈
{0, 1, 2} \ {0} = {1, 2}. Hence, we are in one of the following two cases:
Case 1: We have n%3 = 1.
6 | n3 − n; 12 | n4 − n2 ; 10 | n5 − n; 24 | n5 − n3 ;
6 | n ( n + 1) ( n + 2) ; 24 | n (n + 1) (n + 2) (n + 3)
and many others.
As another example for the use of congruence arguments, let us find out when
Fibonacci numbers are even and when they are odd. A look at the first values
suggests that every third Fibonacci number (starting with f 0 ) is even, while the
remaining ones are odd. Equipped with the notion of a congruence (and parts (c)
and (d) of Exercise 3.3.2), we can restate this as follows:
two nonnegative integers m − 2 and m − 1 are < m, we can thus apply (45) to
n = m − 2 and to n = m − 1 (by our induction hypothesis). We thus obtain
(
0, if 3 | m − 1;
f m −1 ≡ mod 2
1, if 3 - m − 1
and (
0, if 3 | m − 2;
f m −2 ≡ mod 2.
1, if 3 - m − 2
Adding these two congruences, we obtain
( (
0, if 3 | m − 1; 0, if 3 | m − 2;
f m −1 + f m −2 ≡ + mod 2.
1, if 3 - m − 1 1, if 3 - m − 2
This rewrites as
( (
0, if 3 | m − 1; 0, if 3 | m − 2;
fm ≡ + mod 2 (47)
1, if 3 - m − 1 1, if 3 - m − 2
(since the recursive definition of the Fibonacci sequence yields f m = f m−1 + f m−2 ).
Our goal is now to deduce (46) from this congruence. In order to do so, it suffices
to show that
( (
0, if 3 | m − 1; 0, if 3 | m − 2;
+
1, if 3 - m − 1 1, if 3 - m − 2
(
0, if 3 | m;
≡ mod 2 (48)
1, if 3 - m
(because then, combining (47) with (48) will immediately yield (46) by the transi-
tivity of congruence).
The proof of (48) is a straightforward case distinction. Indeed, Proposition 3.3.2
(a) (applied to n = 3 and u = m) yields that m%3 ∈ {0, 1, 2} and m%3 ≡ m mod 3.
Symmetry of congruence yields m ≡ m%3 mod 3 (since m%3 ≡ m mod 3). Since
m%3 ∈ {0, 1, 2}, we are in one of the following three cases:
Case 1: We have m%3 = 0.
Case 2: We have m%3 = 1.
Case 3: We have m%3 = 2.
Let me work through Case 1 in detail, leaving the other two cases to the reader
(the arguments are closely similar). In Case 1, we have m%3 = 0. Thus, m ≡ m%3 =
0 mod 3. According to Proposition 3.2.3 (applied to n = 3 and a = m), we have
m ≡ 0 mod 3 if and only if 3 | m. Thus, 3 | m (since m ≡ 0 mod 3). Furthermore,
subtracting the congruence 1 ≡ 1 mod 3 from the congruence m ≡ 0 mod 3, we
obtain m − 1 ≡ 0 − 1 = −1 mod 3. Thus, we do not have m − 1 ≡ 0 mod 3 (because
For example, the common divisors of 6 and 8 are −2, −1, 1, 2. We refer to [19s,
§2.9] for a thorough treatment of common divisors; here we shall only sketch the
main steps (particularly to the extent they illustrate induction). The notion of a
greatest common divisor is crucial:46
Definition 3.4.2. Let b1 , b2 , . . . , bk be finitely many integers. The greatest com-
mon divisor (or, for short, the gcd) of b1 , b2 , . . . , bk is the nonnegative integer
gcd (b1 , b2 , . . . , bk ) defined as follows:
46 Itis easy to see that any nonzero integer b has only finitely many divisors; indeed, each divisor
of b is an integer between − |b| and |b|. Hence, if b1 , b2 , . . . , bk are finitely many integers that are
not all 0, then there are only finitely many common divisors of b1 , b2 , . . . , bk . Moreover, there is
at least one common divisor of b1 , b2 , . . . , bk (since 1 is always such a divisor). Hence, the set of
all common divisors of b1 , b2 , . . . , bk is nonempty and finite (when b1 , b2 , . . . , bk are not all zero);
therefore, this set has a largest element. This is used implicitly in Definition 3.4.2.
(Note that the second case should make some eyes roll; if b1 , b2 , . . . , bk are all
0, then every integer is a common divisor of b1 , b2 , . . . , bk ; it is thus strange to
designate 0 the greatest common divisor. But this makes the more sense the more
you learn about greatest common divisors. For now, treat it as an annoying special
case.)
For example, gcd (4, 6) = 2 and gcd (3, 5) = 1 and gcd (6, 10, 15) = 1. Definition
3.4.2 easily entails the following (see [19s, Definition 2.9.6] for the details):
Note that we are focusing on gcds of two or fewer numbers for now; we will
eventually come back to the general case.
Theorem 3.4.5 (Bezout’s theorem). Let a and b be two integers. Then, there exist
integers x ∈ Z and y ∈ Z such that
gcd ( a, b) = xa + yb.
I shall prove this theorem here not just because it is crucial for the development
of number theory, but also because its proof is an instructive example of strong
induction on a derived quantity (namely, a + b). First, an example:
Example 3.4.6. Set a = 6 and b = 10. Then, gcd ( a, b) = gcd (6, 10) = 2. Theorem
3.4.5 says that there exist integers x ∈ Z and y ∈ Z such that gcd ( a, b) = xa + yb,
that is, 2 = x · 6 + y · 10. And indeed, it is not hard to find such x and y: For
example, we can take x = 2 and y = −1. (Alternatively, we can take x = 7 and
y = −4. There are infinitely many valid choices.)
{ xa + yb | x ∈ Z and y ∈ Z} .
This is a subset of Z. Thus, Theorem 3.4.5 is saying that for any two integers a and
b, we have
gcd ( a, b) ∈ Za + Zb. (50)
We aim to prove this by strong induction on a + b, but first we need to ensure
that a + b belongs to N (or at least to Z≥ g for some g ∈ Z); this does not come
for free, since a + b can be arbitrarily small when a and b range over Z. We will
ensure a + b ∈ N by restricting ourselves to the case a, b ∈ N and then deducing
the general case from this case.
So, at first, let us prove (50) for a, b ∈ N only. We shall prove this by strong
induction on a + b; that is, we shall prove the following claim:
But our induction hypothesis says that Claim 1 is true for all n < k. Hence, we
can apply Claim 1 to b − a and b instead of b and n (since b − a ∈ N and a +
(b − a) = b and b < k). We thus obtain gcd ( a, b − a) ∈ Za + Z (b − a). However,
Thus, in proving (50) for arbitrary integers a and b, we can WLOG assume that
a and b belong to N. But if they do, then Claim 1 (applied to n = a + b) yields that
gcd ( a, b) ∈ Za + Zb, and we are done. Theorem 3.4.5 is proved.
Our above proof of Theorem 3.4.5 essentially encodes (the most basic form of) the
extended Euclidean algorithm, which computes gcd ( a, b) (for a, b ∈ N) and represents
gcd ( a, b) in the form xa + yb (with x, y ∈ Z) by repeatedly subtracting one of the
numbers a and b from the other until one of the numbers becomes 0. While we have
not explicitly shown any algorithm in our proof, it can be recovered by unraveling
our (strong) induction; generally, inductive proofs encode recursive algorithms. We
shall not usually dwell on the algorithmic content of our proofs.
z = xa + y (b − a) = xa + yb − ya = ( x − y) a + yb.
Proof of Theorem 3.4.7. In order to prove (51), we need to prove the “=⇒” and “⇐=”
directions of the equivalence (51).
Proof of the “=⇒” direction:48 We must show that the statement (m | a and m | b)
implies the statement (m | gcd ( a, b)). So let us assume that m | a and m | b.
Theorem 3.4.5 shows that there exist integers x ∈ Z and y ∈ Z such that
and
m | gcd ( a, b) | b (by Proposition 3.4.4 (f)) .
Thus, we have m | a and m | b. This proves the “⇐=” direction of the equivalence
(51).
Now, both directions of the equivalence (51) are proved, so the equivalence holds.
This proves Theorem 3.4.7.
Theorem 3.4.7 can be restated as “an integer m divides two integers a and b if
and only if it divides their gcd”. This gives a useful way to show that something
divides a gcd. A sample application of Theorem 3.4.7 (as well as a useful fact in
itself) is the following theorem ([19s, Theorem 2.9.20]):
48 Commonly, mathematicians just write “=⇒:” instead of “Proof of the “=⇒” direction:”.
49 Commonly, mathematicians just write “⇐=:” instead of “Proof of the “⇐=” direction:”.
Proof of Theorem 3.4.8 (sketched). What follows is perhaps not the simplest way to
prove Theorem 3.4.8, but it serves as a wonderful illustration of Theorem 3.4.7, as
it will use the latter theorem three times.
If we want to prove that two nonnegative integers x and y are equal, it suffices to
show that they mutually divide each other (i.e., that they satisfy x | y and y | x). In
fact, once this is shown, Proposition 3.1.3 (c) (applied to x and y instead of a and b)
will yield | x | = |y|, and this will rewrite as x = y (since x and y are nonnegative).
This might appear like a roundabout approach to proving equalities, but it turns
out to be pretty useful when x and y are characterized through their divisibility
properties (and this is the case for gcds, among other things).
We shall apply this approach to x := gcd (sa, sb) and y := |s| gcd ( a, b). Our goal
is to show that x = y; thus, we shall achieve it by showing that x | y and y | x.
(Indeed, Proposition 3.4.3 (a) shows that x and y are nonnegative.)
If s = 0, then both x and y are 0 (since gcd (0, 0) = 0), and thus we are done.
Hence, we WLOG assume that s 6= 0. Therefore, |s| 6= 0. This will come handy as
we will divide by |s| soon.
Let us first prove y | x. Indeed, Proposition 3.4.4 (f) yields gcd ( a, b) | a. We
can multiply both sides of this divisibility by s (by applying Proposition 3.1.5 to
gcd ( a, b), a and s instead of a, b and c), and thus obtain gcd ( a, b) · s | as. Note that
the two integers gcd ( a, b) · s and y are equal up to sign, since
y = |s| gcd ( a, b) = ±s gcd ( a, b) = ± gcd ( a, b) · s.
|{z}
=±s
Thus, they mutually divide each other; in particular, we have y | gcd ( a, b) · s | as =
sa. Similarly, y | sb. Thus, the integer y divides both sa and sb. Hence, Theorem
3.4.7 (applied to sa, sb and y instead of a, b and m) shows that it divides gcd (sa, sb).
In other words, y | gcd (sa, sb). In other words, y | x (since x = gcd (sa, sb)).
Let us next prove x | y. The integer |s| divides both sa and sb (since |s| | s | sa
and |s| | s | sb). Thus, Theorem 3.4.7 (applied to sa, sb and |s| instead of a, b
and m) shows that it divides gcd (sa, sb). In other words, it divides x (since x =
x
gcd (sa, sb)). Hence, is an integer (since |s| 6= 0). We shall now show that this
|s|
x
integer divides gcd ( a, b). According to Theorem 3.4.7, this will follow if we can
|s|
show that it divides both a and b. So let us prove that it divides a and b. Indeed,
x
|s| equals either s or −s (depending on the sign of s); thus, · s equals either x or
|s|
x
− x. In either case, we have · s | x. Now,
|s|
x
· s | x = gcd (sa, sb) | sa = as.
|s|
We can “cancel” the factor s from this divisibility (by applying Proposition 3.1.5
x x x
to , a and s instead of a, b and c), and thus obtain | a. Similarly, | b.
|s| |s| |s|
x x x
Combining | a with | b, we obtain | gcd ( a, b) (by Theorem 3.4.7, applied
|s| |s| |s|
x x
to m = ). This, in turn, is equivalent to · s | gcd ( a, b) · s (by Proposition 3.1.5,
|s| |s|
x
applied to , gcd ( a, b) and s instead of a, b and c). In view of gcd ( a, b) · s =
|s|
x x
s gcd ( a, b) = y, this rewrites as · s | y. But as we recall, · s equals either x or
|s| |s|
x
− x; in either case, we have x | · s | y. Hence, x | y is proved.
|s|
We have now proved both x | y and y | x. As we have seen above, this entails
x = y (since x and y are nonnegative). This proves Theorem 3.4.8.
Before we prove this theorem, let us chat about it a bit. Here is an example first:
What makes Theorem 3.4.9 useful is that it lets us “swim upstream” in divisibility
arguments, in the sense of deriving “stronger” divisibilities from “weaker” ones.
(Here, we not-so-rigorously designate a divisibility x | y as “weak” if the ratio y/x
is large and “strong” if it is small. Thus, for example, the divisibility 4 | 24 is
much weaker than either of the two divisibilities 4 | 12 and 12 | 24, so that we
are “swimming downstream” when we derive 4 | 24 from 4 | 12 | 24. We are also
“swimming downstream” when we apply Proposition 3.1.4 (c); indeed, a1 a2 | b1 b2
is “weaker” than a1 | b1 and a2 | b2 (or “equally strong” at best). In contrast, as we
saw in Example 3.4.10, the divisibility ab | gcd ( a, b) · c that we gain from Theorem
3.4.9 can be much “stronger” than the two divisibilities a | c and b | c we have
invested; thus, Theorem 3.4.9 is taking us “upstream”. All this should not be taken
literally, but it gives a useful intuition.)
Again, as the following proof shows, the active ingredient in Theorem 3.4.9 is
Bezout’s theorem:
First proof of Theorem 3.4.9. Theorem 3.4.5 yields that there exist integers x ∈ Z and
y ∈ Z such that gcd ( a, b) = xa + yb. Consider these x and y.
There exists an integer u such that c = au (since a | c). Consider this u.
There exists an integer v such that c = bv (since b | c). Consider this v.
Now,
Thus, there exists an integer d such that gcd ( a, b) · c = abd (namely, d = xv + yu).
In other words, ab | gcd ( a, b) · c. This proves Theorem 3.4.9.
Second proof of Theorem 3.4.9. We have a | a and b | c, thus ab | ac (by Proposition
3.1.4 (c), applied to a1 = a, a2 = b, b1 = a and b2 = c). Also, we have a | c and b | b,
thus ab | cb (by Proposition 3.1.4 (c), applied to a1 = a, a2 = c, b1 = b and b2 = b).
However, we have the logical equivalence
(by Theorem 3.4.7, applied to ac, cb and ab instead of a, b and m). Therefore,
we have ab | gcd ( ac, cb) (since we have ab | ac and ab | cb). This rewrites as
ab | gcd (ca, cb) (since ac = ca).
But Theorem 3.4.8 (applied to s = c) yields
Hence,
ab | gcd (ca, cb) | gcd ( a, b) · c.
This proves Theorem 3.4.9 again.
Here is yet another fact ([19s, Theorem 2.9.19]) that follows from Bezout’s theo-
rem:
Theorem 3.4.11, too, is a tool for “swimming upstream” (as the resulting divisi-
bility a | gcd ( a, b) · c is usually “stronger” than a | bc).
First proof of Theorem 3.4.11. Theorem 3.4.5 yields that there exist integers x ∈ Z
and y ∈ Z such that gcd ( a, b) = xa + yb. Consider these x and y.
We have axc ≡ 0 mod a (since a | axc) and ybc ≡ 0 mod a (since a | bc | ybc).
Adding these two congruences together, we obtain axc + ybc ≡ 0 + 0 = 0 mod a.
In view of axc + ybc = ( xa + yb) c = gcd ( a, b) · c, this rewrites as gcd ( a, b) · c ≡
| {z }
=gcd( a,b)
0 mod a. In other words, a | gcd ( a, b) · c. This proves Theorem 3.4.11.
(by Theorem 3.4.7, applied to ac, bc and a instead of a, b and m). Therefore, we
have a | gcd ( ac, bc) (since we have a | ac and a | bc). This rewrites as a | gcd (ca, cb)
(since ac = ca and bc = cb). But just as in the Second proof of Theorem 3.4.9, we
can show that gcd (ca, cb) | gcd ( a, b) · c. Hence, a | gcd (ca, cb) | gcd ( a, b) · c. This
proves Theorem 3.4.11 again.
Here is yet another property of gcds:
Hint to proof of Proposition 3.4.12. Show that gcd ( a1 , a2 ) divides both b1 and b2 ; then
argue by Theorem 3.4.7. (See [19s, Exercise 2.9.4] for details.)
gcd (b1 , b2 , . . . , bk ) = x1 b1 + x2 b2 + · · · + xk bk .
50 If there is only one nonzero number among b1 , b2 , . . . , bk , then the claim is easily verified by hand.
Theorem 3.4.14 can easily be derived from Theorem 3.4.13 just as Theorem 3.4.7
was derived from Theorem 3.4.5. An alternative proof of Theorem 3.4.14 is found
in [19s, proof of Theorem 2.9.21 (a)].
It is an instructive exercise to derive from Theorem 3.4.14 the following conse-
quence:
See [19s, proof of Theorem 2.9.26] for a detailed proof of Theorem 3.4.15.
It is also not hard to extend Theorem 3.4.8 to multiple numbers ([19s, Exercise
2.9.7]):
3.4.7. An exercise
Here is a sample exercise on greatest common divisors, before we go on to properly
exploit them:
Solution to Exercise 3.4.1 (sketched). This is an outline; see [19s, solution to Exercise
2.9.3] for a detailed version.
(a) Let a ∈ N and b ∈ N be such that b ≥ a. We have b − a ∈ N (since b ≥ a).
Hence, ub−a is an integer. We have
u b − 1 − ( u a − 1) = u b − u a = u b − a − 1 u a .
ugcd(a,b) − 1 .
Note that a and b play symmetric roles in this claim51 , and thus can be swapped
at will. By swapping a and b if necessary, we can ensure that a ≤ b. Hence, we
WLOG assume that a ≤ b. Thus, b − a ∈ N.
It is easy to see that our claim gcd u a − 1, ub − 1 = ugcd(a,b) − 1 holds if a = 0
52 .
Thus, we are done if a = 0. Hence, we WLOG assume that a 6= 0. Therefore,
a > 0 (since a ∈ N). Thus, a + b > b, so that b < a + b = k.
But our induction hypothesis says that Exercise 3.4.1 (b) is true for a + b < k.
Hence, we can apply Exercise 3.4.1 (b) to b − a instead of b (since b − a ∈ N and
a + (b − a) = b < k). We thus obtain
gcd u a − 1, ub−a − 1 = ugcd(a,b−a) − 1 . (53)
But we have gcd ( a, b − a) = gcd ( a, b) (this has already been proved during our
proof of Theorem 3.4.5). Furthermore, Exercise 3.4.1 (a) (applied to b − a instead of
a) yields ub − 1 ≡ ub−a − 1 mod ub−(b−a) − 1 (since b − a ∈ N and b ≥ b − a). Since
b − (b − a) = a, this rewrites as ub − 1 ≡ ub−a − 1 mod u a − 1. Hence, Proposition
3.4.4 (d) (applied to u a − 1, ub − 1 and ub−a − 1 instead of a, b and c) yields
b− a
a b
gcd u − 1, u − 1 = gcd u − 1, u a
− 1 = ugcd(a,b−a) − 1 (by (53))
Now, forget that we fixed a, b. We thus have shown that any a, b ∈ N satisfying
a + b = k satisfy gcd u a − 1, ub − 1 = ugcd(a,b) − 1 . In other words, Exercise 3.4.1
(b) is true for a + b = k. This completes the induction step. Thus, Exercise 3.4.1 (b)
is solved.
[See also https://math.stackexchange.com/questions/7473/ for various solu-
tions of Exercise 3.4.1 (b).]
51 because Proposition 3.4.4 (b) yields gcd ( a, b) = gcd (b, a) and gcd u a − 1, ub − 1 =
gcd ub − 1, u a − 1
52 Proof. Assume that a = 0. Then, gcd ( a, b) = b (this has already been proved during our above
proof of Theorem 3.4.5) and thus b = gcd ( a, b). Furthermore, from a = 0, we obtain u a − 1 =
u0 − 1 = 0 (since u0 = 1) and therefore
gcd u a − 1, ub − 1 = gcd 0, ub − 1
= gcd ub − 1, 0 (by Proposition 3.4.4 (b))
qed.
3.5. Coprimality
3.5.1. Definition and basic properties
Perhaps ironically, gcds are at their most useful when they equal 1. This situation
has a name:
Definition 3.5.1. Let a and b be two integers. We say that a is coprime to b if and
only if gcd ( a, b) = 1.
Example 3.5.2. (a) The number 2 is coprime to 3, since gcd (2, 3) = 1. More
generally, if a is any integer, then a is coprime to a + 1. (Check this! Or see [19s,
Example 2.10.2 (c)] for the proof.)
(b) The number 6 is not coprime to 15, since gcd (6, 15) = 3 6= 1.
(c) Let a be an integer. Then, it is easy to see (see [19s, Example 2.10.2 (d)] for
the proof) that
(
2, if a is even;
gcd ( a, a + 2) = gcd ( a, 2) =
1, if a is odd.
Proof of Proposition 3.5.4. Follows from Proposition 3.4.4 (b). (See [19s, proof of
Proposition 2.10.4] for details.)
Note that coprimality is not transitive: i.e., if we have a ⊥ b and b ⊥ c, then we
don’t usually have a ⊥ c. (A simple counterexample is a = 2, b = 1 and c = 2.)
Definition 3.5.5. Let a and b be two integers. Proposition 3.5.4 shows that a is
coprime to b if and only if b is coprime to a. Hence, we shall sometimes use a
more symmetric terminology for this situation: We shall say that “a and b are
coprime” to mean that a is coprime to b (or, equivalently, that b is coprime to a).
53 The book [NiZuMo91] even abbreviates “coprime” as “prime”, which I find somewhat misleading
(as the concept is only mildly related to the notion of a “prime” that we will discuss later on).
Proof of Theorem 3.5.7. We have gcd ( a, b) = 1 (as in the proof of Theorem 3.5.6).
Now, Theorem 3.4.9 yields ab | gcd ( a, b) ·c = c. This proves Theorem 3.5.7.
| {z }
=1
Theorem 3.5.7 is highly useful, and will become more so once we have learnt
about prime factorization. For now, here is a quick sample application:
Solution to Exercise 3.5.3. The integer n is odd (since 2 - n); thus, Exercise 3.3.4 yields
8 | n2 − 1. Also, 3 - n; thus Exercise 3.3.5 yields 3 | n2 − 1. But it is easy to see
that gcd (8, 3) = 1, so that 8 ⊥ 3 (by the definition of “coprime”). Thus, Theorem
3.5.7 (applied to a = 8, b = 3 and c = n2 − 1) yields 8 · 3 | n2 − 1. In other words,
24 | n2 − 1 (since 8 · 3 = 24). This solves Exercise 3.5.3.
Coprimality is “inherited” by divisors, in the sense that coprime integers have
coprime divisors. To be more precise:
Proof of Proposition 3.5.8. We have b1 ⊥ b2 ; in other words, gcd (b1 , b2 ) = 1 (by the
definition of “coprime”). But Proposition 3.4.12 yields gcd ( a1 , a2 ) | gcd (b1 , b2 ) = 1.
Since gcd ( a1 , a2 ) is a nonnegative integer (by Proposition 3.4.3 (a)), this entails that
gcd ( a1 , a2 ) = 1 (since the only nonnegative integer that divides 1 is 1). In other
words, a1 ⊥ a2 (by the definition of “coprime”). This proves Proposition 3.5.8.
The next theorem (still part of the fallout of Bezout’s theorem) is important, but
we will not truly appreciate it until later:
aa0 = 1; this exists if and only if a equals 1 or −1). Theorem 3.5.9 (b) shows that
such a modular inverse always exists when a ⊥ n; Theorem 3.5.9 (c) is the converse
of this statement (i.e., it says that if a modular inverse of a modulo n exists, then
a ⊥ n).
Proof of Theorem 3.5.9 (sketched). (See [19s, proof of Theorem 2.10.8] for details.)
(a) Theorem 3.4.5 (applied to b = n) yields that there exist integers x ∈ Z and y ∈
Z such that gcd ( a, n) = xa + yn. Consider these x and y. We have54 gcd ( a, n) =
xa + yn ≡ xa = ax mod n, so that ax ≡ gcd ( a, n) mod n. Thus, there exists an
|{z}
≡0 mod n
a0 ∈ Z such that aa0 ≡ gcd ( a, n) mod n (namely, a0 = x). This proves Theorem 3.5.9
(a).
(b) Assume that a ⊥ n. In other words, gcd ( a, n) = 1 (by the definition of
“coprime”). Hence, the claim of Theorem 3.5.9 (a) rewrites immediately as the
claim of Theorem 3.5.9 (b).
(c) Assume that there exists an a0 ∈ Z such that aa0 ≡ 1 mod n. Consider this a0 .
Let g = gcd ( a, n). Then, g is a nonnegative integer55 , and Proposition 3.4.4 (f)
(applied to b = n) yields g | a and g | n.
Now, g | a | aa0 , so that aa0 ≡ 0 mod g. But also g | n. Hence, from aa0 ≡ 1 mod n,
we obtain aa0 ≡ 1 mod g (by Proposition 3.2.6 (e), applied to g, aa0 and 1 instead of
m, a and b). Hence, 1 ≡ aa0 ≡ 0 mod g. Equivalently, g | 1 − 0 = 1. Hence, g = 1
(since the only nonnegative integer that divides 1 is 1). Thus, gcd ( a, n) = g = 1. In
other words, a ⊥ n. This proves Theorem 3.5.9 (c).
Proof of Theorem 3.5.10. Theorem 3.5.9 (b) (applied to n = c) yields that there exists
an a0 ∈ Z such that aa0 ≡ 1 mod c. Likewise, Theorem 3.5.9 (b) (applied to b and
c instead of a and n) yields that there exists a b0 ∈ Z such that bb0 ≡ 1 mod c.
Consider these a0 and b0 .
Multiplying the two congruences aa0 ≡ 1 mod c and bb0 ≡ 1 mod c, we obtain
( aa0 ) (bb0 ) ≡ 1 · 1 = 1 mod c.
Now, define the integers r = ab and s = a0 b0 . Then, |{z}
r |{z}s = ( ab) ( a0 b0 ) =
= ab = a0 b0
≡ 1 mod c. Hence, there exists an ∈ Z such
( aa0 ) (bb0 ) r0 that rr 0 ≡ 1 mod c
(namely,
r 0 = s). Thus, Theorem 3.5.9 (c) (applied to r and c instead of a and n) yields that
r ⊥ c. In view of r = ab, this rewrites as ab ⊥ c. This proves Theorem 3.5.10.
54 Here, we are again using the substitution principle for congruences (from Example 3.2.13). Con-
vince yourself that you know how to do without this principle.
55 by Proposition 3.4.3 (a)
Second proof of Lemma 3.5.11. Theorem 3.5.9 (b) yields that there exists an a0 ∈ Z
such that aa0 ≡ 1 mod n (since a ⊥ n). Consider this a0 . Now, multiplying both
sides of the congruence ab ≡ ac mod n by a0 , we obtain
a0 ab ≡ a0 ac mod n.
But we have a0 a
|{z} c ≡ 1c = c mod n and similarly a0 ab ≡ b mod n. Hence,
= aa0 ≡1 mod n
b ≡ a0 ab ≡ a0 ac ≡ c mod n.
Proposition 3.5.12. Let a and b be two integers such that ( a, b) 6= (0, 0). Let
a b
g = gcd ( a, b). Then, g > 0 and ⊥ .
g g
Proof of Proposition 3.5.12. The integers a and b are not both 0 (since ( a, b) 6= (0, 0)).
Hence, gcd ( a, b) is a positive integer (by Proposition 3.4.3 (b)). Thus, gcd ( a, b) > 0.
In other words, g > 0 (since g = gcd ( a, b)).
Moreover, g = gcd ( a, b), so that Proposition 3.4.4 (f) yields g | a and g | b. Hence,
a b a b
and are integers. Thus, Theorem 3.4.8 (applied to g, and ) yields
g g g g
a b a b a b
gcd g · , g · = | g| gcd , = g gcd , .
g g |{z} g g g g
=g
(since g>0)
Therefore,
a b 1 a b 1
gcd , = gcd g · , g · = gcd ( a, b) = 1
g g g g g g
|{z} |{z}
=a =b
a b
(since g = gcd ( a, b)). In other words, ⊥ (by the definition of “coprime”). This
g g
proves Proposition 3.5.12.
An easy consequence of Proposition 3.5.12 is the following fundamental fact
([19s, Exercise 2.10.14]):
Corollary 3.5.13. Let r ∈ Q. Then, there exist two coprime integers a and b
satisfying r = a/b.
Proof of Corollary 3.5.13. Write r as r = x/y for some integers x and y (with y 6= 0).
Apply Proposition 3.5.12 to a = x and b = y. (Details are found in [19s, solution to
Exercise 2.10.14].)
Corollary 3.5.13 is commonly stated in the form “any rational number can be
represented as a reduced fraction”. Here, “reduced fraction” means a fraction in
which the numerator and the denominator are coprime integers. (Such fractions
are also known as “irreducible fractions” or “fractions in lowest terms”.)
Exercise 3.5.7. Find three integers x, y and z such that gcd ( x, y, z) = 1, yet no
two of x, y and z are coprime.
gcd ( x, y) = gcd (bc, ca) = gcd (ca, bc) = gcd (ca, cb)
= |c| gcd ( a, b) (by Theorem 3.4.8)
| {z }
=1
(since any two of a, b and c
are coprime)
= |c| = c (since c > 1 ≥ 0)
>1
and similarly gcd (y, z) > 1 and gcd (z, x ) > 1 (which shows that no two of x, y
and z are coprime), but also
gcd ( x, y, z) = gcd gcd ( x, y), gcd (z) (by Theorem 3.4.15)
| {z } | {z }
=c =z
(by Proposition 3.4.4 (a))
(since Theorem 3.5.10 yields ab ⊥ c). Thus, in order to solve the exercise, it remains
to find three integers a, b and c that are mutually coprime and greater than 1. But
this is easy – for example, one can take a = 5 and b = 3 and c = 2. Taking these
yields x = 6, y = 10 and z = 15, which is our above example.
Another application of coprime integers is the following fact (known as the ra-
tional root test):
Remark 3.5.15. Theorem 3.5.14 provides an algorithm for finding all rational
roots of a polynomial with integer coefficients. Indeed, let P ( x ) = an x n +
an−1 x n−1 + · · · + a0 x0 be such a polynomial. We can WLOG assume that an 6= 0
(otherwise, we throw away the an x n term and replace n by n − 1) and that a0 6= 0
(otherwise, we record 0 as a root of our polynomial and divide P ( x ) by x). Any
rational root r of P ( x ) can be written in the form r = p/q for some integers p
and q satisfying p ⊥ q (by Corollary 3.5.13). Writing it in this form, we then con-
clude from Theorem 3.5.14 that p | a0 and q | an . But p | a0 yields only finitely
many options for p (since a0 is nonzero and thus has only finitely many divi-
sors), and q | an yields only finitely many options for q (since an is nonzero and
thus has only finitely many divisors). Thus, we have only finitely many options
for r (since r = p/q). By listing all these options and checking which of them
actually satisfy P (r ) = 0, we can identify all rational roots of P ( x ). (Note that
divisors of a positive integer can be negative; however, we can WLOG assume
that q > 0 because otherwise we can replace p and q by − p and −q.)
We state another property of gcds and coprimality, which will come useful in an
exercise later on:
Hence, we have gcd ( a, bc) | gcd ( a, b) (since we have gcd ( a, bc) | a and gcd ( a, bc) |
b).
On the other hand, a | a and b | bc. Hence, Proposition 3.4.12 (applied to a1 = a,
a2 = b, b1 = a and b2 = bc) yields
Recall also that gcd ( a, bc) | gcd ( a, b). Thus, Proposition 3.1.3 (c) (applied to
gcd ( a, bc) and gcd ( a, b) instead of a and b) yields |gcd ( a, bc)| = |gcd ( a, b)|. But a
gcd is always a nonnegative integer (by Proposition 3.4.3 (a)); thus, both gcd ( a, bc)
and gcd ( a, b) are nonnegative integers, and therefore satisfy |gcd ( a, bc)| = gcd ( a, bc)
and |gcd ( a, b)| = gcd ( a, b). Hence, gcd ( a, bc) = |gcd ( a, bc)| = |gcd ( a, b)| =
gcd ( a, b). This proves Proposition 3.5.18.
For example, lcm (6, 9) = 18 and lcm (3, 5) = 15 and lcm (6, 10, 15) = 30 and
lcm (2, 4, 0) = 0. Definition 3.6.2 immediately yields the following:
Hints to the proof of Theorem 3.6.4. (See [19s, Theorem 2.11.6] for the details.) We
WLOG assume that a 6= 0 and b 6= 0 (since otherwise, our claim immediately boils
ab
down to 0 = 0). Then, set c = . It is now easy to see that c is a nonzero
gcd ( a, b)
integer (since gcd ( a, b) | a | ab and ab 6= 0) and is a common multiple of a and b
56 Proof. Assume that b1 , b2 , . . . , bk are nonzero. Then, the product b1 b2 · · · bk is nonzero, so that
its absolute value |b1 b2 · · · bk | is a positive integer. Moreover, |b1 b2 · · · bk | is a common multiple
of b1 , b2 , . . . , bk (indeed, each i ∈ {1, 2, . . . , k} satisfies bi | b1 b2 · · · bk | |b1 b2 · · · bk | ). Hence,
there exists at least one positive common multiple of b1 , b2 , . . . , bk (namely, |b1 b2 · · · bk |). Hence,
the set of all positive common multiples of b1 , b2 , . . . , bk is nonempty. Since this set is a set of
nonnegative integers, we thus conclude (using Theorem 5.1.2) that it has a minimum. In other
words, the smallest positive common multiple of b1 , b2 , . . . , bk is well-defined.
(since gcd ( a, b) | b and gcd ( a, b) | a). Thus, |c| is a positive common multiple of a
and b (indeed, c 6= 0, so that |c| is positive).
On the other hand, the definition of c yields gcd ( a, b) · c = ab. Now, if x is any
positive common multiple of a and b, then Theorem 3.4.9 (applied to x instead of
c) yields ab | gcd ( a, b) · x, so that gcd ( a, b) · c = ab | gcd ( a, b) · x and therefore
c | x (here, we have cancelled the nonzero factor gcd ( a, b) from our divisibility),
which entails x ≥ |c|. In other words, any positive common multiple of a and b
is ≥ |c|. Thus, |c| is the smallest positive common multiple of a and b (since we
already know that |c| is a positive common multiple of a and b). In other words,
|c| = lcm ( a, b). Hence,
ab | ab|
lcm ( a, b) = |c| = =
gcd ( a, b) gcd ( a, b)
(since gcd ( a, b) is positive), and this yields the claim of Theorem 3.6.4.
The lowest common multiple lcm ( a, b) of two integers a and b has a universal
property analogous to that of the greatest common divisor (Theorem 3.4.7):
Hints to the proof of Theorem 3.6.5. (See [19s, Theorem 2.11.7 (a)] for the details.) We
WLOG assume that a 6= 0 and b 6= 0 (since otherwise, both sides of (55) are equiv-
alent to the statement “m = 0” and therefore are equivalent to each other). Let
n = lcm ( a, b). Thus, n is a positive integer. Now, our goal is to prove the equiva-
lence (55). The “⇐=” direction of this equivalence is easy (in fact, if lcm ( a, b) | m,
then a | lcm ( a, b) | m and b | lcm ( a, b) | m), so we only need to prove the “=⇒”
direction. To achieve this, we assume that a | m and b | m. Thus, m is a common
multiple of a and b. Therefore, the remainder m%n must also be a common multiple
of a and b (why?). However, this remainder m%n belongs to {0, 1, . . . , n − 1}, and
thus is either 0 or a positive integer smaller than n. However, as a common multi-
ple of a and b, it cannot be a positive integer smaller than n (because n = lcm ( a, b)
is the smallest positive common multiple of a and b). Hence, it must be 0. In other
words, m%n = 0. Equivalently, n | m, so that lcm ( a, b) = n | m. This proves
the “=⇒” direction of the equivalence (55); thus, our proof of Theorem 3.6.5 is
complete.
Theorem 3.6.5 can be generalized to k integers:
Hints to the proof of Theorem 3.6.6. This is a straightforward adaptation of our proof
of Theorem 3.6.5.
We end our first dive into number theory here, but we shall come back to it a few
more times during this course. One last comment at this point: It is commonly be-
lieved that number theory quickly starts requiring advanced mathematics (analysis,
geometry, abstract algebra) as one goes beyond the basics. This is not true; there
are several books full of beautiful results treated with elementary means ([Stein09],
[UspHea39], [NiZuMo91]; see also [AnDoMu17] for a text specifically targeted at
olympiad problems). There also are miraculous applications accessible at the most
basic level, such as the RSA cryptosystem; as these are nowadays treated in most
courses on abstract algebra or cryptography, I shall not discuss them here.
n+k−1
|S| ≤ .
k
n+1
(Thus, in particular, if S is a lacunar subset of {1, 2, . . . , n}, then |S| ≤ .)
2
Exercise 3.7.3. Let ( F0 , F1 , F2 , . . .) be the Fermat sequence – that is, the sequence of
integers defined by
n
Fn = 22 + 1 for each n ∈ N.
(Keep in mind that nested powers are to be read top-to-bottom: That is, the
c c c
expression “ab ” means a(b ) rather than ab .)
(b) Prove that gcd ( Fn , Fm ) = 1 for any two distinct nonnegative integers n and
m.
Exercise 3.7.4. Prove that there exist infinitely many odd positive integers n for
which
1! · 2! · · · · · (2n)!
is a perfect square.
( n + 1) !
Exercise 3.7.6. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Prove that each non-
negative integer n satisfies
Exercise 3.7.7. Let a and b be two positive integers. Prove that there exist posi-
tive integers x and y such that
gcd ( a, b) = xa − yb.
Exercise 3.7.8. Prove that any positive integer a can be uniquely expressed in the
form
a = 3m + bm−1 3m−1 + bm−2 3m−2 + · · · + b0 30
where m is a nonnegative integer, and where b0 , b1 , . . . , bm−1 ∈ {0, 1, −1}. (This
is called the balanced ternary representation.)
Then,
Thus, the entries 4, 6, 8, 9 are marked twice. This is exactly the pq entries claimed
in the exercise. You can easily find situations in which there are more than pq
doubly-marked entries.]
Exercise 3.7.10. A bitstring shall mean a finite sequence consisting of 0’s and 1’s.
(This is what we called an “n-bitstring” in Exercise 2.1.3, except that the length is
no longer fixed.) We shall write our bitstrings without commas and parentheses
– i.e., we shall simply write a1 a2 · · · an for the bitstring ( a1 , a2 , . . . , an ).
Bitstrings can be transformed by moves. In each move, you pick two consecutive
entries 01 in the bitstring (appearing in this order), and replace them by three
consecutive entries 100 (in this order). In other words, in each, move you replace
a bitstring of the form . . . 01 . . . by . . . 100 . . ., where the two “. . .” parts stay
unchanged. For example, here is a move:
01101101 → 011100101
(where we are using an underscore to mark the place where the move is hap-
pening). Here is a sequence of moves:
(where we are putting an underscore under the position of the next move). Note
that the last bitstring in this sequence has no two consecutive entries 01 any
more, and thus no more moves can be applied to it.
(a) Prove that there are no infinite sequences of moves. That is, if you start
with a bitstring a, then any sequence of moves that can be applied successively
must have an end.
(b) A bitstring shall be called immovable if no move can be applied to it. Part
(a) shows that, starting with any bitstring a, we can always reach an immovable
bitstring by performing moves until no more moves are possible. Prove that this
immovable bitstring is uniquely determined by a – that is, no matter how you
perform the moves, the immovable bitstring that results at the end will be the
same. Moreover, the number of moves needed to reach the immovable bitstring
will be the same.
=2·(7n+1)+1
(since Exercise 3.5.1 (a) yields 1 ⊥ 7n + 1 and thus gcd (1, 7n + 1) = 1). In other
words, 21n + 4 ⊥ 14n + 3. This solves Exercise 3.8.1.
A second solution to Exercise 3.8.1 can be given using the following converse of
Bezout’s theorem:
Proof of Proposition 3.8.1. (a) Let g = gcd ( a, b). Thus, g = gcd ( a, b) | a (by Proposi-
tion 3.4.4 (f)), so that a ≡ 0 mod g. Similarly, b ≡ 0 mod g. Now, x |{z} a +y |{z}
b ≡
≡0 mod g ≡0 mod g
x · 0 + y · 0 = 0 mod g. In other words, g | xa + yb. In other words, gcd ( a, b) |
xa + yb (since g = gcd ( a, b)). This proves Proposition 3.8.1 (a).
(b) We know (from Proposition 3.4.3 (a)) that gcd ( a, b) is a nonnegative integer.
But Proposition 3.8.1 (a) yields gcd ( a, b) | xa + yb = 1. Thus, gcd ( a, b) is a divisor
of 1, and therefore a nonnegative divisor of 1 (since gcd ( a, b) is nonnegative). But
the only nonnegative divisor of 1 is 1 itself. Hence, we conclude that gcd ( a, b) = 1.
In other words, a ⊥ b. This proves Proposition 3.8.1 (b).
Second solution to Exercise 3.8.1. We have (−2) · (21n + 4) + 3 · (14n + 3) = 1. Hence,
Proposition 3.8.1 (b) (applied to a = 21n + 4, x = −2, b = 14n + 3 and y = 3) yields
21n + 4 ⊥ 14n + 3. This solves Exercise 3.8.1 again.
This second solution to Exercise 3.8.1 is slick, but how could we have found
it? The answer turns out to be “pretty easily, once we made up our mind to
apply Proposition 3.8.1 (b)”. Indeed, in order to prove 21n + 4 ⊥ 14n + 3 us-
ing Proposition 3.8.1 (b), it is necessary to find two integers x and y that satisfy
x · (21n + 4) + y · (14n + 3) = 1. In theory, these x and y could depend on n, but
the first thing you should try are constants. So you are looking for two (constant)
integers x and y that satisfy x · (21n + 4) + y · (14n + 3) = 1 for each n ∈ Z. But
this boils down to a system of infinitely many linear equations in x and y (one for
each n); any two of them determine x and y uniquely. Solving the system thus
yields x = −2 and y = 3, which is exactly the two numbers used in the solution
above.
Here is another little exercise:
Exercise 3.8.2. You have a corridor with 1000 lamps, which are initially all off.
Each lamp has a light switch controlling its state.
Every night, a ghost glides through the corridor (always in the same direction)
and flips some of the switches:
On the 1st night, the ghost flips every switch.
On the 2nd night, the ghost flips switches 2, 4, 6, 8, 10, . . ..
On the 3rd night, the ghost flips switches 3, 6, 9, 12, 15, . . ..
etc.
(That is: For each k ∈ {1, 2, . . . , 1000}, the ghost spends the k-th night flipping
switches k, 2k, 3k, . . ..)
Which lamps will be on after 1000 nights?
Discussion of Exercise 3.8.2. Let us first make the problem more manageable by fo-
cussing on a single lamp. So let us fix some m ∈ {1, 2, . . . , 1000} and find out
whether lamp m is on after 1000 nights.
Indeed, switch m gets flipped on the k-th night if and only if m is a multiple of k.
In other words, switch m gets flipped on the k-th night if and only if k is a divisor
of m. Thus, the number of times that switch m gets flipped (during the entire 1000
nights) is precisely the number of positive divisors of m. Of course, lamp m will be
on after 1000 nights if and only if this number of times is odd. Thus, asking which
lamps will be on after 1000 nights is equivalent to asking which of the numbers
1, 2, . . . , 1000 have an odd number of positive divisors.
Experiments reveal that among the first 10 positive integers, only three have an
odd number of positive divisors: namely, 1, 4 and 9. (For example, 9 has the 3
positive divisors 1, 3 and 9.) This suggests the following:
Exercise 3.8.3. Let n be a positive integer. Prove that the number of positive
divisors of n is even if and only if n is not a perfect square.
Solution to Exercise 3.8.3 (sketched). A detailed proof can be found in [19s, Proposi-
tion 2.14.7], so we shall keep to the main idea. We will use the word “posdiv” as
n
shorthand for “positive divisor”. If d is a posdiv of n, then is an integer and
d
n
again a posdiv of n. We shall refer to as the complement of d. Note that being the
d
complement is a symmetric relation: If d is a posdiv of n, and if e is the complement
of d, then d is in turn the complement of e.
We can thus pair up each posdiv of n with its complement. This results in
a “pairing” that covers all posdivs of n, except that it might fail to be a proper
pairing: Namely, if a posdiv of n is its own complement, then this posdiv will be
paired with itself.
Example 3.8.2. Let us see how this “pairing” looks like:
When does n have a posdiv that gets paired with itself? In other words, when is
n
there a posdiv d of n that is its own complement? Clearly, this means that d = ,
d
or, equivalently, n = d2 . If n is
√ a perfect square, then there is exactly one posdiv d
2
that satisfies n = d (namely, n); otherwise, there is no such d. Thus:
• If n is a perfect square, then exactly one posdiv of n gets paired with itself.
Hence:
Solution to Exercise 3.8.4. The numbers a and b are coprime; in other words, gcd ( a, b) =
1.
But Theorem 3.4.5 yields that there exist integers x ∈ Z and y ∈ Z such that
gcd ( a, b) = xa + yb. Consider these x and y, and denote them by x 0 and y0 . (We do
not want to call them x and y, since they are not the x and y we are looking for.)
Thus, x 0 and y0 are integers satisfying gcd ( a, b) = x 0 a + y0 b. Hence, x 0 a + y0 b =
gcd ( a, b) = 1. Multiplying both sides of this equality by n, we find n ( x 0 a + y0 b) =
n · 1 = n. Hence, n = n ( x 0 a + y0 b) = nx 0 a + ny0 b. Thus, there exist integers x and y
such that n = xa + yb (namely, x = nx 0 and y = ny0 ). This solves Exercise 3.8.4.
Now, what happens if we require x and y to be nonnegative in Exercise 3.8.4?
Then, Exercise 3.8.4 is no longer valid. For example, if a = 3 and b = 5, then there
are no nonnegative integers x and y such that 4 = xa + yb. This is, in a way, due
to 4 being “too small”; one is thus tempted to ask whether requiring n to be large
enough (for a and b positive) will force those nonnegative x and y to exist. If so,
then how large is large enough?
The answer is given by a famous result of J. J. Sylvester (who found it in 1882
when studying invariant theory). We state it as an exercise:
Exercise 3.8.5. Let a and b be two coprime positive integers. Let n be an integer
such that n > ab − a − b.
Prove that there exist nonnegative integers x and y such that n = xa + yb.
The “n > ab − a − b” bound in Exercise 3.8.5 is sharp: The claim of the exercise
would no longer hold if we allowed n = ab − a − b. (See Exercise 4.5.2 (b) for why.)
Exercise 3.8.5 is often stated in terms of coins: If a and b are two coprime positive
integers, and if you have unlimited supplies of a-cent coins and of b-cent coins, but
no other coins, then Exercise 3.8.5 says that you can pay any amount that is larger
than ab − a − b cents57 without asking for change. See Wikipedia on the Sylvester
Coin Problem, which also studies the generalization to more than two sorts of
coins. (This generalization is significantly harder.)58
Discussion of Exercise 3.8.5. Exercise 3.8.4 yields that there exist integers x and y
such that n = xa + yb. Consider these x and y, and denote them by x 0 and y0 . (We
do not want to call them x and y, since they are not the x and y we are looking for.)
Thus, x 0 and y0 are integers satisfying n = x 0 a + y0 b.
If x 0 and y0 are nonnegative, then we are already done (since we can just take
x = x 0 and y = y0 ). But x 0 and y0 might not be nonnegative yet. The trick is
now to modify x 0 and y0 in such a way that they become nonnegative but the sum
x 0 a + y0 b is unchanged. (If you want, you can view this as an instance of the “find
a not-quite-answer and tweak it until it becomes a full answer” technique; the
time-honored regula falsi is another instance of this technique.)
How can we modify x 0 and y0 in a way that x 0 a + y0 b is unchanged? A simple
way to do so is to add b to x 0 and subtract a from y0 (because this causes x 0 a + y0 b to
become ( x 0 + b) a + (y0 − a) b, which is still the same as x 0 a + y0 b). More generally,
we can pick any d ∈ Z and add db to x 0 and subtract da from y0 . Obviously, if
we pick d large enough, then x 0 + db will become nonnegative, whereas a small
enough d will make y0 − da nonnegative. The question is: Is there a (nonempty)
“goldilocks zone” in which d is sufficiently large for x 0 + db to be nonnegative and
yet sufficiently small for y0 − da to be nonnegative?
We can try to describe this “goldilocks zone” explicitly. The number x 0 + db is
− x0
nonnegative if and only if d ≥ (check this!); on the other hand, the number
b
y0
y0 − da is nonnegative if and only if d ≤ . Hence, the “goldilocks zone” for d is
a
− x 0 y0
the interval , . Let us check whether this interval is nonempty. We have
b a
y0 − x 0 x 0 a + y0 b ab − a − b
since x 0 a + y0 b = n > ab − a − b
− = >
a b ab ab
1 1
= 1− − ,
a b
which is ≥ 0 in all interesting cases (the only exception being when a or b is 1,
but this case is easy to handle separately). Thus, in all interesting cases, we have
y0 − x0
≥ .
a b
Unfortunately, this is not
the whole story. We are not looking for a real 0number0
− x 0 y0 y −x
d in the interval , , but for an integer d in this interval. Having ≥
b a a b
guarantees the former but not the latter. How can we guarantee the latter? What
must the difference β − α of two real numbers α and β satisfy to ensure that the
interval [α, β] contains an integer?
It is not hard to see that the answer to this question is “they must satisfy β − α ≥
y0 − x 0
1”. Unfortunately, this is not true for our “goldilocks zone”; the difference −
a b
is always < 1. So we are stuck.
Being stuck, let us revisit what we did, in the hopes of finding something im-
provable. Did we perhaps throw away some information too early, or make too
weak an estimate? One thing that stands out is that we never really used the fact
that x 0 and y0 are integers.
This turns out to be the key. We said that the number x 0 + db is nonnegative if
−x0
and only if d ≥ . But we can say something slightly stronger: The number
b
− x0 − 1
x 0 + db is nonnegative if and only if d > . Indeed, we have the following
b
chain of equivalences:
x 0 + db is nonnegative ⇐⇒ x 0 + db ≥ 0
− x0 − 1
0
⇐⇒ db > − x − 1 ⇐⇒ d > .
b
y0 + 1 − x 0 − 1 x 0 a + y0 b + a + b n+a+b
since x 0 a + y0 b = n
− = =
a b ab ab
>1 (since n + a + b > ab (because n > ab − a − b)) .
But an open
interval of size > 1 must always contain an integer59 . Hence, the open
− x 0 − 1 y0 + 1
interval , contains an integer d. Picking such a d, we then con-
b a
clude that both x 0 + db and y0 − da are nonnegative, and thus there exist nonnega-
tive integers x and y such that n = xa + yb (namely, x = x 0 + db and y = y0 − da).
Thus, we have found a solution to Exercise 3.8.5.
59 Proof.Let (α, β) be an open interval of size > 1. Thus, α and β are real numbers such that
β − α > 1. We must prove that the interval (α, β) contains an integer.
Indeed, it is easy to see that bαc + 1 is an integer contained in this interval (α, β). Check this!
It is instructive to see how short this solution becomes if we forget about the
pains we took finding it, and only write down the parts that ended up necessary
for the proof:
Solution to Exercise 3.8.5 (final copy). Exercise 3.8.4 yields that there exist integers x
and y such that n = xa + yb. Consider these x and y, and denote them by x 0 and
y0 . Thus, x 0 and y0 are integers satisfying n = x 0 a + y0 b.
− x0 − 1
Define an integer d by d = + 1. Now, we claim the following:
b
− x0 − 1
[Proof of Claim 1: The chain of inequalities (1) (applied to x = ) shows
b
that
− x0 − 1 −x0 − 1 −x0 − 1
≤ < + 1. (56)
b b b
Hence,
−x0 − 1 − x0 − 1 − x0 − 1
< +1 = d since d = +1 .
b b b
We can multiply this inequality by b (since b is positive), and thus obtain − x 0 − 1 <
db. Hence, db > − x 0 − 1, so that x 0 + db > −1. Since x 0 + db is an integer, this
entails that x 0 + db ≥ 0. In other words, x 0 + db is nonnegative.
It remains to show that y0 − da is nonnegative. But n + a + b > ab (because
n > ab − a − b). We can divide this inequality by ab (since ab > 0), and thus obtain
n+a+b
> 1. Now,
ab
y0 + 1 − x 0 − 1 x 0 a + y0 b + a + b n+a+b
since x 0 a + y0 b = n
− = =
a b ab ab
> 1,
so that
y0 + 1 −x0 − 1 − x0 − 1
> +1 ≥ + 1 = d.
a b }
| {z b
0
−x − 1
≥
b
(by the first inequality in (56))
We can multiply this inequality by a (since a is positive), and find y0 + 1 > da. In
other words, y0 − da > −1. Since y0 − da is an integer, this entails y0 − da ≥ 0. In
other words, y0 − da is nonnegative. This completes our proof of Claim 1.]
Thus, the integers x 0 + db and y0 − da are nonnegative. They furthermore satisfy
x 0 + db a + y0 − da b = x 0 a + dba + y0 b − dab = x 0 a + y0 b = n,
so that n = ( x 0 + db) a + (y0 − da) b. Thus, there exist nonnegative integers x and
y such that n = xa + yb (namely, x = x 0 + db and y = y0 − da). This solves Exercise
3.8.5.
• Let n ∈ N. Assume that we have defined ∑ as for every finite set S with
s∈S
|S| = n (and every choice of numbers as ). Now, if S is a finite set with
|S| = n + 1 (and if a number as is chosen for each s ∈ S), then ∑ as is
s∈S
defined by picking any t ∈ S and setting
∑ as = at + ∑ as . (57)
s∈S s∈S\{t}
It is not immediately clear why this definition is legitimate; in fact, the right hand
side of (57) is defined using a choice of t, but theoretically one can imagine that
different choices of t would lead to different results. Nevertheless, one can prove
(see, e.g., [Grinbe15, Theorem 2.118] for this proof) that this definition is indeed
legitimate (i.e., the right hand side of (57) does not depend on t). This is essentially
saying that if we sum the numbers as for all s ∈ S by starting with 0 and adding
these numbers one by one, then the result does not depend on the order in which
the numbers are being added. (Note that this is not true of multiplying matrices,
or of putting on clothes, or of chemical reactions. So it’s not an obvious claim!)
Expressions of the form ∑ as for finite sets S are called finite sums. Here are
s∈S
some examples:
60 Throughout Section 4.1, “number” means an integer or a rational number or a real number or
a complex number. More generally, the concept of a finite sum can be applied to any sort of
object that has an addition operation with reasonable properties (such as commutativity and
associativity); e.g., in linear algebra, one defines finite sums of vectors in a vector space, and in
abstract algebra, one generalizes this further to finite sums of elements of an abelian group (or
even monoid).
x 1 1 1 2 2 2 3 3 3
∑ y
= + + + + + + + +
1 2 3 1 2 3 1 2 3
( x,y)∈{1,2,3}2
x
(here, we are using the notation ∑ a( x,y) with S = {1, 2, 3}2 and a( x,y) = ).
( x,y)∈S y
As I mentioned above, the most common finite sums are of a special kind:
v
Thus, finite sums of the form ∑ as satisfy
s=u
v
∑ as = 0 for v < u, and (58)
s=u
v v v −1
∑ as = au + ∑ as = ∑ as + av for v ≥ u. (59)
s=u s = u +1 s=u
The equality (58) says that a sum that “ends before it begins” is 0. For example,
2
∑ i = 0. This is not completely uncontroversial61 , but it shall be so in this course.
i =5
v
In a sum of the form ∑ as , the integer u is called the lower limit (or lower bound)
s=u
of the sum, whereas the integer v is called the upper limit (or upper bound) of the
sum.62 The sum is said to start (or begin) at u and end at v.
Another way to use ∑ signs is in describing sums that sum over all elements of
a given set that satisfy a given statement. This is done as follows:
Definition 4.1.5. Let S be a finite set, and let A (s) be a logical statement defined
for every s ∈ S. (For example, if S is a set of integers, then A (s) can be the
statement “s is even”.) For each s ∈ S satisfying A (s), let as be a number. Then,
the sum ∑ as is defined by
s∈S;
A(s)
∑ as = ∑ as .
s∈S; s∈{t∈S | A(t)}
A(s)
In other words, ∑ as is the sum of the as for all s ∈ S which satisfy A (s).
s∈S;
A(s)
2
61 I have seen authors who would “sum backwards” when v < u, thus interpreting ∑ i as −4 − 3.
i =5
This has some advantages (because why let a notation go to waste?), but it would mean that
v
∑ as cannot be rewritten as ∑ as without checking the order relation between u and
s=u s∈{u,u+1,...,v}
v, and I don’t want this extra headache.
62 This has nothing to do with the notions of “bounds” and “limits” in analysis.
∑ a = |S| · a. (60)
s∈S
Example 4.1.9. Let u and v be two integers. Let as be a number for each s ∈
{u, u + 1, . . . , v}. Also, let λ be a number. Then, Theorem 4.1.8 (applied to S =
{u, u + 1, . . . , v}) yields
v v
∑ λas = λ ∑ as . (62)
s=u s=u
Equivalently,
λau + λau+1 + · · · + λav = λ ( au + au+1 + · · · + av ) . (63)
For example, if n ∈ N, then the sum of the first n even positive integers is
2 + 4 + · · · + 2n = 2 · 1 + 2 · 2 + · · · + 2 · n
by (63), applied to λ = 2
= 2 (1 + 2 + · · · + n )
and u = 1 and v = n and as = s
n ( n + 1)
= 2· (by (9))
2
= n ( n + 1) .
The next rule ([Grinbe15, (7)]) says that if each addend in a sum is itself a sum
of two numbers, then we can split the sum up:
Theorem 4.1.10. Let S be a finite set. For every s ∈ S, let as and bs be numbers.
Then,
∑ ( a s + bs ) = ∑ a s + ∑ bs . (64)
s∈S s∈S s∈S
The equality (64) is often used forwards (i.e., in order to split a sum of the form
∑ ( as + bs ) into ∑ as + ∑ bs ) and backwards (i.e., in order to combine two sums
s∈S s∈S s∈S
∑ as + ∑ bs into ∑ ( as + bs )). When applying it backwards, don’t forget to check
s∈S s∈S s∈S
that the two sums being combined are ranging over the same set!
An easy consequence of Theorem 4.1.10 is the following:
Exercise 4.1.1. Let S be a finite set. For every s ∈ S, let as and bs be numbers.
Then,
∑ ( a s − bs ) = ∑ a s − ∑ bs .
s∈S s∈S s∈S
∑ ((as − bs ) + bs ) = ∑ (as − bs ) + ∑ bs .
s∈S s∈S s∈S
∑ (as − bs ) = ∑ (( a − b ) + bs ) − ∑ bs = ∑ a s − ∑ bs .
| s {zs
s∈S s∈S s∈S s∈S s∈S
}
= as
∑ at = ∑ a f (s) . (65)
t∈ T s∈S
Roughly speaking, (65) holds because the sum ∑ a f (s) contains the same ad-
s∈S
dends as the sum ∑ at . We say that the sum ∑ a f (s) is obtained from the sum
t∈ T s∈S
∑ at by substituting f (s) for t. (Conversely, ∑ at is obtained from ∑ a f (s) by
t∈ T t∈ T s∈S
substituting t for f (s).)
Example 4.1.13. For any n ∈ N, we have
∑ t3 = ∑ (−s)3 .
t∈{1,2,...,n} s∈{−n,−n+1,...,−1}
∑ as = ∑ a f (s) .
s∈ T s∈S
Theorem 4.1.12 has several well-known and oft-used consequences. The first one
says that we can shift the index of a sum by any integer k:
Corollary 4.1.14. Let u, v and k be integers. Let at be a number for each t ∈
{u + k, u + k + 1, . . . , v + k}. Then,
v+k v
∑ at = ∑ as+k .
t=u+k s=u
This map f is easily seen to be well-defined and bijective64 . Thus, Theorem 4.1.12
(applied to S = {u, u + 1, . . . , v} and T = {u + k, u + k + 1, . . . , v + k }) yields
∑ at = ∑ a f (s) = ∑ as+k .
t∈{u+k,u+k+1,...,v+k } s∈{u,u+1,...,v} |{z} s∈{u,u+1,...,v}
= as+k
(since f (s)=s+k)
In other words,
v+k v
∑ at = ∑ as+k .
t=u+k s=u
This proves Corollary 4.1.14.
The next corollary says that sums can be turned around: i.e., we have
a u + a u +1 + · · · + a v = a v + a v −1 + · · · + a u . (66)
Restated using ∑ signs, and generalized by shifting the index, this takes the fol-
lowing form:
Corollary 4.1.15. Let u, v and k be integers. Let at be a number for each t ∈
{k − v, k − v + 1, . . . , k − u}. Then,
k−u v
∑ at = ∑ ak−s . (67)
t=k−v s=u
∑ at = ∑ a f (s) = ∑ ak−s .
t∈{k−v,k−v+1,...,k−u} s∈{u,u+1,...,v} |{z} s∈{u,u+1,...,v}
= ak−s
(since f (s)=k−s)
In other words,
k−u v
∑ at = ∑ ak−s .
t=k−v s=u
This proves Corollary 4.1.15.
Here is an example for the use of substitution in sums. Recall the formula (9),
which is easily proved by induction. We shall now prove it in a more elegant way:
Exercise 4.1.2. Let n ∈ N. Prove the equality (9) without using induction.
n
Thus, we shall focus on computing ∑ i.
i =0
n
We can substitute n − i for i in the sum ∑ i (since the map {0, 1, . . . , n} →
i =0
{0, 1, . . . , n} , i 7→ n − i is a bijection). Thus, we obtain
n n
∑i= ∑ (n − i ) .
i =0 i =0
(If you are too lazy to think about bijections, you can also derive this immediately
by applying Corollary 4.1.15 to u = 0, v = n, k = n and at = t. This is the main
purpose of Corollary 4.1.15: avoid the use of bijections.)
Now comes Gauss’s “doubling trick”: Recall that 2q = q + q for every q ∈ Q.
Hence,
n n n n n
2∑i= ∑i+ ∑i = ∑ i + ∑ (n − i )
i =0 i =0 i =0 i =0 i =0
|{z}
n
= ∑ ( n −i )
i =0
n
= ∑ |(i + ({z
n − i )) (here, we have used (64) backwards)
i =0
}
=n
n
= ∑ n = ( n + 1) n (by (60))
i =0
= n ( n + 1) , (69)
and therefore
n
n ( n + 1)
∑i= 2
. (70)
i =0
n ( n + 1)
In view of (68), this rewrites as 1 + 2 + · · · + n = , which is precisely the
2
equality (9). Hence, Exercise 4.1.2 is solved.
Let us remark how the computation (69) could be rewritten without the use of ∑
signs:
2 · (0 + 1 + · · · + n )
= (0 + 1 + · · · + n ) + (0 + 1 + · · · + n )
= (0 + 1 + · · · + n ) + ( n + ( n − 1) + · · · + 0)
(here, we have turned the second sum around using (66))
= (0 + n) + (1 + (n − 1)) + · · · + (n + 0)
| {z } | {z } | {z }
=n =n =n
(here, we have used (64) backwards)
= |n + n +{z· · · + n} = (n + 1) n = n (n + 1) .
n+1 times
66This arguably looks simpler than (69), but it is clear that with more complicated
sums it will become progressively harder to avoid the use of ∑ signs.
Gauss’s “doubling trick” used in the above solution is not a one-trick pony. Here
is a more advanced use:
1 + 2 + · · · + n | 1d + 2d + · · · + n d .
Solution to Exercise 4.1.3 (sketched). This is solved in detail in [19s, Exercise 2.10.8];
thus, we only give the skeleton of the argument. In view of (9), the claim that we
66 We can also visualize this computation as a “picture proof”. For example, here is the picture for
the case n = 5:
1
2
3
4
n=5 5 5
4
3
2
1
n+1 = 6 .
The addends of the sum 0 + 1 + · · · + n are drawn as purple rectangles, whereas the addends of
the sum n + (n − 1) + · · · + 0 are drawn as red rectangles. (Rectangles of area 0, corresponding
to 0 addends, are degenerate and thus invisible.) The rectangles are matched in such a way
that the i-th column (counted from left, started with 0) has a purple rectangle of area i and a
red rectangle of area n − i. This matching corresponds precisely to the way we matched our
addends: (0 + n) + (1 + (n − 1)) + · · · + (n + 0).
| {z } | {z } | {z }
=n =n =n
n ( n + 1) d
| 1 + 2d + · · · + n d .
2
This is equivalent to
n ( n + 1 ) | 2 1d + 2d + · · · + n d (71)
(by Proposition 3.1.5). Hence, it suffices to prove (71).
In order to prove (71), it suffices to show that
d d d
n | 2 1 +2 +···+n and (72)
n + 1 | 2 1d + 2d + · · · + n d . (73)
[Proof of (72): If n = 0, then (72) boils down to 0 | 2 · 0, which is obvious. Thus, for
the rest of this proof, we WLOG assume that n 6= 0. Hence, n − 1 ∈ N. Therefore,
we can apply (73) to n − 1 instead of n (since we have already proven (73) for each
n ∈ N). We thus obtain
n | 2 1d + 2d + · · · + ( n − 1 ) d .
In other words, 2 1d + 2d + · · · + (n − 1)d ≡ 0 mod n. Also, d > 0 (since d is
odd), so that n | nd and thus nd ≡ 0 mod n. Now,
2 1d + 2d + · · · + nd = 2 1d + 2d + · · · + (n − 1)d + |{z}
nd
≡0 mod n
≡ 2 1d + 2d + · · · + (n − 1)d ≡ 0 mod n.
We have now proven both (72) and (73). As we have explained, this yields (71),
which in turn solves Exercise 4.1.3.
Intuitively, the claim of Theorem 4.1.16 is obvious: The left hand side of (74) is
v v
∑ ( a s − a s −1 ) = ∑ (−as−1 + as )
s=u | {z } s=u
=− as−1 + as
= (− au−1 + au ) + (− au + au+1 ) + (− au+1 + au+2 ) + · · · + (− av−1 + av ) .
If we expand the right hand side of this equality, then it “contracts like a telescope”
(thus the name of Theorem 4.1.16): All addends except for the − au−1 and the av
cancel each other, and you are left with − au−1 + av = av − au−1 , which is exactly
the right hand side of (74). (Be careful with this argument, though: It does not
work for v = u − 1. But this case is trivial anyway.) This intuitive argument can
be formalized. Alternatively, Theorem 4.1.16 can be proved by induction on v (the
proof is utterly straightforward), or derived from Exercise 4.1.1.
Note that Theorem 4.1.16 can be regarded as a discrete version of the Second
Part
R v 0 of the Fundamental Theorem of Calculus. In fact, the latter fact says that
u F ( x ) dx = F ( v ) − F ( u ) for any differentiableRfunction F on a (real) interval
[u, v]. But the ∑ sign is a discrete analogue of the sign, whereas the consecutive
differences as − as−1 are discrete analogues of the values of the derivative F 0 .
For all its simplicity, Theorem 4.1.16 is a surprisingly helpful tool for simplifying
sums. The next four exercises are examples of this:
n
Exercise 4.1.4. Let n ∈ N. Simplify the sum ∑ i · i! (that is, rewrite it without
i =1
using the ∑ sign).
67 Thisis similar to computing an integral by finding an antiderivative of the function under the
integral sign.
1 a a
= i −1 − i (77)
i ( i + 1) ( i + 2) · · · ( i + p ) p p
a i −1 − ai
|{z} |{z}
1 1
= =
i ( i + 1) · · · ( i + p − 1) ( i + 1) ( i + 2) · · · ( i + p )
(by the definition of ai−1 ) (by the definition of ai )
1 1
= −
i ( i + 1) · · · ( i + p − 1) ( i + 1) ( i + 2) · · · ( i + p )
| {z } | {z }
i+p i
= =
i ( i + 1) · · · ( i + p − 1) · ( i + p ) i · ( i + 1) ( i + 2) · · · ( i + p )
i+p i
= −
i ( i + 1) · · · ( i + p − 1) · ( i + p ) i · ( i + 1) ( i + 2) · · · ( i + p )
i+p i
= −
i ( i + 1) ( i + 2) · · · ( i + p ) i ( i + 1) ( i + 2) · · · ( i + p )
(i + p ) − i p
= = (78)
i ( i + 1) ( i + 2) · · · ( i + p ) i ( i + 1) ( i + 2) · · · ( i + p )
and thus
a i −1 a 1 1 p
− i = ( a i −1 − a i ) = · (by (78))
p p p p i ( i + 1) ( i + 2) · · · ( i + p )
1
= ;
i ( i + 1) ( i + 2) · · · ( i + p )
Now,
n
1
∑ i ( i + 1) ( i + 2) · · · ( i + p )
i =1 | {z }
a i −1 a i
= −
p p
(by (77))
n n
− a i − a i −1
a i −1 a i
=∑ − =∑ −
i =1 |
p p p p
{z } i =1
− a i − a i −1
= −
p p
− a n − a 1−1
= − (by the telescope principle)
p p
1 1
= a 1−1 − a n = a0 − an
p p |{z} |{z}
|{z}
= a0 1 1
= =
1·2····· p ( n + 1) ( n + 2) · · · ( n + p )
(by the definition of a0 ) (by the definition of an )
1 1 1
= − . (79)
p 1 · 2 · · · · · p ( n + 1) ( n + 2) · · · ( n + p )
for any positive integer p. This also “holds” for p = 0, in the sense that the infinite
∞ 1
series ∑ (known as the harmonic series) diverges (which is precisely what one
i =1 i
1 1
would expect from seeing the = term on the right hand side of (80)). This is a
p 0
well-known fact, with several proofs on the Wikipedia.
To facilitate its future application, let us restate Theorem 4.1.16 in a form that
will allow us to apply it without substituting indices:
Hence,
n
1 n √ √ √ √
∑ i+ i+1 ∑
√ √ = i + 1 − i = n+1− 1
i =1 | {z √ } i=1
√
= i +1− i
√
(by the telescope principle68 ). This simplifies further to n + 1 − 1.
Finally, here is what might be the simplest application of the telescope principle;
we state it mainly because of its usefulness:
We notice that Exercise 4.1.7 generalizes Exercise 2.1.1 and also yields a rather
explicit new proof of Proposition 3.2.7 (check it!).
Theorem 4.1.18. Let S be a finite set. Let X and Y be two subsets of S such that
X ∩ Y = ∅ and X ∪ Y = S. (Equivalently, X and Y are two subsets of S such that
68 specifically,
√
by Corollary 4.1.17, applied to u = 1, v = n and ai = i
each element of S lies in exactly one of X and Y.) Let as be a number for each
s ∈ S. Then,
∑ as = ∑ as + ∑ as . (83)
s∈S s∈ X s ∈Y
Here, as we explained, ∑ as + ∑ as stands for ∑ as + ∑ as .
s∈ X s ∈Y s∈ X s ∈Y
Behind Theorem 4.1.18 stands the intuitively obvious fact that a sum ∑ as can
s∈S
be computed by first sorting its addends into two “heaps” ∑ as and ∑ as , then
s∈ X s ∈Y
summing each heap separately, and finally adding the two heap sums together. For
example, this says that
a1 + a2 + a3 + a4 + a5 = ( a1 + a4 ) + ( a2 + a3 + a5 ) .
(This is the particular case of (83) for S = {1, 2, 3, 4, 5}, X = {1, 4} and Y = {2, 3, 5}.)
w
Most commonly, Theorem 4.1.18 is used to split a sum of the form ∑ as into two
s=u
parts:
{u, u + 1, . . . , v} ∩ {v + 1, v + 2, . . . , w} = ∅ and
{u, u + 1, . . . , v} ∪ {v + 1, v + 2, . . . , w} = {u, u + 1, . . . , w} .
Thus, Theorem 4.1.18 (applied to S = {u, u + 1, . . . , w} and X = {u, u + 1, . . . , v}
and Y = {v + 1, v + 2, . . . , w}) yields
∑ as = ∑ as + ∑ as .
s∈{u,u+1,...,w} s∈{u,u+1,...,v} s∈{v+1,v+2,...,w}
−1 n n n
= ∑ (−s) + (−0) + ∑ s = ∑ t + ∑ s
s=−n | {z } s=1 t =1 s =1
| {z } =0
n
=∑ t
t =1
(here, we have substituted t for −s
in the sum, since the
map {1,2,...,n}→{−n,−n+1,...,−1}, s7→−s
is a bijection)
n n
here, we have renamed the summation index t
= ∑ s+ ∑ s as s in the first sum
s =1 s =1
n
= 2· ∑ s = 2 · (1 + 2 + · · · + n ) = n ( n + 1) (by (70)) .
s =1
(b) Set S = {0, 1, . . . , 2n − 1}. Let X be the set of all even elements of S, and let Y
be the set of all odd elements of S. Then, each element of S lies in exactly one of X
and Y (since each element of S is either even or odd, but not both). In other words,
X ∩ Y = ∅ and X ∪ Y = S. Therefore, we can apply Theorem 4.1.18 to as = s%2.
We obtain
∑ (s%2) = ∑ (s%2) + ∑ (s%2) . (85)
s∈S s∈ X s ∈Y
Let us now simplify the right hand side. If s ∈ X, then s is even (by the definition of
X) and thus satisfies s%2 = 0 (by Exercise 3.3.2 (a)). Hence, ∑ (s%2) = ∑ 0 = 0.
s∈ X | {z } s∈ X
=0
On the other hand, if s ∈ Y, then s is odd (by the definition of Y) and thus satisfies
s%2 = 1 (by Exercise 3.3.2 (b)). Hence, ∑ (s%2) = ∑ 1 = |Y | · 1 (by (60)). Now,
s∈Y | {z } s ∈Y
=1
what is |Y | ? We defined Y as the set of all odd elements of S = {0, 1, . . . , 2n − 1};
hence, the elements of Y are 1, 3, 5, . . . , 2n − 1. These are precisely n elements69 .
69 Strictly
speaking, this needs to be proved. It can be easily proved by induction on n, or using
Theorem 3.1.8.
Since S = {0, 1, . . . , 2n − 1}, we can rewrite the ∑ sign on the left hand side as
s∈S
2n−1 2n−1
∑ . Thus, (86) rewrites as ∑ (s%2) = n.
s =0 s =0
The following is just a restatement of Theorem 4.1.18 using the notation from
Definition 4.1.5:
Theorem 4.1.20. Let S be a finite set. For each s ∈ S, let as be a number, and let
A (s) be a logical statement. Then,
∑ as = ∑ as + ∑ as = ∑ as + ∑ as .
s∈S s∈S; s∈S; s∈S; s∈S;
A(s) is true A(s) is false A(s) not A(s)
(The right hand side is just a shorter way to rewrite the middle hand side; there
is nothing profound happening here.)
Note that the sum on the right hand side of (87) is a double sum – i.e., a sum of
sums.
Theorem 4.1.18 is the particular case of Theorem 4.1.21 obtained if we set n = 2,
S1 = X and S2 = Y.
As an example for the use of Theorem 4.1.21, here is a pretty obvious exercise:
Exercise 4.1.9. Let I be a finite set of integers. For each pair (i, j) ∈ I × I, let a(i,j)
be a number. Prove that
∑ (i,j) ∑ (i,i)
a = a + ∑ a (i,j) + a ( j,i ) .
(i,j)∈ I × I i∈ I (i,j)∈ I × I;
i< j
Solution to Exercise 4.1.9. Let S be the set I × I. Define three subsets S1 , S2 and S3
of S by
S1 = {(i, j) ∈ I × I | i < j} ,
S2 = {(i, j) ∈ I × I | i = j} ,
S3 = {(i, j) ∈ I × I | i > j} .
∑ as = ∑ as + ∑ as + ∑ as .
s∈S s ∈ S1 s ∈ S2 s ∈ S3
We shall now take a closer look at the sums on the right hand side.
The set S2 = {(i, j) ∈ I × I | i = j} consists of the pairs (i, i ) for all i ∈ I. More
precisely, there is a bijection
I → S2 ,
i 7→ (i, i ) .
Thus, we can substitute (i, i ) for (i, j) in the sum ∑ a(i,j) . This sum therefore
(i,j)∈S2
rewrites as follows:
∑ a(i,j) = ∑ a(i,i) . (90)
(i,j)∈S2 i∈ I
S1 → S3 ,
(i, j) 7→ ( j, i )
is a bijection (because if (i, j) ∈ I × I satisfies i < j, then j > i, and vice versa).
Therefore, we can substitute ( j, i ) for (i, j) in the sum ∑ a(i,j) . This sum therefore
(i,j)∈S3
rewrites as follows:
∑ a(i,j) = ∑ a( j,i) . (91)
(i,j)∈S3 (i,j)∈S1
Finally, I × I = S, so that
∑ as = ∑ ∑ as . (92)
s∈S w ∈W s∈S;
f (s)=w
The idea behind the formula (92) is the following: The left hand side is the sum
of all as for s ∈ S. The right hand side is what you get if you first subdivide the
collection of numbers as into heaps according to the value of f (s) (with one heap
for each w ∈ W), then sum each heap, and then sum the resulting heap sums. That
the two sides are equal is thus quite obvious, although the rigorous proof would
require some bookkeeping70 .
(It is easy to see that Exercise 4.1.8 (b) follows from Exercise 4.1.10, applied to 2
and n instead of n and m.)
Solution to Exercise 4.1.10 (sketched). We let S be the set {0, 1, . . . , mn − 1}. Let W be
the set {0, 1, . . . , n − 1}. Define a map
f : S → W,
k 7→ k%n.
= ∑ ∑ w. (93)
w ∈W s∈S;
s%n=w
Now, let us simplify the sum ∑ w for each w ∈ W. Indeed, fix w ∈ W. The
s∈S;
s%n=w
summation sign ∑ is just shorthand for ∑ (by Definition 4.1.5).
s∈S; s∈{k∈S | k%n=w}
s%n=w
Thus, we have
(by (60)). Now, we need to compute |{k ∈ S | k%n = w}|, that is, find the number
of all k ∈ S satisfying k%n = w.
w, n + w, 2n + w, 3n + w, . . . , (m − 1) n + w.
Forget that we fixed w. We thus have proved (95) for each w ∈ W. Now, (93)
becomes
n −1
∑ (s%n) = ∑ ∑ w= ∑ mw = ∑ mw (since W = {0, 1, . . . , n − 1})
s∈S w ∈W s∈S; w ∈W w =0
s%n=w
| {z }
=mw
(by (95))
n −1
(n − 1) ((n − 1) + 1) ( n − 1) n
=m ∑ w =m
2
=m
2
w =0
| {z }
=0+1+2+···+(n−1)
=1+2+···+(n−1)
(n − 1) ((n − 1) + 1)
=
2
(by (70), applied
to n−1 instead of n)
mn (n − 1)
= .
2
This solves Exercise 4.1.10.
Intuitively, Theorem 4.1.24 says that if you have a rectangular table filled with
numbers, then you can sum the entries of the table by going along rows (and
then summing the row tallies), or by going along columns (and then summing the
column tallies), or plainly by summing all the entries in some unspecified way.
Indeed, if our table is the rectangular table
∑ a( x,y) .
( x,y)∈{1,2,...,n}×{1,2,...,m}
Thus, (96) states precisely that these three sums are equal.
We can generalize Theorem 4.1.23 by replacing the sets {1, 2, . . . , n} and {1, 2, . . . , m}
by any two finite sets X and Y:
Theorem 4.1.24. Let X and Y be two finite sets. Let a( x,y) be a number for each
( x, y) ∈ X × Y. Then,
Theorem 4.1.24 is [Grinbe15, (27)] (and a proof can be found there). Of course,
Theorem 4.1.24 can in turn be recovered from Theorem 4.1.23, because any two
finite sets X and Y can be relabeled as {1, 2, . . . , n} and {1, 2, . . . , m} for appropriate
n and m.
Theorem 4.1.24 is called Fubini’s theorem for finite sums, due to its similarity to the
(much deeper and subtler) Fubini’s theorems in analysis (which allow interchang-
ing infinite sums or integrals). Unlike the latter, it comes with no restrictions (like
absolute convergence or measurability).
Theorem 4.1.24 can be used in multiple ways. When we use it to rewrite a sum
∑ a( x,y) as ∑ ∑ a( x,y) , we say that we are decomposing the summation sign
( x,y)∈ X ×Y x ∈ X y ∈Y
∑ . When we use it to rewrite a double sum ∑ ∑ a( x,y) as ∑ ∑ a( x,y) ,
( x,y)∈ X ×Y x ∈ X y ∈Y y ∈Y x ∈ X
we say that we are interchanging the summation signs ∑ and ∑ . Note that two
x∈X y ∈Y
summation signs can only be interchanged in this way if the sets X and Y that they
range over are independent of x and y; for example, we can interchange the two
n m
summation signs in the double sum ∑ ∑ , but we cannot interchange the two
x =1 y =1
n x
summation signs in the double sum ∑ ∑ . (But we shall see below how we can
x =1 y =1
nevertheless transform the latter double sum.)
Here is a simple (yet quite useful) application of Theorem 4.1.23:
as = vs , we find ! ! !
m n n m
∑ ∑ ui vs = ∑ ui ∑ vs .
s =1 i =1 i =1 s =1
Hence,
! ! !
n m m n m n
∑ ui ∑ vj = ∑ ∑ ui vj = ∑∑ v j ui
i =1 j =1 j =1 i =1 j=1 i =1 |{z}
| {z } = ui v j
n
= v j ∑ ui
i =1
n
= ∑ v j ui
i =1
(again by (61))
m n
= ∑ ∑ ui v j . (98)
j =1 i =1
Hence, ! !
m n n m
∑ ui v j = ∑ ∑ ui v j = ∑ ui ∑ vj
(i,j)∈{1,2,...,n}×{1,2,...,m} j =1 i =1 i =1 j =1
∑ ∑
= ui ui + ui u j + u j ui
|{z}
i ∈{1,2,...,n} (i,j)∈{1,2,...,n}×{1,2,...,n}; | {z }
=u2i i< j =2ui u j
!
by Exercise 4.1.9, applied to I = {1, 2, . . . , n}
and a(i,j) = ui u j
= ∑ u2i + ∑ 2ui u j
i ∈{1,2,...,n} (i,j)∈{1,2,...,n}×{1,2,...,n};
i< j
n
= ∑ u2i + ∑ 2ui u j
i =1 1≤ i < j ≤ n
| {z }
=2 ∑ ui u j
1≤ i < j ≤ n
here, we have rewritten the summation
signs
∑ and ∑
i ∈{1,2,...,n} (i,j)∈{1,2,...,n}×{1,2,...,n};
i< j
n
as ∑ and ∑
i =1 1≤ i < j ≤ n
n
= ∑ u2i + 2 ∑ ui u j .
i =1 1≤ i < j ≤ n
In view of
! ! ! !
n n n n
here, we have renamed the
∑ ui ∑ uj = ∑ ui ∑ ui index j in the second sum as i
i =1 j =1 i =1 i =1
!2
n
= ∑ ui ,
i =1
this rewrites as !2
n n
∑ ui = ∑ u2i + 2 ∑ ui u j .
i =1 i =1 1≤ i < j ≤ n
Theorem 4.1.25. Let X and Y be two finite sets. For every pair ( x, y) ∈ X × Y,
let A ( x, y) be a logical statement. For each ( x, y) ∈ X × Y satisfying A ( x, y), let
a( x,y) be a number. Then,
Theorem 4.1.25 differs from Theorem 4.1.24 in that the sums are restricted to only
those y ∈ Y or only those ( x, y) ∈ X × Y or only those x ∈ X that satisfy A ( x, y).
In other words, if we regard the three sides of (97) as three ways to sum the entries
of a rectangular table, then the three sides of (100) are likewise understood as
three ways to sum the entries of a gappy table (i.e., a rectangular table in which not
every cell has an entry). This added generality is convenient, but it is not profound;
indeed, Theorem 4.1.25 can easily be derived from Theorem 4.1.24 by defining a( x,y)
to be 0 for any ( x, y) ∈ X × Y that does not satisfy A ( x, y).
∑ ∑ xy = ∑ xy = ∑ ∑ xy.
x ∈{1,2,...,n} y∈{1,2,...,m}; ( x,y)∈{1,2,...,n}×{1,2,...,m}; y∈{1,2,...,m} x ∈{1,2,...,n};
x +y is even x +y is even x +y is even
Finally, the last two variants of Fubini’s theorem we will give are analogues of
Theorem 4.1.23 for triangular (instead of rectangular) tables. Let us state them and
then give an application:
Example 4.1.28. If n = 4, then the formula (101) (rewritten without the use of ∑
Theorem 4.1.29. Let n ∈ N. Let a( x,y) be a number for each ( x, y) ∈ {1, 2, . . . , n}2
satisfying x ≤ y. Then,
n n n y
∑∑ a( x,y) = ∑ a( x,y) = ∑ ∑ a(x,y) . (102)
x =1 y = x 2
( x,y)∈{1,2,...,n} ; y =1 x =1
x ≤y
Example 4.1.30. If n = 3, then the formula (102) (rewritten without the use of ∑
signs) looks as follows:
a(1,1) + a(1,2) + a(1,3) + a(2,2) + a(2,3) + a(3,3)
a(1,1) a(1,2) a(1,3)
= the sum of all entries of the table a ( 2,2 ) a ( 2,3 )
a(3,3)
= a(1,1) + a(1,2) + a(2,2) + a(1,3) + a(2,3) + a(3,3) .
Theorem 4.1.27 and Theorem 4.1.29 are [Grinbe15, (31) and (33), respectively].
They are commonly used to interchange summation signs: i.e., to rewrite a sum
n n− x n n−y
of the form ∑ ∑ a( x,y) as ∑ ∑ a( x,y) or vice versa, or to rewrite a sum of the
x =1 y =1 y =1 x =1
n n n y
form ∑ ∑ a( x,y) as ∑ ∑ a( x,y) . This kind of interchange is somewhat trickier
x =1 y = x y =1 x =1
than the straightforward interchange facilitated by Theorem 4.1.23; indeed, unlike
the latter, it requires a change of the limits of summation. However, it is not hard
to remember how the limits have to change: After all, the resulting double sum
needs to include the same a( x,y) as the original one. Thus, for example, we rewrite
n n− x n n−y
∑ ∑ a( x,y) as ∑ ∑ a( x,y) because both of these double sums are really summing
x =1 y =1 y =1 x =1
over all pairs ( x, y) of positive integers that satisfy x + y ≤ n.
An example of this interchange is given by the following exercise:
n
Exercise 4.1.13. Let x be a number distinct from 1. Simplify the sum ∑ ixi =
i =1
1x1 + 2x2 + · · · + nx n .
x m +1 − 1
x0 + x1 + · · · + x m = (103)
x−1
(here, we have divided by x − 1, which is allowed since x 6= 1).
Let us formalize this computation – specifically, its second and third equality
• Let n ∈ N. Assume that we have defined ∏ as for every finite set S with
s∈S
|S| = n (and every choice of numbers as ). Now, if S is a finite set with
|S| = n + 1 (and if a number as is chosen for each s ∈ S), then ∏ as is
s∈S
defined by picking any t ∈ S and setting
∏ as = at · ∏ as . (104)
s∈S s∈S\{t}
Definition 4.2.3. Let S be a finite set, and let A (s) be a logical statement defined
for every s ∈ S. For each s ∈ S satisfying A (s), let as be a number. Then, the
product ∏ as is defined by
s∈S;
A(s)
∏ as = ∏ as .
s∈S; s∈{t∈S | A(t)}
A(s)
In other words, ∏ as is the product of the as for all s ∈ S which satisfy A (s).
s∈S;
A(s)
k
· · · }a = ∏ a for every number a and every k ∈ N. Thus, in
Note that ak = |aa {z
i =1
k times
particular, a0 = (empty product) = 1. This includes 00 = 1.
All the notations we have introduced for finite sums exist just as well for finite
products, mutatis mutandis71 . For example, expressions of the form ∏ as are called
s∈S
finite products, and the terms as in such expressions are called their factors (or terms).
There is no agreement on the operator precedence of the ∏ sign versus the · sign
(i.e., expressions like ∏ as b are ambiguous and need to be avoided), but the ∏
s∈S
than the + and − signs (so an expression
sign definitely has higher precedence
like ∏ as + b always means ∏ as + b).
s∈S s∈S
In all reasonable regards, finite products (of numbers) behave just like finite
sums, as long as the obvious changes are made (addition replaced by multiplica-
tion, subtraction by division, 0 by 1, products by powers, etc.). Let me state (without
comment) the multiplicative analogues of Theorem 4.1.7, Theorem 4.1.8, Theorem
4.1.10, Theorem 4.1.1, Theorem 4.1.12, Theorem 4.1.16, Theorem 4.1.18, Corollary
4.1.19, Theorem 4.1.21, Theorem 4.1.22 and Theorem 4.1.24, respectively:72
∏ a = a|S| . (105)
s∈S
Theorem 4.2.5. Let S be a finite set. For every s ∈ S, let as be a number. Also, let
λ ∈ N. Then,
!λ
∏ aλs = ∏ as . (106)
s∈S s∈S
71 “Mutatis mutandis” means “once the things that need to be changed have been changed” (i.e.,
“once the necessary changes are made”).
72 The proofs for all these analogues are analogous to the proofs of the original theorems for sums.
This also holds for λ ∈ Z if all the numbers as are nonzero; and this also holds
for λ ∈ R if all the numbers as are positive reals.
Theorem 4.2.6. Let S be a finite set. For every s ∈ S, let as and bs be numbers.
Then, ! !
∏ ( a s bs ) = ∏ a s ∏ bs . (107)
s∈S s∈S s∈S
Exercise 4.2.1. Let S be a finite set. For every s ∈ S, let as and bs be numbers
such that bs 6= 0. Then,
! !
as
∏ b = ∏ a s / ∏ bs .
s∈S s s∈S s∈S
Theorem 4.2.7. Let S and T be two finite sets. Let f : S → T be a bijective map.
Let at be a number for each t ∈ T. Then,
∏ at = ∏ a f (s) . (108)
t∈ T s∈S
Theorem 4.2.9. Let S be a finite set. Let X and Y be two subsets of S such that
X ∩ Y = ∅ and X ∪ Y = S. (Equivalently, X and Y are two subsets of S such that
each element of S lies in exactly one of X and Y.) Let as be a number for each
s ∈ S. Then, ! !
∏ as = ∏ as ∏ as . (110)
s∈S s∈ X s ∈Y
∏ as = ∏ ∏ as . (114)
s∈S w ∈W s∈S;
f (s)=w
Theorem 4.2.13. Let X and Y be two finite sets. Let a( x,y) be a number for each
( x, y) ∈ X × Y. Then,
Using common sense, the reader can easily figure out how all these theorems are
named (for example, Theorem 4.2.8 is known as the telescope principle for products, or
the multiplicative telescope principle), and also state multiplicative analogues for the
remaining rules for finite sums (e.g., for Theorem 4.1.25 and for Theorem 4.1.27).
The most famous finite products are the factorials
n
n! = 1 · 2 · · · · · n = ∏i for all n ∈ N.
i =1
1 s−1 1/s
1− = = .
s s 1/ (s − 1)
Hence,
n n
1 1/s 1/n
∏ 1 − s = ∏ 1/ (s − 1) = 1/ (2 − 1)
s=2 | {z } s =2
1/s
=
1/ (s − 1)
(by (109), applied to u = 2, v = n and as = 1/s)
1
= .
n
The next exercise is a simple formula that is useful in combinatorics (more on its
use perhaps later on):
Solution to Exercise 4.2.3 (sketched). See [Grinbe15, Exercise 3.2 (a)] or [17f-hw2s, Ex-
ercise 1 (a)] for a detailed solution. The main idea:
∏ ∏ ∏
(2n)! = i= ·
i i (by Theorem 4.2.9)
i ∈{1,2,...,2n} i ∈{1,2,...,2n}; i ∈{1,2,...,2n};
i is even i is odd
| {z } | {z }
=2·4·6·····(2n) =1·3·5·····(2n−1)
=2n ·(1·2·3·····n)
(by (107) and (105))
= 2n · (1 · 2 · 3 · · · · · n) · (1 · 3 · 5 · · · · · (2n − 1)) = 2n n! · (1 · 3 · 5 · · · · · (2n − 1)) .
| {z }
=n!
Finally, let us state the natural generalization of Exercise 4.1.11 to products with
several factors (each of which is a finite sum):
Theorem 4.2.14. For every n ∈ N, let [n] denote the set {1, 2, . . . , n}.
Let n ∈ N. For every i ∈ [n], let pi,1 , pi,2 , . . . , pi,mi be finitely many numbers.
Then,
n mi n
∏ ∑ pi,k = ∑ ∏ pi,ki . (116)
i =1 k =1 (k1 ,k2 ,...,k n )∈[m1 ]×[m2 ]×···×[mn ] i =1
and the right hand side is precisely what one obtains when expanding this product
into a sum of m1 m2 · · · mn monomials (i.e., products of single pi,k ’s). Thus, there is
nothing surprising about Theorem 4.2.14. A formal proof of Theorem 4.2.14 can be
found in [Grinbe15, Lemma 6.20].
73 See also the Wikipedia page for Pascal’s triangle for an overview of many properties.
n
Definition 4.3.1. Let n and k be any two numbers. We define a number as
k
follows:
• If k ∈ N, then we set
n ( n − 1) ( n − 2) · · · ( n − k + 1)
n
= . (117)
k k!
/ N, then we set
• If k ∈
n
= 0. (118)
k
n
We call a binomial coefficient, and we refer to it as “n choose k”. (We will
k
soon see what motivated this terminology.)
74 We shall soon see that these definitions are equivalent to ours (in said cases).
√
(h) The equality (118) (applied to n = 2 and k = 2) yields
√
√2 = 0, / N.
since 2 ∈
2
Instead offurther examples, let us see a table of the most important binomial
n
coefficients – namely those with n ∈ N and k ∈ {0, 1, . . . , n}. This table
k
is called Pascal’s triangle; here are its first 9 rows (i.e., the part that covers n ∈
{0, 1, . . . , 8}):
k =0
.
k =1
n=0 → 1 .
k =2
n=1 → 1 1 .
k =3
n=2 → 1 2 1 .
k =4
n=3 → 1 3 3 1 .
k =5
n=4 → 1 4 6 4 1 .
k =6
n=5 → 1 5 10 10 5 1 .
k =7
n=6 → 1 6 15 20 15 6 1 .
n=7 → 1 7 21 35 35 21 7 1
n=8 → 1 8 28 56 70 56 28 8 1
Why did we restrict ourselves only to k∈ {0, 1, . . . , n} when making this table?
n
What about the binomial coefficients “left of Pascal’s triangle” – i.e., those
k
with k < 0 ? They
are not shown because they are all 0 (by (118)). The binomial
n
coefficients “right of Pascal’s triangle” – i.e., those with k > n – are also 0, as
k
the following proposition shows:
n
Proposition 4.3.4. Let n ∈ N and k ∈ R be such that k > n. Then, = 0.
k
/ N,
Hints to the proof of Proposition 4.3.4. (See [19fco, Proposition 1.3.6].) For k ∈
this follows from (118). Thus, assume k ∈ N. Now, recall the old joke problem
“Simplify ( x − a) ( x − b) · · · ( x − z)”.
/ N.
Warning 4.3.5. Proposition 4.3.4 does not usually hold for n ∈
A more interesting question is what we can say about the binomial coefficients
n
“above Pascal’s triangle” – i.e., those with n < 0. It turns out that they are just
k
“mirror images” of the ones below (up to sign); namely, we have the following:
−n k n+k−1
= (−1) . (123)
k k
Hints to the proof of Proposition 4.3.6. This is a simple computation using Definition
4.3.1. (See [19fco, Proposition 1.3.7] for details.)
Proposition 4.3.4 and Proposition 4.3.6 are the reasons why almost all tables of
binomial coefficients you will find in the literature show only (parts of) Pascal’s
n
triangle. (Of course, there are also the binomial coefficients with non-integer
k
n, but it is not really clear how to tabulate them.)
Binomial coefficients tend to appear in almost all parts of mathematics (as coef-
ficients or as standalone values). Being able to identify them when one encounters
them is thus a useful skill. Myself, I know few numbers by heart, but the bino-
mial coefficients in the first six rows of Pascal’s triangle are among them (I never
deliberately memorized them; I just see them too often to forget). If you need any
further rows of Pascal’s triangle and have no computer handy, the easiest way to
construct them is using a surprising pattern in Pascal’s triangle: Every entry (ex-
cept for the 1 at the peak) is the sum of the two adjacent entries above it75 (for
example, 56 = 21 + 35). This pattern holds not only for the entries of Pascal’s
triangle, but more generally for all binomial coefficients:
Hints to the proof of Theorem 4.3.7. Since there were two cases in Definition 4.3.1, we
must distinguish between three cases here: k ∈ {1, 2, 3, . . .}, k = 0 and k ∈ / N.
The firstcase is
the interesting
one (the latter two are trivial). In this first case,
n−1 n−1
rewrite and as fractions and add them by finding a common
k−1 k
denominator.
75 If there is only one adjacent entry above it (as it happens for the 1’s along the left and right sides
of Pascal’s triangle), then we treat the missing other entry as a 0 (after all, there should be a 0 at
its position; we just didn’t put it in the table).
Theorem 4.3.7 is known as Pascal’s rule. It provides perhaps the quickest way to
compute Pascal’s triangle up to a given row; however, Definition 4.3.1 might still be
a better way to compute a specific entry (as long as one remembers not to multiply
the products out, since there will be a lot of cancellation visible in the fraction).
There is an even more explicit formula:
Theorem 4.3.8 (Factorial formula for the binomial coefficients). Let n ∈ N and
k ∈ N be such that k ≤ n. Then,
n n!
= .
k k! · (n − k )!
n (n − 1) (n − 2) · · · (n − k + 1) = n!/ (n − k )!.
−3
1/3
Warning 4.3.9. Theorem 4.3.8 cannot be used to compute or or
5 4
√π
; it only applies under the given assumptions (n ∈ N and k ∈ N and
2
n
k ≤ n). (This is the reason why, unlike various authors, we do not define
k
through Theorem 4.3.8.)
Hints to the proof of Theorem 4.3.10. If k ∈ N and k ≤ n, then rewrite both sides
using Theorem 4.3.8. Otherwise, argue that both sides are 0. (See [19fco, Theorem
1.3.11] for details.)
Example 4.3.13. (a) Let n = 4 and k = 2 and S = {1, 2, 3, 4}. Then, the 2-element
subsets of S are {1,
2},{1, 3}, {1, 4}, {2, 3}, {2, 4} and {3, 4}. The number of
4
these subsets is 6 = , which is exactly what Theorem 4.3.12 predicts.
2
(b) Now, let k = 5 instead (while n is still 4, and S is still {1, 2, 3, 4}). Then,
there are no 5-element subsets of S, since Sonly has 4 elements. Thus, the
4
number of these 5-element subsets is 0 = , which is exactly what Theorem
5
4.3.12 predicts.
Hints to the proof of Theorem 4.3.12. There is a fairly straightforward proof of Theo-
rem 4.3.12 by induction on n. In the induction step, pick an element s ∈ S and
classify the k-element subsets of S as “red” or “green” according to whether they
contain s or not (similarly to our above proof of Theorem 2.3.4). This proof can be
found in [19fco, proof of Theorem 1.3.12] or [Grinbe15, solution to Exercise 3.4].
An alternative proof can be given using enumerative combinatorics (see [LeLeMe16,
§15.5] or [19fco, §2.7]).
n
Warning 4.3.14. Theorem 4.3.12 says nothing about / N.
when n ∈
k
Hints to the proof of Theorem 4.3.15. In the case n ∈ N, this can either be shown
by induction on n (using Theorem 4.3.7), or obtained immediately from Theorem
4.3.12. The general case n ∈ Z can be reduced to the case n ∈ N via Proposition
4.3.6 and (118). (See [19fco, proof of Theorem 1.3.16] for details.)
Theorem 4.3.16 (the binomial formula). Let x and y be any numbers. Let n ∈ N.
Then,
n
n k n−k
( x + y) = ∑
n
x y .
k =0
k
n
This is why the are called the “binomial coefficients”.
k
Hints to the proof of Theorem 4.3.16. Either induct on n (see [19fco, proof of Theorem
1.3.24] for details), or argue combinatorially using Theorem 4.2.14 (best done after
familiarizing yourself with basic bijections).
Let us state two famous consequences of Theorem 4.3.16. The first one says that
the sum of all entries in the n-th row of Pascal’s triangle (where rows are counted
from 0) is 2n :
n n
Corollary 4.3.17. Let n ∈ N. Then, ∑ = 2n .
k =0 k
Hints to the proof of Corollary 4.3.17. Apply Theorem 4.3.16 to x = 1 and y = 1. (See
[19fco, Corollary 1.3.27] for details.)
The second consequence ([19fco, Proposition 1.3.28], [Spivey19, §3.4, Identity 12])
is a bit subtler:
Here, we are using the so-called Iverson bracket notation (which despite its trivial
definition is surprisingly useful):
We finish our first incursion into binomial coefficients with a formula that ex-
presses Fibonacci numbers as sums thereof:
Exercise 4.4.1. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Prove that each inte-
ger n ≥ 0 satisfies
f 1 + f 3 + f 5 + · · · + f 2n−1 = f 2n .
Discussion of Exercise 4.4.1. This is easy to prove by induction on n, but let us try to
prove it by the telescope principle.
Let n ≥ 0 be an integer. For each integer i ≥ 1, we have f i+1 = f i + f i−1 (by the
recursive definition of the Fibonacci numbers) and therefore
f i = f i +1 − f i −1 . (126)
f1 + f3 + f5 + · · · + f −1
|{z} |{z} |{z} |2n
{z }
=1 = f2 + f1 = f4 + f3 = f 2n−2 + f 2n−3
= f1 + f2 = f3 + f4 = f 2n−3 + f 2n−2
= 1 + ( f 1 + f 2 ) + ( f 3 + f 4 ) + · · · + ( f 2n−3 + f 2n−2 )
| {z }
= f 1 + f 2 +···+ f 2n−2
= f (2n−2)+2 −1
(by Exercise 2.2.1, applied to 2n−2 instead of n)
= 1 + f (2n−2)+2 − 1 = f (2n−2)+2 = f 2n .
n −1 k
Exercise 4.4.2. ”Simplify” ∏ 1+ a2 for a 6= 1 and n ∈ N. (The answer
k =0
should not contain any ∏ signs.)
Discussion of Exercise 4.4.2. Let a be a number such that a 6= 1. Let n ∈ N. For each
k ∈ N, we have
k +1 k
k 2
1− a2
|{z} a 2 ·2 = 1 − a 2
= 1 − |{z}
k 2
= a 2 ·2 = a2k
(since 2k+1 =2k ·2)
k
k
= 1 − a2 1 + a2 (128)
k
(by the classical formula 1 − b2 = (1 − b) (1 + b), applied to b = a2 ) and therefore
k +1
2k 1 − a2
1+a = k
. (129)
1 − a2
Now,
n −1 n −1 k +1
n s
1 − a2 1 − a2
∏ 1+a 2k
= ∏ 1 − a2
k
= ∏ 2s −1
k =0 | {z } k =0 s =1 1 − a
k +1
1 − a2
= k
1 − a2
(by (129))
(n−1)/2
n
Exercise 4.4.3. Show that ∑ = 2n−1 for any odd n ∈ N.
k =0 k
0
1 − a2 1 − a1 1−a
(since = = = 1). In other words, (130) holds for n = 0.
1−a 1−a 1−a
Induction step: Let m ∈ N. Assume (as the induction hypothesis) that (130) holds for n = m.
We must prove that (130) holds for n = m + 1.
Our induction hypothesis says that (130) holds for n = m; in other words, it says that
m −1 2m
2k = 1 − a .
∏ 1 + a
k =0 1−a
Now, (128) (applied to k = m) yields
m +1
m
m
1 − a2 = 1 − a2 1 + a2 . (131)
But
! m
m m −1
1 − a2
∏ 2k
∏ 2k 2m m
1+a = 1+a · 1+a = · 1 + a2
k =0 k =0
1−a
| {z }
m
1 − a2
=
1−a
m +1
1 m
m
1 m +1
1 − a2
= · 1 − a2 1 + a2 = · 1 − a2 = .
1−a | {z } 1−a 1−a
m +1
=1− a2
(by (131))
In other words, (130) holds for n = m + 1. This completes the induction step. Thus, (130) is
proved.
Discussion of Exercise 4.4.3. Intuitively, the idea is clear from a look at Pascal’s tri-
angle: Pascal’s triangle is symmetric across the vertical axis (by Theorem 4.3.10).
Thus, if n ∈ N is odd, then the n-th row of Pascal’s triangle (i.e., the row that
begins with 1 and n) splits neatly into two equal halves (one half being to the left
of the vertical axis, and the other half being to the right of it), and therefore the
1
sum of the left half of this row is exactly of the sum of all entries in this row; but
2
the latter sum is 2n according to Corollary 4.3.17. Thus, the former sum is 2n−1 .
Here is a formal way to restate this argument: Let n ∈ N be odd. Thus, n =
2u + 1 for some u ∈ N. Consider this u. From n = 2u + 1, we obtain 2u = n − 1
andu = (n − 1) /2 and u + 1 = n − u and 2u + 1 = n. Now, Corollary 4.3.17 yields
n n
∑ = 2n = 22u+1 (since n = 2u + 1), so that
k =0 k
n 2u+1
n n
2 2u+1
= ∑ = ∑ (since n = 2u + 1)
k =0
k k =0
k
u 2u+1
n n
= ∑ + ∑ (132)
k =0
k k = u +1
k
(here, we have split the sum at k = u; that is, we have applied (84) to 0, u and
2u + 1 instead of u, v and w). But
2u+1 n
n n
∑ k = ∑ k (since u + 1 = n − u and 2u + 1 = n)
k = u +1 k=n−u
u
n
= ∑
k =0
n−k
| {z }
n
=
k
(by Theorem 4.3.10)
here, we have substituted n − k for k in the sum,
since the map {0, 1, . . . , u} → {n − u, n − u + 1, . . . , n}
that sends each k to n − k is a bijection
u
n
= ∑ .
k =0
k
u (n−1)/2
n n
2 2u
= ∑ = ∑ (since u = (n − 1) /2) .
k =0
k k =0
k
Hence,
(n−1)/2
n
∑ k
= 22u = 2n−1 (since 2u = n − 1) .
k =0
This solves Exercise 4.4.3.
Exercise 4.4.4. Recall once again the Fibonacci sequence ( f 0 , f 1 , f 2 , . . .), which is
defined recursively by f 0 = 0, f 1 = 1, and
Now, let us define f n for negative integers n as well, by “applying (133) back-
wards”: This means that we set f n−2 = f n − f n−1 for all integers n ≤ 1. This
allows us to recursively compute f −1 , f −2 , f −3 , . . . (in this order). For example,
f −1 = f 1 − f 0 = 1 − 0 = 1;
f −2 = f 0 − f −1 = 0 − 1 = −1;
f −3 = f −1 − f −2 = 1 − (−1) = 2,
etc.
(a) Prove that f −n = (−1)n−1 f n for each n ∈ Z.
(b) Prove that f n+m+1 = f n f m + f n+1 f m+1 for all n ∈ Z and m ∈ Z.
(c) Prove that 7 f n = f n−4 + f n+4 for all n ∈ Z.
(d) Prove that if a, b ∈ Z satisfy a | b, then f a | f b .
Discussion of Exercise 4.4.4. Parts (a), (b) and (c) of Exercise 4.4.4 appear (with de-
tailed solutions) in [18f-mt1s, Exercise 4]; thus, we shall only sketch the arguments
here.
Because of our definition of the f n , the equation
f n = f n −1 + f n −2 (134)
Then, conclude that the equality f −n = (−1)n−1 f n holds for each n ∈ Z as well,
because:
= (−1)n+m f n+m+1 ,
we obtain
(−1)n+m f n+m+1 = (−1)n+m ( f n f m + f n+1 f m+1 ) .
Dividing both sides of this equality by (−1)n+m , we obtain f n+m+1 = f n f m +
f n+1 f m+1 . This solves Exercise 4.4.4 (b).
An alternative solution to Exercise 4.4.4 (b) can be found in [18f-mt1s, Exercise
4]; it relies on two-sided induction (Theorem 3.1.9).
(c) This is just an exercise in applying the recursive equation of the Fibonacci
sequence over and over:77
f n −4 + f n +4 = f n −4 + f n +3 + f n +2
|{z} |{z} |{z}
(134) (134) (134)
= f n +3 + f n +2 = f n +2 + f n +1 = f n +1 + f n
= f n −4 + f n +2 + f n +1 + f n +1 + f n = f n −4 + f n +2 + 2 f n +1 + f n
|{z}
(134)
= f n +1 + f n
= f n −4 + f n +1 + f n + 2 f n +1 + f n = f n −4 + 2 f n + 3 f n +1
|{z}
(134)
= f n + f n −1
= f n −4 + 2 f n + 3 ( f n + f n −1 ) = f n −4 + 5 f n + 3 f n −1
|{z}
(134)
= f n −2 + f n −3
= f n −4 + 5 f n + 3 ( f n −2 + f n −3 ) = f n −4 + f n −3 + 5 f n + 3 f n −2 + 2 f n −3
| {z }
(134)
= f n −2
= f n −2 + 5 f n + 3 f n −2 + 2 f n −3 = 5 f n + 2 f n −2 + 2 ( f n −2 + f n −3 )
| {z }
(134)
= f n −1
= 5 f n + 2 f n −2 + 2 f n −1 = 5 f n + 2 ( f n −1 + f n −2 )
| {z }
(134)
= fn
= 5 fn + 2 fn = 7 fn.
Alternatively, Exercise 4.4.4 (c) can be obtained by applying Exercise 4.4.4 (b) to
m = −5 and again to m = 3, and then adding the resulting equalities together. (See
[18f-mt1s, Exercise 4] for the details.)
(d) Let a, b ∈ Z satisfy a | b. We must prove that f a | f b .
The numbers | a| and |b| belong to N (since a and b belong to Z). Furthermore,
Proposition 3.1.3 (a) yields | a| | |b| (since a | b). Hence, Exercise 3.2.2 (applied to | a|
and |b| instead of a and b) yields f |a| | f |b| .
It remains to derive f a | f b from this. But this is easy: Exercise 3.2.2 (a) (applied to
n = a) yields f −a = (−1) a−1 f a = ± f a . Thus, f |a| = ± f a 78 . Likewise, f |b| = ± f b ;
thus, f b = ± f |b| . Hence, f |b| | f b . Also, from f |a| = ± f a , we obtain f a | f |a| . Thus,
f a | f |a| | f |b| | f b . This solves Exercise 4.4.4 (d).
a1 a2 + a2 a3 + · · · + an−1 an + an a1 ≡ n mod 4.
Exercise 4.5.3. Let n and m be two coprime positive integers. Let u ∈ Z. Prove
that
(un − 1) (um − 1) | (u − 1) (unm − 1) .
n,m ∈ N satisfy
Exercise 4.5.4. Let n > 0. Prove the following:
m n n−1
(a) We have = .
n m m −1
gcd (n, m) n
(b) We have ∈ Z.
n m
n,
4.5.5.Let
Exercise i and j be positive integers such that i < n and j < n. Prove
n n
that gcd , > 1.
i j
Case 1: We have a ≥ 0.
Case 2: We have a < 0.
Let us first consider Case 1. In this case, we have a ≥ 0. Thus, | a| = a, so that f | a| = f a = ± f a .
Hence, f | a| = ± f a is proved in Case 1.
Let us now consider Case 2. In this case, we have a < 0. Thus, | a| = − a, so that f | a| = f − a =
± f a . Hence, f |a| = ± f a is proved in Case 2.
We have now proved that f | a| = ± f a in each of the two Cases 1 and 2. Hence, f | a| = ± f a
always holds, qed.
Exercise 4.5.6. Let n be a positive integer. We let φ (n) denote the number of all
i ∈ {1, 2, . . . , n} satisfying i ⊥ n. (For example, φ (12) = 4, because there are
exactly 4 numbers i ∈ {1, 2, . . . , 12} satisfying i ⊥ 12: namely, 1, 5, 7 and 11.)
(a) Prove that φ (n) is even if n > 2.
1
(b) Prove that the sum of all i ∈ {1, 2, . . . , n} satisfying i ⊥ n equals nφ (n) if
2
n > 1.
[Remark: The function φ : {1, 2, 3, . . .} → N that sends each positive integer n
to φ (n) is known as the Euler totient function (or the phi-function). Here is a table
of its first few values:
n 1 2 3 4 5 6 7 8 9 10 11 12 13
.
φ (n) 1 1 2 2 4 2 6 4 6 4 10 4 12
∞ fk
Exercise 4.5.7. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Find ∑ .
k =2 f k −1 f k +1
79 Readersunfamiliar with complex numbers can imagine that the symbol C is replaced by R here.
The solution doesn’t really depend on what kind of number n is.
n−1 n−1
n
= f k +1 + f n − k −1 .
k F k F k−1 F
n
(c) Prove that ∈ N for any n ∈ N and k ∈ N.
k F
80 As before, the word “number” means an integer, rational, real or complex number.
Discussion of Exercise 4.6.1. We compute the first few entries of our sequence:
x0 = x0 ;
x1 = qx0 + d;
x2 = q x1 +d = q (qx0 + d) + d = q2 x0 + qd + d;
|{z}
=qx0 +d
x3 = q x0 + q2 d + qd + d;
3
x4 = q4 x0 + q3 d + q2 d + qd + d.
Here is a different sequence puzzle, which has appeared in the finals of the Nor-
wegian mathematical olympiad 1994-95 (problem 1a) and the British mathematical
olympiad 1996:
bn − bn − 1 = ( a 1 + a 2 + · · · + a n ) + ( a 1 + a 2 + · · · + a n −1 )
|{z} |{z}
= a1 + a2 +···+ an = a1 + a2 +···+ an−1
= an . (142)
bn = a 1 + a 2 + · · · + a n = n 2 · an (by (140))
|{z}
= bn − bn − 1
(by (142))
= n 2 · ( bn − bn − 1 ) = n 2 bn − n 2 bn − 1 ,
hence
n 2 bn − 1 = n 2 bn − bn = n 2 − 1 bn = ( n − 1 ) ( n + 1 ) bn .
Solving this for bn , we find
n 2 bn − 1 n n
bn = = · · bn − 1 . (143)
( n − 1) ( n + 1) n−1 n+1
This is a recursive equation for the sequence (b0 , b1 , b2 , . . .) that is much easier
to work with than the original recursion (140) for the sequence ( a1 , a2 , a3 , . . .); in
particular, it relies only on one preceding value bn−1 rather than the n − 1 values
a1 , a2 , . . . , an−1 . This is why we introduced the sequence (b0 , b1 , b2 , . . .). The moral
of the story (so far – we haven’t solved the exercise yet!) is that if the sums a1 +
a2 + · · · + an appear in a recursive equation, it is worth introducing a new sequence
(b0 , b1 , b2 , . . .) defined by (141); then, these sums can be rewritten as bn , whereas
single entries an of the original sequence ( a1 , a2 , a3 , . . .) can be rewritten as bn − bn−1
(by (142)). This way, we trade finite sums for differences of two numbers; the latter
are usually easier to deal with than the former.81
Using (143), we can now easily compute the entries of the sequence (b0 , b1 , b2 , . . .),
starting with b1 :
b1 = 1;
2 2 2 2
b2 = · · b1 = · ;
1 3 |{z} 1 3
=1
3 3 3 3 2 2
b3 = · · b2 = · · · ;
2 4 |{z} 2 4 1 3
2 2
= ·
1 3
4 4 4 4 3 3 2 2
b4 = · · b3 = · · · · · ;
3 5 |{z} 3 5 2 4 1 3
3 3 2 2
= · · ·
2 4 1 3
....
81 Notealso that not only sums of the form a1 + a2 + · · · + an , but more generally any sums of the
form ai+1 + ai+2 + · · · + a j can be rewritten in a simpler form using the b1 , b2 , b3 , . . .. Indeed, we
have ai+1 + ai+2 + · · · + a j = b j − bi for all positive integers i and j satisfying i ≤ j.
an = bn − bn − 1 (by (142))
|{z} |{z}
2n 2 ( n − 1)
= =
n+1 n
(by (145)) (by (145))
2n 2 ( n − 1) 2
= − = .
n+1 n n ( n + 1)
82 Try 2
checking that our explicit answer an = does indeed satisfy the recursion (140)! (The
n ( n + 1)
formula you should obtain is precisely (29).)
Discussion of Exercise 4.6.3. Computing the first few entries of our sequence yields
5
a1 = = 2.5;
2
17
a2 = = 4.25;
4
257
a3 = ≈ 16.063;
16
66 049
a4 = ≈ 256.0;
256
....
The first thing that will catch your eye is the omnipresence of powers of 2 here
– both in the denominators (where they are not surprising due to the repeated
squaring in the construction of the sequence) and as approximate values. The
latter is a dead giveaway: It appears that an is very close to a power of 2, and the
difference between an and said power of 2 converges to 0 (rather fast) as n → ∞.
n −1
It is easily observed that the relevant power of 2 is 22 . Thus, we suspect that
n −1
a n ≈ 22 .
n −1
To get an exact formula for an , we take a look at the differences an − 22 (as it
is always a good idea to subtract the part we know to get a closer look at the part
we don’t):
5 0 1
a1 − 22 = −2 = ;
2 2
1 17 1
a2 − 22 = −4 = ;
4 4
2 257 1
a3 − 22 = − 16 = ;
16 16
....
n −1 1
These suggest that an − 22 = n −1
, and thus
22
n −1 1
a n = 22 n −1
+ for each n ≥ 1. (146)
22
Once this formula has been guessed, its proof is a straightforward induction on n
(which we leave to the reader, who can find it in [Galvin20, §2.4, Exercise 2]).
Could we have found this formula without staring at numbers? Yes, although
that would have required a more sophisticated trick: A contest mathematics con-
1
noisseur will recognize the “scent of x + ” in the recursive formula an = a2n−1 − 2.
x
What does this mean? The crucial observation is that if a number y has the form
1
x + for some number x 6= 0, then
x
1
y2 − 2 = x 2 + 2 (147)
x
(check this!). Knowing this, when you see an expression of the form y2 − 2 any-
1 1
where, you may want to try rewriting the y as x + , so that y2 − 2 becomes x2 + 2 .
x x
In the case of the present problem, we thus suspect that there is a “secret” sequence
( x1 , x2 , x3 , . . .) of numbers with the property that
1
an = xn + for every n ≥ 1. (148)
xn
If this sequence exists, then the recursion an = a2n−1 − 2 can be rewritten as xn +
1 1
= xn2 −1 + 2 .
xn x n −1
Constructing such a “secret” sequence ( x1 , x2 , x3 , . . .) is easy: We find x1 by solv-
5 1
ing the equation = a1 = x1 + for x1 (this boils down to a quadratic equation,
2 x1
1
whose solutions are and 2); then we set xn = xn2 −1 for each n ≥ 2 (this is the
2
1 1
easiest way to satisfy the recursion xn + = xn2 −1 + 2 ; of course, we could
xn x n −1
1
have also set xn = 2 , but why complicate things?). This leads to
x n −1
1
x1 = 2 we could have just as well chosen ;
2
x 2 = 22 ;
2
x3 = 22 = 24 ;
2
x4 = 24 = 28 ;
...;
n −1
the general formula is easily seen to be xn = 22 . Hence, (148) rewrites as an =
n −1 1
22 + n−1 . Thus, we have discovered (146) again.
22
1
The rational expression x + is a sufficiently common occurrence in mathe-
x
matics that its properties are worth remembering (cf. the Wikipedia page on the
Joukowsky transform). The equality (147) is a close relative of the formula
cos (2ϕ) = 2 cos2 ϕ − 1
from trigonometry; indeed, using complex numbers, the latter formula can easily
be derived from (147) (by applying (147) to x = eiϕ and y = 2 cos ϕ).
The following sequence-guessing exercise was problem A3 on the Putnam con-
test 2004 (see [GelAnd17, §3.1.1, Example]):
a3 = 2, a4 = 3, a 5 = 23 , a6 = 3 · 5, a7 = 24 · 3, a8 = 3 · 5 · 7.
The odd-indexed values a2m+1 are disguising somewhat better. Unlike the inte-
gers a2m , which are all odd, these are even (at least as far as we have computed
them). Moreover, they seem to be multiples of larger and larger powers of 2. More
a
precisely, a2m+1 appears to be a multiple of 2m ; thus, we can try to look at 2mm+1 in
2
order to pin down the other factor. We see that
a3 a5 a7 a9
= 1, = 2, = 6, = 24.
21 22 23 24
These look familiar – aren’t these the factorials? Thus, we are led to conjecturing
that
a2m+1 = 2m · m! = 2 · 4 · 6 · · · · · (2m) for each m ∈ N (151)
| {z }
the product of the first m
even positive integers
83 We won’t properly discuss prime factorization until Section 9.2, but for now let us take it for
granted.
(where the last equality sign is an easy consequence of the definition of m! and
(107)). Another way to guess this formula (151) would have been to observe exper-
imentally that a3 | a5 | a7 | a9 and thus it is reasonable to look at the consecutive
a5 a7 a9
quotients , , . (The same reasoning could have been used to come up with
a3 a5 a7
(150), if we hadn’t thought of using prime factorization.)
At this point, the two formulas we have guessed – that is, (150) and (151) –
cover all entries of our sequence ( a0 , a1 , a2 , . . .); thus, we can try proving them
by induction. Note that proving any one of these two formulas alone would be
difficult: For example, if we tried to prove (150) by induction on m, then we could
not get much mileage out of our recursion (149), since it would require us to know
a2m−1 and a2m−3 , which would not be covered by (150). Likewise, if we tried to
prove (151) by induction on m, then we would need to know a2m and a2m−2 , which
(151) could not help us compute. However, (150) and (151) complement each other
so neatly that proving them together is a straightforward induction exercise. Let
us do this in detail just to drive this point home:
and
a2k+1 = 2 · 4 · 6 · · · · · (2k ) . (153)
If k ≤ 1, then this is straightforward. Thus, we WLOG assume that k > 1. Hence, 2k > 2,
so that 2k ≥ 3. Now, our induction hypothesis yields that the equalities (150) and (151)
hold for m = k − 2. In other words, we have
a2k−4 = 1 · 3 · 5 · · · · · (2k − 5)
and
a2k−3 = 2 · 4 · 6 · · · · · (2k − 4) . (154)
Also, our induction hypothesis yields that the equalities (150) and (151) hold for m = k − 1.
In other words, we have
a2k−2 = 1 · 3 · 5 · · · · · (2k − 3) (155)
and
a2k−1 = 2 · 4 · 6 · · · · · (2k − 2) . (156)
Now, (149) (applied to n = 2k − 3) yields
so that
a −3 · (1 · 3 · 5 · · · · · (2k − 1))
|2k
{z } | {z }
=2·4·6·····(2k−4) =(1·3·5·····(2k−3))·(2k−1)
(by (154))
we obtain
a2k−3 a2k = a2k−3 · (1 · 3 · 5 · · · · · (2k − 1)) .
We can cancel the factor a2k−3 from this equality (since a2k−3 = 2 · 4 · 6 · · · · · (2k − 4) 6= 0),
and thus find a2k = 1 · 3 · 5 · · · · · (2k − 1). This proves (152).
Furthermore, (149) (applied to n = 2k − 2) yields
so that
a −2 · (2 · 4 · 6 · · · · · (2k))
|2k
{z } | {z }
=1·3·5·····(2k−3) =(2·4·6·····(2k−2))·(2k)
(by (155))
we obtain
a2k−2 a2k+1 = a2k−2 · (2 · 4 · 6 · · · · · (2k)) .
We can cancel the factor a2k−2 from this equality (since a2k−2 = 1 · 3 · 5 · · · · · (2k − 3) 6= 0),
and thus find a2k+1 = 2 · 4 · 6 · · · · · (2k ). This proves (153).
Thus, both (152) and (153) are proved. This completes the induction step. Thus, Claim 1
is proved.]
Obviously, Claim 1 entails that a2m and a2m+1 are integers for each m ∈ N.
Hence, an is an integer for each n ∈ N (since each n ∈ N has the form 2m or
2m + 1 for some m ∈ N). This solves Exercise 4.6.4.
(2m)!
[Remark: Using Exercise 4.2.3, we could have rewritten (150) as a2m = .
2m m!
This would have made (150) shorter and a bit easier to work with, but it would
have obscured the fact that a2m is an integer.
We could have also combined the two formulas (150) and (151) into a single
formula
a n = ( n − 1) · ( n − 3) · ( n − 5) · · · · ,
where the product on the right hand side is understood to end at 1 if n is even and
at 2 if n is odd.]
4.7. Periodicity
4.7.1. Periodic sequences
Next, we shall discuss a property that some sequences have: periodicity. Here is a
way to define it:
On the other hand, if we remove the first entry of u, then u becomes the
sequence (0, 0, 0, 0, . . .), which is periodic (and even 1-periodic). The sequence u
is therefore “periodic except for a few early entries”. Such sequences are called
eventually periodic, but we will not have much use for this word.
Note that this differs from the definition of the Fibonacci sequence only in a
single sign. Here is a table of the first few entries of this new sequence:
n 0 1 2 3 4 5 6 7 8 9 10 11 12
.
gn 0 1 1 0 −1 −1 0 1 1 0 −1 −1 0
What a difference a sign can make! We observe from the table that the sequence
( g0 , g1 , g2 , . . .) is 6-periodic (i.e., its entries repeat every 6 terms: that is, gi = gi+6
for each i ∈ N), and can be rewritten explicitly as
using the Iverson bracket notation (Definition 4.3.19). All of this can be proved
by a straightforward strong induction on n.
Proof of Theorem 4.7.8. (a) Let a and b be two periods of u. We must prove that a + b
is a period of u.
Recall that a is a period of u if and only if every i ∈ N satisfies ui = ui+a (by
Definition 4.7.1 (a)). Hence, every i ∈ N satisfies
ui = ui + a (157)
(since a is a period of u). The same argument (applied to b instead of a) shows that
every i ∈ N satisfies
ui = ui +b . (158)
Now, every i ∈ N satisfies
ui = ui + a (by (157))
= u(i+a)+b (by (158), applied to i + a instead of i )
= ui+(a+b) (since (i + a) + b = i + ( a + b)) .
(d) Let a and b be two periods of u. Then, a and b are two positive integers (since
a period must be a positive integer by definition). Hence, Exercise 3.7.7 shows that
there exist positive integers x and y such that gcd ( a, b) = xa − yb. Consider these
x and y. Theorem 4.7.8 (c) (applied to n = x) yields that xa is a period of u. Also,
Theorem 4.7.8 (c) (applied to y and b instead of n and a) yields that yb is a period
of u.
Note that gcd ( a, b) is itself a positive integer (by Proposition 3.4.3 (b)). Hence,
gcd ( a, b) > 0, so that xa − yb = gcd ( a, b) > 0 and thus xa > yb. Therefore,
Theorem 4.7.8 (b) (applied to xa and yb instead of a and b) shows that xa − yb is a
period of u. In other words, gcd ( a, b) is a period of u (since gcd ( a, b) = xa − yb).
This proves Theorem 4.7.8 (d).
(e) Let a be a period of u, and let p and q are two nonnegative integers satisfying
p ≡ q mod a. We must prove that u p = uq .
From p ≡ q mod a, we obtain q ≡ p mod a (by Proposition 3.2.6 (c)). Hence, p and
q play symmetric roles in our situation (and, of course, also in the claim u p = uq
that we need to prove). Thus, we can WLOG assume that p ≥ q (since otherwise,
we can simply swap p with q). Assume this.
We must prove that u p = uq . If p = q, then this is obvious. Hence, for the rest of
this proof, we WLOG assume that p 6= q. Hence, p > q (since p 6= q and p ≥ q).
We have p ≡ q mod a. In other words, a | p − q. In other words, there exists an
integer c such that p − q = ac. Consider this c. We have ac = p − q > 0. Since a is
positive (because a is a period of u), we can divide this inequality by a, and thus
obtain c > 0. Hence, c is a positive integer. Thus, Theorem 4.7.8 (c) (applied to
n = c) shows that ca is a period of u.
However, ca is a period of u if and only if every i ∈ N satisfies ui = ui+ca (by
Definition 4.7.1 (a)). Thus, every i ∈ N satisfies ui = ui+ca (since ca is a period of
u). Applying this to i = q, we find uq = uq+ca = u p (since q + ca = p (because
ca = ac = p − q)). In other words, u p = uq . Hence, Theorem 4.7.8 (e) is proved.
As a consequence of Theorem 4.7.8, the periods of any given periodic sequence
have a rather simple structure:
na is a period of u (161)
[Proof of Claim 1: Let a ∈ {periods of u}. We will show that a ∈ {positive multiples of m}.
We have a ∈ {periods of u}. In other words, a is a period of u. Also, m is a period
of u. Hence, Theorem 4.7.8 (d) (applied to b = m) shows that gcd ( a, m) is a period
of u. Furthermore, Proposition 3.4.4 (f) (applied to b = m) yields gcd ( a, m) | a and
gcd ( a, m) | m. From the latter divisibility, we easily obtain gcd ( a, m) ≤ m 85 .
But m is the smallest period of u. Hence, every period b of u satisfies b ≥ m.
Applying this to b = gcd ( a, m), we obtain gcd ( a, m) ≥ m (since gcd ( a, m) is a
period of u). Combining this with gcd ( a, m) ≤ m, we find gcd ( a, m) = m. Hence,
m = gcd ( a, m) | a. In other words, a is a multiple of m. Since a is positive (because
a is a period of u), we thus conclude that a is a positive multiple of m. In other
words, a ∈ {positive multiples of m}.
Forget that we fixed a. We thus have shown that a ∈ {positive multiples of m} for
each a ∈ {periods of u}. In other words, {periods of u} ⊆ {positive multiples of m}.
This proves Claim 1.]
[Proof of Claim 2: Let a ∈ {positive multiples of m}. We will show that a ∈
{periods of u}.
We have a ∈ {positive multiples of m}. In other words, a is a positive multiple
of m. Hence, a is a multiple of m; in other words, there exists an integer c such that
a = mc. Consider this c.
We have mc = a > 0 (since a is positive). We can divide this inequality by m
(since m > 0), and thus find c > 0. Hence, c is a positive integer. Thus, Theorem
4.7.8 (c) (applied to m and c instead of a and n) yields that cm is a period of u.
In other words, cm ∈ {periods of u}. In view of cm = mc = a, this rewrites as
a ∈ {periods of u}.
85 Proof. We know that gcd ( a, m) is nonnegative (by Proposition 3.4.3 (a)), so that |gcd ( a, m)| =
gcd ( a, m).
But Proposition 3.1.3 (b) (applied to gcd ( a, m) and m instead of a and b) yields |gcd ( a, m)| ≤
|m| (since gcd ( a, m) | m and m 6= 0). In view of |gcd ( a, m)| = gcd ( a, m) and |m| = m, this
rewrites as gcd ( a, m) ≤ m.
Forget that we fixed a. We thus have shown that a ∈ {periods of u} for each a ∈
{positive multiples of m}. In other words, {positive multiples of m} ⊆ {periods of u}.
This proves Claim 2.]
Combining Claim 1 with Claim 2, we obtain {periods of u} = {positive multiples of m}.
This proves Corollary 4.7.9.
Note that Theorem 4.7.8 and Corollary 4.7.9 rely substantially on the assumption
that the sequence (u0 , u1 , u2 , . . .) be infinite. A theory of periodic finite sequences
exists, but is less well-behaved. For example, the 6-tuple (0, 1, 0, 0, 1, 0) is 3-periodic
(in the obvious meaning of this word) and 5-periodic, but not gcd (3, 5)-periodic
(since its entries are not all equal); thus, the most natural analogue of Theorem
4.7.8 (d) for finite sequences does not hold. The same applies to Theorem 4.7.8 (b);
indeed, the 5-tuple (0, 0, 1, 0, 0) is 4-periodic and 3-periodic but not (4 − 3)-periodic.
Example 4.7.12. For each x ∈ R, the real x − b x c is known as the fractional part
of x; it satisfies 0 ≤ x − b x c < 1. (Some authors denote it by { x }, though this
notation clashes with the set builder notation.) Now, the function
R → R,
x 7→ x − b x c
Example 4.7.13. The delta function δ0 is the function R → R that sends each x ∈ R
to [ x = 0] (where we are using Definition 4.3.19). Thus, it sends 0 to 1, but sends
all nonzero reals to 0. It is easy to see that this function δ0 is not periodic.
The following is an analogue of Theorem 4.7.8 for functions (to the extent such
an analogue is possible):
Theorem 4.7.14. Let A be either the set R or the set R+ := {positive reals}. Let
S be any set. Let u : A → S be a function.
(a) If a and b are two periods of u, then a + b is a period of u.
(b) If a and b are two periods of u such that a > b, then a − b is a period of u.
(c) If a is a period of u, then na is a period of u for every positive integer n.
(d) If a and b are two positive integers that are periods of u, then gcd ( a, b) is
a period of u.
(e) If a is a period of u, and if p and q are two elements of A such that p − q is
an integer multiple of a, then u ( p) = u (q).
Proposition 4.7.15. Let A be either the set R or the set R+ := {positive reals}.
Let S be any set. Let a be a positive real. Let u : A → S and v : A → S be two
a-periodic functions. Let b ∈ A. Assume that
Then, u = v.
y−b y−b
Furthermore, from x = y − a , we obtain y − x = a . Thus, y − x
a a
y−b
is an integer multiple of a (since is an integer). But the function u is a-
a
periodic; in other words, a is a period of u. Hence, Theorem 4.7.14 (e) (applied to
p = y and q = x) yields that u (y) = u ( x ) (since y − x is an integer multiple of a).
In other words, u ( x ) = u (y). The same argument (applied to v instead of u) yields
v ( x ) = v (y). Now, u (y) = u ( x ) = v ( x ) = v (y).
Forget that we fixed y. We thus have shown that u (y) = v (y) for each y ∈ A. In
other words, u = v. This proves Proposition 4.7.15.
An analogue of Proposition 4.7.15 exists for periodic sequences.
Then, u = v.
y−b y−b
a ≤ y−b < a + 1 . Now, combining
a a
y−b
x = y−a ≥ y − (y − b) = b
a
| {z }
≤y−b
with
y−b y−b
x= y −a y−b = +b − a
|{z} a | {z } a
=y−b+b y−b
% ! $
<a +1
a
y−b y−b
<a +1 +b−a = b + a,
a a
Once these three claims are proved, we will be able to apply Proposition 4.7.15
and conclude that u = v; this will easily yield the claim of Exercise 1.1.3. Let us
thus prove the three claims:
[Proof of Claim 1: We shall show that every x ∈ R satisfies u ( x ) = u ( x + a).
Indeed, let x ∈ R. We observe that
87 It also appears (with y renamed as x) as Proposition A.2.3 in our first solution to Exercise 1.1.3.
Hence,
n −1 n −1 n
k k+1 k
∑ x+a+ n = ∑ x+ n = ∑ x+ n
k =0 | {z } k =0 k =1
k+1
$ %
= x+
n
(by (165))
byc = 0. (167)
(This follows almost immediately from the definition of byc; indeed, 0 ≤ y < 1
entails that the largest integer that is ≤ y is 0.)
We have x ∈ [b, b + a) = [0, 0 + a) (since b = 0). In other words, 0 ≤ x < 0 + a.
1
Hence, x < 0 + a = a = , so that nx < 1. Also, 0 ≤ nx (since 0 ≤ x). Thus,
n
0 ≤ nx < 1. Hence, (167) (applied to y = nx) yields
bnx c = 0. (168)
k
Next, let k ∈ {0, 1, . . . , n − 1}. Then, 0 ≤ k ≤ n − 1. We have |{z}
x + <
n
1 |{z}
< n−1
n ≤
n
(since k≤n−1)
1 n−1 k k
+ x +
= 1 and |{z} ≥ 0. Thus, 0 ≤ x + < 1. Hence, (167) (applied
n n n n
≥0 |{z}
≥0
(since k≥0)
k
to y = x + ) yields
n
k
x+ = 0. (169)
n
Forget that we fixed k. We thus have proved (169) for each k ∈ {0, 1, . . . , n − 1}.
Now, the definition of u yields
n −1 n −1
k
u (x) = ∑ x + − bnx c = ∑ 0 −0 = 0.
n
k=0 | {z }
|k={z0 }
| {z }
=0
=0 (by (168)) =0
(by (169))
a0 = 0, a1 = 1, and
a n = 1 + a n −1 a n −2 for each integer n ≥ 2.
Exercise 4.8.2. For any positive integer n, we let d (n) denote the number of all
positive divisors of n. (For example, d (6) = 4.)
Let n be a positive integer. Prove that
jnk jnk jnk
d (1) + d (2) + · · · + d ( n ) = + +···+ .
1 2 n
(y + x1 + x2 )2 − (y + x1 )2 − (y + x2 )2 + y2 = 2!x1 x2 .
Note that (35) is the particular case of this equality for y = m + 1, x1 = 1 and
x2 = 2.]
a0 = 0, a1 = 1, and
a n = n ( a n −1 + ( n − 1 ) a n −2 ) for each integer n ≥ 2.
( a0 , a1 , a2 , . . .) = (1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, . . .) .
Prove that
1√
1
an = 8n + 1 + for each n ∈ N.
2 2
The following is a bonus problem: You can get points on it even if you solved 5
others. Be warned that it is rather hard.
(For example, we didn’t use Binet’s formula all that often in our study of Fibonacci
numbers!)
Some resources on linearly recurrent sequences are [Markus83], [BeDeQu11],
[Melian01] and [Ivanov08].
Example 4.9.3. The Lucas sequence (`0 , `1 , `2 , . . .) is another famous (1, 1)-
recurrent sequence of integers. It is defined recursively by `0 = 2, `1 = 1, and
`n = `n−1 + `n−2 for all n ≥ 2. Its first terms are 2, 1, 3, 4, 7, 11, 18.
88 The name “two-term recurrences” refers to the two terms axn−1 and bxn−2 on the right hand side.
Some people prefer to also count the xn term on the left hand side, which makes these equations
“three-term recurrences” instead.
89 As before, “numbers” can mean integer, rational, real or complex numbers.
90 The name “( a, b )-recurrent” is not standard; I have picked it merely for the sake of brevity. A
more standard way to say “( a, b)-recurrent” would be “linearly recurrent with characteristic
polynomial x2 − ax − b”; this is related to the polynomial point of view that we might discuss
later on.
91 mostly taken from [Grinbe15, Chapter 4]
x n +6 = x n +5 − x n +4 = ( x n +4 − x n +3 ) − x n +4 = − x n +3
|{z} |{z}
= x n +4 − x n +3 = x n +2 − x n +1
= − x n +2 − x n +1 = − ( x n +1 − x n − x n +1 ) = x n .
|{z}
= x n +1 − x n
Example 4.9.9. The sequence (t0 , t1 , t2 , . . .) from Exercise 1.1.2 itself is not ( a, b)-
recurrent for any pair ( a, b); however, its two subsequences (t0 , t2 , t4 , t6 , . . .) and
(t1 , t3 , t5 , t7 , . . .) are (4, −1)-recurrent, since Exercise 1.1.2 (a) shows that t2n =
4t2(n−1) − t2(n−2) and t2n+1 = 4t2(n−1)+1 − t2(n−2)+1 for every n ≥ 2.
are (2 cos α, −1)-recurrent. More generally, if α and β are two angles, then the
sequence
(sin ( β + 0α) , sin ( β + 1α) , sin ( β + 2α) , . . .) (173)
is (2 cos α, −1)-recurrent.
Proof of Proposition 4.9.10 (sketched). Let α and β be two angles. It suffices to show
that the sequence (sin ( β + 0α) , sin ( β + 1α) , sin ( β + 2α) , . . .) is (2 cos α, −1)-recurrent
(because the two sequences (171) and (172) are particular cases of this sequence for
π
β = 0 and β = , respectively). In other words, it suffices to show that
2
sin ( β + nα) = 2 cos α sin ( β + (n − 1) α) + (−1) sin ( β + (n − 2) α)
Hence,
Discussion of Exercise 4.9.1. Let us first solve Exercise 4.9.1 in a “barbaric” way – by
experimenting and guessing. We will later see a more cultured way (or two) of
solving it.
We begin by taking a look at Binet’s formula, in order to get an idea of what we
should expect.
First, we observe that Binet’s formula involves the two irrational numbers ϕ
and ψ, even though the Fibonacci numbers are integers. Thus, we should expect
irrational numbers (specifically, square roots) to appear in our formula, even if a,
b, x0 and x1 are integers.
1 1
Binet’s formula said f n = √ ϕn − √ ψn . While it would be strange to expect
5 5
1
the same specific numbers √ , ϕ and ψ to appear in the general case, we can hope
5
that the overall form of the formula will be the same:
Therefore,
0 = γλn + δµn − a γλn−1 + δµn−1 + b γλn−2 + δµn−2
n n −1 n −2 n n −1 n −2
= γλ − aγλ − bγλ + δµ − aδµ − bδµ
| {z } | {z }
=γ(λ2 − aλ−b)λn−2 =δ(µ2 − aµ−b)µn−2
= γ λ2 − aλ − b λn−2 + δ µ2 − aµ − b µn−2 . (176)
Now, forget that we fixed n. We thus have shown that the equality (176) must
hold for every integer n ≥ 2. Since the only “moving parts” in this equality are
the λn−2 and the µn−2 terms (in the sense that all the other terms are independent
of n), we sense an easy way to ensure that it holds: Namely, it will hold whenever
λ2 − aλ − b = 0 and µ2 − aµ − b = 0. Technically, this is not the only way to make
(176) hold; for example, the same would hold if γ = 0 and δ = 0. However, it is
clear that γ = 0 and δ = 0 can only work if the sequence ( x0 , x1 , x2 , . . .) consists of
zeros, while we are trying to study the general case. In the “typical” case, neither
γ nor δ will be 0, since otherwise the sequence ( x0 , x1 , x2 , . . .) would have to be a
geometric progression (by (174)).
So we need to pick λ and µ in such a way that λ2 − aλ − b = 0 and µ2 − aµ − b =
0. In other words, λ and µ must be roots of the quadratic equation X 2 − aX − b = 0.
As you know from high school(?), this quadratic equation has two complex roots
(counted with multiplicity93 ). It seems a good idea to let λ and µ be the two roots
of this equation.94 Explicitly, this means that
√ √
a + a2 + 4b a − a2 + 4b
λ= and µ= . (177)
2 2
(We could of course swap the roles of λ and µ, but this would not change anything.)
Note that λ and µ can fail to be real numbers, even if a and b are reals. (For example,
this will happen if a = b = −1.)
By defining λ and µ through (177), we have ensured that (176) holds for each
integer n ≥ 2. Thus, (175) holds for each integer n ≥ 2 as well (since (176) is equiv-
alent to (175)). In other words, the sequence γλ0 + δµ0 , γλ1 + δµ1 , γλ2 + δµ2 , . . .
is ( a, b)-recurrent. Hence, if the formula (174) holds for n = 0 and for n = 1, then it
also holds for all n ∈ N (because two ( a, b)-recurrent sequences that agree in their
first two entries must be identical). It thus remains to pick γ and δ in such a way
that the formula (174) holds for n = 0 and for n = 1. In other words, we must pick
93 This means that sometimes, the equation has only one root, but we should count it as two equal
roots. (This happens precisely when a2 + 4b = 0.)
94 Technically, we could of course let λ and µ be one and the same root. But this feels like wasting
x1 − µx0 λx0 − x1
γ= and δ= (179)
λ−µ λ−µ
95 Indeed,we already explained that, due to our choice of λ and µ, if the formula (174) holds for
n = 0 and for n = 1, then it also holds for all n ∈ N. But our choice of γ and δ ensures that the
formula (174) does indeed hold for n = 0 and n = 1. Thus, this formula holds for all n ∈ N, as
desired.
x0 = x0 ;
x1 = x1 ;
− a2 a
x2 = ax1 + |{z} b x0 = ax1 + x0 = a x1 − x0 ;
4 4
− a2
=
4
a − a2
2 3 a
x3 = a x2 + |{z}b x1 = aa x1 − x0 + x1 = a x1 − x0 ;
|{z} 4 4 4 4
a
− a 2
= a x1 − x0 =
4 4
x4 = a x3 + |{z}b x2
|{z} |{z}
3 a − a2 = a x − a x
!
=a 2 x1 − x0 = 1 0
4 4 4 4
− a2
2 3 a a 3 1 3a
= aa x1 − x0 + a x1 − x0 = a x1 − x0 ;
4 4 4 4 2 16
5 a
x5 = a4 x1 − x0 (we are now omitting the intermediate steps) ;
16 8
5 3 5a
x6 = a x1 − x0 .
16 64
The answer may not immediately stare at us from the equations, but again we can
make an ansatz: Namely, we expect to have
This suggests that both the ui and the vi are fractions whose denominators are
powers of 2. The exact denominators appear to oscillate, but it is noticeable that
the denominator of ui is never larger than 2i−1 , while that of vi is never larger than
96 We are saying “for each n > 0” instead of “for each n ∈ N” here, since an−1 is undefined when
n = 0 and a = 0. (In truth, we are being over-careful here; the a = 0 case is easy enough that we
can just leave it aside.)
Voilà: now the pattern is impossible to miss.97 We guess that 2i−1 ui = i and
2i vi = i − 1. If this is true, then (180) becomes
n−1
n −1 n
xn = a x1 − n ax0 for each n > 0. (181)
2n −1 2
In other words,
1 n −1 n
xn = 2na x 1 − ( n − 1 ) a x 0 for each n > 0. (182)
2n
This is, so far, a guess. But clearly, if a formula like (182) is true, then it can be
proved by a straightforward strong induction on n. And this is indeed the case;
(182) is true, and its induction proof can be found in [Grinbe15, solution to Exercise
4.1]. Note that (182) holds for n = 0 as well, if we agree to understand nan−1 as 0
for n = 0 (even if an−1 may fail to be defined).
Thus, we have found explicit formulas for xn in both cases a2 + 4b 6= 0 and
2
a + 4b = 0. Exercise 4.9.1 is solved.
Combining our results obtained in the discussion of Exercise 4.9.1 above, we
obtain the following result (a “generalized Binet formula”):
where we set
√ √
a+ a2 + 4b a− a2 + 4b
λ= and µ= (184)
2 2
and
x1 − µx0 λx0 − x1
γ= and δ= . (185)
λ−µ λ−µ
97 If you found the idea of considering 2i−1 ui and 2i vi somewhat far-fetched: there are other ways
to guess the same result. For example, after computing u7 and u9 , it becomes easy to notice that
the numerator ofui is i whenever i is odd. With this in mind, you will then be motivated to look
u1 u2 u3 u4
at the sequence , , , , . . . , which will quickly reveal itself to be the rather famous
1 2 3 4
( 1, 2, 4, 8, 16, . . . ) .
1 n −1 n
xn = 2na x 1 − ( n − 1 ) a x 0
2n
(where we agree to understand nan−1 as 0 for n = 0).
It is easy to see that Theorem 2.3.1 is a particular case of Theorem 4.9.11 (a)
(obtained by setting a = 1 and b = 1 and xi = f i ). Likewise, we can compute
explicit formulas for other examples of ( a, b)-recurrent sequences:
Example 4.9.12. Consider the Lucas sequence (`0 , `1 , `2 , . . .) from Example 4.9.3.
This sequence is (1, 1)-recurrent; thus, Theorem 4.9.11 (a) (applied to a = 1 and
b = 1 and xi = `i ) yields that every n ∈ N satisfies `n = γλn + n
√δµ , where (as you
√
1+ 5 1− 5
can see by straightforward computations) we have λ = and µ =
2n 2
and γ = 1 and δ = 1. That is, every n ∈ N satisfies `n = ϕ + ψn , where ϕ and
ψ are as in Theorem 2.3.1.
xn = v1n + (u − v) 0n = v + (u − v) 0n .
This is, of course, again true due to the way 0n behaves when n = 0 and when
n > 0.
−µ λ
−1 0 1
−λ µ
.
Example 4.9.17. Let α and β be two angles. Proposition 4.9.10 shows that the
sequence
(sin ( β + 0α) , sin ( β + 1α) , sin ( β + 2α) , . . .)
is (2 cos α, −1)-recurrent. Obviously, we already have an explicit formula for its
entries, but let us contrast it with what Theorem 4.9.11 (a) would yield. Namely,
Theorem 4.9.11 (a) (applied to a = 2 cos α and b = −1 and xn = sin ( β + nα))
(To be fully precise, Theorem 4.9.11 (a) only applies when (2 cos α)2 − 4 6= 0, that
is, when α isqnot a multiple of π; but the other case is easy.) We note that the
square root (2 cos α)2 − 4 is an imaginary number (since |2 cos α| ≤ 2 and thus
√
(2 cos α)2 − 4 ≤ 0) and can be rewritten as 2i |sin α|, where i = −1 (this follows
easily from (sin α)2 + (cos α)2 = 1). We assume that α ∈ (0, π ), so that we can
rewrite |sin α| as sin α (the other case is no harder). Then, our above formulas for
λ and µ become
The formula sin ( β + nα) = γλn + δµn can now be straightforwardly (if labori-
ously) derived from de Moivre’s formula.
Now,
2
x(m+1)+1 x(m+1)−1 − xm +1
2 2
= x +2 xm − xm +1 = ( axm+1 + bxm ) xm − xm+1
|m
{z }
= axm+1 +bxm
2 2 2
= axm+1 xm + bxm − xm +1 = bxm − xm+1 ( x − ax )
| m+1{z m}
=bxm−1
(by (187))
2 2 2
= bxm − xm+1 · bxm−1 = b xm − xm+1 xm−1 = (−b) xm+1 xm−1 − xm
| {z }
=(−b)m−1 ( x2 x0 − x12 )
(by (188))
m −1 (m+1)−1
= (−b) (−b) x2 x0 − x12 = (−b) x2 x0 − x12 .
| {z }
=(−b)m =(−b)(m+1)−1
In other words, (186) holds for n = m + 1. This completes the induction step. Thus,
Exercise 4.9.2 is solved by induction.
Alternatively, Exercise 4.9.2 can be solved in a straightforward way using Theo-
rem 4.9.11, provided that one is willing to get one’s hands dirty with the necessary
computations.
Next, let us generalize the addition formula for Fibonacci numbers (Exercise
2.2.3) to ( a, b)-recurrent sequences:
Note that Exercise 2.2.3 is the particular case of Exercise 4.9.3 for a = 1 and b = 1
and xi = f i and yi = f i . Indeed, the Fibonacci sequence satisfies f 0 = 0 and f 1 = 1,
so Exercise 4.9.3 can be applied to it.
Once you start generalizing, it is hard to stop. Thus, rather than solving Exercise
4.9.3 directly, let us generalize it even further (dropping the requirements x0 = 0
and x1 = 1) and solve the generalization instead:
Solution to Exercise 4.9.4. Rather than try to adapt our above solution to Exercise
2.2.3 to our now-increased generality, we start from scratch and prove Exercise 4.9.4
by induction. (In this we follow [Grinbe15, Theorem 2.26], which is a particular case
of Exercise 4.9.4.)
Our goal is to prove that (189) holds for all nonnegative integers n and m.
We proceed by induction on n (without fixing m):
Induction base: For any nonnegative integer m, we have
In other words, (189) holds for n = 0 (and every nonnegative integer m).
Induction step: Let k ∈ N. Assume (as the induction hypothesis) that (189) holds
for n = k. We must now prove that (189) holds for n = k + 1.
We have assumed that (189) holds for n = k. In other words, we have
Again, an alternative solution could have been given using Theorem 4.9.11.
As we said, Exercise 4.9.4 is a generalization of Exercise 4.9.3; thus, having solved
the former, we can now quickly obtain the latter.
Solution to Exercise 4.9.3. Let n and m be two nonnegative integers. Then, Exercise
4.9.4 yields
bx0 yn+m + x1 yn+m+1 = bxn ym + xn+1 ym+1 .
Comparing this with
b x0 yn+m + x1 yn+m+1 = b · 0yn+m +yn+m+1 = yn+m+1 ,
|{z} |{z} | {z }
=0 =1 =0
we obtain yn+m+1 = bxn ym + xn+1 ym+1 . This solves Exercise 4.9.3.
If m < 1, then this is easy to do directly98 . Thus, for the rest of this proof, we
WLOG assume that m ≥ 1. Hence, the numbers m − 1 and m − 2 both belong to
98 Proof.Assume that m < 1. We must prove that (194) holds.
We have m < 1. Thus, either m = −1 or m = 0 (since m ∈ {−1, 0, 1, . . .}). In other words, we
are in one of the following two cases:
Case 1: We have m = −1.
Case 2: We have m = 0.
Let us first consider Case 1. In this case, we have m = −1. Hence, m + 1 = 0, so that
xm+1 = x0 = 0.
xm+1 = x1 = 1.
We have assumed that Proposition 4.9.18 holds for n < m. Hence, Proposition
4.9.18 holds for n = m − 2 (since m − 2 ∈ {−1, 0, 1, . . .} and m − 2 < m). In other
words, we have
m −2
m − 2 − k m−2−2k k
x(m−2)+1 = ∑ a b .
k =0
k
In view of (m − 2) + 1 = m − 1, this rewrites as
m −2
m − 2 − k m−2−2k k
x m −1 = ∑ k
a b . (196)
k =0
m 0
m − k m−2k k 0 − k 0−2k k
∑ k
a b = ∑
k
a b (since m = 0)
k =0 k =0
0 − 0 0−2·0 0
= b = 1,
|a {z } |{z}
0
| {z } = a0 =1 =1
=1
m − k m−2k k
m
we obtain xm+1 = ∑ a b . Hence, we have shown that (194) holds in Case 2.
k =0 k
We have now shown that (194) holds in each of the two Cases 1 and 2. Thus, (194) always
holds (under our assumption that m < 1). Qed.
we obtain
m −1
m − k − 1 m−2k k
bxm−1 = ∑ k−1
a b . (198)
k =0
Now,
we obtain
m
m − k m−2k k
x m +1 = ∑ k
a b .
k =0
In other words, Proposition 4.9.18 holds for n = m. This completes the induction
step. Thus, Proposition 4.9.18 is proved.
Proposition 4.9.18 is, in a way, an explicit formula for any entry of an ( a, b)-
recurrent sequence that begins with 0 and 1. Unlike the formulas in Theorem
4.9.11, it involves no irrational numbers; however, it involves a finite sum and
binomial coefficients. Its other disadvantage is that it only applies to a very specific
( a, b)-recurrent sequence (namely, the one starting with 0 and 1) rather than to
any arbitrary ( a, b)-recurrent sequence. This disadvantage, however, can easily be
amended: In fact, every ( a, b)-recurrent sequence can be expressed through the
very specific one that starts with 0 and 1. Namely, we have the following:
In view of
b x0 yn+0 + x1 yn+0+1 = b0yn+0 +yn+1 = yn+1 ,
|{z} |{z} | {z } | {z }
=0 =1 = y n +1 =0
this rewrites as yn+1 = by0 xn + y1 xn+1 . This proves Proposition 4.9.19.
Proposition 4.3.20 is a particular case of Proposition 4.9.18:
Proof of Proposition 4.3.20. We have n ∈ N ⊆ {−1, 0, 1, . . .} and 1 6= 0. The Fi-
bonacci sequence ( f 0 , f 1 , f 2 , . . .) is (1, 1)-recurrent (as we have already seen) and
satisfies f 0 = 0 and f 1 = 1. Hence, Proposition 4.9.18 (applied to a = 1, b = 1 and
xi = f i ) yields
n
n − k n−2k k
f n +1 = ∑ 1| {z } |{z}1
k =0
k
=1 =1
n
n−k n−0 n−1 n−2 n−n
= ∑ = + + +···+ .
k =0
k 0 1 2 n
This proves Proposition 4.3.20.
Another particular case of Proposition 4.9.18 is [Grinbe15, Exercise 4.4].
Yet another particular case of Proposition 4.9.18 is the following corollary, whose
connection to ( a, b)-recurrent sequences is not immediately visible:
Corollary 4.9.20. Let n ∈ {−1, 0, 1, . . .}. Then,
n
k n−k
n + 1 = ∑ (−1) 2n−2k .
k =0
k
Proposition 4.9.21 shows what is so nice about the vectors vi as opposed to the
single entries xi : We cannot compute an entry xi+1 from knowing xi alone (we
need xi−1 as well), but we can compute a vector vi+1 from knowing vi alone (by
Proposition 4.9.21 (a)). Furthermore, Proposition 4.9.21 (b) (applied to i = 0) says
that An v0 = vn for each n ∈ N; this lets us quickly compute vn (and thus xn ) if we
can quickly compute An . Fortunately, powers of matrices can be computed quickly
(exponentiation by squaring does the trick). This yields one of the quickest ways
to exactly compute any entry of an ( a, b)-recurrent sequence.100
The proof of Proposition 4.9.21 is rather easy:
xi
Proof of Proposition 4.9.21. (a) Let i ∈ N. The definition of vi yields vi = .
x i +1
x i +1
The definition of vi+1 yields vi+1 = .
x i +2
The sequence ( x0 , x1 , x2 , . . .) is ( a, b)-recurrent. In other words, every n ≥ 2
satisfies xn = axn−1 + bxn−2 (by the definition of “( a, b)-recurrent”). Applying this
to n= i + 2, we obtain xi+2 = axi+1 + bxi = bxi + axi+1 . Now, recall
equality that
0 1 xi
A= (by the definition of A). Multiplying this equality by vi = ,
b a x i +1
we find
0 1 xi 0xi + 1xi+1 x i +1
Avi = = =
b a x i +1 bxi + axi+1 bxi + axi+1
100 Thisphenomenon, where it is easier to work with a “bundle” of several entries of a sequence
(or values of a function) instead of a single entry (or value), is omnipresent in mathematics and
computer science.
A n vi = vi +n (200)
(by Proposition 4.9.21 (a), applied to i + m instead of i). In other words, (200) holds
for n = m + 1. This completes the induction step. Thus, (200) is proved. In other
words, Proposition 4.9.21 (b) is proved.
As an illustration of how useful Proposition 4.9.21 is, let us use it to solve Exercise
4.9.2 again:
Second solution to Exercise 4.9.2 (sketched). If u and v are two column vectors of size
2, then (u | v) shall denote the 2 × 2-matrix whose columns are u and v (from left
to right). It is well-known (see, e.g., [Heffer20, Chapter Three, Section IV, Lemma
3.7]) that any 2 × 2-matrix B and any two column vectors u and v of size 2 satisfy
B (u | v) = ( Bu | Bv) . (201)
for each i ∈ N.
It is well-known (see, e.g., [Grinbe15, Theorem 6.23]) that any n ∈ N and any
two n × n-matrices A and B satisfy
det ( AB) = det A · det B. (204)
(In the current solution, we shall only use this equality in the case n = 2; in this
case it can be proved by straightforward computation.)
An easy consequence of (204) is the following formula (see, e.g., [Grinbe15,
Corollary 6.25 (b)]): If n ∈ N, and if B is an n × n-matrix, then
det Bk = (det B)k (205)
(If you don’t know this, you can easily prove it by induction on n.) For a diagonal
matrix D, computing its powers D n is a trivial task (it suffices to take each diagonal
entry of D to the n-th power). Thus, in order to compute An , it will suffice to
diagonalize A.
Not every square matrix can be diagonalized; however, over the complex num-
bers, “most” matrices can be101 . Diagonalizing a matrix is particularly easy for
a 2 × 2-matrix like A, since it only requires solving a quadratic (as opposed to a
higher-degree) equation. Let me omit the details and merely state the result:
(The appearance of the numbers λ and µ should not be surprising: They are
the two eigenvalues of A.)
Let us first draw some conclusions in the case a2 + 4b 6= 0, and then discuss what
can be done in the case a2 + 4b = 0.
Assume that a2 + 4b 6= 0. Then, we have just found a way to diagonalize A.
Namely, we have defined two complex numbers λ and µ as in (184), and we have
set
λ 0 1 1
D = diag (λ, µ) = and T= .
0 µ λ µ
101 Theword “most” here can be interpreted in many ways, most of which are correct :)
We will soon see what it means in our specific case.
A = T JT −1 ,
where
a
0 1 0
!
T= a and J= 2 a .
1 1
2 2
− a2
(The computation is best done by rewriting b as right away, thus getting rid of
4 n
the dependent parameter b.) In order to compute A , we thus need to know how
to compute J n . Fortunately, there is a formula for this:
n
dn
d 0 0
= (210)
u d ndn−1 u dn
for any numbers d and u and any n ∈ N (where we agree to interpret ndn−1 as 0
when n = 0). This formula (210) is a particular case of a general rule for taking
powers of Jordan blocks, but it also can easily be proved directly102 . Now, from
A = T JT −1 , we obtain
for each n ∈ N. Recalling how T and J were defined, and using (210) to compute
J n , we thus get an explicit expression for An , which we can then turn into an explicit
expression for xn in the same way as we did in the case a2 + 4b 6= 0 above. Thus
we recover Theorem 4.9.11 (b).
Discussion of Exercise 4.9.5. The most systematic approach to this is by using Theo-
rem 4.9.11. Indeed, the sequence ( a0 , a1 , a2 , . . .) is (1, 2)-recurrent (due to the equal-
ity an = an−1 + 2an−2 that holds for each n ≥ 2). Since 12 + 4 · 2 = 9 6= 0, we can
thus apply Theorem 4.9.11 (a) to a = 1 and b = 2 and xi = ai . We thus conclude
that every n ∈ N satisfies
an = γλn + δµn , (211)
where we set
√ √
1+ 12 + 4 · 1 1− 12 + 4 · 1
λ= and µ= (212)
2 2
and
a1 − µa0 λa0 − a1
γ= and δ= . (213)
λ−µ λ−µ
The equalities (212) yield
√ √
1 + 12 + 4 · 1 1+ 9 1+3
λ= = = =2 and
√2 2√ 2
2
1− 1 +4·1 1− 9 1−3
µ= = = = −1.
2 2 2
Hence, (213) yields
a1 − µa0 1 − (−1) · 2
γ= = (since λ = 2 and µ = −1 and a0 = 2 and a1 = 1)
λ−µ 2 − (−1)
=1
and (by a similar computation) δ = 1. Thus, (211) shows that every n ∈ N satisfies
δ µn = λn + µn = 2n + (−1)n
an = γ λn + |{z}
|{z}
=1 =1
√
1+ 5
Exercise 4.9.6. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Let ϕ = .
2
1 1
(a) Prove that f n = √ ϕn + for each n ∈ N.
5 2
(b) Prove that ϕn = f n−1 + f n ϕ for each positive integer n.
Discussion
of Exercise 4.9.6. (a) First, we observe that if u is a real number, then
1
u+ is the result of “rounding” u to the nearest integer (where a possible tie is
2
resolved in favor of the larger integer103 ). Thus, we have the following:
1 1
Claim 1: Let u ∈ R. Let v ∈ Z be such that v − ≤ u < v + . Then,
2 2
1
u+ = v.
2
[Proof of Claim 1: For the sake of completeness, let us give a formal proof of this. Let
1 1 1 1
x = u + . Adding to all sides of the inequality chain v − ≤ u < v + , we obtain v ≤
2 2 2 2
1 1 1 1 1 1
u + < v + + . In other words, v ≤ x < v + 1 (since u + = x and v + + = v + 1).
2 2 2 2 2 2
Thus, the integer v is ≤ x (since v ≤ x), but the next integer v + 1 is no longer ≤ x (since
x < v + 1). Hence, the largest integer that is ≤ x is v. In other words, b x c is v (since b x c
was
defined
as the largest integer that is ≤ x). In other words, b x c = v. This rewrites as
1 1
u+ = v (since x = u + ). This proves Claim 1.]
2 2
√
1− 5
Now, let us apply this. Set ψ = . Then, ψ ≈ −0.618, so that |ψ| ≤ 1.
2
1 1
Let n ∈ N. Then, Theorem 2.3.1 yields f n = √ ϕn − √ ψn , so that
5 5
1 1
√ ϕn = f n + √ ψn . (214)
5 5
1 1 1 1
However, |ψn | = |ψ|n ≤ 1 (since |ψ| ≤ 1), so that √ ψn = √ |ψn | ≤ √ < . In
5 5 |{z} 5 2
≤1
1 1 1
other words, the number √ ψn lies in the open interval − , ; in other words,
5 2 2
103 For 1
example, = 0.5 is rounded to 1, not to 0.
2
1 1 1
− < √ ψn < . Hence, (214) entails
2 5 2
1 1 1
√ ϕn = f n + √ ψn < f n +
5 5 2
| {z }
1
<
2
and
1 n 1 n 1 1
√ ϕ = fn + √ ψ > fn + − = fn − .
5 5 2 2
| {z }
1
>−
2
1 1 1
Combining the latter two inequalities, we find f n − < √ ϕn < f n + . Hence,
2 5 2
1 n 1 n 1
Claim 1 (applied to u = √ ϕ and v = f n ) yields that √ ϕ + = f n (since
5 5 2
f n ∈ Z). This solves Exercise 4.9.6 (a).
(b) We apply induction on n:
Induction base: We have ϕ1 = f 0 + f 1 ϕ (since f 0 + f 1 ϕ = 0 + 1ϕ = ϕ = ϕ1 ).
|{z} |{z}
=0 =1
In other words, Exercise 4.9.6 (b) holds for n = 1.
Induction step: Let m be a positive integer. Assume (as the induction hypothesis)
that Exercise 4.9.6 (b) holds for n = m. We must prove that Exercise 4.9.6 (b) holds
for n = m + 1. In other words, we must prove that ϕm+1 = f m + f m+1 ϕ.
We have ϕ2 = ϕ + 1. (This is easily seen by calculation using the definition of ϕ.)
Also, the recursive definition of the Fibonacci sequence yields f m+1 = f m + f m−1 =
f m −1 + f m .
Our induction hypothesis says that Exercise 4.9.6 (b) holds for n = m. In other
words, we have ϕm = f m−1 + f m ϕ. Now,
ϕ m +1 = ϕm ϕ = ( f m −1 + f m ϕ ) ϕ = f m −1 ϕ + f m ϕ 2 = f m −1 ϕ + f m ( ϕ + 1 )
|{z} |{z}
= f m −1 + f m ϕ = ϕ +1
= f m−1 ϕ + f m ϕ + f m = ( f m−1 + f m ) ϕ + f m = f m+1 ϕ + f m = f m + f m+1 ϕ.
| {z }
= f m +1
In other words, Exercise 4.9.6 (b) holds for n = m + 1. This completes the induction
step. Thus, Exercise 4.9.6 (b) is solved.
Solution to Exercise 4.9.7. We essentially repeat our above solution to Exercise 3.2.2,
with the obvious changes made at every step where they are necessary.
Fix a ∈ N. We must prove that for each b ∈ N, the following statement holds:
if a | b, then x a | xb . (215)
We shall prove (215) by strong induction on b:
Induction step: Let k ∈ N. Assume (as the induction hypothesis) that (215) holds
for all b < k. We must prove that (215) holds for b = k. In other words, we must
prove that
if a | k, then x a | xk .
So let us assume that a | k. We must then prove that x a | xk .
If k = 0, then this is clearly true (since we have xk = x0 = 0 in this case, and since
x a | 0 is true104 ). Thus, for the rest of this proof, we WLOG assume that k 6= 0.
Hence, k ≥ 1 (since k ∈ N).
It is fairly easy to see (from a | k and k ≥ 1 and a ∈ N) that a ≥ 1 and k − a ∈ N
and k − a < k and a | k − a 105 . From a ≥ 1, we obtain a − 1 ∈ N.
Our induction hypothesis says that (215) holds for all b < k. In other words,
for each b ∈ N satisfying b < k, the statement (215) holds. We can apply this to
b = k − a (since k − a ∈ N and k − a < k), and thus conclude that the statement
(215) holds for b = k − a. In other words, if a | k − a, then x a | xk−a . Thus, x a | xk−a
(since we know that a | k − a). In other words, xk−a ≡ 0 mod x a . Note also that
x a ≡ 0 mod x a (since every integer n satisfies n ≡ 0 mod n).
But Exercise 4.9.3 (applied to u, v and xi instead of a, b and yi ) shows that
xn+m+1 = vxn xm + xn+1 xm+1
for any nonnegative integers n and m. We can apply this to n = a − 1 and m = k − a
(since a − 1 ∈ N and k − a ∈ N); thus, we obtain
x(a−1)+(k−a)+1 = vx a−1 xk−a + x(a−1)+1 x(k−a)+1 .
and thus x a | xk . This is precisely what we wanted to show. Thus, we have proved
that (215) holds for b = k. This completes the induction step. Thus, Exercise 4.9.7
is solved.
Exercise 4.9.7 also appears in [Grinbe15, Theorem 2.26 (c)] (with different nota-
tions). Note that the x1 = 1 condition is not actually necessary for the claim to hold
(see Exercise 4.10.2 below); it was merely convenient for our proof. The x0 = 0
condition, on the other hand, is “more or less necessary” (i.e., if x0 6= 0, then the
claim of Exercise 4.9.7 holds only in a few exceptional cases106 ).
Next, let us generalize Exercise 3.5.2:
Discussion of Exercise 4.9.8. Let us try to imitate the solution to Exercise 3.5.2. Thus,
we use induction on n.
Induction base: Exercise 3.5.1 (a) (applied to a = x0 ) yields 1 ⊥ x0 . According to
Proposition 3.5.4, this entails x0 ⊥ 1. In other words, x0 ⊥ x1 (since x1 = 1). In
other words, Exercise 4.9.8 holds for n = 0.
Induction step: Let m ∈ N. Assume (as the induction hypothesis) that Exercise
4.9.8 holds for n = m. We must prove that Exercise 4.9.8 holds for n = m + 1. In
other words, we must prove that xm+1 ⊥ xm+2 .
Our induction hypothesis says that Exercise 4.9.8 holds for n = m. In other
words, we have xm ⊥ xm+1 . According to Proposition 3.5.4 (applied to a = xm
and b = xm+1 ), this entails xm+1 ⊥ xm . In other words, gcd ( xm+1 , xm ) = 1 (by the
definition of “coprime”). But the sequence ( x0 , x1 , x2 , . . .) is (u, v)-recurrent; thus,
xm+2 = uxm+1 + vxm . Hence,
gcd ( xm+1 , xm+2 ) = gcd ( xm+1 , uxm+1 + vxm ) = gcd ( xm+1 , vxm )
(by Proposition 3.4.4 (c), applied to a = xm+1 and b = vxm ) .
It would be nice if we knew that xm+1 ⊥ vxm , since that would yield gcd ( xm+1 , vxm ) =
1 and we could proceed. Unfortunately, we only know that xm+1 ⊥ xm , which is
weaker. What should we do?
Theorem 3.5.10 suggests a way we could try to prove xm+1 ⊥ vxm . Namely, if
we know that v ⊥ xm+1 and xm ⊥ xm+1 , then an application of Theorem 3.5.10
would yield vxm ⊥ xm+1 , and therefore xm+1 ⊥ vxm (by Proposition 3.5.4). The two
necessary ingredients for this argument to work are v ⊥ xm+1 and xm ⊥ xm+1 . We
already know that xm ⊥ xm+1 , but how do we get v ⊥ xm+1 ?
The way out of this predicament turns out to be a highly important strategy that
can be useful wherever induction is in play. Namely, we insert “v ⊥ xm+1 ” into our
induction hypothesis! This means that, instead of proving the claim “xn ⊥ xn+1 ”,
we prove the stronger claim “xn ⊥ xn+1 and v ⊥ xn+1 ”. This may look more
difficult (after all, we now have to prove two statements rather than one), but in
practice it may turn out to be more doable, as the extra strength of our claim makes
the induction hypothesis stronger as well (after all, the induction hypothesis now
also contains two statements rather than one). Thus, in the induction step, we have
both more work and more to work with.
What happens if we insert v ⊥ xn+1 into our claim? In the base case, we just have
to show (additionally) that v ⊥ x1 , which is easy (since x1 = 1). In the induction
step, we have to show (additionally) that v ⊥ xm+2 , but we can use v ⊥ xm+1
(which is now part of the induction hypothesis).
So how do we show that v ⊥ xm+2 in the induction step? We compute
where the last equality sign follows from noticing that v ⊥ uxm+1 (which, in turn,
follows from v ⊥ u and v ⊥ xm+1 using Theorem 3.5.10). So we get v ⊥ xm+2 , and
we win: Our stronger claim “xn ⊥ xn+1 and v ⊥ xn+1 ” has turned out to be easier
to prove than the original claim “xn ⊥ xn+1 ”.
For the sake of clarity, let me distill the above discussion into a detailed solution
to Exercise 4.9.8:
Solution to Exercise 4.9.8 (final copy). We claim that each n ∈ N satisfies
x n ⊥ x n +1 and v ⊥ x n +1 . (216)
to a = vxm and b = xm+1 ). In other words, gcd ( xm+1 , vxm ) = 1 (by the definition
of “coprime”).
But the sequence ( x0 , x1 , x2 , . . .) is (u, v)-recurrent; in other words, every n ≥ 2
satisfies xn = uxn−1 + vxn−2 (by the definition of “(u, v)-recurrent”). Applying this
to n = m + 2, we obtain xm+2 = ux(m+2)−1 + vx(m+2)−2 = uxm+1 + vxm . Hence,
gcd ( xm+1 , xm+2 ) = gcd ( xm+1 , uxm+1 + vxm ) = gcd ( xm+1 , vxm )
(by Proposition 3.4.4 (c), applied to a = xm+1 and b = vxm )
= 1.
1 1 1
+ + · · · + <2 for all n ∈ N. (217)
12 22 n2
It is unclear how to prove this by induction on n, since the space between the
left and the right hand sides keeps shrinking as n grows. However, the stronger
inequality
1 1 1 1
+ + · · · + ≤ 2 − for all n ∈ N (218)
12 22 n2 n
can easily be proved by induction on n. (This example has been taken from https:
//mathoverflow.net/a/40688 , where other instances of this phenomenon can also
be found.)
The vector space of ( a, b)-recurrent sequences. First, while we have used matri-
ces to study ( a, b)-recurrent sequences in Subsection 4.9.4, there is yet another way
in which linear algebra shines light on ( a, b)-recurrent sequences. Namely, for any
two fixed numbers a and b, the ( a, b)-recurrent sequences form a 2-dimensional
vector subspace of the vector space of all sequences. More precisely:
Proposition 4.9.22. Let K be one of the fields Q, R and C. Fix two numbers a, b ∈
K. Let Reca,b denote the set of all ( a, b)-recurrent sequences ( x0 , x1 , x2 , . . .) ∈
K∞ . Consider K∞ (that is, the set of all infinite sequences of elements of K)
as an (infinite-dimensional) K-vector space, with addition and scaling defined
entrywise107 . Then, Reca,b is a 2-dimensional vector subspace of K∞ .
Proof of Proposition 4.9.22 (sketched). Since Proposition 4.9.22 is nowhere near essen-
tial to what we are planning to do, we shall be on the terse side. First of all, we
claim that Reca,b is a vector subspace of K∞ . In order to prove this, we need to
show the following three facts:
107 This means that addition is defined by
( x0 , x1 , x2 , . . . ) + ( y0 , y1 , y2 , . . . ) = ( x0 + y0 , x1 + y1 , x2 + y2 , . . . )
for all ( x0 , x1 , x2 , . . .) , (y0 , y1 , y2 , . . .) ∈ K∞ ,
(In other words, sequences are considered as row vectors of infinite size.) The zero vector of this
vector space is the sequence (0, 0, 0, . . .).
All three of these facts are straightforward to verify108 . Thus, we have shown that
Reca,b is a vector subspace of K∞ . It remains to prove that Reca,b is 2-dimensional.
We shall achieve this by constructing a basis (s, t) of Reca,b .
Indeed, we define a sequence s = (s0 , s1 , s2 , . . .) ∈ K∞ recursively by setting
s0 = 0, s1 = 1 and sn = asn−1 + bsn−2 for each n ≥ 2. Thus, the sequence s is
( a, b)-recurrent.
Furthermore, we define a sequence t = (t0 , t1 , t2 , . . .) ∈ K∞ recursively by setting
t0 = 1, t1 = 0 and tn = atn−1 + btn−2 for each n ≥ 2. Thus, the sequence t is
( a, b)-recurrent.
The two sequences s and t are ( a, b)-recurrent, thus belong to Reca,b . Further-
more, any K-linear combination λs + µt (with λ, µ ∈ K) starts with the two entries
λ s0 +µ t0 = λ · 0 + µ · 1 = µ and λ s1 +µ t1 = λ · 1 + µ · 0 = λ, and thus
|{z} |{z} |{z} |{z}
=0 =1 =1 =0
cannot equal the zero sequence (0, 0, 0, . . .) unless both λ and µ are 0. In other
words, the sequences s and t are K-linearly independent.
Moreover, we claim that s and t span Reca,b . Indeed, every sequence x =
( x0 , x1 , x2 , . . .) ∈ Reca,b can be written as a K-linear combination of s and t as
follows:
x = x1 s + x0 t. (219)
[Proof of (219): Let x = ( x0 , x1 , x2 , . . .) ∈ Reca,b . We must prove (219). Since both s
and t belong to Reca,b , the linear combination x1 s + x0 t also belongs to Reca,b (since
Reca,b is a vector subspace of K∞ ). In other words, x1 s + x0 t is an ( a, b)-recurrent
sequence.
108 Justin case, let me show the proof of fact 2:
Let ( x0 , x1 , x2 , . . .) ∈ Reca,b and (y0 , y1 , y2 , . . .) ∈ Reca,b . We must show that ( x0 , x1 , x2 , . . .) +
(y0 , y1 , y2 , . . .) ∈ Reca,b .
We have ( x0 , x1 , x2 , . . .) ∈ Reca,b . In other words, the sequence ( x0 , x1 , x2 , . . .) is ( a, b)-recurrent
(since Reca,b is the set of all ( a, b)-recurrent sequences). In other words, every n ≥ 2 satisfies
xn = axn−1 + bxn−2 . Likewise, every n ≥ 2 satisfies yn = ayn−1 + byn−2 . Hence, every n ≥ 2
satisfies
T0 ( x ) = 1, T1 ( x ) = x, and
Tn ( x ) = 2xTn−1 ( x ) − Tn−2 ( x ) for each n ≥ 2.
(Thus, the polynomial Tn is the answer to the rather natural question “how can
we express cos (nα) through cos α without using arc-cosines?”. It is easy to prove
(220) by induction on n.)
The definition of the Chebyshev polynomials Tn shows that the sequence
( T0 , T1 , T2 , . . .) is (2x, −1)-recurrent (where we have extended the concept of
“( a, b)-recurrent” to sequences of polynomials in the obvious way). We can now
apply most of what we know about ( a, b)-recurrent sequences to this sequence
Clearly, Definition 4.9.1 is a particular case of Definition 4.9.24. Here are some
other particular cases:
p0 = 1, p1 = 1, p2 = 1, and
p n = p n −2 + p n −3 for each n ≥ 3.
This sequence is obviously (0, 1, 1)-recurrent. The Perrin sequence is also (0, 1, 1)-
recurrent but has starting values 3, 0 and 2 (in this order). For the properties
of these two sequences, we refer to their Wikipedia articles.
109 Indeed,you need to check that xn2 = a2 + b xn2 −1 + a2 + b bxn2 −2 − b3 xn2 −3 for each n ≥ 3. But
this can be done by expressing xn and xn−1 through xn−2 and xn−3 (via xn−1 = axn−2 + bxn−3
and xn = a x n −1 +bxn−2 = a ( axn−2 + bxn−3 ) + bxn−2 ) and expanding both sides.
|{z}
= axn−2 +bxn−3
(Here, we agree that the zero polynomial has degree < mi , whatever mi is.)
Thus, in particular, if all roots of p ( X ) are distinct (i.e., we have h = k, and the
multiplicities mi are all equal to 1), then each n ∈ N satisfies
We shall not dwell on the proof of Theorem 4.9.25, nor on its uses. Proofs of The-
orem 4.9.25 can be found in [Melian01, Theorem 1] and in [Ivanov08, Theorem 2].
The proof in [Melian01, Theorem 1] is essentially a straightforward generalization
of our above second proof of Theorem 4.9.11 in Subsection 4.9.4; it relies on the
k × k-matrix
0 1 0 ··· 0
0
0 1 ··· 0
.. .
.. .
.. . .
. . ..
. (225)
0 0 0 ··· 1
a k a k −1 a k −2 · · · a 1
(a generalization of the matrix A from Proposition 4.9.21) and its Jordan normal
form110 . The generalization of Proposition 4.9.21 to ( a1 , a2 , . . . , ak )-recurrent se-
quences is easily stated and proved, and this generalization provides a way to
study ( a1 , a2 , . . . , ak )-recurrent sequences via matrix algebra. Unlike the particular
case k = 2 (in which case explicit computations are a viable method), it is this ma-
trix approach that bears the most fruits in the general case. For example, here is a
neat folklore result whose only proof I know uses the matrix approach:
110 Tobe more precise, the matrix used in [Melian01, Theorem 1] is obtained from the above matrix
by a 180◦ -rotation; but this is just a matter of relabeling rows and columns.
Exercise 4.10.3. Generalize Exercise 4.9.2 further, to a claim about two ( a, b)-
recurrent sequences ( x0 , x1 , x2 , . . .) and (y0 , y1 , y2 , . . .).
[Hint: The left hand side will be xn+1 yn−1 − xn yn .]
The next exercise is about generalizing Exercise 3.7.2 and Exercise 3.4.1 (b):
Exercise
√ √ Let n ∈√N. Prove that there exists some m ∈ N such that
4.10.6.
n
2 − 1 = m + 1 − m.
j √ n k
Exercise 4.10.8. Let n ∈ N. Prove that 1+ 2 is even if and only if n is
odd.
Exercise 4.10.9. Let m and k be two positive integers such that m | k + 1. Define
a sequence ( a0 , a1 , a2 , . . .) of positive integers recursively by
a0 = 1, a1 = 1, a2 = m and
k + a n −1 a n −2
an = for each n ≥ 3.
a n −3
not all) instances of this “unexpected integrality” phenomenon, but properly un-
derstanding this theory goes beyond these notes. (See [AlCuHu16] for a large part
of this theory. For more, google “cluster algebras” and “Laurent phenomenon”.)
In this short section, we shall see more examples of such problems.
and
1 + t n −1 t n −2 · · · t n − k +1
tn = for each n ≥ k. (227)
tn−k
1 + t k −1 t k −2 · · · t 1 1+1·1·····1
(For example, tk = = = 2 and likewise tk+1 =
t0 1
3.)
Prove that tn is a positive integer for each integer n ≥ 0.
1 + t n −1 t n −2
tn = for each n ≥ 3
t n −3
1 + t n −1 t n −2
(since the right hand side of (227) becomes ). Hence, the sequence
t n −3
(t0 , t1 , t2 , . . .) is precisely the sequence (t0 , t1 , t2 , . . .) from Exercise 1.1.2. Thus,
the claim of Exercise 4.11.1 in the case k = 3 is precisely the claim of Exercise
1.1.2 (b).
Let us make a table of the first few entries of the sequence (t0 , t1 , t2 , . . .) (for
k = 3):
n 0 1 2 3 4 5 6 7 8 9 10 11 12 13
.
tn 1 1 1 2 3 7 11 26 41 97 153 362 571 1351
This sequence is sequence A005246 in the OEIS, and is (0, 4, 0, −1)-recurrent (as
we know from Exercise 1.1.2 (a)).
1 + t n −1
tn = for each n ≥ 2. (228)
t n −2
Let us make a table of the first few entries of the sequence (t0 , t1 , t2 , . . .):
n 0 1 2 3 4 5 6 7 8 9 10 11 12
.
tn 1 1 2 3 2 1 1 2 3 2 1 1 2
1 + t n −1 t n −2 t n −3
tn = for each n ≥ 4.
t n −4
Let us make a table of the first few entries of the sequence (t0 , t1 , t2 , . . .):
n 0 1 2 3 4 5 6 7 8 9 10 11
.
tn 1 1 1 1 2 3 7 43 452 45351 125920291 60027819184831
The rapid growth of the tn (after a slow start for n ≤ 7) strikes the eye.
Actually, the sequence grows at least doubly exponentially111 , whence it is
not ( a1 , a2 , . . . , am )-recurrent for any positive integer m and any numbers
a1 , a2 , . . . , am (because Theorem 4.9.25 shows that any ( a1 , a2 , . . . , am )-recurrent
sequence grows at most exponentially). The sequence (t0 , t1 , t2 , . . .) is A051786
in the OEIS.
Rather than solving Exercise 4.11.1 directly, let us generalize it even further:
111 To make this more precise: It is not hard to prove that tn ≥ 2 f n−3 for each n ≥ 3 (where
( f 0 , f 1 , f 2 , . . .) is the Fibonacci sequence). Since the Fibonacci sequence grows exponentially,
we thus conclude that tn grows at least doubly exponentially.
The inequality tn ≥ 2 f n−3 can be proved by induction on n. Here is an outline: The first step is
to show (by strong induction) that tn ≥ tn−1 for each positive integer n. The next step is to show
that tn ≥ tn−1 tn−2 for each integer n ≥ 2. Once this is done, tn ≥ 2 f n−3 can be proved by strong
induction (the induction step is arguing that tm ≥ tm−1 tm−2 ≥ 2 f m−4 2 f m−5 = 2 f m−4 + f m−5 =
|{z} |{z}
≥2 f m −4 ≥2 f m −5
2 f m−3 ).
Example 4.11.4. Exercise 4.11.1 is the particular case of Exercise 4.11.2 when all
the integers p1 , p2 , . . . , pk−1 equal 1. (Indeed, the equality (230) turns into (227)
in this case.)
1 + t n −1 t n −2
tn = for each n ≥ 4.
t n −4
Let us make a table of the first few entries of the sequence (t0 , t1 , t2 , . . .):
n 0 1 2 3 4 5 6 7 8 9
155 1706 .
tn 1 1 1 1 2 3 7 22
2 3
We see that t8 and t9 are not positive integers. So the claim of Exercise 4.11.2
does not hold in this case.
Solution to Exercise 4.11.2. For each integer n ≥ k, we have
p p p
tn tn−k = 1 + tn1−1 tn2−2 · · · tnk−−k1+1 . (231)
(Indeed, this follows by multiplying both sides of the equality (230) by tn−k .)
We must prove that
tn is a positive integer (232)
for each integer n ≥ 0.
We shall prove (232) by strong induction on n:
Induction step: Let m ≥ 0 be an integer. Assume (as the induction hypothesis)
that (232) holds for n < m. We must prove that (232) holds for n = m. In other
words, we must prove that tm is a positive integer. It clearly suffices to show that
tm is an integer (since we already know that tm is positive).
Hence, our goal is to prove that tm is an integer. If m < k, then this is clearly
true112 . Thus, for the rest of this proof, we WLOG assume that we don’t have
m < k. Hence, m ≥ k. Thus, (230) (applied to n = m) yields
p p −1 p
1 + tm1−1 tm2−2 · · · tmk− k +1
tm = . (233)
tm−k
We have assumed that (232) holds for n < m. In other words, tn is a positive
integer for each n < m. In other words, t0 , t1 , . . . , tm−1 are positive integers. In
other words, the numbers tm−1 , tm−2 , tm−3 , . . . , t0 are positive integers. This will
allow us to do modular arithmetic with these numbers (i.e., to state congruences
between these numbers).
Recall that our goal is to prove that tm is an integer. If m − k < k, then this can
easily be done113 . Hence, for the rest of this proof, we WLOG assume that we don’t
have m − k < k. Thus, m − k ≥ k.
Let r = m − k. Then, r = m − k ≥ k ≥ 0, so that r ∈ N. Hence, (231) (applied to
n = r) yields
p p p
tr tr−k = 1 + tr−1 1 tr−2 2 · · · tr−k−k1+1 (234)
(since r ≥ k). Note that the numbers tr , tr−1 , tr−2 , . . . , tr−k are among the numbers
t m −1 , t m −2 , t m −3 , . . . , t 0 114 , and thus are integers115 . Thus, all the numbers that
Also, the numbers tm−1 , tm−2 , . . . , tm−k+1 are among the numbers tm−1 , tm−2 , tm−3 , . . . , t0
116 ,
and thus are integers117 . Hence,
p p p
− tm1−1 tm2−2 · · · tmk−−1k+1
p p −1 p
= (−1) tm1−1 tm2−2 · · · tmk− k +1
| {z }
p p p
≡tr−1 1 tr−2 2 ···tr−k−k+1 1 mod tr
(by (235))
! !
k −1 k −1
∏ tr−i i ∏ tmi−i
p p p p p p p p
≡ tr−1 1 tr−2 2 · · · tr−k−k1+1 tm1−1 tm2−2 · · · tmk−−1k+1 =
| {z }| {z } i =1 i =1
k −1 p k −1 p
= ∏ tr−i i = ∏ tmi−i
i =1 i =1
k −1 k −1
∏ tr−i i tmi−i = ∏ (tr−i tm−i ) pi mod tr .
p p
= (236)
i =1 | {z } i =1
=(tr−i tm−i ) pi
In other words,
p p −1 p
tm1−i−1 tm2−i−2 · · · tmk− i −k+1 = tm−i tm−i −k − 1. (238)
The numbers tm−i , tm−i−1 , . . . , tm−i−k are among the numbers tm−1 , tm−2 , tm−3 , . . . , t0
118 ,
and thus are integers119 . Thus, all the numbers that occur on either side of
(238) are integers. Let us now set j = k − i. Then, j = k − i ∈ {1, 2, . . . , k − 1}
pj
(since i ∈ {1, 2, . . . , k − 1}). Hence, tm−i− j is one of the factors in the product
p p −1 p k −1 pj p p p
tm1−i−1 tm2−i−2 · · · tmk− 1 2
i −k+1 . Therefore, tm−i − j | tm−i −1 tm−i −2 · · · tm−i −k+1 (since the
116 since m − k +1 = r + 1 ≥ r ≥ 0
| {z }
=r
117 sincethe numbers tm−1 , tm−2 , tm−3 , . . . , t0 are integers
118 because m − i ≤ m − 1 and m − i − k ≥ k − k = 0
|{z} | {z }
≥1 ≥k
119 since the numbers tm−1 , tm−2 , tm−3 , . . . , t0 are integers
The number tr is among the numbers tm−1 , tm−2 , tm−3 , . . . , t0 122 , and thus is a
positive integer123 , hence is nonzero. Thus, from (240), we conclude that
p p p
−1
1 + tm1−1 tm2−2 · · · tmk− k +1
∈ Z.
tr
In view of r = m − k, this rewrites as
p p p
−1
1 + tm1−1 tm2−2 · · · tmk− k +1
∈ Z.
tm−k
In view of (233), this rewrites as tm ∈ Z. In other words, tm is an integer. As we
know, this is sufficient to complete the induction step. Thus, the induction step is
complete, and (232) is proved. This solves Exercise 4.11.2.
120 sincep1 , p2 , . . . , pk−1 are positive integers
121 Inthe following computation, we use (41) to multiply several congruences modulo tr .
122 because r = m − k ≤ m − 1 and r ≥ k ≥ 0
|{z}
≥2≥1
123 since the numbers tm−1 , tm−2 , tm−3 , . . . , t0 are positive integers
Thus, we have solved Exercise 4.11.1 as well (since Exercise 4.11.1 is the particular
case of Exercise 4.11.2 when all of p1 , p2 , . . . , pk−1 equal 1). This yields a new
solution to Exercise 1.1.2 (b) (since the claim of Exercise 4.11.1 in the case k = 3 is
precisely the claim of Exercise 1.1.2 (b)).
n 0 1 2 3 4 5 6 7 8 9 10 11
.
an 1 1 1 1 1 2 3 5 11 37 83 274
The growth rate of this sequence is faster than exponential124 ; thus, the sequence is
not (b1 , b2 , . . . , bk )-recurrent (for any b1 , b2 , . . . , bk ).
Here is a similar sequence ([Malouf92, Theorem 1]):
2
124 Infact, using Landau’s Big-O notation, we have an = O qn for a constant q ≈ 1.0728. See
[Brown20] for a proof.
n 0 1 2 3 4 5 6 7 8 9 10 11
.
an 1 1 1 1 2 3 7 23 59 314 1529 8209
At this point, it should be clear (both from their names and from their definitions)
that the Somos-4 and Somos-5 sequences are part of a sequence of sequences:
and
an−1 an−k+1 + an−2 an−k+2 + · · · + an−bk/2c an−k+bk/2c
an =
an−k
bk/2c
∑ a n −i a n − k +i
i =1
= for each n ≥ k.
an−k
It is easy to see that the Somos-2 and Somos-3 sequences are just the constant
sequence (1, 1, 1, . . .). We have seen the Somos-4 and Somos-5 sequences. Sur-
prisingly, all entries of the Somos-k sequences for all k ∈ {2, 3, . . . , 7} are integers.
However, the magic stops at k = 7: The 17-th entry of the Somos-8 sequence is not
an integer.
There is much to say about the Somos-k sequences, as well as other sequences
with similar definitions and properties (we will in fact see some of them later on).
Good starting points are the Wikipedia page for “Somos sequence” and Jim Propp’s
“Somos Sequences Site”. As mentioned above, [Gale98, Chapters 1 and 4] gives an
introduction with a few of the simplest proofs. Similar sequences can be found in
[FomZel02], [AlCuHu16] and [Russel16, Chapters 5–6]. Most of these sequences
have connections to combinatorics (in particular, the Somos-k sequences for all
k ∈ {4, 5, 6, 7} are known to enumerate perfect matchings in certain graphs); also,
the Somos-k sequences are related to elliptic curves (see, e.g., [Poorte04], or – for a
particularly short connection – the solution to Fifth Day problem 1 in [Zagier96]).
The Somos-4 and Somos-5 sequences have nontrivial divisibility properties as well
([Kamp15]).
We shall not dwell on these wide and fertile grounds; however, we shall state
(without proof) two theorems that generalize the integrality of the Somos-k se-
quences for k ∈ {4, 5, 6, 7}. The first generalizes the integrality of the Somos-4 and
Somos-5 sequences:
and
wan−i an−k+i + zan− j an−k+ j
an = for each n ≥ k. (243)
an−k
Then, an is a positive integer for each integer n ≥ 0.
Exercise 4.11.4 (that is, the integrality of the Somos-4 sequence) is the particular
case of Theorem 4.11.7 for k = 4, i = 1, j = 2, w = 1 and z = 1. Exercise 4.11.3 (that
is, the integrality of the Somos-5 sequence) is the particular case of Theorem 4.11.7
for k = 5, i = 1, j = 2, w = 1 and z = 1.
Note that the only reason why we required w and z to be positive in Theorem
4.11.7 is to ensure that all of a0 , a1 , a2 , . . . are positive; this prevents the denomi-
nator an−k in (243) from becoming zero. If an−k 6= 0 can be guaranteed in some
other way, then we can drop the requirement that w and z be positive (although, of
course, the claim must be changed: an will not generally be a positive integer, but
merely an integer). The “grown-up” version of Theorem 4.11.7 does not deal with
a sequence of integers at all; instead, it considers w and z as indeterminates, so
all of a0 , a1 , a2 , . . . are rational functions in these two indeterminates w and z (with
integer coefficients). The claim is then that these rational functions a0 , a1 , a2 , . . . are
actually polynomials with nonnegative integer coefficients. This has been proved
combinatorially (meaning that these polynomials an have been described explicitly,
as sums over matchings in certain graphs!) in [BMPrWe09, Theorem 11]. An alter-
native algebraic proof (using the algebra of Laurent polynomials) has been given
in [FomZel02, Example 1.7].
The next theorem generalizes the integrality of the Somos-6 and Somos-7 se-
quences:
and
uan−i an−k+i + van− j an−k+ j + wan−` an−k+`
an = for each n ≥ k.
an−k
The integrality of the Somos-6 sequence is the particular case of Theorem 4.11.8
and p q
a a + arn−2
a n = n −1 n −3 for each n ≥ 4. (244)
a n −4
Prove that an is a positive integer for each integer n ≥ 0.
However, this generalization cannot be merged with the w and z from Theorem
4.11.7. To wit, if we replace (244) by
then a8 = 10337/2 will fail to be an integer. On the other hand, the recurrence
an−1 an−3 + zan−2
an = for each n ≥ 4
a n −4
appears to produce integers an for each z ∈ N and each n ∈ N. (Is there a proof?)
This area still offers many challenges and surprises. Let me mention a counterex-
ample and a few open problems:
This is known as Göbel’s sequence (see also OEIS sequence A003504, which is
the same sequence shifted by an entry). It may appear that all its entries are
integers; but this is not so! The smallest n for which an is not an integer is 43; the
corresponding an = a43 has about a billion digits before the decimal point. (See
[Zagier96, Fifth Day, problem 3] for a more detailed discussion of this sequence;
note, however, that it is defined starting with a1 = 2 rather than a0 = 1 there.)
Note that the recurrence relation (245) can be replaced by
(n − 1) an−1 + a2n−1
an = for each n ≥ 1.
n
and
( a n −1 + 1 ) ( a n −2 + 1 ) ( a n −3 + 1 )
an = for each n ≥ 4.
a n −4
This is sequence A276123 in the OEIS. Is an an integer for each n ∈ N ? It
has been shown by mercio (math.stackexchange #1906097) that each an is a “2-
integer” (i.e., it becomes an integer when multiplied with a sufficiently large
power of 2), but it is not clear whether the power of 2 can be dispensed with.
More generally, we can fix an integer k ≥ 2, and define a sequence
( 0 , a1 , a2 , . . .) of positive rational numbers recursively by setting
a
and
( a n −1 + 1 ) ( a n −2 + 1 ) · · · ( a n − k +1 + 1 )
an = for each n ≥ k.
an−k
The above sequence is obtained for k = 4. For each k ≥ 2, one can ask whether
all the an are integers. The cases k = 2 and k = 3 have been resolved in the
positive (i.e., it is known that each an is an integer when k ∈ {2, 3}). The case
k = 5 is also open (MathOverflow question #323963). For each k > 5, the answer
is negative (viz., a2k is not an integer).
Here are three similar questions (all found by the same Michael Somos who the
Somos-k sequences originate with125 ) that have been answered in the positive:
n 0 1 2 3 4 5 6 7 8 9 10 11
.
xn 1 1 1 1 1 1 2 3 4 10 33 140
a0 = 2, a1 = 1, a2 = 1, a3 = 1, (248)
and
( a n −1 + a n −2 ) ( a n −2 + a n −3 )
an = for each n ≥ 4. (249)
a n −4
This is sequence A248049 in the OEIS.
(a) Prove that an an integer for each n ∈ N.
(b) Prove that an = xn+2 xn+1 xn xn−1 for each n ≥ 1, where ( x0 , x1 , x2 , . . .) is the
sequence defined in Exercise 4.11.6.
Here is a table of the first few entries of this sequence:
n 0 1 2 3 4 5 6 7 8 9 10 11
.
an 2 1 1 1 2 6 24 240 3960 184800 33033000 26125799700
n 0 1 2 3 4 5 6 7 8 9 10 11
.
bn 1 1 1 1 2 3 8 30 132 1400 23595 1107260
Solutions to Exercises 4.11.6, 4.11.7 and Exercise 4.11.8 can be found in Section
A.5.
Theorem 5.1.1. Let S be a nonempty finite set of real numbers. Then, S has a
minimum and a maximum.
Proof of Theorem 5.1.1. Proposition 2.1.2 shows that S has a maximum127 . The same
argument (mutatis mutandis128 ) shows that S has a minimum. This proves Theo-
rem 5.1.1.
The word “nonempty” in Theorem 5.1.1 is clearly necessary: The empty set has
neither a minimum nor a maximum. The word “finite”, too, cannot simply be
1 1 1
dropped (for example, the set , , , . . . has no minimum); but there are many
1 2 3
infinite sets that nevertheless have minima or maxima. For example, the following
holds ([Grinbe15, Theorem 2.44]):
126 We are saying “The one” here, but of course there can be several ones. For example, among the
three sets {1, 2}, {1, 3} and {0, 1, 2}, the first two have the smallest size.
127 To be more precise, Proposition 2.1.2 shows this under the assumption that S is a set of integers,
while we are here only assuming that S is a set of real numbers. However, the proof is the same
in either case.
128 Once again, the words “mutatis mutandis” mean “once the things that need to be changed have
been changed”. The things that need to be changed here are the following: The “≥” sign needs
to be flipped (i.e., replaced by a “≤” sign); the word “maximum” needs to be replaced by
“minimum”.
Of course, S will not usually have a maximum in this situation; for example, N
itself has no maximum.
Note that we have used Theorem 5.1.2 in Definition 3.6.2 (when arguing that the
smallest positive common multiple of k nonzero integers is well-defined). We have
also tacitly used Theorem 5.1.2 in Corollary 4.7.9 (in the corollary itself, not in the
proof), when defining m as the smallest period of u. Indeed, the existence of “the
smallest period of u” follows from the fact that the set {periods of u} has a smallest
element (i.e., a minimum); but this is a particular case of Theorem 5.1.2.
Theorem 5.1.2 can be generalized: For a set of integers, the existence of a lower
bound guarantees the existence of a minimum, while the existence of an upper bound
guarantees the existence of a maximum. Let us recall what lower and upper bounds
are:
For example, 0 and any negative real number are lower bounds for the set
1 1 1
, , , . . . , whereas 1 and any larger number are upper bounds for this set. No
1 2 3
positive real is a lower bound for this set, because if a is a positive real, then
there
1 1
exists a positive integer n such that < a (for example, we can take n = + 1 ).
n a
Now, here is the promised generalization of Theorem 5.1.2:
Note that the word “integers” in Theorem 5.1.4 is important. Even with ratio-
nal
numbers, the theorem would fail; for example, as we have seen above, the
1 1 1
set , , , . . . has a lower bound but no minimum. (And likewise, the set
1 2 3
1 1 1
− , − , − , . . . has an upper bound but no maximum.)
1 2 3
For the sake of completeness, let us give a proof of Theorem 5.1.4:
Proof of Theorem 5.1.4. (a) Assume that S has a lower bound. Let a be this lower bound.
Thus, a is a lower bound of S. In other words, every s ∈ S satisfies
a≤s (252)
Theorem 5.1.2 is a particular case of Theorem 5.1.4 (a), since any set of nonnega-
tive integers has a lower bound (namely, 0).
We note in passing that some things can be said about infinite sets of real num-
bers, even if neither Theorem 5.1.1 nor Theorem 5.1.4 apply to them. Namely, we
can define two “weaker” versions of minima and maxima:
u < m ≤ t. Also, u ∈ S and thus a ≤ u (by (252), applied to s = u). Also, u is an integer (since
u ∈ S, but S is a set of integers). Hence, u is an integer and satisfies a ≤ u ≤ t (since u < t). In
other words, u is an integer z satisfying a ≤ z ≤ t. In other words, u ∈ H (since H is the set of
all such integers z).
Combining u ∈ S with u ∈ H, we obtain u ∈ S ∩ H = T. Hence, (253) shows that m ≤ u. But
this contradicts m > u. This contradiction shows that our assumption was false. Hence, m ≤ u
is proved.
(b) A supremum (or least upper bound) of S means a minimum of the set of all
upper bounds of S. That is, it means an upper bound a of S with the property
that every upper bound b of S satisfies a ≤ b. A supremum of S is unique if it
exists, and is denoted by sup S.
Theorem 5.1.7. Let S be a nonempty set of reals that is closed with respect to the
topology on R. Then:
(a) If S has a lower bound, then S has a minimum.
(b) If S has an upper bound, then S has a maximum.
5.2. Applications
5.2.1. Writing numbers as sums of powers of 2
We shall now see various uses of the Extremal Principle. We begin with a well-
known result:
Theorem 5.2.1. Let n ∈ N. Then, there is a unique finite subset T of N such that
n = ∑ 2t .
t∈ T
The reader will probably have noticed that Theorem 5.2.1 is just the existence
and uniqueness of the base-2 representation of n in disguise. Indeed, if the base-2
representation of an n ∈ N is
n = bk · 2k + bk−1 · 2k−1 + · · · + b0 · 20
n= ∑ 2t , where T = {i ∈ {0, 1, . . . , k } | bi = 1} .
t∈ T
Proposition 5.2.3. Let n ∈ N. Then, there exists a finite subset T of N such that
n = ∑ 2t .
t∈ T
Proposition 5.2.4. Let n ∈ N. Let T and T 0 be two finite subsets of N such that
n = ∑ 2t and n = ∑ 2t . Then, T = T 0 .
t∈ T t∈ T 0
In other words, we must prove that there exists a finite subset T of N such that
m = ∑ 2t .
t∈ T
If m = 0, then this is obvious133 . Thus, for the rest of this proof, we WLOG
assume that m 6= 0. Hence, m ≥ 1.
It is easy to see that m < 2m 134 . Hence, there exists at least one p ∈ N such that
m < 2 p (for example, p = m works). In other words, the set { p ∈ N | m < 2 p } is
nonempty. Hence, Theorem 5.1.2 shows that this set has a minimum (since it is a
set of nonnegative integers). In other words, there is a smallest p ∈ N satisfying
m < 2 p . Let q be this smallest p.
Thus, q itself is a p ∈ N satisfying m < 2 p . In other words, q ∈ N and m < 2q .
Hence, 2q > m ≥ 1, so that q > 0. Therefore, q − 1 ∈ N. If we had m < 2q−1 , then
q − 1 would therefore be a p ∈ N satisfying m < 2 p ; but this would contradict the
fact that q is the smallest such p. Hence, we cannot have m < 2q−1 . In other words,
we have m ≥ 2q−1 .
Hence, m − 2q−1 ∈ N. Also, m − 2q−1 < m (since 2q−1 > 0). Thus, Proposition
5.2.3 holds for n = m − 2q−1 (since we assumed that Proposition 5.2.3 holds for n <
m). In other words, there exists a finite subset T of N such that m − 2q−1 = ∑ 2t .
t∈ T
Consider this T, and denote it by T0 . Hence, T0 is a finite subset of N such that
m − 2q −1 = ∑ 2t .
t∈ T0
Now, from m − 2q−1 = ∑ 2t , we obtain
t∈ T0
m = 2q −1 + ∑ 2t . (254)
t∈ T0
133 Proof. Assume that m = 0. Then, the empty set ∅ is a finite subset of N and satisfies ∑ 2t =
t ∈∅
(empty sum) = 0 and thus m = 0 = ∑ 2t . Hence, there exists a finite subset T of N such that
t ∈∅
m = ∑ 2t (namely, T = ∅). Thus, we have proved our claim under the assumption that m = 0.
t∈ T
134 Thequickest way to see this is to apply (5) to n = m and conclude that 20 + 21 + · · · + 2m−1 =
2 − 1 < 2m , so that 2m > |{z}
m 21 + · · · + 2| m{z−}1 ≥ 1 + 1 + · · · + 1 = m, and thus m < 2m .
20 + |{z}
| {z }
≥1 ≥1 ≥1 m times
135 Proof. Assume the contrary. Thus, q − 1 ∈ T0 . Hence, 2q−1 is an addend of the sum ∑ 2t . Since
t∈ T0
all addends of this sum are nonnegative, we thus conclude that ∑ 2t ≥ 2q−1 (because a sum of
t∈ T0
nonnegative reals is always ≥ to each of its addends). Hence, m − 2q−1 = ∑ 2t ≥ 2q−1 , so that
t∈ T0
m ≥ 2q−1 + 2q−1 = 2 · 2q−1 = 2q . But this contradicts m < 2q . This contradiction shows that our
assumption was false. Qed.
Now, let us prove that Proposition 5.2.4 holds for n = m. Let T and T 0 be two
finite subsets of N such that m = ∑ 2t and m = ∑ 2t . We shall show that T = T 0 .
t∈ T t∈ T 0
If m = 0, then this is easy to prove136 .
Thus, for the rest of this proof, we WLOG
assume that m 6= 0.
If we had T = ∅, then we would have ∑ 2t = ∑ 2t = (empty sum) = 0, which
t∈ T t ∈∅
would contradict ∑ 2t = m 6= 0. Hence, we cannot have T = ∅. Thus, the set
t∈ T
T is nonempty. Hence, T is a nonempty finite set of integers. Therefore, Theorem
5.1.1 (applied to S = T) shows that T has a minimum and a maximum. Thus, in
particular, T has a maximum. Similarly, T 0 has a maximum. Consider these two
maxima max T and max ( T 0 ).
We shall show that max T ≤ max ( T 0 ). Indeed, assume the contrary. Thus,
max T > max ( T 0 ). The number max T is an element of T (by the definition of a
maximum); therefore, 2max T is an addend of the sum ∑ 2t . Since all addends of
t∈ T
this sum are nonnegative integers, we thus conclude that
∑ 2t ≥ 2max T (255)
t∈ T
136 Proof. Assume that m = 0. Then, 0 = m = ∑ 2t . Hence, ∑ 2t = 0. In other words, the sum
t∈ T t∈ T
∑ 2t is 0. But all addends of the sum ∑ 2t are positive. Thus, if this sum was nonempty,
t∈ T t∈ T
then it would be positive (because a nonempty sum of positive reals is positive), which would
contradict the fact that this sum is 0. Hence, this sum must be empty. In other words, T = ∅.
The same argument (applied to T 0 instead of T) yields T 0 = ∅. Hence, T = ∅ = T 0 . Thus, we
have proved that T = T 0 under the assumption that m = 0.
m= ∑ 0 2t ≤ ∑ 2t = 20 + 21 + · · · + 2max T −1
t∈ T t∈{0,1,...,max T −1}
max T
=2 −1 (by (5), applied to n = max T )
max T
<2 .
This contradicts
m= ∑ 2t ≥ 2max T (by (255)) .
t∈ T
This contradiction shows that our assumption was wrong. Hence, max T ≤ max ( T 0 )
is proved. The same argument (with the roles of T and T 0 interchanged) yields
max ( T 0 ) ≤ max T. Combining these two inequalities, we obtain max T = max ( T 0 ).
Set g = max T; thus, g = max T ∈ T and g = max T = max ( T 0 ) ∈ T 0 .
Define an integer n ∈ N by n = ∑ 2t . Then,
t∈ T \{ g}
m= ∑ 2t = 2 g + ∑ 2t (since g ∈ T )
t∈ T t∈ T \{ g}
| {z }
=n
= 2g + n,
2 g + n = m = ∑ 2t = 2 g + ∑ 2t since g ∈ T 0 .
t∈ T 0 t∈ T 0 \{ g}
T = ( T \ { g}) ∪ { g} = T 0 \ { g} ∪ { g} = T 0 since g ∈ T 0 .
| {z }
= T 0 \{ g}
Forget that we fixed T and T 0 . We thus have shown that if T and T 0 are two
finite subsets of N such that m = ∑ 2t and m = ∑ 2t , then T = T 0 . In other
t∈ T t∈ T 0
words, Proposition 5.2.4 holds for n = m. This completes the induction step; thus,
Proposition 5.2.4 is proved.
Proof of Theorem 5.2.1. Proposition 5.2.3 shows that there exists a finite subset T of
N such that n = ∑ 2t . Proposition 5.2.4 then shows that such a T is unique.
t∈ T
Theorem 5.2.1 is thus proved.
The reader will have an opportunity to make a similar argument in Exercise 5.4.6
below.
138 Two sets U and V are said to intersect if and only if U ∩ V 6= ∅. Note that two intervals [ a, b] and
[b, c] always intersect, even though the intersection is a singleton set.
Solution to Exercise 5.2.2. Write each interval Im as [ am , bm ] for two reals am and bm .
Let
Iv = [ av , bv ]). This shows that u, p and v are distinct (since otherwise, two of the
three intervals Iu , I p , Iv would be equal, and thus would intersect140 ).
But we assumed that for any three distinct elements i, j, k ∈ {1, 2, . . . , n}, at least
two of the three intervals Ii , Ij , Ik intersect. Applying this to i = u, j = p and
k = v, we conclude that at least two of the three intervals Iu , I p , Iv intersect. But
this contradicts the fact that no two of the three intervals Iu , I p , Iv intersect. This
contradiction shows that our assumption was false. Hence, we have shown that
each of the intervals I1 , I2 , . . . , In contains at least one of a and b. This solves Exercise
5.2.2.
Does this mean we have solved Exercise 5.2.1? It looks like it does, but there is a
minor wrinkle. Exercise 5.2.1 does not just claim that there exist two moments such
that each student is present in the classroom at least at one of them. It also claims
that the lecturer can pick these two moments. This is a slightly stronger claim, as
the lecturer might not know in advance when the students will enter or leave the
classroom until they have done so (and by then, it might be too late to make the
announcements). Thus, the lecturer needs to work with incomplete information (or
at least Exercise 5.2.1 allows for such an interpretation).
To some extent, our solution to Exercise 5.2.2 above works even with this in-
complete information. Indeed, the numbers a and b we defined can be computed
“on the fly” if the lecturer knows how many students she has (i.e., the number n)
and pays attention to their comings and goings. The number a is the moment at
which the last student enters the classroom (so the head count is complete), and
the number b is the moment at which the first student leaves the classroom. At
both of these moments, the lecturer (if she keeps a head count and pays attention
to students leaving) can immediately make the announcement.
But what if the lecturer does not know n? Without knowing how many students
there are in total, how to tell when the last one has entered? The way Exercise 5.2.1
is stated, it is not clear whether this is a situation to be considered141 , but we can
choose to do so anyway. Can the lecturer find a and b independently of the number
of students? Yes – but this needs a different choice of a and b. See Exercise 5.4.7
below for this. See also Exercise 5.4.8 for a generalization of Exercise 5.2.2.
140 since
these intervals are nonempty
141 Theoriginal wording in [Grinbe08, Exercise 3.11] uses n = 100, so this situation needs not be
addressed.
142 Theword “segment” mens “line segment”. Two sets U and V are said to intersect if and only if
U ∩ V 6= ∅. Thus, two line segments intersect even if they just have an endpoint in common (or
an endpoint of one lies on the other).
F1 W1
W2 W3
(Looks familiar?) There are six bijections σ : [n] → [n]; let us draw the n segments
F1 Wσ(1) , F2 Wσ(2) , . . . , Fn Wσ(n) for each of them:
F2 F3 F2 F3
F1 W1 F1 W1
W2 W3 W2 W3
F2 F3 F2 F3
F1 W1 F1 W1
W2 W3 W2 W3
F2 F3 F2 F3
F1 W1 F1 W1
W2 W3 W2 W3
The third bijection (i.e., the first one in the second row of the table) has
the property required in the problem (viz., that no two of the n segments
F1 Wσ(1) , F2 Wσ(2) , . . . , Fn Wσ(n) intersect).
Solution to Exercise 5.2.3 (sketched). For any bijection σ : [n] → [n], we define the
road length r (σ) by
(Visually speaking, this is the total length of road that needs to be paved if we
choose to connect the farms F1 , F2 , . . . , Fn to the wells Wσ(1) , Wσ(2) , . . . , Wσ(n) , re-
spectively.)
The set {bijections σ : [n] → [n]} is clearly nonempty and finite143 . Thus, the set
{r (σ) | σ : [n] → [n] is a bijection} also is nonempty and finite. Hence, this set
has a minimum element144 . In other words, there exists a bijection σ : [n] → [n] for
which r (σ) is minimum (among all such bijections). Consider this σ. (If there are
several σ that all give the same minimum value of r (σ), then we just pick any of
them.) Note that any bijection σ0 : [n] → [n] satisfies
r (σ) ≤ r σ0
(256)
(since σ was chosen in such a way that r (σ ) is minimum). (Intuitively, the bijection
σ is an assignment of wells to farms that minimizes the total road length.)
We shall now show that no two of the n segments F1 Wσ(1) , F2 Wσ(2) , . . . , Fn Wσ(n)
intersect. Indeed, assume the contrary. Thus, there exist two distinct elements
i, j ∈ [n] such that the two segments Fi Wσ(i) and Fj Wσ( j) intersect. Consider these
i, j. The segments Fi Wσ(i) and Fj Wσ( j) intersect. The situation is illustrated in the
following picture (which also suggests the next step):
Wσ( j)
Fi
Wσ(i)
Fj
.
are distinct). Also, from σ (i ) 6= σ ( j), we obtain Wσ(i) 6= Wσ( j) (since the n points
W1 , W2 , . . . , Wn are distinct).
Now, we claim that
This appears rather obvious from a look at the above picture, but a rigorous proof
takes some work. We thus outsource this work into a lemma (Lemma 5.2.6 below).
The inequality (257) follows from Lemma 5.2.6, applied to X = Fi , Y = Wσ(i) ,
Z = Fj and W = Wσ( j) (since Fi 6= Fj and Wσ(i) 6= Wσ( j) , and since the points
X, Z, Y, W are not collinear, and since the segments Fi Wσ(i) and Fj Wσ( j) intersect).
Now, what do we gain from the inequality (257)? Intuitively, it is telling us that
if we replace the roads Fi Wσ(i) and Fj Wσ( j) by Fi Wσ( j) and Fj Wσ(i) (that is, if we
reconnect the wells Wσ(i) and Wσ( j) , which we originally connected to the farms Fj
and Fi , to the farms Fj and Fi instead), then the total road length decreases. This
observation is helpful, since it contradicts the fact that our original road connections
were chosen to minimize the road length. So let us formalize this: We define a new
map σ0 : [n] → [n] by setting
σ (k ) , if k 6= i and k 6= j;
0
σ (k ) = σ ( j) , if k = i; for each k ∈ [n] .
σ (i ) , if k = j
That is, the map σ0 is obtained from σ by swapping the values at i and j. It is clear
that this map σ0 is a bijection (since σ was a bijection, and we obtained σ0 from σ
by swapping two values). Consequently, (256) yields r (σ ) ≤ r (σ0 ). However, the
definition of r (σ ) yields
(here we have split off the addends for k = i and for k = j from the sum). The same
r σ0 = ∑
Fi Wσ0 (i) + Fj Wσ0 ( j) + Fk Wσ0 (k)
| {z } | {z } k∈[n]; | {z }
=| Fi Wσ( j) | =| Fj Wσ(i) | k6=i and k6= j =| Fk Wσ(k) |
(since σ0 (i )=σ( j)) (since σ0 ( j)=σ (i )) (since σ0 (k)=σ(k)
(because k6=i and k6= j))
This contradicts r (σ ) ≤ r (σ0 ). This contradiction shows that our assumption was
wrong. Hence, no two of the n segments F1 Wσ(1) , F2 Wσ(2) , . . . , Fn Wσ(n) intersect.
Thus, Exercise 5.2.3 is solved, except that we still owe a proof of the following
lemma:
Lemma 5.2.6. Let X, Y, Z, W be four points in the plane. Assume that X 6= Z and
Y 6= W. Assume furthermore that
| XW | + | ZY | < | XY | + | ZW | .
Proof of Lemma 5.2.6. The segments XY and ZW intersect, i.e., have some point Q
in common. Consider this point Q. We illustrate this situation with a picture, albeit
we don’t harbor any illusions about its generality:
X Q
Y
Z .
Recall the triangle inequality, which says that any triangle ABC satisfies | AC | <
| AB| + | BC |. This inequality holds even when the triangle ABC is degenerate (i.e.,
when the three points A, B, C are collinear), as long as we replace the “<” sign by
a “≤” sign. In other words, any three points A, B, C in the plane satisfy
| AC | ≤ | AB| + | BC | . (260)
Applying this to A = X, B = Q and C = W, we obtain
| XW | ≤ | XQ| + | QW | . (261)
The same argument (applied to Z and Y instead of X and W) yields
| ZY | ≤ | ZQ| + | QY | . (262)
However, the point Q lies on the segment XY, and thus satisfies | XQ| + | QY | =
| XY |. The same argument (applied to Z and W instead of X and Y) yields | ZQ| +
| QW | = | ZW |.
Now, adding the two inequalities (261) and (262) together, we find
| XW | + | ZY | ≤ (| XQ| + | QW |) + (| ZQ| + | QY |)
= | XQ| + | QY | + | ZQ| + | QW |
| {z } | {z }
=| XY | =| ZW |
= | XY | + | ZW | . (263)
This is almost the inequality | XW | + | ZY | < | XY | + | ZW | that we need to prove.
But only “almost”. In fact, the inequality in (263) has a “≤” sign, while we want to
prove the same inequality with a “<” sign. In other words, we want to prove that
the inequality (263) cannot be an equality.
We assume the contrary. That is, we assume that the inequality (263) is an equal-
ity. Thus, we have
| XW | + | ZY | = | XY | + | ZW |
= (| XQ| + | QW |) + (| ZQ| + | QY |) (264)
(since we have previously shown that (| XQ| + | QW |) + (| ZQ| + | QY |) = | XY | +
| ZW |).
We notice the following basic fact: If a, b, c, d are four real numbers satisfying
a ≤ b and c ≤ d and a + c = b + d, then a = b and c = d 145 . We can apply this to
a = | XW | and b = | XQ| + | QW | and c = | ZY | and d = | ZQ| + | QY | (because the
three relations (261), (262) and (264) are saying precisely that these four numbers
a, b, c, d satisfy a ≤ b and c ≤ d and a + c = b + d). As a result, we conclude that
| XW | = | XQ| + | QW | (265)
145 Proof.
Let a, b, c, d be four real numbers satisfying a ≤ b and c ≤ d and a + c = b + d. Then,
a +c ≤ b + c and b + |{z}
b + d = |{z} c ≤ b + d. Combining these two inequalities, we find
≤b ≤d
b + d = b + c. Hence, d = c, so that c = d. Now, a + c = b + |{z}
d = b + c, so that a = b. Hence,
=c
we have proved that a = b and c = d, qed.
and
| ZY | = | ZQ| + | QY | . (266)
Now, we recall the triangle inequality in its original form. It says that if three
points A, B, C form a nondegenerate triangle (i.e., are not collinear), then | AC | <
| AB| + | BC |. Hence, the contrapositive holds: If three points A, B, C satisfy | AC | =
| AB| + | BC |, then they are collinear. A bit of thought reveals an even stronger
conclusion: If three points A, B, C satisfy | AC | = | AB| + | BC |, then B lies on the
segment AC. Applying this to A = X, B = Q and C = W, we conclude that Q lies
on the segment XW (since we have | XW | = | XQ| + | QW |). The same argument (ap-
plied to Z and Y instead of X and W) yields that Q lies on the segment ZY. Hence,
in total, we know that the point Q lies on the four segments XY, XW, ZY, ZW.
It is now tempting to conclude right away that this forces all four points X, Z, Y, W
are collinear. In truth, this is not totally obvious yet, since some of the segments
XY, XW, ZY, ZW may be degenerate, or the point Q might be an endpoint of some
of them. Thus, we proceed more cautiously.
We claim that we have Q = X or Q = Y. Indeed, assume the contrary. Thus,
Q 6= X and Q 6= Y. Thus, the lines QX and QY are well-defined. These two lines
QX and QY are furthermore equal (since Q lies on the segment XY), so we can
call them the “line QXY”. This line QXY contains the points X and Y, thus also
the point W (since Q lies on the segment XW) and the point Z (since Q lies on the
segment ZY); thus, it contains all four points X, Z, Y, W. Hence, these four points
X, Z, Y, W are collinear. But this contradicts (259). This contradiction shows that
our assumption was false.
Hence, we have shown that Q = X or Q = Y. Similarly, we can see that Q = Z
or Q = W. Hence, we are in one of the following two cases:
Case 1: We have Q = Z.
Case 2: We have Q = W.
Let us first consider Case 1. In this case, we have Q = Z. Hence, Q = Z 6= X
(since X 6= Z). But recall that we have Q = X or Q = Y. Hence, we must have
Q = Y (since Q 6= X). But Q lies on the segment XW. In other words, Z and
Y lie on the segment XW (since Q = Z and Q = Y). This shows that the four
points X, Z, Y, W are collinear. But this contradicts (259). Thus, we have found a
contradiction in Case 1.
Let us next consider Case 2. In this case, we have Q = W. Hence, Q = W 6= Y
(since Y 6= W). But recall that we have Q = X or Q = Y. Hence, we must have
Q = X (since Q 6= Y). But Q lies on the segment ZY. In other words, W and
X lie on the segment ZY (since Q = W and Q = X). This shows that the four
points X, Z, Y, W are collinear. But this contradicts (259). Thus, we have found a
contradiction in Case 2.
We have now found a contradiction in each of the Cases 1 and 2. Hence, we
always obtain a contradiction. Thus, our assumption was wrong. This means
we have shown that the inequality (263) cannot be an equality. Hence, the “≤”
sign in this inequality can be replaced by a “<” sign. In other words, we have
| XW | + | ZY | < | XY | + | ZW |. This proves Lemma 5.2.6.
Exercise 5.2.4. Let n be a positive integer. Consider a circular track with n gas
stations on it. Consider a car. Assume that, taken together, the n gas stations
have just enough gas for the car to complete the entire track. Prove that at least
one of these n gas stations has the property that if the car starts at this gas station
with an initially empty gas tank, then it can traverse the entire track without ever
running out of gas, provided that it refuels at every gas station it comes across
(including the one at which it starts).
(It is understood that the car’s tank is large enough to fit all the gas it can get.
It is also understood that the track is one-way, so the car can only move in one
direction. It is also understood that the use of gas is proportional to the length
of road covered – i.e., independent of speed and acceleration.)
E
0.3
(0.1)
0.2
D (0.2) (0.2) A
0.1 0.1
(0.4) (0.1)
C B
0.3
Here, the 5 gas stations are called A, B, C, D, E; the amount of gas available from
each gas station is written in parentheses beside the station; and the length of
road between two consecutive gas stations is written on the corresponding piece
of track. The measures of gas and road length are normalized in such a way that
the total length of the track is 1, and the total amount of gas in all stations is 1.
We understand that the car can only go clockwise around the track.
In this example, we see that if a car with an empty tank were to start at A,
then it would not be able to traverse the entire track. Indeed, it would first refuel
at A; this would put 0.2 units of gas in its tank; it would then use 0.1 units of
gas to get to B; then it would refuel at B; then it would have 0.2 − 0.1 + 0.1 = 0.2
units of gas in its tank; but it would then run out of gas between B and C.
On the other hand, if a car with an empty tank were to start at C, then it would
be able to traverse the entire track; here is a plot of the gas in its tank over the
entire journey:
C D E A B C
(with the horizontal axis standing for road length covered, while the vertical axis
stands for the gas in the car’s tank). (The labels C, D, E, A, B, C at the bottom
mark the points at which the car is at a gas station.) Note that this is a “sawtooth
function” plot, in which the vertical segments correspond to refuelling and the
downward slopes correspond to gas being burned along the road.
Solution to Exercise 5.2.4 (sketched). Imagine a new car that starts somewhere on the
track with enough gas to go through the entire track. We call this the ghost car.
Now, let the ghost car go around the track146 , refueling at each gas station (even
though it does not actually need this extra gas).
For example, in Example 5.2.7, if the ghost car starts at gas station A, then here
146 We assume that the ghost car uses gas at the same rate as the original car.
A B C D E A
.
Clearly, the ghost car never runs out of gas (since it had enough even before re-
fuelling); but there will be a point in its journey where its gas level is minimum.
More precisely, there will be a gas station at which the ghost car’s gas level (before
refuelling) is minimum; let us pick such a gas station and call it P. Thus, the ghost
car’s gas level at P is ≤ to its gas level at any other gas station, and thus also ≤ to
its gas level at any point on the road (because its gas level only declines between
gas stations). In the example above, P = C.
After the ghost car has completed its loop around the track, it is back at the same
station it started, and with the same amount of gas in its tank (since the total gas
it has spent during the loop was precisely the amount it collected from the gas
stations). At that point, we refill all gas stations (with the same amount of gas that
they initially had) and we let the ghost car keep going around the circle (again
collecting gas at the stations). Thus, the ghost car makes another loop. This second
loop is an exact repetition of its previous loop (i.e., at each point, the ghost car has
the same gas level on its second loop as it did on its first loop), because the ghost
car started with the same gas level as initially and the gas stations had the same
amount of gas as initially. Thus, if we plot the gas level in the car, the part of the
plot that corresponds to the second loop is just a horizontally shifted copy of the
A B C D E A B C D E A
.
Thus, the minimum gas level (over both loops of the ghost car) is still achieved at
station P. In other words, the ghost car never has less gas in its tank than it does at
station P (before refuelling).
Now, let us start our original car (not the ghost car) from station P. We claim that
it will complete the entire track without running out of gas. Indeed, the following
picture shows (again in our above example) both the gas level of the ghost car (in
grey) and the gas level of the original car (in blue):
A B C D E A B C D E A
.
We see that the gas level plot of the original car is just a copy of a piece of the
gas level plot of the ghost car, shifted downwards so it starts on the horizontal
axis. Indeed, the original car makes the same journey as the ghost car from P to P,
except that the original car starts with an empty tank whereas the ghost car starts
with some gas.
But recall that the ghost car never has less gas in its tank than it does at station
P. In other words, the gas level plot of the ghost car never goes below the level
at station P. Therefore, the gas level plot of the original car never goes below the
horizontal axis147 . In other words, the original car (on its journey from P to P)
never runs out of gas. This is precisely what we wanted to show. Thus, Exercise
5.2.4 is solved.
147 sincethe gas level plot of the original car is just a copy of a piece of the gas level plot of the ghost
car, shifted downwards so it starts on the horizontal axis
At high noon, each cowboy shoots his nearest neighbor, provided that he has
a unique nearest neighbor. (If his nearest neighbor does not exist148 or is not
unique, then he shoots no one.)
Prove that at least one cowboy does not get shot.
B
F E G
B
F E G
(where an arrow from I to J means that I shoots J). (Note that cowboy E shoots
no one, since he has two nearest neighbors F and G.) Thus, cowboys C, D, F and
G do not get shot.
that he has a unique nearest neighbor. We must prove that at least one cowboy
does not get shot.
Indeed, if m = 1, then there is only one cowboy, and he has no nearest neighbor
and thus does not shoot anyone. Thus, if m = 1, then the lone cowboy does not
got shot. Hence, we are done if m = 1. Thus, for the rest of this proof, we WLOG
assume that m 6= 1. Hence, m > 1 (since m ≥ 1), and thus m ≥ 3 (since m is odd).
Consequently, m − 2 ≥ 1. Also, the integer m − 2 is odd (since m is odd).
Moreover, m ≥ 3 ≥ 2. Thus, there exists at least one pair ( A, B) of two distinct
cowboys A and B. Let us pick a pair ( A, B) of two distinct cowboys A and B with
minimum distance | AB|. Then, B is a nearest neighbor of A, so that A shoots either
B or no one (depending on whether B is the only nearest neighbor of A). Likewise,
B shoots either A or no one.
Now, let us consider the m − 2 cowboys distinct from A and B. We call these
m − 2 cowboys lucky (because they might get to live a bit longer than A and B).
The two cowboys A and B do not shoot any lucky cowboy (since A shoots either B
or no one, and since B shoots either A or no one).
Now, we know that m − 2 ≥ 1 is an odd integer satisfying m − 2 < m. Hence,
our induction hypothesis yields that Exercise 5.2.5 holds for n = m − 2. Therefore,
we can apply Exercise 5.2.5 to the m − 2 lucky cowboys. We thus conclude that if
the two cowboys A and B did not exist (i.e., if the only cowboys around were the
lucky ones), then at least one lucky cowboy would not get shot. In other words, if
the two cowboys A and B did not exist, then there would be a lucky cowboy C that
would not get shot. Consider this C.
Now, we claim that C does not get shot even in our original setup (i.e., even when
A and B do exist). Indeed, assume the contrary. Thus, there is a cowboy D that
shoots C. Then, D must be a lucky cowboy (since A and B do not shoot any lucky
cowboy, and hence do not shoot C), and C must be his unique nearest neighbor
(since any cowboy shoots his unique nearest neighbor). But this entails that D
would shoot C even if A and B did not exist (because its unique nearest neighbor
would not change when the two unrelated cowboys A and B are removed, unless
this neighbor was one of A and B); but this is impossible, since we know that C
would not get shot if A and B did not exist. This contradiction shows that our
assumption was wrong.
Hence, we have showed that C does not get shot even in our original setup.
Therefore, at least one cowboy does not get shot.
We have thus proved that Exercise 5.2.5 holds for n = m. This completes the
induction step, so Exercise 5.2.5 is solved.
Another example of the Extremal Principle used in an induction is found in the
solution of Exercise 3.7.9.
Exercise 5.2.6. Let n be a positive integer. Consider three chess clubs, each of
which has n players. Assume that no two players in the same club have played
against each other, but each player has played against at least n + 1 other players.
Prove that there exist three players a, b and c that have mutually played against
each other (that is, a has played against b, and b has played against c, and c has
played against a).
a3 b3 c3
b2
a2 c2
a1 b1 c1
Here, the nodes are the players; the oval blobs are the three clubs; and the con-
necting lines show who has played against whom (viz., two players are con-
nected by a line segment if and only if they have played against each other). We
thus see that a2 , b3 and c3 have mutually played against each other.
Solution to Exercise 5.2.6. If a is any player, then we define the score of a to be the
maximum number of players from a single club that a has played against. (For
example, if A, B and C are the three clubs, and if a player a has played against 0
players from club A and against 6 players from club B and against 4 players from
club C, then the score of a is 6.)
It is easy to see that the score of any player is positive149 . (Actually, it is at least
n+1
, but we won’t need this.)
2
The three clubs have 3n players altogether. Among these 3n players, let a be the
player with maximum score. Let k be the score of a. Thus, a has played against k
players from some club (by the definition of a score). Let B be this club, and let A
be the club that contains a. It is clear that A 6= B 150 . Thus, A and B are two of
the three clubs. Let C be the remaining club.
Player a belongs to club A, and thus has played against no one from club A (since
no two players in the same club have played against each other). Furthermore,
player a has played against k players from club B. But we also know that player
a has played against at least n + 1 other players in total151 . Hence, we can easily
see that player a must have played against at least one player c from club C 152 .
Consider this c.
Recall that a is a player with maximum score. Since the score of a is k, this entails
that the maximum score of a player is k. Therefore, the score of c is at most k.
Thus, player c has played against at most k players from club A (because otherwise,
c would have played against more than k players from club A, and therefore the
score of c would be greater than k). Therefore, player c must have played against
at least n + 1 − k players from club B 153 .
Now, let X be the set of all players from club B that player a has played against.
Then, | X | = k (since a has played against k players from club B).
Also, let Z be the set of all players from club B that player c has played against.
Then, | Z | ≥ n + 1 − k (since player c must have played against at least n + 1 − k
150 Proof. Assume the contrary. Thus, A = B. Hence, B is the club that contains a (since A is the
club that contains a). Thus, a has played against no players from club B (since no two players in
the same club have played against each other). But we recall that player a has played against k
players from club B. Comparing the previous two sentences, we conclude that k = 0. However, k
is the score of A and therefore positive (since the score of any player is positive). This contradicts
k = 0. This contradiction shows that our assumption was wrong. Qed.
151 because each player has played against at least n + 1 other players
152 Proof. Assume the contrary. Thus, player a has played against no one from club C. We further
know that a has played against no one from club A. Recall hat player a has played against at
least n + 1 other players in total. All these at least n + 1 players must belong to club B (since
player a has played against no one from club C and against no one from club A). Thus, club B
must have at least n + 1 players. But this contradicts the fact that club B has only n players (since
any club has exactly n players). This contradiction shows that our assumption was wrong. Qed.
153 Proof. Assume the contrary. Thus, player c has played against fewer than n + 1 − k players from
(the number of players from club B that c has played against) < n + 1 − k.
Moreover, player c has played against at most k players from club A (as we have already seen);
in other words,
Finally, player c belongs to club C, and thus cannot have played against anyone from club C
(because no two players in the same club have played against each other). Hence,
Now, recall that each player has played against at least n + 1 other players. Hence, c has played
against at least n + 1 other players. In other words,
√
Exercise 5.3.1. Prove that / Q.
3∈
There are many simple ways to solve Exercise 5.3.1. In particular, Corollary
√ 3.5.13
could be used to obtain an easy contradiction from an assumption of 3 ∈ Q.
However, let us forget for a moment about Corollary 3.5.13, and discover a more
complicated solution to Exercise 5.3.1 that illustrates how infinite descent works.
√
Discussion of Exercise 5.3.1. Assume the contrary. Thus, 3 ∈ Q. In √ other words,
there exists a pair ( a, b) of integers a and b satisfying b 6= 0 and 3 = a/b. We
shall call such a pair a solution.154 Thus, by our assumption, there exists a solution.
a and b are integers satisfying b 6= 0 and
√ Consider any solution ( a, b). Thus,
√
3 = a/b. Squaring the equality 3 = a/b, we obtain 3 = ( a/b)2 = a2 /b2 , so that
a2 = 3b2 .
Now, let us analyze the parity of b (that is, whether b is even or odd). Assume
first that b is odd. Hence, Exercise 3.3.3 (b) (applied to u = b) yields b2 ≡ 1 mod 4.
Hence, a2 = 3 |{z} b2 ≡ 3 · 1 = 3 mod 4. But if a was odd, then we would have
≡1 mod 4
a2 ≡ 1 mod 4 (by Exercise 3.3.3 (b), applied to u = a), which would entail 1 ≡ a2 ≡
3 mod 4, which would in turn contradict 1 6≡ 3 mod 4. Hence, a cannot be odd.
Thus, a is even. Hence, a2 ≡ 0 mod 4 (by Exercise 3.3.3 (a), applied to u = a), so
that 0 ≡ a2 ≡ 3 mod 4, which contradicts 0 6≡ 3 mod 4. This contradiction shows
that our assumption (that b is odd) was false. Hence, b is not odd. In other words,
b is even.
Hence, b2 ≡ 0 mod 4 (by Exercise 3.3.3 (a), applied to u = b). If a was odd,
then we would have a2 ≡ 1 mod 4 (by Exercise 3.3.3 (b), applied to u = a), which
b2 ≡ 3 · 0 = 0 mod 4, which would in turn contradict
would entail 1 ≡ a2 = 3 |{z}
≡0 mod 4
1 6≡ 0 mod 4. Thus, a cannot be odd. Hence, a must be even.
We have now shown that both a and b are even. In √ other words, a/2 and b/2
are integers. Furthermore,√ b/2 6 = 0 (since b 6 = 0) and 3 = ( a/2) / (b/2) (since
( a/2) / (b/2) = a/b = 3). Therefore, the pair ( a/2, b/2) is a solution again (by
the definition of a “solution”).
Let us see what we have achieved. We have not obtained the contradiction that
we were hoping for. However, proceeding from our original (assumed) solution
( a, b), we have found a new solution ( a/2, b/2). This new solution is “smaller”
than ( a, b) in various regards: For example, |b/2| < |b| (since b 6= 0). Let us define
the weight of a solution ( a, b) to be the nonnegative integer |b|. Thus, the new
solution ( a/2, b/2) has smaller weight than ( a, b) (since b 6= 0 and thus |b/2| < |b|).
Hence, we have proved the following observation:
Observation 1: If ( a, b) is any solution, then there exists a solution of
smaller weight than ( a, b).
154 The word “solution” here has been chosen in analogy to “solution of an equation”, not to “solu-
tion of a problem”. In particular, Exercise 5.3.1 will be solved once we have shown that there is
no solution.
It turns out that this observation is almost as good as a contradiction. Here are
three ways to complete the solution of Exercise 5.3.1 using Observation 1:
• First way: We have assumed that there exists a solution. Consider such a
solution, and call it ( a0 , b0 ).
Observation 1 (applied to ( a, b) = ( a0 , b0 )) thus yields that there exists a
solution of smaller weight than ( a0 , b0 ). Consider such a solution, and call
it ( a1 , b1 ).
Observation 1 (applied to ( a, b) = ( a1 , b1 )) thus yields that there exists a
solution of smaller weight than ( a1 , b1 ). Consider such a solution, and call
it ( a2 , b2 ).
Clearly, this argument (in which we apply Observation 1 to construct a new
solution from an old one) can be applied over and over. Thus, we obtain an
infinite sequence of solutions ( a0 , b0 ) , ( a1 , b1 ) , ( a2 , b2 ) , . . ., each of which has
smaller weight than the previous one. Thus, the weights of these solutions
form an infinite strictly decreasing sequence. In other words, if we denote
the weight of the solution ( ai , bi ) by wi , then the sequence (w0 , w1 , w2 , . . .) is
strictly decreasing.
However, the weight of a solution is a nonnegative integer. Thus, w0 , w1 , w2 , . . .
are nonnegative integers; therefore, (w0 , w1 , w2 , . . .) is a strictly decreasing se-
quence of nonnegative integers. But there is no strictly decreasing sequence
of nonnegative integers (in fact, if (k0 , k1 , k2 , . . .) is any strictly decreasing se-
quence of integers, then it is easy to see that k i will be negative for any i > k0 ).
The preceding two sentences contradict each other; thus we have found the
contradiction we wanted.
• Third way: Finally, we can also finish our argument by induction. Namely, we
use strong induction to prove the following claim: For each n ∈ N,
Thus, we have finished the solution of Exercise 5.3.1 in three different ways. It is
fairly clear that these three ways formalize the same intuition: that a nonnegative
integer cannot keep getting decreased indefinitely (without eventually falling be-
low 0), and therefore a method to decrease the weight of a solution (no matter how
small it originally was) gives a guarantee that no solutions can exist. This principle
is known as the principle of Infinite Descent, and is often ascribed to Fermat even
though it was known to the ancient Greeks. Note that our arguments (in all three
ways) crucially rely on the fact that the weight of a solution was a nonnegative in-
teger. If it was merely an integer or a nonnegative rational number, then we could
not conclude much from Observation 1, since an infinite sequence of integers (or
of nonnegative rational numbers) could decrease indefinitely.
Here is a more sophisticated example for the Infinite Descent technique (Putnam
1973 problem B1):
a1 = 1, a2 = 2, a3 = 3, a4 = 4, a5 = 5.
Then, the splitting property holds for removing a1 : Indeed, after removing a1 ,
we can split the remaining four numbers a2 , a3 , a4 , a5 into the two equinumerous
heaps a2 , a5 and a3 , a4 with equal sums (a2 + a5 = a3 + a4 ). Likewise, the splitting
property holds for removing a3 (since a1 + a5 = a2 + a4 ) and for removing a5
(since a1 + a4 = a2 + a3 ), but not for removing a2 or a4 .
a solution (indeed, subtracting b from all 2n + 1 numbers does not invalidate the
splitting property157 ) and still non-flat (since a1 − b = a2 − b = · · · = a2n+1 − b
would imply a1 = a2 = · · · = a2n+1 , which would contradict the assumption that
( a1 , a2 , . . . , a2n+1 ) is non-flat). Thus, this (2n + 1)-tuple ( a1 − b, a2 − b, . . . , a2n+1 − b)
is a nonnegative non-flat solution. Hence, there exists a nonnegative non-flat solu-
tion. This proves Observation 1.]
Thanks to Observation 1, we don’t need to bother with negative integers if we
don’t want to. This will come useful later.
Next, let us study the parity of the integers in a solution:
Hence,
Thus, a1 , a2 , . . . , a2n+1 all have the same parity. This proves Observation 2.]
Now, Observation 2 helps us transform non-flat solutions into smaller non-flat
solutions with an appropriate meaning of “smaller”. To be more precise, we con-
sider nonnegative solutions. If ( a1 , a2 , . . . , a2n+1 ) is a nonnegative solution, then the
weight of this solution is defined to be the nonnegative integer a1 + a2 + · · · + a2n+1 .
Now we claim:
It is easy to check that (in either case) (b1 , b2 , . . . , b2n+1 ) is a nonnegative non-flat
solution with smaller weight than ( a1 , a2 , . . . , a2n+1 ). 158 Thus, there exists a non-
negative non-flat solution with smaller weight than ( a1 , a2 , . . . , a2n+1 ). This proves
Observation 3.]
Now, all we need is to reap our rewards. By the Principle of Infinite Descent,
Observation 3 entails that there exists no nonnegative non-flat solution. Hence, by
Observation 1, we conclude that there exists no non-flat solution either. In other
words, any solution is flat. Exercise 5.3.2 is solved.
There are some variants of this solution; in particular, it is possible to avoid
Observation 1, at the expense of a more complicated notion of weight159 and a
more complicated proof of (the analogue of) Observation 3.
Can we replace the “integers” in Exercise 5.3.2 by some more general types of
numbers? Let’s first try rational numbers:
158 Note that the weight of (b1 , b2 , . . . , b2n+1 ) is indeed smaller (and not just smaller-or-equal) than
the weight of ( a1 , a2 , . . . , a2n+1 ), because a1 , a2 , . . . , a2n+1 cannot all be 0 (since ( a1 , a2 , . . . , a2n+1 )
is non-flat).
159 Indeed, the way we defined the weight of a solution ( a , a , . . . , a
1 2 2n+1 ), it would not be nonnega-
tive in general if we don’t require ( a1 , a2 , . . . , a2n+1 ) to be nonnegative. Thus, we would have to
fix this – e.g., by redefining this weight as | a1 | + | a2 | + · · · + | a2n+1 | instead.
( a + 1) n
Exercise 5.4.1. Let n ∈ N and a ∈ N. Prove that an + 1 | .
n
In the following exercise, we shall consider polynomials in a single variable x.
The coefficients of these polynomials can be any kinds of numbers (rational, real
or complex). Recall that a polynomial has degree ≤ m (for some integer m) if and
m
only if it can be written as a sum ∑ ci xi with some constants c0 , c1 , . . . , cm . If m < 0,
i =0
then the only polynomial that has degree ≤ m is the zero polynomial 0 (since the
m
sum ∑ ci xi is an empty sum when m < 0).
i =0
If P = P ( x ) is a polynomial, then ∆P shall denote the polynomial defined by
(∆P) ( x ) = P ( x ) − P ( x − 1) .
For example, if P ( x ) = x3 , then (∆P) ( x ) = P ( x ) − P ( x − 1) = x3 − ( x − 1)3 =
3x2 − 3x + 1.
If P is a polynomial, and if n ∈ N, then ∆n P shall denote the polynomial
∆ (∆ (· · · (∆P) · · · )) with n copies of ∆ in front of the P. (Formally speaking, this
means that ∆n P is defined recursively by setting ∆0 P = P and ∆n P = ∆ ∆n−1 P
for each n ≥ 1.)
Exercise 5.4.2. Let m ∈ Z. Let P be a polynomial in a single variable x. Assume
that P has degree ≤ m. Prove the following:
(a) The polynomial ∆P has degree ≤ m − 1.
(b) The polynomial ∆n P has degree ≤ m − n for each n ∈ N.
(c) For each n ∈ N, we have
n
k n
(∆ P) ( x ) = ∑ (−1)
n
P ( x − k) .
k =0
k
a0 = s, and
an = an−1 (qan−1 + 2) for each integer n ≥ 1.
a1 = 1, a2 = 1, a3 = 3, and
a2n−1 − a2n−2
an = for each integer n ≥ 4.
a n −3
The next exercise is a “Fibonacci analogue” of Theorem 5.2.1; it uses the notion
of a lacunar subset (defined in Definition 2.3.3).
Exercise 5.4.6. Let n ∈ N. Let N2 denote the set {2, 3, 4, . . .}. Prove that there is
a unique lacunar finite subset T of N2 such that n = ∑ f t .
t∈ T
(For example, 28 = f 3 + f 5 + f 8 = ∑ f t .)
t∈{3,5,8}
Exercise 5.4.7. Solve Exercise 5.2.1 if n is not known to the lecturer. That is, find
a way to construct the moments a and b in Exercise 5.2.1 in such a way that the
lecturer will know that these moments have arrived the very time they arrive
(rather than only in hindsight).
Theorem 6.1.1. Let U and V be two finite sets such that |U | > |V |. Let f : U → V
be any map. Then, f cannot be injective.
In terms of pigeons and pigeonholes, this is saying that any injective distribution
of pigeons into pigeonholes (where “injective” means “no two pigeons sharing a
hole”) requires at least as many pigeonholes as pigeons.
Most of the time, the words “pigeonhole principle” refer to one of Theorems 6.1.1
and 6.1.2. The next theorems in this section are closely related but less commonly
used.
160 The variant name “box principle” likewise results from stating the principle in terms of pearls
and boxes (instead of pigeons and pigeonholes).
161 We will give proofs of these theorems (or references to such proofs) later.
The “equality case” of Theorem 6.1.2 is also interesting: If we have equally many
pigeons and pigeonholes, then any injective distribution of pigeons into pigeon-
holes must be surjective as well (i.e., each pigeonhole is inhabited), and thus must
be bijective. Let us state this formally, too:
A few words about the proofs: Theorem 6.1.3 follows immediately from [Grinbe15,
Lemma 1.5]. Theorem 6.1.1 is an easy consequence of [Grinbe15, Lemma 1.5] as well162 .
Theorem 6.1.2 is just the contrapositive of Theorem 6.1.1. All three theorems are basic facts
about finite sets and can be used without proof on any contest.
A warning about infinite sets: Theorem 6.1.3 fails badly when U and V are
allowed to be infinite. For example, the map N → N, i 7→ i + 1 is injective, but not
bijective.163
For future use, let us restate Theorem 6.1.1 in more explicit terms:
162 Proof.Let U and V be two finite sets such that |U | > |V |. Let f : U → V be any map. Assume
that f is injective. Then, [Grinbe15, Lemma 1.5] yields the logical equivalence
( f is injective) ⇐⇒ ( f is bijective) .
Hence, f is bijective (since f is injective). Thus, f is a bijection. Hence, there exists a bijection
from U to V (namely, f ). This yields |U | = |V |, which contradicts |U | > |V |. This contradiction
shows that our assumption (that f is injective) was wrong. Hence, f cannot be injective. This
proves Theorem 6.1.1.
163 Compare “Hilbert’s Hotel” for various phenomena like this. (Hilbert seemed to prefer humans
Then, |U | ≤ k |V |.
= ∑ ∑ 1
v ∈V u∈U;
f (u)=v
| {z }
=(the number of all u∈U such that f (u)=v)·1
=(the number of all u∈U such that f (u)=v)
≤k
(by (268))
Theorem 6.1.7. Let U and V be two finite sets such that |U | < |V |. Let f : U → V
be any map. Then, f cannot be surjective.
In terms of pigeons and pigeonholes, this is saying that any surjective distribu-
tion of pigeons into pigeonholes (where “surjective” means “no hole stays empty”)
requires at least as many pigeons as pigeonholes.
Again, the “equality case” is interesting: If we have equally many pigeons and
pigeonholes, then any surjective distribution of pigeons into pigeonholes must be
injective as well (i.e., no two pigeons share a hole). In formal terms, this is saying
the following:
Theorem 6.1.9. Let U and V be two finite sets. Let f : U → V be a surjective
map. Assume that |U | = |V |. Then, f is bijective.
A few words about the proofs: Theorem 6.1.9 follows immediately from [Grinbe15,
Lemma 1.4]. Theorem 6.1.7 is an easy consequence of [Grinbe15, Lemma 1.4] as well164 .
Theorem 6.1.8 is just the contrapositive of Theorem 6.1.7. Again, these are basic results that
need no proof in real mathematics.
Again, Theorem 6.1.9 fails when U and V are allowed to be infinite. For example,
the map N → N, i 7→ i//2 is surjective, but not bijective.
6.2. Applications
6.2.1. Simple applications
There are many ways in which the pigeonhole principle (in its various forms) can
be used. Let us first collect some simple examples (before moving on to more
sophisticated ones):
164 Proof.Let U and V be two finite sets such that |U | < |V |. Let f : U → V be any map. Assume
that f is surjective. Then, [Grinbe15, Lemma 1.4] yields the logical equivalence
( f is surjective) ⇐⇒ ( f is bijective) .
Hence, f is bijective (since f is surjective). Thus, f is a bijection. Hence, there exists a bijection
from U to V (namely, f ). This yields |U | = |V |, which contradicts |U | < |V |. This contradiction
shows that our assumption (that f is surjective) was wrong. Hence, f cannot be surjective. This
proves Theorem 6.1.7.
• Among any 13 persons, there are two that are born in the same month.
This follows from Theorem 6.1.1 (applied to U = {the 13 persons} and V =
{the 12 months} and to f being the map that sends each person to their birth
month). Or, to say this in less formal terms: This follows from the pigeonhole
principle, where the “pigeons” are the 13 persons and the “pigeonholes” are
the 12 months.
• There are two people alive right now with the exact same number of hairs on
their heads.
Indeed, we can safely assume that any human has at most 5 000 000 hairs on
their head (in fact, the typical number of hairs on a human head is around
100 000), but the world population is far larger (over 7 billion). Thus, we can
apply Theorem 6.1.1 to U = {humans alive right now} and V = {0, 1, . . . , 5 000 000}
and to f being the map that sends each person to their number of hairs.
(Alternatively, it suffices to find two baldies.)
I have stolen this example from [Galvin20, Week 2], but in fact it is one of the
oldest examples of the Pigeonhole Principle; it appeared in a 1622 book by
Jean Leurechon (see [RitHee13]).
and then the pigeonhole principle (i.e., Theorem 6.1.1) will ensure that at least
one of these 25 squares will contain at least 2 mosquitoes.
• Consider a triangle ABC, and a straight line ` in its plane. Assume that `
contains none of the vertices A, B and C. Then, the line ` cannot cut more
than two sides of the triangle ABC.
Indeed, if ` cuts a segment XY without passing through either of its endpoints
X and Y, then the two points X and Y must lie on different sides165 of the line
`. But the line ` has only two sides, and therefore the pigeonhole principle
(i.e., Theorem 6.1.1) guarantees that at least two vertices of the triangle ABC
will lie on one side of `; therefore, the side connecting these two vertices
cannot be cut by `.
165 formally speaking: half-planes
• Among any 25 persons, there are three that are born in the same month.
This follows by applying Theorem 6.1.6 to k = 2 and U = {the 25 persons}
and V = {the 12 months}, because these two sets U and V satisfy |U | > 2 |V |.
• If n + 1 distinct numbers are selected from the set {1, 2, . . . , 2n} (for some
positive integer n), then some two of these n + 1 numbers sum to 2n + 1. 166
Indeed, define the “pigeons” to be our n + 1 selected numbers. Define the
“pigeonholes” to be the n two-element sets
(that is, the two-element sets {i, 2n + 1 − i } for all i ∈ {1, 2, . . . , n}). These n
two-element sets are disjoint and together cover the whole set {1, 2, . . . , 2n}.
Thus, each of our n + 1 selected numbers lies in precisely one of these n two-
element sets. In other words, each of our n + 1 “pigeons” lies in precisely
one “pigeonhole”. By the Pigeonhole Principle (Theorem 6.1.1), this entails
that two of our “pigeons” share a “pigeonhole” – i.e., that two of our n + 1
selected numbers lie in the same two-element set. Since the selected numbers
are distinct, this means that these two numbers must be the two elements of
the two-element set they lie in; therefore, they sum to 2n + 1.
• You have 10 pairs of shoes: 5 pairs of black shoes and 5 pairs of yellow shoes.
You pick k shoes at random. How high must k be so you can be sure that
among the shoes you pick, there will be at least one matching pair (i.e., one
left and one right shoe of the same color)?
The answer is that k must be at least 11. Indeed, k ≤ 10 is insufficient, since
picking k ≤ 10 shoes may leave you with k left shoes. On the other hand,
picking 11 shoes will suffice, because the Pigeonhole Principle (Theorem 6.1.5)
guarantees that among these 11 shoes there will be at least 6 of the same color,
and (by assumption) these 6 shoes cannot all be left or all be right (since there
are only 5 left shoes of each color, and only 5 right shoes of each color).
166 For
example, for n = 5, if we select the 6 numbers 1, 3, 4, 5, 7, 9 from the set {1, 2, . . . , 10}, then
some two of these 6 numbers (namely, 4 and 7) sum to 11.
More such examples can be found, e.g., in [Macgil17, Notes on the Pigeonhole
Principle].
We have also seen an application of the Pigeonhole Principle (specifically, of
Corollary 6.1.4) in the solution to Exercise 1.1.9. The third solution to Exercise 3.7.1
can also be viewed as a use of the Pigeonhole Principle (indeed, regard the elements
of the k-lacunar subset S as pigeons, and regard the q + 1 intervals I0 , I1 , . . . , Iq as
pigeonholes).
Here is another simple consequence of the pigeonhole principles:
Corollary 6.2.1. Let U and V be two finite sets such that |U | ≤ |V |. Let f : U → V
and g : V → U be two maps such that f ◦ g = idV . Then, the maps f and g are
mutually inverse.
Note that Corollary 6.2.1 fails if the condition |U | ≤ |V | is removed167 , and also
fails if U and V are allowed to be infinite168 .
Proof of Corollary 6.2.1. The assumption f ◦ g = idV shows that the map f is surjec-
tive169 . Hence, Theorem 6.1.8 shows that |U | ≥ |V |. Combining this with |U | ≤ |V |,
we obtain |U | = |V |. Thus, Theorem 6.1.9 yields that f is bijective. In other words,
f is invertible (since a map is bijective if and only if it is invertible). Hence, the
inverse map f −1 exists. Now, from f ◦ g = idV , we conclude that f −1 = g (because
comparing f −1 ◦ f ◦ g = idU ◦ g = g with f −1 ◦ f ◦ g = f −1 ◦ idV = f −1 results in
| {z } |{z}
=idU =idV
f −1 = g). Thus, the maps f and g are mutually inverse. This proves Corollary
6.2.1.
Note that, just as we have proved Corollary 6.2.1 using Theorems 6.1.8 and 6.1.9,
we can also prove Corollary 6.2.1 using Theorems 6.1.2 and 6.1.3 instead (by ap-
plying the latter theorems to V, U and g instead of U, V and f ). The details of this
alternative proof are left to the reader.
6.2.2. Handshakes
A slightly less obvious application of the pigeonhole principle is the following
exercise ([Grinbe08, Aufgabe 2.10] or [Engel98, Exercise 4.13]):
167 For example, if U = {0, 1, 2, 3} and V = {0, 1} and f (u) = u//2 and g (v) = 2v, then f ◦ g = idV ,
but the maps f and g are not mutually inverse.
168 For example, if U = N and V = N and f ( u ) = u//2 and g ( v ) = 2v, then f ◦ g = id , but the
V
maps f and g are not mutually inverse.
169 Proof. Let v ∈ V. Then, from f ◦ g = id , we obtain ( f ◦ g ) ( v ) = id ( v ), so that v = id ( v ) =
V V V
( f ◦ g) (v) = f ( g (v)). Hence, v is a value of the map f (namely, the value of f on g (v)).
Forget that we fixed v. We thus have shown that each v ∈ V is a value of the map f . In other
words, the map f is surjective.
E A
F
C
D B .
Here, A, B, C, D, E, F are the 6 scientists, and a line segment connects any pair of
scientists that has exchanged a handshake. Thus, scientist A has shaken 2 hands;
B has shaken 3 hands; C has shaken 5 hands; D has shaken 2 hands; etc.. Thus,
A and D have shaken the same number of hands.
Example 6.2.3. The two assumptions in Exercise 6.2.1 (that any pair shakes hands
at most once, and that no one shakes their own hands) are important. If a
scientist is allowed to shake hands with themselves, then a counterexample can
be obtained even for n = 2 (imagine two scientists, one of whom shakes their
own hands while the other doesn’t), independently of whether we count a “self-
handshake” as one or two hands being shaken. If a pair of scientists is allowed
to shake hands multiple times, then a counterexample can be found for n = 3
(imagine three scientists A, B and C, where A shakes hands with B once and
with C twice). The language of graph theory will later give us faster ways to
state such assumptions (in particular, we will be able to model the n scientists as
a loopless simple graph).
Solution to Exercise 6.2.1. Assume the contrary. Thus, any two distinct scientists
have shaken different numbers of hands.
Let U be the set of our n scientists. Let V be the set {0, 1, . . . , n − 1}. Thus, both
U and V are n-element sets; hence, |U | = |V |. From n ≥ 2, we obtain n − 1 6= 0
and 0 ∈ V and n − 1 ∈ V.
170 Forreaders from the future: Handshakes were a form of greeting popular until 2020. A hand-
shake involves two people, each of whom shakes exactly one hand of the other. Thus, when
person a shakes person b’s hands, person b also shakes person a’s hands.
The definition of f yields f (u1 ) = (u1 a) %b and f (u2 ) = (u2 a) %b. Hence,
(u2 a) %b = f (u2 ) = f (u1 ) = (u1 a) %b. But Proposition 3.3.4 (applied to u2 a, u1 a
and b instead of u, v and n) yields that u2 a ≡ u1 a mod b if and only if (u2 a) %b =
(u1 a) %b. Hence, we have u2 a ≡ u1 a mod b (since we have (u2 a) %b = (u1 a) %b).
Thus, au2 = u2 a ≡ u1 a = au1 mod b. Therefore, Lemma 3.5.11 (applied to u2 , u1
and b instead of b, c and n) yields u2 ≡ u1 mod b (since a ⊥ b). In other words,
b | u2 − u1 . Hence, Proposition 3.1.3 (b) (applied to b and u2 − u1 instead of a and
b) yields |b| ≤ |u2 − u1 | = u2 − u1 (since u2 − u1 > 0). Hence, u2 − u1 ≥ |b| = b
(since b > 0). This contradicts u2 − u1 < b.
This contradiction shows that our assumption was false. Hence, f (u1 ) 6= f (u2 )
is proved.
Now, forget that we fixed u1 and u2 . We thus have shown that f (u1 ) 6= f (u2 ) for
any two distinct elements u1 and u2 of U. In other words, the map f is injective.
This proves Claim 1.]
Claim 1 says that f is injective. Thus, Theorem 6.1.3 yields that f is bijective
(since |U | = |V |). Therefore, f is surjective. Hence, there exists some u ∈ U such
that f (u) = 1%b (since 1%b ∈ {0, 1, . . . , b − 1} = V). Consider this u. (Note that
1%b = 1 whenever b > 1; but I don’t want to make an exception for the case b = 1.)
The definition of f yields f (u) = (ua) %b. Hence, (ua) %b = f (u) = 1%b.
But Proposition 3.3.4 (applied to ua, 1 and b instead of u, v and n) yields that
ua ≡ 1 mod b if and only if (ua) %b = 1%b. Hence, we have ua ≡ 1 mod b (since
we have (ua) %b = 1%b). In other words, b | ua − 1. In other words, there exists
some integer v such that ua − 1 = bv. Consider this v. From ua − 1 = bv, we obtain
1 = ua − bv = ua − vb.
We have u ∈ U = {2, 3, . . . , b + 1}; thus, u is a positive integer. Furthermore, it
is easy to see that v is a positive integer172 . Thus, u and v are two positive integers
and satisfy 1 = ua − vb. Therefore, there exist positive integers x and y such that
1 = xa − yb (namely, x = u and y = v). This solves Exercise 6.2.2.
It is now easy to reduce Exercise 3.7.7 to Exercise 6.2.2:
Second solution to Exercise 3.7.7. Both numbers a and b are positive and thus nonzero;
hence, ( a, b) 6= (0, 0). Let g = gcd ( a, b). Thus, Proposition 3.5.12 yields that g > 0
a b a b
and ⊥ . In particular, the numbers and are integers. Moreover, these
g g g g
a b
integers and are positive (since a, b and g are positive). Hence, Exercise 6.2.2
g g
a b
(applied to and instead of a and b) shows that there exist positive integers x
g g
a b
and y such that 1 = x · − y · . Consider these x and y, and denote them by u
g g
172 Proof.From u ∈ U = {2, 3, . . . , b + 1}, we obtain u ≥ 2 > 1. Multiplying this inequality by a,
we obtain ua > 1a (since a is positive). Hence, ua > 1a = a ≥ 1 (since a is a positive integer).
However, ua − 1 = bv, so that bv = ua − 1 > 0 (since ua > 1). We can divide this equality by b
(since b is positive), and obtain v > 0. Hence, v is a positive integer (since v is an integer).
a b
and v. Thus, u and v are two positive integers and satisfy 1 = u · − v · . Hence,
g g
a b 1
1 = u· − v · = (ua − vb), so that g = ua − vb. In view of g = gcd ( a, b),
g g g
this rewrites as gcd ( a, b) = ua − vb. Hence, there exist positive integers x and y
such that gcd ( a, b) = xa − yb (namely, x = u and y = v). This solves Exercise 3.7.7
again.
4 3 11
0 2 10 1
9 5
8 6
.
We observe on this diagram that if we start at any node and follow the arrows,
we will eventually get stuck in a cycle (i.e., we will start walking around in circles).
This observation holds in general whenever X is a finite set and f : X → X is a
map (although the cycles in which we get stuck might be 1-node cycles – i.e., we
may run into a fixed point). Here is a somewhat stronger statement:173
173 If X is a set, and if f : X → X is a map, then the notation f n (for n ∈ N) denotes the n-fold
f 6 (x) f 4 (x)
f 5 (x)
(this shows a case when f 3 ( x ) = f 7 ( x ), so that the i and j in Theorem 6.2.5 can be
chosen to be 3 and 7). This kind of picture is known as a rho to number theorists (in
honor of the Greek letter rho, which it vaguely resembles) or as a lollipop to graph
theorists. Note that we can have i = 0 (in which the picture consists just of a cycle
with no “running-in”) or j = i + 1 (in which case the cycle is just a single node with
an arrow directly to itself).
Proof of Theorem 6.2.5. (a) Consider the n + 1 elements f 0 ( x ) , f 1 ( x ) , . . . , f n ( x ) of
the n-element set X. Corollary 6.1.4 (applied to m = n + 1, V = X and ai = f i−1 ( x ))
yields that at least two of these n + 1 elements f 0 ( x ) , f 1 ( x ) , . . . , f n ( x ) must be
equal (since n + 1 > n). In other words, there exist two integers i and j with
0 ≤ i < j ≤ n and f i ( x ) = f j ( x ). This proves Theorem 6.2.5 (a).
(b) Let d = j − i. Then, d = j − i > 0 (since i < j); thus, d is a positive in-
teger (since i < j). Let us denote the sequence f i ( x ) , f i+1 ( x ) , f i+2 ( x ) , . . . by
(u0 , u1 , u2 , . . .). Thus,
Forget that we fixed k. We thus have proved that every k ∈ N satisfies uk = uk+d .
However, d is a positive integer; thus, we know (from Definition 4.7.1 (a)) that d is a
period of the sequence (u0 , u1 , u2 , . . .) if and only if every k ∈ N satisfies uk = uk+d .
Therefore, d is a period of the sequence (u0 , u1 , u2 , . . .) (since every k ∈ N satisfies
uk = uk+d ). In other words, the sequence (u0 , u1 , u2 , . . .) is d-periodic (by Definition
4.7.1 (c)). In other words, the sequence f i ( x ) , f i+1 ( x ) , f i+2 ( x ) , . . . is ( j − i )-
periodic (since (u0 , u1 , u2 , . . .) = f i ( x ) , f i+1 ( x ) , f i+2 ( x ) , . . . and d = j − i). This
Example 6.2.7. Let X = {0, 1, . . . , 9}. Let f : X → X be the map that sends the
elements 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 to 7, 5, 4, 3, 2, 6, 0, 1, 9, 8, respectively. The following
174 This
is only one of two commonly used meanings of the word “permutation”; see (e.g.) [Grinbe15,
Remark 5.4] or the Wikipedia page for the distinction. In a nutshell, the second meaning of “per-
mutation” is a list that contains each element of a set exactly once. In order to avoid confusion,
we shall not use this second meaning.
diagram shows all elements of X (as nodes) and how the map f acts on them (by
drawing an arrow from each node i ∈ X to the node f (i )):
5 9 8
1 6
7 0 2 4
.
Note that our map f here is a permutation of X; thus, any node has exactly one
arrow arriving at it.
The behavior seen in this diagram is a simpler particular case of that seen in
Example 6.2.4: Every node is part of a cycle (rather than merely being connected to
a cycle via some arrows). We can formalize this as follows:
Proof of Theorem 6.2.8. (a) Theorem 6.2.5 (a) shows that there exist two integers i
and j with 0 ≤ i < j ≤ n and f i ( x ) = f j ( x ). Consider these i and j. Let d = j − i.
Then, d = j − i > 0 (since i < j) and i + d = j (since d = j − i).
It is well-known that f p ◦ f q = f p+q for any p, q ∈ N. Applying this to p = i and
q = d, we obtain f i ◦ f d = f i+d = f j (since i + d = j). Hence, f j = f i ◦ f d , so that
f j ( x ) = f i ◦ f d ( x ) = f i f d ( x ) . Therefore, f i ( x ) = f j ( x ) = f i f d ( x ) , so that
f i f d ( x ) = f i ( x ).
Proof of Corollary 6.2.9. (a) Assume that f is injective. Hence, Theorem 6.1.3 (ap-
plied to U = X and V = X) yields that f is bijective (since | X | = | X |). In other
words, f is a permutation of X. This proves Corollary 6.2.9 (a).
(b) Assume that f is surjective. Hence, Theorem 6.1.9 (applied to U = X and
V = X) yields that f is bijective (since | X | = | X |). In other words, f is a permutation
of X. This proves Corollary 6.2.9 (b).
We also note that any composition of two permutations of a set X is again a
permutation of X (since a composition of two bijections is always a bijection). Fur-
thermore, the inverse of any permutation of a set X is again a permutation of X
(since the inverse of a bijection is always a bijection). If you are familiar with the
notion of a group, you will thus recognize the set of all permutations of a given set
X to be a group (known as the symmetric group on X).
More can be said about endofunctions. Even the “rho” (or “lollipop”) of an
element bears some surprises:
See Exercise 6.3.3 for a generalization of Theorem 6.2.10 (allowing both the tor-
toise and the hare to start with leads).
Exercise 6.2.3. Let m be a positive integer. Let a and b be integers such that
b ⊥ m. Let ( x0 , x1 , x2 , . . .) be any ( a, b)-recurrent sequence of integers.
Prove that
the sequence ( x0 %m, x1 %m, x2 %m, . . .) is k-periodic for some k ∈ 1, 2, . . . , m2 .
Solution to Exercise 6.2.3 (sketched). The matrix approach from Proposition 4.9.21 (a)
will be useful here again – even though we don’t really need matrices but can
simply work with pairs of numbers. Recall that the idea behind this approach was
that, even though an entry xn of our sequence cannot be directly obtained from the
previous entry xn−1 , each pair ( xn , xn+1 ) of two consecutive entries can be obtained
easily from the preceding such pair ( xn−1 , xn ). It turns out that the same holds for
the remainders x0 %m, x1 %m, x2 %m, . . .: Namely, each pair ( xn %m, xn+1 %m) can be
obtained from the preceding such pair ( xn−1 %m, xn %m) (we shall soon see how).
First, let us introduce some notations.
Let M be the m-element set {0, 1, . . . , m − 1}. Thus, | M × M| = | M | · | M| =
| M|2 = m2 (since | M| = m).
For each integer z, let − →z denote the remainder z%m. Thus, every integer z
satisfies −→z = z%m ∈ {0, 1, . . . , m − 1} = M and
−
→
z = z%m ≡ z mod m (270)
Claim 3: We have −
→
xi , −
x−→
i +1 = f ( ω ) for each i ∈ N.
i
Proving these three claims will be an exercise (Exercise 6.3.6 below). Assume
that they are proved for now. Now, we can apply Theorem 6.2.8 (a) to X = M × M,
n = m2 and x = ω. This yields that there exists a k ∈ 1, 2, . . . , m2 such that
f k (ω ) = ω. Consider this k. Applying Theorem 6.2.8 (b) to X = M × M, n =
m2 and x = ω, we conclude that the sequence f 0 (ω ) , f 1 (ω ) , f 2 (ω ) , . . . is k-
periodic. In other words, k is a period of this sequence. In other words, every
i ∈ N satisfies
f i (ω ) = f i +k (ω ) (271)
(by the definition of a period).
Now, let i ∈ N. Then, Claim 3 yields − →
xi , −
x−
i
→ = f i (ω ). Also, Claim 3 (applied
+1
to i + k instead of i) yields − x−→, − x −−→ = f i+k (ω ). Hence,
i + k i + k +1
−
→
xi , −
x−→ i i +k
i +1 = f ( ω ) = f (ω ) (by (271))
− −→ − −− → −
−→ − −− →
i +k
= x i + k , x i + k +1 since xi+k , xi+k+1 = f (ω ) .
In other words, − →
xi = −x− → −−→ −−−→ −
→ −−→
i +k and xi +1 = xi +k+1 . Thus, in particular, xi = xi +k .
Forget that we fixed i. We thus have shown that every i ∈ N satisfies − →xi =
−
x− →. In other words, k is a period of the sequence − →
x , −
→
x , −
→
x , . . . (since k is a
i +k 0 1 2
−
→ −
→ −
→
positive integer). In other words, the sequence x0 , x1 , x2 , . . . is k-periodic. In
other words, the sequence ( x0 %m, x1 %m, x2 %m, . . .) is k-periodic (since − →
xi = xi %m
for each i ∈ N). Thus, we have found a k ∈ 1, 2, . . . , m such that the sequence
2
The following diagram shows all elements of X (as nodes) and how the map f
acts on them (by drawing an arrow from each node i ∈ X to the node f (i )):
8 1 2 0
11 5 3
7 4 6
10 9
.
We have
The pattern we might be seeing here is that the sets f i ( X ) get smaller and smaller
as i gets larger, until they eventually stop changing at all. This and more is claimed
in the following proposition:
The set f n ( X ) in Proposition 6.2.12 is called the eventual image of the map f (since
each element of X eventually ends up in f n ( X ) if we apply f to it often enough).
Proof of Proposition 6.2.12. (a) We need to show that f i ( X ) ⊇ f i+1 ( X ) for each i ∈
N.
Indeed, let i ∈ N. Fix some p ∈ f i+1 ( X ). Thus,
p = f i+1 ( x ) for some x ∈ X.
Forget that we fixed p. We thus have shown that p ∈ f m+1 ( X ) for each p ∈
f m ( X ). In other words, f m ( X ) ⊆ f m+1 ( X ). Combining this with f m ( X ) ⊇
f m+1 ( X ), we obtain f m ( X ) = f m+1 ( X ). Thus, f i ( X ) = f m ( X ) = f m+1 ( X ). This
completes the induction step. Thus, (273) is proved by induction.]
Having proved (273), we have proved Proposition 6.2.12 (b).
(c) Note that f 0 = idX , so that f 0 ( X ) = idX ( X ) = X. Hence, f 0 ( X ) = | X | = n.
We shall first show that there exists some i ∈ {0, 1, . . . , n} such that f i ( X ) =
f i +1 ( X ).
Indeed, assume the contrary. Thus, each i ∈ {0, 1, . . . , n} satisfies
f i ( X ) 6 = f i +1 ( X ) . (274)
Prove that there exists a player who has (directly or indirectly) owned all other
players.
[Example: Consider a tournament between 5 players A, B, C, D, E encoded by
the following diagram:
D C
(where an arrow from player p to player q means that p has won the match
against q). Then, player A has directly owned players B and C and indirectly
owned players D (via C) and E (via B). Actually, every player other than C has
directly or indirectly owned all other players.]
(Theorem 6.2.10 is the particular case of Exercise 6.3.3 for p = 0 and q = 0.)
Exercise 6.3.6. Complete the above solution to Exercise 6.2.3 by proving Claims
1, 2 and 3.
n−1 n
0 1 1 2
, , , , ..., , ,
n n n n n n
and argue that two of the numbers frac (0x ) , frac (1x ) , . . . , frac (nx ) must lie in
one of these n intervals. If these are frac (ix ) and frac ( jx ) (with i < j), then what
can you say about frac ( jx − ix ) ?
For part (b), use part (a) as a stepping stone. If p is a positive integer satisfying
n−1 1
frac ( px ) > , then find a q > p such that frac (qx ) is either < or >
n n
frac ( px ) (again using part (a)).]
1 1 1
Exercise 6.3.10. Let R = , , , . . . . Find the smallest positive real ε such that
1 2 3
the entire set R can be covered with 5 closed intervals of length ε each.
Theorem 7.1.2 (Sum rule). If S1 , S2 , . . . , Sk are k disjoint finite sets, then the set
S1 ∪ S2 ∪ · · · ∪ Sk is finite and satisfies
| S1 ∪ S2 ∪ · · · ∪ S k | = | S1 | + | S2 | + · · · + | S k | . (276)
(Note that “disjoint” means “pairwise disjoint”; i.e., the k sets S1 , S2 , . . . , Sk are
said to be disjoint if and only if every two distinct elements i and j of {1, 2, . . . , k}
satisfy Si ∩ S j = ∅.)
Remark 7.1.3. A weaker version of Theorem 7.1.2 holds even if we don’t require
S1 , S2 , . . . , Sk to be disjoint: If S1 , S2 , . . . , Sk are any k finite sets, then the set
S1 ∪ S2 ∪ · · · ∪ Sk is finite and satisfies
| S1 ∪ S2 ∪ · · · ∪ S k | ≤ | S1 | + | S2 | + · · · + | S k | . (277)
Theorem 7.1.4 (Product rule). If A1 , A2 , . . . , An are finite sets, then the set A1 ×
A2 × · · · × An is finite and satisfies
| A1 × A2 × · · · × A n | = | A1 | · | A2 | · · · · · | A n | . (278)
Theorem 7.1.6 (Power rule). If A is a finite set, and if n ∈ N, then the set An is
finite and satisfies
| An | = | A|n . (279)
Remark 7.1.7. The set An in Theorem 7.1.6 is defined as the Cartesian product
|A × A ×
{z· · · × A}; it is known as the n-th Cartesian power of A. It consists of the
n times
n-tuples ( a1 , a2 , . . . , an ) whose entries all belong to A.
| A \ B| = | A| − | B| . (280)
All the above theorems are basic facts and can be used without proof.175
175 For
the sake of completeness, here are some references to their proofs (except for Theorem 7.1.1,
which is truly fundamental and even used to define the size of a set by some authors):
• Theorem 7.1.2 is [Loehr11, 1.2]. It can easily be derived from Theorem 2.3.6 by induction
on n. (Theorem 2.3.6, on the other hand, can be proved, e.g., by induction on | Q|; but the
details boil down to how the size of a set is defined.)
• Remark 7.1.3 can also be proved by induction on k, using the fact that | P ∪ Q| ≤ | P| + | Q|
for any two finite sets P and Q. (The latter fact, in turn, can be shown by induction on
| Q|.)
• Theorem 7.1.4 is [Loehr11, 1.5]. It can be proved by induction on n, using the fact that
| P × Q| = | P| · | Q| for any two finite sets P and Q. The latter fact can be obtained from
Theorem 7.1.2 as follows: If we denote the elements of P by p1 , p2 , . . . , pk (where k = | P|),
7.2. Notations
The following two conventions will be used throughout Chapter 7:
Convention 7.2.1. If n ∈ N, then [n] shall mean the n-element set {1, 2, . . . , n}.
(Thus, in particular, [1] = {1} and [0] = {} = ∅.)
This convention might appear to clash with the Iverson bracket notation for truth
values (Definition 4.3.19); but in practice, there is never a chance of confusion.
(Convention 7.2.1 only defines [n] when n is a number, whereas Definition 4.3.19
only defines [A] when A is a logical statement.)
Convention 7.2.2. The symbol “#” shall mean the word “number” (or “the num-
ber”). For example, “# of subsets of {1, 2, 3}” means “the number of subsets of
{1, 2, 3}”.
Hence,
(# of odd numbers in [7]) = 4.
7.3.1. Subsets
We have already seen (in Theorem 4.3.12) how many k-element subsets a given
n-element set has. Now, let us count all subsets (of all possible sizes) of a given
n-element set:
{ p1 } × Q, { p2 } × Q, ..., { pk } × Q,
each of which has size | Q| (by Theorem 7.1.1). The details are left to the reader.
• Theorem 7.1.6 follows by applying Theorem 7.1.4 to Ai = A.
• Theorem 7.1.8 is [Loehr11, 1.3] and [19fco, Theorem 1.4.7 (a)]. It is an easy consequence
of Theorem 2.3.6.
(# of subsets of S) = 2n .
Proof of Theorem 7.3.1 (sketched). We shall only give a brief outline; see [19fco, Theo-
rem 1.4.1] for details. (More precisely, the proof we are sketching here is the Third
proof of [19fco, Theorem 1.4.1]; it appears in [19fco, §1.5.3]. Two other proofs are
given in [19fco, solution to Exercise 1.4.1] and [19fco, §1.4.2].)
We denote the n elements of S by s1 , s2 , . . . , sn (in some order).
If I is any subset of S, then the n-tuple176
176 See Definition 4.3.19 for the meaning of the square brackets.
177 Recall that a tuple means a finite ordered list (of any kind of objects).
Note that (2, 1) and (1, 2) are not the same composition, since tuples are ordered.
Proof of Theorem 7.3.4 (sketched). We shall outline the proof; the details can be found
in [19fco-hw0s, Exercise 1 (b)].
The case n = 0 is easy (the only composition of 0 is the 0-tuple ()). Thus, for the
rest of this proof, we WLOG assume that n 6= 0. Hence, n ≥ 1. We thus need to
show that (# of compositions of n) = 2n−1 . Inspired by the bijection principle, we
thus would like to define a bijection
{compositions of n} → {subsets of [n − 1]} ,
where (as we recall from Convention 7.2.1) we have [n − 1] = {1, 2, . . . , n − 1}.
Indeed, once we have found such a bijection, we can apply the bijection principle
to obtain
|{compositions of n}| = |{subsets of [n − 1]}|
= (# of subsets of [n − 1]) = 2n−1
(by Theorem 7.3.1 (applied to [n − 1] and n − 1 instead of S and n), since [n − 1] is
an (n − 1)-element set), so that
(# of compositions of n) = |{compositions of n}| = 2n−1 .
This will clearly prove Theorem 7.3.4. Thus, in order to complete this proof, all that
remains to be done is to find a bijection {compositions of n} → {subsets of [n − 1]}.
How do we do this? If a = ( a1 , a2 , . . . , ak ) is a composition of n, then consider
the set
C ( a) := { a1 + a2 + · · · + ai | i ∈ {1, 2, . . . , k − 1}}
= { a1 ,
a1 + a2 ,
a1 + a2 + a3 ,
...,
a 1 + a 2 + · · · + a k −1 } .
This set C ( a) consists of all partial sums of the tuple a (not counting the empty sum
0, and also not counting the full sum a1 + a2 + · · · + ak ). Since a = ( a1 , a2 , . . . , ak )
is a composition of n, the entries a1 , a2 , . . . , ak are positive integers and their sum
is a1 + a2 + · · · + ak = n; hence, all their partial sums a1 + a2 + · · · + ai for i ∈
{1, 2, . . . , k − 1} are larger than 0 and smaller than n. In other words, all these
partial sums belong to the set {1, 2, . . . , n − 1} = [n − 1]. That is, C ( a) is a subset
of [n − 1] (since C ( a) is the set of these partial sums).
Thus, for each composition a of n, we have defined a subset C ( a) of [n − 1]. We
thus obtain a map
3 1 2 1
0 3 4 6 7
(where the lengths of the blocks are shown in blue, and where the red vertical
lines separate the blocks), and the lengths of these 4 blocks are 3, 1, 2, 1 (from left to
right), so that C −1 ( I ) = (3, 1, 2, 1). Proving that this construction really defines an
inverse map to C is straightforward and left to the reader (see [19fco-hw0s, solution
to Exercise 1 (b)], where it is done rigorously and with no reference to pictures).
Thus, the map C : {compositions of n} → {subsets of [n − 1]} is a bijection.
So we have found a bijection {compositions of n} → {subsets of [n − 1]}. As we
explained above, this completes the proof of Theorem 7.3.4.
7.3.3. Maps
Let us next count maps (i.e., functions) between two sets.
Definition 7.3.5. Let A and B be two sets. Then, B A shall mean the set of all
maps from A to B.
Theorem 7.3.6. Let A and B be two finite sets. Then, the set B A is finite, and
satisfies
B A = | B || A| . (281)
• We decide which of the three sets A, B, C will contain 2. Again, there are 7
options for this decision.
• We decide which of the three sets A, B, C will contain 3. Again, there are 7
options for this decision.
• And so on, until we have placed each of the n elements 1, 2, . . . , n of [n] in the
sets A, B, C (or, rather, in whichever of these sets A, B, C we want to place it
in).
Altogether, we thus make n decisions, and each time there are 7 available options.
Thus, the total # of possibilities (for the triple ( A, B, C ) we are constructing) is
7| · 7 ·{z· · · · 7} = 7n . So the # of all triples ( A, B, C ) of subsets of [n] satisfying A ∩ B ∩
n times
C = ∅ is 7n .
This wasn’t very rigorous: what exactly is a “decision”, what is an “option”,
what is a “possibility”, and why are we multiplying the 7’s? The answer is that
our informal argument above was informal code for an application of the bijection
principle. Here is an outline of how to formalize it: Define the map
where
1, if i ∈
/ A and i ∈
/ B and i ∈
/ C;
∈ ∈ ∈
2, if i A and i / B and i / C;
3, if i ∈
/ A and i ∈ B and i ∈
/ C;
ui = 4, if i ∈
/ A and i ∈
/ B and i ∈ C; for each i ∈ [n]
5, if i ∈ A and i ∈ B and i ∈
/ C;
6, if i ∈ A and i ∈
/ B and i ∈ C;
∈ ∈ ∈C
7, if i / A and i B and i
(so that ui essentially encodes which of the sets A, B, C contain i). It is not hard to
see that this map is a bijection. Thus, the bijection principle entails
Convention 7.3.7. (a) I am using the three words “decision”, “option” and “pos-
sibility” for what most authors (including Loehr in [Loehr11]) call “choice”. In
my opinion, using the word “choice” for all three concepts is misleading, as they
are not the same. Let me illustrate the differences on an example:
Imagine you are about to buy a car. You get to choose its color (“black”, “grey”
or “red”) and its body style (“sedan”, “minivan” or “convertible”). All pairs of
a color and a body style are available. Thus:
• you make 2 decisions (namely, the color and the body style);
• you have 3 options in your first decision (namely, “black”, “grey” and
“red”);
The general rule is that you are choosing between a number of options in each
decision; and the total combination of options you have chosen after you made
all decisions is a possibility.
By avoiding the word “choice”, I am also eliminating the source of confusion
that the standard idioms “You have one choice” and “You have no choice” cause.
(In my terminology, these would translate as “You have one decision, which
allows for at least 2 options” and “You have 1 option”.) I hope the pedantry will
pay off as we get to more complicated proofs where any bit of clarity will be
helpful.
(b) Assume you are making several decisions (as in the example above, where
you are buying a car). The decisions are said to be independent if the set of
options you get to choose from in one decision does not depend on the options
you have chosen in the others. Otherwise, they are dependent. For example,
in the above example, the two decisions were independent; however, if a red
sedan becomes unavailable, then they become dependent, since choosing “red”
in the first decision makes the “sedan” option in the second decision unavailable.
(The decision-making process in our above discussion of Exercise 7.3.1 was an
example where we had n independent decisions, each allowing for 7 options.)
set. Then,
Proof of Theorem 7.3.8 (sketched). We shall give an informal proof, and later explain
what it relies on.
First of all, we note that m = | A| ∈ N and thus
n ( n − 1) ( n − 2) · · · ( n − m + 1)
n
=
m m!
(by (117), applied to k = m). Hence,
n
m! · = n ( n − 1) ( n − 2) · · · ( n − m + 1) . (285)
m
We denote the m elements of A by a1 , a2 , . . . , am (in some order). Now, if f : A →
B is an injective map, then the m values f ( a1 ) , f ( a2 ) , . . . , f ( am ) are distinct (i.e.,
no two of them are equal), so that they satisfy
f ( a1 ) ∈ B,
f ( a2 ) ∈ B \ { f ( a1 )} ,
f ( a3 ) ∈ B \ { f ( a1 ) , f ( a2 )} ,
f ( a4 ) ∈ B \ { f ( a1 ) , f ( a2 ) , f ( a3 )} ,
....
• And so on, until we have chosen the last value f ( am ) (there are n − m + 1
options for it).
Note that the options that are available to us at each step of this procedure depend
on the previously made decisions (so our decisions are dependent); however, the
number of options at each step does not. Namely, we have n options in our first
decision, n − 1 options in our second decision, n − 2 options in our third decision,
and so on. Hence, in total, we have n (n − 1) (n − 2) · · · (n − m + 1) possibilities for
how we can make these choices. Since each of these possibilities leads to a different
injective map f : A → B, and since each injective map f : A → B can be obtained
from one of these possibilities, we thus conclude that
• you have a2 options in decision 2 (no matter what option you chose in
decision 1);
• you have a3 options in decision 3 (no matter what options you chose in
decisions 1 and 2);
• . . .;
• you have an options in decision n (no matter what options you chose in the
previous decisions).
Then, the total # of possibilities for how you can make these choices is
a1 a2 · · · a n .
This can be made rigorous (see [Newste20, Theorem 7.2.19] or [Loehr11, §1.8]).
Note that we have applied Theorem 7.3.10 to m instead of n in our proof of Theorem
181 This is because f ( a1 ), f ( a2 ) and f ( a3 ) are distinct (because of how we chose f ( a2 ) and f ( a3 )).
We are using the proper names “Smirnov” and “Carlitz” as adjectives here. “Cyc-
Smirnov” is short for “cyclically Smirnov”. One can think of Smirnov tuples as
tuples that can have repeated entries, but never in consecutive positions. Cyc-
Smirnov tuples are defined in the same way, except that the last and the first po-
sitions also count as consecutive (which is natural if one imagines the tuple being
written on a round band).
Clearly, any injective tuple with at least one entry is cyc-Smirnov; also, every
cyc-Smirnov tuple is Smirnov.
Example 7.3.12. (a) The tuple (5, 1, 2) is injective (and thus Smirnov and cyc-
Smirnov).
(b) The tuple (2, 1, 2) is not injective and not cyc-Smirnov, but it is Smirnov.
(c) The tuple (2, 1, 2, 1) is cyc-Smirnov (and thus Smirnov), but not injective.
(d) The tuple (2, 2, 1) is not Smirnov (and thus neither cyc-Smirnov nor injec-
tive).
Discussion of Exercise 7.3.2. (a) Recall the notation [k ] = {1, 2, . . . , k} (from Conven-
tion 7.2.1). Now, we claim that the injective k-tuples ( a1 , a2 , . . . , ak ) ∈ Ak are “the
same as” the injective maps from [k ] to A. To be more precise, there is a bijection
n o
{injective maps from [k] to A} → injective k-tuples ( a1 , a2 , . . . , ak ) ∈ Ak ,
f 7→ ( f (1) , f (2) , . . . , f (k ))
therefore
# of injective k-tuples ( a1 , a2 , . . . , ak ) ∈ Ak
= (# of injective maps from [k] to A)
= n ( n − 1) ( n − 2) · · · ( n − k + 1)
(by (283), applied to k, [k ] and A instead of m, A and B). This solves Exercise 7.3.2
(a).
(b) To construct a Smirnov k-tuple ( a1 , a2 , . . . , ak ) ∈ Ak , we proceed as follows:
Thus, the Dependent product rule shows that the total # of possibilities for how we
can make these choices is
n ( n − 1 ) ( n − 1 ) · · · ( n − 1 ) = n ( n − 1 ) k −1 .
| {z }
k−1 times
It is easy to see that the maps f and g are mutually inverse (indeed, f ◦ g = id
is clear, whereas g ◦ f = id follows from the fact that each noncyc-Smirnov k-tuple
has the form ( a1 , a2 , . . . , ak−1 , a1 ) for some a1 , a2 , . . . , ak−1 ∈ A). Thus, the map f is
invertible, i.e., a bijection. Hence, the bijection principle shows that
Forget that we fixed k. We thus have proved the equality (286) for each integer
k > 1. Moreover, recall that c (n, 1) = 0. This gives us a recurrent description of
the sequence (c (n, 1) , c (n, 2) , c (n, 3) , . . .). We attempt to solve this recurrence by
c (n, k )
= n ( n − 1 ) k −1 − c (n, k − 1) (by (286))
| {z }
=n(n−1)k−2 −c(n,k−2)
(by (286))
= n ( n − 1 ) k −1 − n ( n − 1 ) k −2 − c (n, k − 2)
| {z }
=n(n−1)k−3 −c(n,k−3)
(by (286))
i =0 i =0
| {z } | {z } | {z }
=(−1)k (−1)i =(n−1)(n−1)i =((−1)(n−1))i
=(1−n)i
k −2
1 − (1 − n ) k −1
= (−1)k n (n − 1) · ∑ (1 − n ) i = (−1)k n (n − 1) ·
1 − (1 − n )
|i=0 {z }
=(1−n)0 +(1−n)1 +···+(1−n)k−2
1 − (1 − n ) k −1
=
1 − (1 − n )
(by (4))
1 − (1 − n ) k −1
= (−1)k n (n − 1) · = (−1)k (n − 1) · 1 − (1 − n)k−1
n
= (−1) (n − 1) − (−1) (n − 1) (1 − n)k−1
k k
| {z }
=(−1)k−1 (n−1)k−1
= (n − 1)k + (−1)k (n − 1) .
(If you found the way we derived this answer vertiginous, you can also prove it
by induction on k using c (n, 1) = 0 and (286). See [17f-hw3s, solution to Exercise
5 (b)] for the details of this straightforward proof.182 ) Thus, the # of cyc-Smirnov
k-tuples is c (n, k ) = (n − 1)k + (−1)k (n − 1). This solves Exercise 7.3.2 (c).
(An aside for the graph-theoretically trained reader: Exercise 7.3.2 is equivalent
to some known formulas for the chromatic polynomials of certain graphs. Indeed,
the injective k-tuples can be regarded as proper colorings of the complete graph
Kk ; the Smirnov k-tuples as proper colorings of the path graph Pk ; the cyc-Smirnov
k-tuples as proper colorings of the cycle graph Ck . From this point of view, the an-
swers to the three parts of Exercise 7.3.2 are really computing the chromatic poly-
nomials of these graphs Kk , Pk and Ck , and our approach to Exercise 7.3.2 (c) is a
particular case of the “deletion-contraction recurrence” for chromatic polynomials.
See [White10a] or [Guicha20, §5.9] for brief introductions to chromatic polynomi-
als. Four different solutions of Exercise 7.3.2 (c) – all stated in the language of
chromatic polynomials – can be found in [LeeShi19].)
7.4. Permutations
7.4.1. All permutations
Next, let us count the permutations of a finite set ([19fco, §2.4.4]):
(# of permutations of X ) = n!.
Example 7.4.2. Let n = 3 and X = [n] = [3]. Then, Theorem 7.4.1 says that
(# of permutations of X ) = n! = 3! = 6. Here are the 6 permutations of X
(written in two-line notation – i.e., the entries in the bottom row are the images
of the entries in the top row):
1 2 3 1 2 3 1 2 3
, , ,
1 2 3 1 3 2 2 1 3
1 2 3 1 2 3 1 2 3
, , .
2 3 1 3 1 2 3 2 1
182 I have denoted cyc-Smirnov tuples as “rounded smords” in [17f-hw3s, Exercise 5 (b)] (and also
denoted Smirnov tuples as “smords” in [17f-hw3s, Exercise 5 (a)]). This was mainly done in
order to make googling for solutions harder. (“Smord” is short for “Smirnov word”.)
Proof of Theorem 7.4.3. The sets U and V are n-element sets; hence, |U | = n and
|V | = n. Thus, |U | = n = |V |. Therefore, Theorem 6.1.3 shows that every injective
map from U to V is bijective. Conversely, every bijective map from U to V is
injective (by definition). Combining the preceding two sentences, we conclude that
the bijective maps from U to V are precisely the injective maps from U to V. Thus,
(# of bijective maps from U to V )
= (# of injective maps from U to V )
= n ( n − 1) ( n − 2) · · · ( n − n + 1)
| {z }
=1
(by (283), applied to A = U, B = V and m = n)
= n (n − 1) (n − 2) · · · 1 = 1 · 2 · · · · · n = n!.
But “bijection” means the same thing as “bijective map”. Hence,
(# of bijections from U to V ) = (# of bijective maps from U to V ) = n!.
This proves Theorem 7.4.3.
Proof of Theorem 7.4.1. The permutations of X are the same thing as the bijective
maps from X to X (by the definition of “permutation”). In other words, they are
the same thing as the bijections from X to X. Hence,
(# of permutations of X ) = (# of bijections from X to X ) = n!
(by Theorem 7.4.3, applied to U = X and V = X).This proves Theorem 7.4.1.
As we explained above, this set Sn is indeed a group (in the sense of abstract
algebra) and thus deserves its name. In particular, the set Sn (for each n ∈ N)
is closed under composition (i.e., if f , g ∈ Sn , then f ◦ g ∈ Sn ) and closed under
inversion (i.e., if f ∈ Sn , then f −1 ∈ Sn ).
(Some authors use notations like Sn , Σn or Sym (n) instead of Sn ; note that all of
these are variations on the letter “S”.)
We shall outline two solutions to this exercise, as they illustrate two different
counting strategies that are both rather useful.
First solution to Exercise 7.4.1 (sketched). This is an outline; see [18s-mt1s, proof of
Proposition 0.5] for a more detailed writeup183 .
Recall that Sn is the set of all permutations of [n]. Thus,
On the other hand, I claim that “the colors are equidistributed”: i.e., the number
of green permutations σ ∈ Sn equals the number of red permutations σ ∈ Sn .
To prove this, I will construct a bijection from {green permutations σ ∈ Sn } to
{red permutations σ ∈ Sn }.
Indeed, the idea is simple: If σ ∈ Sn is a green permutation, then interchanging
the first two values of σ 186 yields a new permutation τ ∈ S , which is red
n
(because interchanging the first two values σ (1) and σ (2) obviously inverts the
inequality σ (1) > σ (2)). Thus, we obtain a map
183 Note that [18s-mt1s, Proposition 0.5] is not quite the same as our Exercise 7.4.1, but it is completely
analogous; the only difference is that σ (1) > σ (2) is replaced by σ (3) > σ (4).
184 Indeed, every permutation σ ∈ S is injective, and thus satisfies σ (1) 6 = σ (2), so that it must
n
satisfy either σ (1) > σ (2) or σ (1) < σ (2).
185 since σ (1) > σ (2) would contradict σ (1) < σ (2)
186 We consider the values of a permutation σ ∈ S
n to be implicitly listed in the order
σ (1) , σ (2) , . . . , σ (n). Thus, the “first two values of σ” are understood to be σ (1) and σ (2).
Interchanging these two values means that we change the permutation so that the values σ (1)
and σ (2) become the values at 2 and 1, respectively (i.e., they switch their roles).
(More formally, “σ with the first two values interchanged” can be defined as fol-
lows: Let s1 be the permutation of [n] that swaps the numbers 1 and 2 while leaving
all other numbers unchanged. That is, s1 is given by
2, if i = 1;
s1 (i ) = 1, if i = 2; for all i ∈ [n] .
i, if i ∈
/ {1, 2}
Then, “σ with the first two values interchanged” is the permutation σ ◦ s1 of [n].
To wit, when we compose σ with s1 , the first two values σ (1) and σ (2) of σ get
interchanged, while all other values of σ stay at their places.)
So we have obtained a map
that is defined in the same way as f (viz., it interchanges the first two values of
σ). The maps f and g are mutually inverse, because if we interchange the first
two values of a permutation σ and subsequently interchange them again, we end
up back at our original permutation σ. Hence, the map f is invertible, and thus
is a bijection. So we have found a bijection from {green permutations σ ∈ Sn } to
{red permutations σ ∈ Sn } (namely, f ). Therefore, the bijection principle yields
Hence,
1 1
|{green permutations σ ∈ Sn }| = |Sn | = n! = n!/2.
2 |{z} 2
=n!
In other words, the number of all green permutations σ ∈ Sn is n!/2. In other
words, the number of all permutations σ ∈ Sn satisfying σ (1) > σ (2) is n!/2
(because these permutations are precisely the green permutations σ ∈ Sn ). This
solves Exercise 7.4.1.
• First, we choose the set {σ (1) , σ (2)}. This set must be a 2-element subset
of [n] (indeed, we must have σ (1) 6= σ (2), since σ must be injective), but
is otherwise arbitrary; thus, the numberofoptions is the # of all 2-element
n
subsets of [n]. But the latter number is (by Theorem 4.3.12, applied to
2
n
S = [n] and k = 2). Hence, the number of options at this step is .
2
Note that, once we have chosen the set {σ (1) , σ (2)}, the values σ (1) and
σ (2) are uniquely determined, because the inequality σ (1) > σ (2) forces
σ (1) to be the largest element of this set and σ (2) to be its smallest element.
• Next, we choose the value σ (3). This value must be an element of the (n − 2)-
element set [n] \ {σ (1) , σ (2)}; thus, there are n − 2 options for it.
• Next, we choose the value σ (4). This value must be an element of the (n − 3)-
element set [n] \ {σ (1) , σ (2) , σ (3)} (this is an (n − 3)-element set because
σ (1) , σ (2) , σ (3) are distinct); thus, there are n − 3 options for it.
• Next, we choose the value σ (5). This value must be an element of the (n − 4)-
element set [n] \ {σ (1) , σ (2) , σ (3) , σ (4)}; thus, there are n − 4 options for
it.
• And so on, until all n values σ (1) , σ (2) , . . . , σ (n) are chosen. (Note that
there will be n − (n − 1) = 1 options for the last value σ (n).)
Thus, the Dependent product rule shows that the total # of possibilities for how we
In other words, this exercise states that the average number of fixed points of a
permutation of [n] is 1.
Exercise 7.4.2 was Problem 1 at the International Mathematical Olympiad (IMO)
1987. We give a solution using some (very basic) probability theory (specifically,
the linearity of expectation):
Solution to Exercise 7.4.2 (sketched). We shall use the language of probability (specif-
ically, discrete random variables and their expected values). See [GriSne07, §6.1]
for a quick refresher. Note that our solution can just as well be restated as a purely
combinatorial argument (using interchange of summation signs instead of linearity
of expectation).
We have
|Sn | = n! (289)
(indeed, this can be shown as in the First solution to Exercise 7.4.1).
Our goal is to prove that ∑ |Fix w| = n!. In other words, our goal is to prove
w ∈ Sn
that ∑ |Fix w| = |Sn | (since |Sn | = n!). In other words, our goal is to prove that
w ∈ Sn
1
∑ |Fix w| = 1. The left hand side of this equality is the average of |Fix w|
| Sn | w ∈ Sn
when w ranges over all of Sn . In other words, it is the expected value of |Fix σ |
when σ is a discrete random variable uniformly distributed over Sn . This suggests
that we use random variables.
We consider a discrete random variable σ that is uniformly distributed over Sn .
We use the notation Pr ( A) for the probability of an event A, and we use the nota-
tion E ( X ) for the expected value of a numerically-valued random variable X. It is
known that any n numerically-valued random variables X1 , X2 , . . . , Xn satisfy
E ( X1 + X2 + · · · + X n ) = E ( X1 ) + E ( X2 ) + · · · + E ( X n ) . (290)
(In fact, this is part of the principle of linearity of expectation. See [GriSne07, Theorem
6.2] for the case n = 2; the general case follows by induction on n.)
Now, we claim that each w ∈ Sn satisfies187
|Fix w| = [w (1) = 1] + [w (2) = 2] + · · · + [w (n) = n] . (291)
[Proof: Let w ∈ Sn . Let i = |Fix w|. Thus, w has i fixed points. If x is one of these i
fixed points, then w ( x ) = x and thus [w ( x ) = x ] = 1; on the other hand, if x is not
a fixed point of w, then w ( x ) 6= x and thus [w ( x ) = x ] = 0. Hence, the sum on the
right hand side of (291) has i addends equal to 1 (one such addend for each of the
i fixed points of w), while the remaining addends are 0. Therefore, the right hand
side of (291) equals i · 1 + (n − i ) · 0 = i = |Fix w|, and thus (291) is proved.]
Now, applying (291) to our random permutation σ, we find
|Fix σ| = [σ (1) = 1] + [σ (2) = 2] + · · · + [σ (n) = n] .
Hence,
E (|Fix σ|) = E ([σ (1) = 1] + [σ (2) = 2] + · · · + [σ (n) = n])
= E ([σ (1) = 1]) + E ([σ (2) = 2]) + · · · + E ([σ (n) = n])
(by (290))
n
= ∑ E ([σ (i) = i]) . (292)
i =1
Pr (σ (i ) = 1) , Pr (σ (i ) = 2) , . . . , Pr (σ (i ) = n)
Pr (σ (i ) = 1) + Pr (σ (i ) = 2) + · · · + Pr (σ (i ) = n) = 1
(since σ (i ) must take one of the n values 1, 2, . . . , n, and of course cannot take
more than one of them simultaneously). Hence, these n probabilities must all
189 Forthe skeptics, let me spell these symmetry reasons out:
We must show that if u and v are any two elements of [n], then the probability of σ (i ) = u
equals the probability of σ (i ) = v.
So let u, v ∈ [n]. Then, there exists a permutation t ∈ Sn that sends u to v. (For example, we
can define t to be the permutation of [n] that swaps u and v and leaves the remaining elements
of [n] unchanged.) Consider such a t. The inverse t−1 of this permutation t is then a permutation
of [n] that sends v to u.
Now, consider the map
Φ : { w ∈ Sn | w ( i ) = u } → { w ∈ Sn | w ( i ) = v } ,
w 7→ t ◦ w.
Ψ : { w ∈ Sn | w ( i ) = v } → { w ∈ Sn | w ( i ) = u } ,
w 7→ t−1 ◦ w.
Then, it is easy to see that the maps Φ and Ψ are mutually inverse (for example, Φ ◦ Ψ =
id
is because
each permutation w ∈ Sn satisfies (Φ ◦ Ψ) (w) = Φ (Ψ (w)) = t ◦ t−1 ◦ w =
t ◦ t−1 ◦w = w = id (w)). Hence, the map Φ is invertible, i.e., is bijective. The bijection
| {z }
=id
principle thus yields
|{w ∈ Sn | w (i ) = u}|
(the probability of σ (i ) = u) = .
| Sn |
Likewise,
|{w ∈ Sn | w (i ) = v}|
(the probability of σ (i ) = v) = .
| Sn |
The right hand sides of these two equalities are equal (because of (293)). Hence, the left hand
sides are also equal. In other words, the probability of σ (i ) = u equals the probability of
σ (i ) = v. This is precisely what we wanted to show.
1
equal (because if we are given n equal numbers whose sum is 1, then each
n
1 1
of these n numbers must be ). In other words, we have Pr (σ (i ) = j) =
n n
1
for each j ∈ [n]. Applying this to j = i, we obtain Pr (σ (i ) = i ) = .
n
• Alternatively, we can just count the permutations w ∈ Sn satisfying w (i ) =
i. Indeed, we can construct such a permutation w by choosing its values
w (1) , w (2) , . . . , w (i − 1) , w (i + 1) , w (i + 2) , . . . , w (n) in order (skipping w (i ),
since w (i ) is already predetermined to be i). Each value must differ both
from i and from all previously chosen values (since w must be injective), so
we have n − 1 options for the first value, n − 2 options for the second, n − 3
for the third, and so on. Thus, by the dependent product rule, the total #
of possibilities for how we can make these choices is (n − 1) (n − 2) · · · 1 =
1 · 2 · · · · · (n − 1) = (n − 1)!. Therefore,
(# of permutations w ∈ Sn satisfying w (i ) = i ) = (n − 1)!.
In other words,
|{w ∈ Sn | w (i ) = i }| = (n − 1)!. (294)
But since σ is uniformly distributed over Sn , we have
|{w ∈ Sn | w (i ) = i }|
Pr (σ (i ) = i ) =
| Sn |
( n − 1) !
= (by (294) and (289))
n!
1
= (since n! = n · (n − 1)!) .
n
1
Thus, we have shown that Pr (σ (i ) = i ) = , so that
n
1
E ([σ (i ) = i ]) = Pr (σ (i ) = i ) =
. (295)
n
Forget that we fixed i. We thus have proved (295) for each i ∈ [n]. Hence, (292)
becomes
n n
1 1
E (|Fix σ|) = ∑ E ([σ (i ) = i ]) = ∑ = n · = 1.
i =1
| {z } i =1 n n
1
=
n
(by (295))
1
But the definition of expected value yields E (|Fix σ |) = ∑ |Fix w| (since σ
| Sn | w ∈ Sn
is uniformly distributed over Sn ). Hence,
1
|Sn | w∑
|Fix w| = E (|Fix σ|) = 1,
∈S n
See [17f-hw7s, solution to Exercise 2] for the same solution, rewritten in elemen-
tary combinatorial language. See also [19fco-mt2s, Exercise 4] for a solution to the
following generalization:
190 In more detail: Any subset of [n] has size k for some k ∈ {0, 1, . . . , n}. Thus, the sum rule yields
n n
n
(# of subsets of [n]) = ∑ (# of subsets of [n] having size k) = ∑ ,
k =0
| {z } k =0 k
=(# of k-element
subsets
of [n])
n
=
k
(by Theorem 4.3.12)
qed.
Now, let us compute the addends on the right hand side of this equality. (Note that
some of these addends can be 0, but this needs not worry us: The argument we
will be making in the following paragraph applies to them just as well as it does to
the others.)
Fix k ∈ {0, 1, . . . , n}. How many n-element subsets I of S have exactly k positive
elements? Such a subset I must have exactly k positive elements, and thus must
have exactly n − k negative elements (since it must have n elements in total, and 0
is not available because 0 ∈ / S). Hence, we can construct such a subset I as follows:
x
• First, we choose the k positive elements of I. (There are options for them,
k
by Theorem 4.3.12192 .)
191 Hereis an illustration of the case x = 5, y = 3 and n = 4 (with the green blob being the n-element
subset):
−3 −2 −1 1 2 3 4 5
y
• Then, we choose the n − k negative elements of I. (There are options
n−k
for them, by Theorem 4.3.12193 .)
Now, forget that we fixed k. Hence, we have proved (296) for each k ∈ {0, 1, . . . , n}.
Now,
(# of n-element subsets of S)
n
= ∑ (|# of n-element subsets of S having exactly k positive elements)
k =0
{z }
x y
=
k n−k
(by (296))
n
x y
= ∑ .
k =0
k n − k
x ny
So the answer to our counting problem is ∑ .
k =0 k n−k
Now,we have answered our counting problem in two ways. The
first way yielded
x+y n x y
as an answer; the second way yielded ∑ . Comparing these
n k=0 k n−k
x+y n x y
answers, we obtain = ∑ . This proves Proposition 7.5.1.
n k =0 k n−k
(See [19s, proof of Lemma 2.17.15] or [19fco, §2.6.1, Second proof of Theorem
2.6.1 for x, y ∈ N] for different writeups of this proof.)
The words “for nonnegative integers” in the name of Proposition 7.5.1 hint at
the fact that there is a more general version of the Chu–Vandermonde identity; we
shall see this soon.
193 since they must belong to the y-element set {−1, −2, . . . , −y}
Proposition
7.5.2 is known as the trinomial revision formula, since the product
n a
of two binomial coefficients is known as a “trinomial coefficient”, and
a b
this proposition allows “revising” it (i.e., rewriting it as a different product of two
binomial coefficients). It is a useful tool in manipulating binomial coefficients.
Again, we have not stated it in the greatest possible generality, but we have to start
somewhere. Note that particular cases of Proposition 7.5.2 have already been used
twice in solutions of problems posed above194 .
Proof of Proposition 7.5.2. We will use double counting again. Consider the follow-
ing counting problem: Assume you have n people. How many ways are there to
choose a committee consisting of a of these n people, and also choose a subcommittee
consisting of b people from the committee?
Throwing away the unnecessary anthropomorphism, we can restate this problem
in a more convenient language as follows: Fix an n-element set N (whose elements
are our n people). We want to count all pairs ( A, B), where A is an a-element
subset of N (this will be our committee) and B is a b-element subset of A (this will
be our subcommittee).195 In other words, we want to count all pairs ( A, B) of sets
satisfying B ⊆ A ⊆ N and | A| = a and | B| = b. We shall refer to such pairs as CS
pairs196 , and we shall count their # in two ways197 :
First way: In order to construct a CS pair ( A, B), we
first choose the committee A
n
and then choose its subcommittee B. We have many options for A (because
a
A hastobe an a-element subset of the n-element set N); then, after choosing A, we
a
have many options for B (because B has to be a b-element subset of A). Thus,
b
194 Namely, the equality (525) in the solution to Exercise 4.5.5 and the equality (667) in the solution
to Exercise 5.4.3 are particular cases of Proposition 7.5.2.
195 Here is a symbolic picture of this situation:
B A
n a
by the dependent product rule, the total # of CS pairs is .
a b
Second way: In order to construct a CS pair ( A, B), wefirst choose the subcom-
n
mittee B and then choose the committee A. We have many options for B
b
(because B has to be a b-element subset of the n-element set N). After choosing B,
how many options do we have for A ? The committee A has to be an a-element
subset of N, but it is also required to contain the (already chosen) subcommittee B
as a subset, so that b of its a elements are already decided. We only need to choose
the remaining a − b elements of A. These a − b elements have to come from the
(n − b)-element set N \ B (because the elements of B have already been chosen to
lie in A). Thus, we are choosing an ( a− b)-element subset of the (n − b)-element
n−b n−b
set N \ B. The # of ways to do this is . 198 Therefore, we have
a−b a−b
many options for choosing A. Hence, by the dependent product rule, the total # of
n−b
n
CS pairs is .
b a−b
Now, we have computed
the # of CS pairs in two different ways. The first way
n−b
n a n
gave us the result , while the second way gave us the result .
a b b a−b
n−b
n a n
Comparing these results, we find = . Thus, Proposition
a b b a−b
7.5.2 is proven.
See [19fco, §2.2.2] for a more formal version of the above proof. Because of this
proof, Proposition 7.5.2 is sometimes called the “committee-subcommittee identity”.
unfamiliar with complex numbers can replace the symbol C by R throughout this section; this
n−b
n a n
= .
a b b a−b
Clearly, Proposition 7.5.1 and Proposition 7.5.2 are particular cases of Theorem
7.5.3 and Theorem 7.5.4 (which is why we have called them “propositions” rather
than “theorems”). The proofs we gave for the two propositions no longer apply to
the theorems that generalize them; how should we then prove the theorems?
One thing we can try to do is start from scratch and search for non-combinatorial
proofs of Theorem 7.5.3 and Theorem 7.5.4. Such proofs indeed exist: An algebraic
proof of Theorem 7.5.3 (completely unrelated to our above proof of Proposition
7.5.1) can be found in [Grinbe15, first proof of Theorem 3.29]200 . It is not a par-
ticularly enlightening or memorable proof, but it serves its purpose just fine (i.e.,
it proves Theorem 7.5.3 in full generality, without requiring x, y ∈ N), and it even
has a slight advantage in being easy to explain (as it requires little else besides
standard manipulations of sums and products). Theorem 7.5.4 can also be proved
by direct computation (using Definition 4.3.1); this proof can be found in [19fco,
§2.2.1, proof of Proposition 1.3.35] (and is arguably even easier than the above
combinatorial proof of Proposition 7.5.2).
However, this supplantation of combinatorial proofs by algebraic ones leaves a
bad aftertaste. Is double counting just a toy that only works in particular cases (i.e.,
usually, when all variables lie in N)? One of the hallmarks of a good mathematical
proof is that it can be adapted to many natural generalizations of the result being
proved; our double-counting proofs of Proposition 7.5.1 and Proposition 7.5.2 fail
this criterion. There is also a more practical concern: Double counting can be used
not just in proving these two propositions; there are many other results which need
it far more (sometimes, the only known proofs use double counting). We cannot
always expect to find an alternative proof that avoids double counting and thus can
be generalized immediately.
Good news: this is a solvable problem. You can have your cake and eat it too!
While our double-counting proofs cannot themselves be generalized to non-integer
values of x, y or n, there is nevertheless a trick that allows to easily deduce the
will result in a slight loss of generality, but this generality is not important for what we are doing.
(None of our arguments in this section depend on whether our numbers are real or
complex.)
200 The main idea is to induct on n, using the “absorption identity” y y y−1
= (which is
n n n−1
easily proved).
general results (such as Theorem 7.5.3 and Theorem 7.5.4) from their particular
cases that can be proved combinatorially (such as Proposition 7.5.1 and Proposition
7.5.2). I call this trick the polynomial identity trick, and it has far more applications
than salvaging combinatorial proofs; but this is probably one of the simplest to
explain. My exposition of this trick follows [19fco, §2.6.2].
The polynomial identity trick relies on the following well-known theorem:201
Theorem 7.5.5. Let P be a nonzero polynomial (with complex coefficients, in a
single variable X). Then, P has at most deg P many roots.
For example:
1 1 √
• The degree-3 polynomial 3X 3 − 2X + 1 has 3 roots, namely −1, + i 3 and
2 6
1 1 √ √
− i 3 (where i = −1 is the imaginary unit).
2 6
• The degree-3 polynomial X 3 − X 2 − X + 1 has 2 roots, namely 1 and −1.
Theorem 7.5.5 is often called the “easy half of the Fundamental Theorem of Al-
gebra”. We will not prove it here, but the reader can find a proof of Theorem 7.5.5
in any good textbook on abstract algebra (e.g., in [Goodma15, Corollary 1.8.24],
[Joyce17, Theorem 1.58], [Walker87, Corollary 4.5.10], [CoLiOs15, Chapter 1, §5,
Corollary 3], [19s, Theorem 7.6.11], [Elman20, Corollary 33.8] and [Knapp16, Corol-
lary 1.14]).
We don’t really need to use complex numbers in Theorem 7.5.5; the theorem
remains true if we restrict ourselves to real or rational numbers (since any real or
rational number is a complex number as well). Complex numbers are special in
that they allow replacing the words “at most” in Theorem 7.5.5 by “exactly”, as
long as we count the roots with multiplicity (so, for example, the double root 1
of the polynomial ( X − 1)2 X counts as two roots 1, 1 rather than as a single root
1). But this is a much deeper result (known as the Fundamental Theorem of Algebra),
which we shall not need in our combinatorial applications and thus don’t bother
stating here.
Theorem 7.5.5 has two corollaries, which are used frequently in combinatorics:
Corollary 7.5.6. If a polynomial P (with complex coefficients, in a single variable
X) has infinitely many roots, then P is the zero polynomial.
Proof of Corollary 7.5.6 (sketched). If P was nonzero, then Theorem 7.5.5 would yield
that P has at most deg P many roots, which would contradict the assumption that
P has infinitely many roots. Thus, P is zero, so that Corollary 7.5.6 follows. (See
[19fco, proof of Corollary 2.6.9] for details.)
201 Recall that a root of a univariate polynomial P means a complex number r that satisfies P (r ) = 0.
Also, the degree deg P of a nonzero polynomial P is the exponent in the largest power of
the variable that appears in P with a nonzero coefficient. (That is, if we write P in the form
P = a0 X 0 + a1 X 1 + · · · + an X n , where X is our variable and where an 6= 0, then the degree of P
is n.)
Then, P = Q.
Proof of Corollary 7.5.7. We claim that the polynomial P − Q has infinitely many
roots. Indeed, each x ∈ S satisfies
( P − Q) ( x ) = P ( x ) − Q ( x ) = 0 (by (297))
and therefore is a root of P − Q. Thus, the polynomial P − Q has each x ∈ S as a
root; hence, it has infinitely many roots (since S is an infinite set). Corollary 7.5.6
(applied to P − Q instead of P) thus shows that P − Q is the zero polynomial. In
other words, P − Q = 0. Hence, P = Q. This proves Corollary 7.5.7.
Corollary 7.5.7 reveals that an equality P = Q between two (univariate) poly-
nomials P and Q can be proved by showing that the polynomials agree on each
element of a (fixed) infinite set S (i.e., that P ( x ) = Q ( x ) for all x ∈ S); it is not
necessary to check that they agree on each complex number (but, rather, this result
is obtained “for free”). This is called the polynomial identity trick.
Before we use this trick to derive Theorem 7.5.3 and Theorem 7.5.4 from their
particular cases, we illustrate it on a toy problem:
Exercise 7.5.1. Let a ∈ C. Let n ∈ N be even. Prove that
! !
n n n
∑ (−1)i ai · ∑ ai = ∑ a2i . (298)
i =0 i =0 i =0
a0 + a1 + · · · + a(n+1)−1 = a0 + a1 + · · · + an (since (n + 1) − 1 = n)
n
= ∑ ai ,
i =0
we obtain
n
1 − a n +1
∑ ai = 1−a
. (299)
i =0
The same argument (applied to − a instead of a) yields
n
1 − (− a)n+1
∑ (−a) = 1 − (−a)
i
(300)
i =0
we obtain ! ! n +1
n n 1 − a2
∑ (−1) i i
a · ∑ ai =
1 − a2
. (301)
i =0 i =0
(by (4), applied to a2 and n + 1 instead of b and n). 203 Comparing this equality
with (301), we obtain
! !
n n n
∑ (−1)i ai · ∑ ai = ∑ a2i .
i =0 i =0 i =0
Thus, we have proved (298) under the assumption that a ∈ / {−1, 1}. How can we
complete this solution to a full (unconditional) proof of (298)?
One way would be to check the remaining two cases (a = 1 and a = −1) by
hand. This is easy and can easily be done by the reader. But I will instead show
another way, which requires no computation whatsoever. Namely, forget that we
fixed a. We thus have proved that the equality (298) holds for all complex numbers
a ∈/ {−1, 1}. In other words, we have proved that (298) holds for all a ∈ C \
{−1, 1}. Now, define two polynomials P and Q (with complex coefficients, in a
single variable X) by
! !
n n n
P= ∑ (−1) i
X i
· ∑X i
and Q= ∑ X2i .
i =0 i =0 i =0
203 Again,we have applied (4) to a complex number b; again, this is fine because (4) could just as
well have been stated for a complex number b.
n−b
n a n
= . (304)
a b b a−b
holds if b ∈
First of all, it is easy to see that (304) / N. Indeed, if b ∈ / N, then
a n
both binomial coefficients and / N, then the
are 0 (by (118)). Thus, if b ∈
b b
equality (304) boils down to 0 = 0 (since each of its sides is a product with one
factor equal to 0), which is clearly true. Thus, we WLOG assume that b ∈ N in the
rest of this proof.
If we have a ∈ / N, then we have a − b ∈ / N as well (since otherwise, we would
have a − b ∈ N and therefore a = |a {z b ∈ N, which would contradict
− b} + |{z}
∈N ∈N
n−b
n
a∈/ N), and therefore both binomial coefficients and are 0 (by (118)).
a a−b
Hence, if we have a ∈ / N, then the equality (304) boils down to 0 = 0, which is
clearly true. Thus, we WLOG assume that a ∈ N in the rest of this proof.
Now, we have a, b ∈ N, but we don’t necessarily have n ∈ N. If n ∈ N, then
/N
(304) follows from Proposition 7.5.2, but how can we prove it for n ∈ ?
n
We take a broader view. We have defined the binomial coefficient for any
k
number n; but we can just as well extend this definition by plugging a polynomial
• If k ∈ N, then we set
F ( F − 1) ( F − 2) · · · ( F − k + 1)
F
= . (305)
k k!
/ N, then we set
• If k ∈
F
= 0. (306)
k
X−b
X a X
P (X) = and Q (X) = .
a b b a−b
204 Then, for all x ∈ N, we have
x a X a
P (x) = since P ( X ) =
a b a b
x−b
x
= (by Proposition 7.5.2, applied to x instead of n)
b a−b
= Q (x)
X−b x−b
X x
(since Q ( X ) = and thus Q ( x ) = ). Therefore, Corol-
b a−b b a−b
lary 7.5.7 (applied to S = N) shows that P = Q (since the set N is infinite).
Evaluating both sides of this equality at the number n, we thus find P (n) = Q (n)
204 Explicitly, these polynomials look as follows: We have
X ( X − 1) ( X − 2) · · · ( X − a + 1) a
P (X) = .
a! b
Furthermore, if a − b ∈ N, then
X ( X − 1) ( X − 2) · · · ( X − b + 1) ( X − b ) ( X − b − 1) ( X − b − 2) · · · ( X − b − ( a − b ) + 1)
Q (X) = · .
b! ( a − b)!
X ( X − 1) ( X − 2) · · · ( X − b + 1)
/ N, then Q ( X ) =
(On the other hand, if a − b ∈ · 0 = 0.)
b!
(no matter n ∈ N or n ∈
whether N). But the definitions
/ of P and Q show that
n−b
n a n n a
P (n) = and Q (n) = . Hence, = P (n) = Q (n) =
a b b a−b a b
n−b
n
. This proves (304), and thus Theorem 7.5.4 is proven.
b a−b
Note that we have used the polynomial identity trick (in the shape of Corollary
7.5.7) to generalize the equality (304) from n ∈ N to n ∈ C. However, we did not
use this trick to generalize it from a ∈ N to a ∈ C (or from b ∈ N to b ∈ C); instead,
we have used ad-hoc arguments to prove that (304) holds in the cases a ∈ / N and
b∈ / N. In fact, the polynomial identity trick would
not have helped us here. The
n
reason is that, while the binomial coefficient is a polynomial function in n
k
205 , it is not a polynomial function in k (indeed, n is zero for all negative k, but
k
nonzero for k = 0; but this is not how a polynomial function in k could behave).
Thus we needed a different argument to generalize from a, b ∈ N to a, b ∈ C.
Next, let us derive Theorem 7.5.3 from Proposition 7.5.1. This will use the poly-
nomial identity trick twice – once to generalize from x ∈ N to x ∈ C, and once
again to generalize from y ∈ N to y ∈ C. (Alternatively, we could do it in sitting
if we generalized Corollary 7.5.7 to polynomials in two variables; this is how it is
done in [Grinbe15, §3.3.3, Second proof of Theorem 3.30].)
We begin by showing an “intermediate stage” between Proposition 7.5.1 and
Theorem 7.5.3:
Lemma 7.5.8 is clearly more general than Proposition 7.5.1 but less than Theorem
7.5.3. We shall first deduce this lemma from Proposition 7.5.1, and then use this
lemma to deduce Theorem 7.5.3 in turn. Both deductions will use the polynomial
identity trick.
Proof of Lemma 7.5.8. It shall be convenient for us to rename the variables x and y
as u and v. Thus, we let n ∈ N and u ∈ N and v ∈ C. We must then prove that
n
u+v u v
= ∑ . (307)
n k =0
k n−k
205 This
means that for any fixed number k, there is a
polynomial
P such that each number n satisfies
n X
= P (n). (Namely, this P is the polynomial .)
k k
and therefore
n
u+x u x
P (x) = = ∑
n k =0
k n−k
by Proposition 7.5.1 (applied to u and x instead of x and y),
since u ∈ N and x ∈ N
= Q (x) .
Hence, n
u+v u v
= P (v) = Q (v) = ∑ .
n k =0
k n−k
This proves (307). Thus, Lemma 7.5.8 is proven.
Proof of Theorem 7.5.3. It shall again be convenient for us to rename the variables x
and y as u and v. Thus, we let n ∈ N and u ∈ C and v ∈ C. We must then prove
that n
u+v u v
= ∑ . (308)
n k =0
k n−k
Define two polynomials P and Q (with complex coefficients, in a single variable
X) by n
X+v X v
P (X) = and Q (X) = ∑ .
n k =0
k n−k
206 Here F
we are using binomial coefficients in which F is a polynomial. See our above proof of
k
Theorem 7.5.4 for the definition of this kind of binomial coefficients.
and therefore
n
x+v x v
P (x) = = ∑
n k =0
k n−k
(by Lemma 7.5.8 (applied to y = v), since x ∈ N)
= Q (x) .
Hence, n
u+v u v
= P (u) = Q (u) = ∑ .
n k =0
k n−k
This proves (308). Thus, Theorem 7.5.3 is proven.
After these proofs, it might appear that the polynomial identity trick is magic. In
some ways, this is true, as it allowed us to extend combinatorial proofs to situations
n
in which combinatorics has no say (such as properties of binomial coefficients
k
with non-integer n). However, it has its limitations. For example, we cannot use it
n i
to extend Exercise 4.5.8 (a) to negative n (since ∑ is not a polynomial function
i =0 k
n
in n); nor can we use it to extend Theorem 4.3.10 to negative n (since is
n−k
not a polynomial function in n); nor can we use it to extend Theorem 4.3.8 to
n!
negative n (indeed, does not even make sense when n is negative). See
k! · (n − k )!
[19fco, §2.6.4] for more examples of what can and what cannot be done using the
polynomial identity trick.
207 Here F
we are using binomial coefficients in which F is a polynomial. See our above proof of
k
Theorem 7.5.4 for the definition of this kind of binomial coefficients.
For example, if n = 3, and if the coin comes up tails first, then heads, then tails
again, then heads, then heads, then heads, then tails again, then the event H2
happens (because the coin has come up tails exactly twice by the 4-th time it comes
up heads).
Now we claim that
Pr H = Pr ( H0 ) + Pr ( H1 ) + · · · + Pr ( Hn ) . (309)
The coin comes up tails exactly k times in this outcome O if and only if the set IO
has size k. Thus, we are looking for the# of k-element
subsets of {1, 2, . . ., n + k};
n+k n+k
but Theorem 4.3.12 shows that this # is . Thus, there are precisely
k k
many outcomes (of the first n + k tosses) that have the property that the coin comes
209 Itcannot have come up tails more than n times, since we are only tossing the coin 2n + 1 times.
210 Computing Pr ( Hk ) is known as Banach’s matchbox problem.
211 For example, the outcome “the coin comes up heads, then tails, then heads” is encoded as the
1
up tails exactly k times. Since each outcome has probability , we thus conclude
2n + k
that
Since the event on the left of this equality is precisely Hk , we can rewrite
hand side
n+k 1 1
this equality as Pr ( Hk ) = · n+k · . Thus, (311) is proved.]
k 2 2
Now, (309) becomes
n
Pr H = Pr ( H0 ) + Pr ( H1 ) + · · · + Pr ( Hn ) = ∑ Pr ( Hk )
k =0 | {z }
n+k 1 1
= · ·
k 2n + k 2
(by (311))
n n
n+k 1 1 n+k 1 1 1
= ∑ k
· n+k · = ∑
k
· n· k·
k =0 |2{z } 2 k=0 2 2 2
1 1
= ·
2n 2k
n
1 1 n+k 1
= · n·∑ .
2 2 k =0 k 2k
The same argument (with the roles of heads and tails interchanged) yields
n
1 1 n+k 1
Pr T = · n · ∑ .
2 2 k =0 k 2k
Hence,
n
n+k 1
∑ k 2 k
= 2n .
k =0
This solves Exercise 7.5.2.
The solution we just gave for Exercise 7.5.2 suggests a generalization, which can
be obtained if we replace the fair coin by a biased coin. (See [Grinbe15, Exercise
3.27 (a)] for this generalization, which is known as the Daubechies identity.)
Results like Theorem 7.5.3, Theorem 7.5.4, Theorem 4.3.10, Proposition 4.3.6, The-
orem 4.3.7, Exercise 4.5.8 and Exercise 7.5.2 are commonly called binomial identities,
as they are identities involving binomial coefficients. We shall see several more such
identities in the coming sections. Even more can be found in [GrKnPa94, Chapter
5], [Spivey19], [Riorda68] and [BenQui03]. (The book [BenQui03], in particular, is
devoted to proving such identities by double counting.)
(Some addends on the right hand side of this equality will be 0, but as usual we
are OK with this.)
Now, fix j ∈ [n + 1]. Let us compute
(# of ( x + y + 1) -element subsets U of [n + 1] satisfying minx+1 U = j) .
If U is an ( x + y + 1)-element subset of [n + 1] satisfying minx+1 U = j, then U has
precisely x elements smaller than j (by the definition of minx+1 U) and therefore
precisely ( x + y + 1) − ( x + 1) = y elements larger than j. Hence, we can construct
such a subset U through the following procedure:
j−1
• First, we choose the x elements of U that are smaller than j. We have
x
options for this. (Indeed, the x elements we are choosing need to belong
to [n + 1] and be smaller than j; that is, they need to come from the set
{1, 2, . . . , j − 1}. Thus, we are really choosing an x-element subset of the set
( j − 1)-element set {1, 2, . . . , j − 1}. But Theorem 4.3.12 says that there are
j−1
precisely many such subsets.)
x
n+1−j
• Then, we choose the y elements of U that are larger than j. We have
y
options for this. (Indeed, the y elements we are choosing need to belong
to [n + 1] and be larger than j; that is, they need to come from the set
{ j + 1, j + 2, . . . , n + 1}. Thus, we are really choosing a y-element subset of
the set (n + 1 − j)-element set { j + 1,
j + 2, . . . , n + 1}. But Theorem 4.3.12
n+1−j
says that there are precisely many such subsets.)
y
• We don’t need to decide whether j will be an element of U, since this is
already predetermined: We must have j ∈ U in order to have minx+1 U = j.
j−1 n+1−j
According to the product rule, there are possibilities for how
x y
these choices can be made. Thus,
Before we solve this exercise, let me quickly mention that Exercise 7.6.2 is a
generalization of Proposition 4.3.18. Indeed, if n is a positive integer, then Exercise
7.6.2 (applied to m = 0, a = 1 and b = 0) yields
n
j n 1j + 0
∑ (−1) j 0
= 0 = [ n = 0] (since n 6= 0)
j =0
and thus
n n n
n 1j + 0 n k n
[n = 0] = ∑ (−1) j
= ∑ (−1) j = ∑ (−1) k ;
j
j =0
j 0 j =0 k =0
| {z }
=1
(by (119))
but this is precisely the claim of Proposition 4.3.18 in the case when n > 0. Thus,
in the case when n > 0, Proposition 4.3.18 follows from Exercise 7.6.2. (The case
when n = 0 is trivial.)
There are various ways to solve Exercise 7.6.2, but the following is perhaps the
shortest (and has the advantage of illustrating the usefulness of Exercise 5.4.2):
each x ∈ N satisfies
n
k n
∑ (−1) k P (x − k) = 0
k =0
(since n > m (because we assumed that m < n)). Applying this to x = 0, we obtain
n
k n
∑ (−1) k P (0 − k) = 0.
k =0
Thus,
n n
k n n
0 = ∑ (−1) − }k = ∑ (−1)
P 0| {z k
P (−k )
k =0
k k =0
k | {z }
=−k
− a (−k) + b
=
m
− aX + b
(since P( X )= )
m
n n
− a (−k) + b
k n k n ak + b
= ∑ (−1) = ∑ (−1)
k =0
k m k m
| {z } k=0
ak + b
=
m
(since − a(−k)= ak)
n
j n aj + b
= ∑ (−1) .
j =0
j m
Example 7.6.3. (a) Here are three set partitions of the set [6] = {1, 2, 3, 4, 5, 6}:
Note that the set partitions P2 and P3 are actually identical (since the order of
elements in a set does not matter).
(b) Here are all set partitions of the set [3] = {1, 2, 3}:
And here are the same set partitions, drawn as pictures (each block of the set
partition is drawn as a blob):
3 3 3
3 3
1 2 1 2 1 2
1 2 1 2
Thus, we can transform an equivalence relation into a set partition and vice
versa. These two transformations are mutually inverse, so they are bijections between
Remark 7.6.4. Let n ∈ N. The # of all set partitions of [n] is known as the n-th Bell
number Bn . The sequence ( B0 , B1 , B2 , . . .) = (1, 1, 2, 5, 15, 52, 203, . . .) is Sequence
A000110 in the OEIS, and has the following nice recursive formula:
n
n
Bn+1 = ∑ B for each n ∈ N.
k =0
k k
(It is a neat exercise on counting to prove this. A proof can be found in [Guicha20,
Theorem 1.4.3].) No closed form expression for Bn is known. (See [Gardne91,
Chapter Two] for a popular-science survey of Bell numbers.)
Definition 7.6.5. Let S be a set. A perfect matching of S shall mean a set partition
{ E1 , E2 , . . . , Ek } of S such that E1 , E2 , . . . , Ek are 2-element sets.
Example 7.6.6. (a) Here are all perfect matchings of the set [4] = {1, 2, 3, 4}:
And here are the same perfect matchings, drawn as pictures (each block of the
perfect matching is drawn as a blob):
2 3 2 3 2 3
1 4 1 4 1 4
(b) The set [6] has 15 perfect matchings; three of them are
{{1, 2} , {3, 4} , {5, 6}} , {{1, 4} , {2, 6} , {3, 5}} , {{1, 6} , {2, 5} , {3, 4}} .
One can think of a perfect matching of a set S as a way to pair up the elements of
S with each other in such a way that each element of S ends up in exactly one pair.
(Here, the word “pair” is to be understood in its common-language meaning, not
in its mathematical meaning; the correct mathematical word is “two-element set”.)
{equivalence relations on S} and {set partitions on S} (for a given set S). The proof of this
is completely straightforward axiom checking; you can find it spelled out in [Goodma15, Propo-
sition 2.6.7].
Exercise 7.6.3. Let n ∈ N. Let S be an n-element set. Find the # of all perfect
matchings of S.
We shall sketch two solutions to Exercise 7.6.3, without ever going fully rigorous
(which would be rather tedious in this particular case). Our first solution will use a
decision procedure to construct a perfect matching of S (which will allow counting
the perfect matchings of S via the dependent product rule), while our second will
exemplify a counting strategy known as overcounting.
First solution to Exercise 7.6.3 (sketched). Let us first show the following:
n = |S| = | E1 ∪ E2 ∪ · · · ∪ Ek | (since S = E1 ∪ E2 ∪ · · · ∪ Ek )
= | E1 | + | E2 | + · · · + | Ek | (since E1 , E2 , . . . , Ek are disjoint)
= 2| + 2 +{z· · · + 2} (since | E1 | = 2, | E2 | = 2, . . . , | Ek | = 2)
k times
= k · 2 = 2k.
This entails that n is even. This contradicts the fact that n is odd. This contradiction
shows that our assumption was false. Hence, Claim 1 is proven.]
Claim 1 solves Exercise 7.6.3 in the case when n is odd. Thus, for the rest of this
solution, we WLOG assume that n is even. Thus, n/2 ∈ N.
We WLOG assume that S = [n]. Indeed, S is an n-element set, so we can relabel
the elements of S as 1, 2, . . . , n; this clearly does not change the # of perfect match-
ings of S (because, as we relabel the elements of S, we can relabel the elements of
the blocks in all perfect matchings of S 215 ).
If P is a perfect matching of S, then we shall say that two distinct elements of S
are partners of each other (in P) if and only if they belong to one and the same block
215 What we are actually using here is the “isomorphism principle”. See [19fco, §1.7.2] for some more
discussion about this principle.
• Choose the partner of 1 (in P). There are n − 1 options for this (since the
partner of 1 must be distinct from 1). We declare both 1 and its partner to be
partnered.
• Take the smallest unpartnered element p3 of S, and choose its partner. There
are n − 5 options (since neither p3 nor the four partnered elements qualify as
partners). We declare both p3 and its partner to be partnered.
(n − 1) (n − 3) (n − 5) · · · (n − 2 (n/2) + 1)
possibilities for how these choices can be made. Each possibility leads to a different
perfect matching of S, and each perfect matching of S can be obtained in this way.
216 We call an element of S unpartnered if we have not declared it to be partnered yet. (Of course,
in the perfect matching we are constructing, it will eventually have a partner.) The smallest
unpartnered element of S is 2 if the partner we have chosen for 1 is distinct from 2; otherwise, it
is 3.
Hence,
(# of perfect matchings of S)
= (n − 1) (n − 3) (n − 5) · · · (n − 2 (n/2) + 1)
| {z }
=1
= ( n − 1) ( n − 3) ( n − 5) · · · 1
= 1 · 3 · 5 · · · · · |{z}
n −1 (317)
=2(n/2)
= 1 · 3 · 5 · · · · · (2 (n/2) − 1)
(2 (n/2))!
= n/2 (by Exercise 4.2.3, applied to n/2 instead of n)
2 (n/2)!
n!
= n/2 (since 2 (n/2) = n) . (318)
2 · (n/2)!
Combining this with Claim 1, we thus conclude that
0,
if n is odd;
(# of perfect matchings of S) = n!
2n/2 · (n/2)! ,
if n is even.
[Remark: Instead of proving Claim 1 the way we did above, we could have used
the same decision procedure that we used in the case when n is even. This would
have given a different proof of Claim 1. Indeed, the last decision in our decision
procedure requires choosing a partner for the smallest unpartnered element; if n
is odd, then there are 0 options for it, because the smallest unpartnered element
at that point is the last unpartnered element and thus cannot find a partner. This
entails that (if n is odd) the number of possibilities is (n − 1) (n − 3) (n − 5) · · · 0 =
0. Thus, Claim 1 is proved again.]
Second solution to Exercise 7.6.3 (sketched). As in the first solution above, we can show
that (# of perfect matchings of S) = 0 when n is odd. Thus, for the rest of this so-
lution, we WLOG assume that n is even.
Again, as in the first solution above, we WLOG assume that S = [n]. Thus, we
need to find the # of perfect matchings of [n].
To each permutation σ of [n], we assign the perfect matching
(Note that this is well-defined because n is even, and is a perfect matching because
σ is bijective.) Thus, we have found a map
We know that there are n! permutations of [n]. What does this mean about the #
of perfect matchings of [n] ?
The map M is not a bijection (unless n = 0), since different permutations σ
can lead to the same perfect matching M (σ). Thus, we cannot apply the bijection
principle. However, we might be able to salvage the idea if we can compute how
many different permutations σ lead to a single perfect matching.
Thus, let us fix a perfect matching P of [n]. How many permutations σ of [n]
satisfy M (σ) = P ?
Each block of P is a 2-element set (since P is a perfect matching), and the sum of
the sizes of these 2-element sets is |[n]| (since P is a set partition of [n]). Thus, the
# of blocks of P is |[n]| /2 = n/2. In other words, P has exactly n/2 blocks. Hence,
|{z}
=n
we can write P in the form
• Then, we decide which of the two elements of the 2-element set {σ (3) , σ (4)}
will be σ (3). There are 2 options for this. The other (unchosen) element will
then be σ (4).
• And so on, until all values σ (1) , σ (2) , . . . , σ (n) have been chosen.
The dependent product rule shows that the total # of possibilities for how these
choices can be made is
(n/2)! · 2| · 2 ·{z· · · · 2} = (n/2)! · 2n/2 .
n/2 times
Hence,
(# of permutations σ of [n] satisfying M (σ) = P)
= (n/2)! · 2n/2 . (319)
Now, forget that we fixed P. We thus have proved (319) for each perfect matching
P of [n]. Note that the right hand side of (319) does not depend on P; it is the same
for all P. This is what will now allow us to compute the # of perfect matchings of
[ n ].
For each permutation σ of [n], we know that M (σ) is a perfect matching of [n].
Hence, by the sum rule217 , we have
(# of permutations σ of [n])
= ∑ (# of permutations σ of [n] satisfying M (σ) = P)
P is a perfect
| {z }
matching of [n] =(n/2)!·2n/2
(by (319))
= ∑ (n/2)! · 2n/2
P is a perfect
matching of [n]
217 more
precisely, by the slightly more flexible version of the sum rule we will state below (as
Theorem 7.6.7)
Theorem 7.6.7 (Sum rule in map form). Let S and W be two finite sets. Let
f : S → W be a map. Then,
that is not (in general) a bijection, but nevertheless has the property that it takes
all possible values the same number of times. (That is, the # of permutations σ
of [n] satisfying M (σ) = P is the same for all perfect matchings P.) This allowed
us to relate the # of perfect matchings of [n] with the # of permutations of [n].
This strategy is known as the shepherd’s principle: “If you want to count a flock of
sheep, count the legs and divide by 4”. In our case, the sheep were the perfect
matchings of [n], and the legs were the permutations of [n]. (So each sheep had
2n/2 · (n/2)! legs, and the map M sent each leg to its sheep.) Uses of this principle
abound in combinatorics; in particular, Theorem 4.3.12 can be proved using it (see
[LeLeMe16, §15.5.1] or [19fco, §2.7] for this proof). The shepherd’s principle is also
known as the division rule or rule of division, although (as we have seen) it is a simple
consequence of the sum rule and there is usually nothing gained by stating it as a
separate theorem.
A different variant of our second solution to Exercise 7.6.3 appears in [18f-hw3s,
solution to Exercise 3 (c)]. We also note that the case of Exercise 7.6.3 for n even
appears in [Engel98, Chapter 5, Example E8] (our n is denoted by 2n there).
Exercise 7.7.2. Let n be a positive integer. Prove that the number of even positive
divisors of n is even if and only if n/2 is not a perfect square.
(Recall that the summation sign “ ∑ ” means “sum over all subsets S of [n]
S⊆[n];
|S|=r
satisfying |S| = r”, that is, “sum over all r-element subsets S of [n]”.)
|U \ A | = |U | − | A | . (320)
In fact, this is just Theorem 7.1.8 (applied to U and A instead of A and B).
|U \ ( A ∪ B)| = |U | − | A| − | B| + | A ∩ B| . (321)
Indeed, this is not hard to see by applying (320) three times218 . Alternatively,
there is a simple intuitive way to convince yourself of (321): If A and B are two
218 Here are the details: Let U be a finite set, and let A and B be two subsets of U. Then, it
is known from set theory (or easy to verify by drawing Venn diagrams) that U \ ( A ∪ B) =
subsets of a finite set U, then you can try to count the elements of U \ ( A ∪ B)
by starting with |U | and subtracting | A| and | B|. However, this will leave the
elements of A ∩ B subtracted twice instead of once; this flaw can be corrected
by adding | A ∩ B| back in. This leads to the equality (321).
|U \ ( A ∪ B ∪ C )| = |U | − | A| − | B| − |C | + | A ∩ B| + | A ∩ C | + | B ∩ C |
− | A ∩ B ∩ C| . (322)
This, too, can be proved by applying (320) several times (or, more easily, by
applying (320) once and (321) twice, using U \ ( A ∪ B ∪ C ) = (U \ ( A ∪ B)) \
(C \ (( A ∩ C ) ∪ ( B ∩ C )))). We leave the proof to the interested reader. Again,
(U \ A) \ ( B \ ( A ∩ B)). Hence,
The three identities (320), (321) and (322) appear to be parts of a pattern: The left
hand sides have the form |U \ ( A1 ∪ A2 ∪ · · · ∪ An )| for some subsets A1 , A2 , . . . , An
of a finite set U, and the right hand sides are signed sums of the sizes of intersec-
tions of some of these subsets (including |U |, which we consider to be the “trivial
intersection”). This pattern indeed persists; let us state it in its general form:
219 Best done with a Venn diagram at hand (courtesy of Alain Matthes on tex.stackexchange):
A∩B B∩C
A∩B∩C
A C
A∩C
|U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
= |U |
− | A1 | − | A2 | − · · · − | A n |
| {z }
all sizes | Ai |
+ | A 1 ∩ A 2 | + | A 1 ∩ A 3 | + · · · + | A n −1 ∩ A n |
| {z }
all sizes | Ai ∩ A j | with i < j
− | A 1 ∩ A 2 ∩ A 3 | − | A 1 ∩ A 2 ∩ A 4 | − · · · − | A n −2 ∩ A n −1 ∩ A n |
| {z }
all sizes | Ai ∩ A j ∩ Ak | with i < j<k
±···
+ (−1)n | A1 ∩ A2 ∩ · · · ∩ An |
n
= ∑ (−1)m ∑ A i1 ∩ A i2 ∩ · · · ∩ A i m .
m =0 (i1 ,i2 ,...,im )∈[n]m ;
i1 <i2 <···<im
The right hand side of the equality in Theorem 7.8.1 is rather unwieldy, and the
“middle hand side” (which is just a rewritten version of the right hand side without
using the ∑ sign) is even worse. Thus, let us introduce a notation that will allow
us to restate Theorem 7.8.1 in a simpler way:
Definition 7.8.2. Let I be a nonempty set. For each i ∈ I, let Ai be a set. Then,
T
Ai denotes the set
i∈ I
{ x | x ∈ Ai for each i ∈ I } .
Ai is called the intersection of all Ai with i ∈ I.
T
This set
i∈ I
It is easy to see that if I = {i1 , i2 , . . . , im } is a finite set, and if Ai is a set for each
i ∈ I, then \
A i = A i1 ∩ A i2 ∩ · · · ∩ A i m . (323)
i∈ I
T
The notation Ai (for the intersection of a family of sets) is similar to the no-
i∈ I
tation ∑ ai (for the sum of a finite family of numbers). However, in the notation
i∈ I
Ai , the set I must be nonempty (unlike in ∑ ai ) but can be infinite (unlike in
T
i∈ I i∈ I
∑ ai , which is usually undefined when I is infinite).
i∈ I
Now, we can restate Theorem 7.8.1 as follows:
∑ (−1)| I |
\
|U \ ( A1 ∪ A2 ∪ · · · ∪ An )| = Ai . (324)
I ⊆[n] i∈ I
T
Here, the “empty” intersection Ai is understood to mean the set U.
i ∈∅
T
Remark 7.8.4. We have defined the “empty” intersection Ai in Theorem 7.8.3;
i ∈∅
why didn’t we already do this back in Definition 7.8.2?
The reason is that we have had U available in Theorem 7.8.3, and, in a sense,
were treating A1 , A2 , . . . , An as subsets of U rather than just as arbitrary sets.
Had we tried to extend Definition 7.8.2 to the case when I = ∅, we would have
obtained \
Ai = { x | x ∈ Ai for each i ∈ ∅} = {all x }
i ∈∅
Combining Theorem 7.8.3 with the difference rule, we also obtain the following:
∑ (−1)| I |−1
\
| A1 ∪ A2 ∪ · · · ∪ A n | = Ai . (325)
I ⊆[n]; i∈ I
I 6 =∅
Theorem 7.8.3 and Theorem 7.8.5 are known as the principle(s) of inclusion and
exclusion or as the Sylvester sieve formulas. (The word “sieve” refers to the metaphor-
ical view that the sums on the right hand sides of (324) and (325) are “sieving” the
(# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n])
= ∑ (−1)| I | (# of x ∈ U satisfying x ∈ Ai for all i ∈ I ) . (326)
I ⊆[n]
Theorem 7.8.6 is equivalent to Theorem 7.8.3 because each side of the equality
(326) equals to the corresponding side of (324). (We shall explain this in more detail
in Subsection 7.8.3 below.)
Proof of Theorem 7.8.7 (sketched). (See [19fco, §2.4.5, proof of Proposition 2.4.11, and
§2.9.4, proof of Theorem 2.4.17] for more details.220 ) We WLOG assume that B = [n]
(since otherwise, we can just relabel the n elements of B as 1, 2, . . . , n, without
changing the # of all surjective maps from A to B).
We say that a map f : A → B misses an element i ∈ B if f does not take i as
a value (i.e., if there exists no a ∈ A such that i = f ( a)). (The terminology is
motivated by the standard illustrations in which maps are drawn as collections of
arrows.)
We let U = B A = {all maps from A to B}. For each i ∈ [n], we define a subset
Ai of U by
220 See also [Gunder10, Exercise 595] or [19fco, solution to Exercise 2.4.4] for alternative proofs.
(here, we have substituted n − i for k in the sum). This proves Theorem 7.8.7.
As a welcome byproduct of Theorem 7.8.7, we obtain two binomial identities:
Proof of Corollary 7.8.8. (a) We could easily obtain Corollary 7.8.8 (a) by applying
Exercise 5.4.2 (d) to the polynomial P ( x ) = x m ; however, let us instead derive it
from Theorem 7.8.7.
Indeed, let n, m ∈ N satisfy m < n. Then, |[m]| = m and |[n]| = n. Thus,
|[m]| = m < n = |[n]|; therefore, Theorem 6.1.7 (applied to U = [m] and V = [n])
shows that a map f : [m] → [n] cannot be surjective. In other words, there exists
no surjective map f : [m] → [n]. In other words,
(since [m] is an m-element set, whereas [n] is an n-element set). Comparing these
n n
two equalities, we obtain ∑ (−1)n−i im = 0. This proves Corollary 7.8.8 (a).
i =0 i
(b) Let n ∈ N. Corollary 6.2.9 (b) (applied to X = [n]) shows that any surjective
map f : [n] → [n] is a permutation of [n]. In other words, any surjective map
from [n] to [n] is a permutation of [n]. Conversely, any permutation of [n] is a
surjective map from [n] to [n] (because any permutation is bijective and thus sur-
jective). Combining the results of the previous two sentences, we conclude that the
permutations of [n] are precisely the surjective maps from [n] to [n]. Hence,
(by Theorem 7.8.7, applied to m = n, A = [n] and B = [n]). Comparing this with
We shall prove Theorem 7.8.9 and then derive Theorem 7.8.6 and Theorem 7.8.3
from it. The proof will rely on an innocent little proposition which I occasionally
call the cancellation lemma, as it is about a sum of +1s and −1s that cancel each
other out221 :
∑ (−1)| I | = [S = ∅] .
I ⊆S
Once again, we are using the Iverson bracket notation here (see Definition 4.3.19).
Example 7.8.11. The subsets of {1, 2} are ∅, {1}, {2} and {1, 2}. Thus, applying
Proposition 7.8.10 to S = {1, 2}, we find
Indeed, both sides of this equality are 0 (the left hand side because the addends
cancel; the right hand side because {1, 2} 6= ∅).
221 Aside:This is far from the only “cancellation lemma” in mathematics! There are various others,
n −1 2kgπ
such as ∑ cos = n · [n | g] for any positive integer n and any g ∈ Z. Here, it is no longer
k =0 n
+1s and −1s cancelling each other, but rather different phases of the cosine wave. With complex
numbers available, this can be improved even further to
n −1
∑ e2kgπi/n = n · [n | g] ,
k =0
∑ (−1)| I |
I ⊆S
= ∑ ∑ (−1)| I | = ∑ ∑ (−1)k
k∈{0,1,...,n} I ⊆S; k∈{0,1,...,n} I ⊆S;
| {z }
| I |=k =(−1)k | I |=k
(since | I |=k) | {z }
=(# of subsets I of S satisfying | I |=k)·(−1)k
= ∑ ∑ (−1)| I | w ( x ) . (329)
x ∈U I ⊆[n];
x ∈ Ai for all i ∈ I
(Here, for the last equality sign, we have interchanged the two summation signs; as
usual, the “x ∈ Ai for all i ∈ I” condition moved under the inner summation sign.
This relied on Theorem 4.1.25.)
Now, fix x ∈ U. We shall compute the sum ∑ (−1)| I | .
I ⊆[n];
x ∈ Ai for all i ∈ I
S = {i ∈ [ n ] | x ∈ Ai } .
( x ∈ Ai for all i ∈ I ) ⇐⇒ ( I ⊆ S)
(that is, the statement “x ∈ Ai for all i ∈ I” holds if and only if the statement
“I ⊆ S” holds)222 . Hence, the condition “x ∈ Ai for all i ∈ I” under the summation
sign ∑ can be replaced by “I ⊆ S”. We thus obtain
I ⊆[n];
x ∈ Ai for all i ∈ I
({i ∈ [n] | x ∈ Ai } = ∅)
⇐⇒ (there exists no i ∈ [n] such that x ∈ Ai )
⇐⇒ ( x ∈
/ Ai for all i ∈ [n]) . (332)
However, equivalent logical statements have equal truth values: i.e., if A and B are
two equivalent logical statements, then [A] = [B]. Therefore, from the equivalence
(332), we obtain the equality
[{i ∈ [n] | x ∈ Ai } = ∅] = [ x ∈
/ Ai for all i ∈ [n]] .
222 Proof. Let I be a subset of [n]. For any i ∈ [n], we have the logical equivalence
(i ∈ S) ⇐⇒ ( x ∈ Ai ) (330)
∑ (−1)| I | = [ x ∈
/ Ai for all i ∈ [n]] . (333)
I ⊆[n];
x ∈ Ai for all i ∈ I
Now, forget that we fixed x. We thus have proved (333) for each x ∈ U.
Now, (329) becomes
∑ (−1)| I | ∑ w (x)
I ⊆[n] x ∈U;
x ∈ Ai for all i ∈ I
= ∑ ∑ (−1)| I | w ( x )
x ∈U I ⊆[n];
x ∈ Ai for all i ∈ I
∑ ∑ (−1)| I |
=
w (x)
x ∈U I ⊆[n];
x ∈ Ai for all i ∈ I
| {z }
=[ x ∈
/ Ai for all i ∈[n]]
(by (333))
= ∑ [x ∈
/ Ai for all i ∈ [n]] w ( x )
x ∈U
= ∑ [x ∈
/ Ai for all i ∈ [n]] w (x)
x ∈U;
| {z }
x∈
/ Ai for all i ∈[n] =1
(since we have ( x ∈
/ Ai for all i ∈[n]))
+ ∑ [x ∈
/ Ai for all i ∈ [n]] w (x)
x ∈U;
| {z }
not ( x ∈
/ Ai for all i ∈[n]) =0
(since we don’t have ( x ∈
/ Ai for all i ∈[n]))
since each x ∈ U either satisfies ( x ∈
/ Ai for all i ∈ [n])
or does not
= ∑ 1w ( x ) + ∑ 0w ( x ) = ∑ w (x) .
x ∈U; x ∈U; x ∈U;
| {z }
/ Ai for all i ∈[n] =w( x )
x∈ not ( x ∈
/ Ai for all i ∈[n]) x∈
/ Ai for all i ∈[n]
| {z }
=0
However,
∑ w (x)
x ∈U;
| {z }
x∈
/ Ai for all i ∈[n] =1
(by the definition of w( x ))
= ∑ 1 = (# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n]) · 1
x ∈U;
x∈
/ Ai for all i ∈[n]
= (# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n]) . (335)
∑ w (x)
x ∈U;
| {z }
x ∈ Ai for all i ∈ I =1
(by the definition of w( x ))
(# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n])
= ∑ (−1)| I | (# of x ∈ U satisfying x ∈ Ai for all i ∈ I ) .
I ⊆[n]
|U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
= (# of x ∈ U satisfying x ∈ / Ai for all i ∈ [n])
= ∑ (−1)| I | (# of x ∈ U satisfying x ∈ Ai for all i ∈ I ) (337)
I ⊆[n]
since the condition “x ∈ Ai for all i ∈ ∅” is vacuously true for all x ∈ U. On the
other hand, \
Ai = U,
i ∈∅
T
since we defined the “empty intersection” Ai to be U. Comparing this with
i ∈∅
(338), we obtain \
Ai = { x ∈ U | x ∈ Ai for all i ∈ ∅} .
i ∈∅
In other words, Claim 1 holds for I = ∅. Thus, for the rest of this proof, we WLOG
assume that I 6= ∅. This assumption is helpful, since we defined
T
Ai differently
T i ∈∅
than we defined Ai for nonempty I.
i∈ I
Now we know that I is nonempty (since I 6= ∅). Hence,
T
Ai is literally the
i∈ I
intersection of the sets Ai for i ∈ I. Since the latter sets Ai are subsets of U, we thus
T
conclude that their intersection Ai is also a subset of U (since any intersection of
i∈ I
subsets of U is a subset of U). Therefore,
!
\ \
Ai = U ∩ Ai
i∈ I i∈ I
= U ∩ { x | x ∈ Ai for each i ∈ I }
T
since the definition of Ai
i∈ I
Ai = { x | x ∈ Ai for each i ∈ I }
T
yields
i∈ I
= { x ∈ U | x ∈ Ai for each i ∈ I }
= { x ∈ U | x ∈ Ai for all i ∈ I } .
Now,
∑ (−1)| I |
\
Ai
I ⊆[n] i∈ I
| {z }
={ x ∈U | x ∈ Ai for all i ∈ I }
(by Claim 1)
= ∑ |I|
(−1) (# of x ∈ U satisfying x ∈ Ai for all i ∈ I ) .
I ⊆[n]
∑ (−1)| I |
\
|U \ ( A1 ∪ A2 ∪ · · · ∪ An )| = Ai .
I ⊆[n] i∈ I
U \( A1 ∪ A2 ∪···∪ An )
wdµ = ∑ (−1) |I|
T
Ai
wdµ
I ⊆[n] i∈ I
∑ (−1)| I |
\
|U | − |U \ ( A1 ∪ A2 ∪ · · · ∪ An )| = |U | − Ai .
I ⊆[n] i∈ I
But the left hand side of this equality is easily seen to be | A1 ∪ A2 ∪ · · · ∪ An |, whereas the right
| I |−1
∑ (−1) Ai (since the |U | term cancels the I = ∅ addend in the sum).
T
hand side is
I ⊆[n]; i∈ I
I 6 =∅
Thus, we obtain (325), and thus Theorem 7.8.5 is proved.
This exercise is [18s-hw3s, Exercise 5], but we shall give two solutions different
from the one given in [18s-hw3s] (although the second one is related).
First solution of Exercise 7.8.1 (sketched). Forget that we fixed n. For each n ∈ N, we
let en denote the # of 1-even n-tuples in [d]n . We thus must compute en for each
n ∈ N.
We shall do this similarly to how we solved Exercise 7.3.2 (c): We will first es-
tablish a recursive equation for en in terms of en−1 , and then solve this equation to
obtain an explicit formula.
We first notice that e0 = 1. Indeed, there is only one 0-tuple in [d]0 (namely, the
empty list ()), and this 0-tuple is 1-even (since the number 1 occurs 0 times in it).
Now, let n be a positive integer. Then, the definition of en yields224
en = (# of 1-even n-tuples)
d
= ∑ (# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k)
k =1
(by the sum rule, since xn ∈ [d] for each n-tuple ( x1 , x2 , . . . , xn )).
We now want to compute the # of 1-even n-tuples ( x1 , x2 , . . . , xn ) ∈ [d]n satisfying
xn = k for a given k ∈ [d]. The answer will depend on whether k is 1 or not.
224 Inthe following argument, the word “n-tuple” will always mean “n-tuple in [d]n ”, and similarly
the word “(n − 1)-tuple” will always mean “(n − 1)-tuple in [d]n−1 ”. We will not need tuples of
elements of sets other than [d].
First, we can find the answer if k is not 1: For each k ∈ [d] satisfying k 6= 1, we
have
(# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k)
= e n −1 . (339)
[Proof of (339): Let k ∈ [d] satisfy k 6= 1. If an n-tuple ( x1 , x2 , . . . , xn ) satisfies
xn = k, then the number 1 occurs as often in the (n − 1)-tuple ( x1 , x2 , . . . , xn−1 ) as it
does in the n-tuple ( x1 , x2 , . . . , xn ) (since we have xn = k 6= 1, and thus the removal
of the last entry xn from the n-tuple ( x1 , x2 , . . . , xn ) does not affect the occurrences
of 1 in this n-tuple). Thus, in particular, if an n-tuple ( x1 , x2 , . . . , xn ) satisfying
xn = k is 1-even, then the (n − 1)-tuple ( x1 , x2 , . . . , xn−1 ) is 1-even. Hence, we
obtain a map
{1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k} → {1-even (n − 1) -tuples} ,
( x 1 , x 2 , . . . , x n ) 7 → ( x 1 , x 2 , . . . , x n −1 ) .
This map is easily seen to be a bijection225 . Thus, the bijection principle yields
|{1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k}|
= |{1-even (n − 1) -tuples}| = (# of 1-even (n − 1) -tuples) = en−1
(since en−1 was defined as the # of 1-even (n − 1)-tuples). But this is clearly equiv-
alent to (339). This proves (339).]
Next, let us answer our question for k = 1: We have
(# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = 1)
= d n −1 − e n −1 . (340)
= d n −1 − e n −1 .
225 Indeed, the map
{1-even (n − 1) -tuples} → {1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k} ,
( x 1 , x 2 , . . . , x n −1 ) 7 → ( x 1 , x 2 , . . . , x n −1 , k )
is easily seen to be well-defined and inverse to it.
Now, what does this have to do with the 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying
xn = 1 ?
If an n-tuple ( x1 , x2 , . . . , xn ) satisfies xn = 1, then the number 1 occurs one less
time in the (n − 1)-tuple ( x1 , x2 , . . . , xn−1 ) than it does in the n-tuple ( x1 , x2 , . . . , xn )
(since we have xn = 1, and thus the removal of the last entry xn from the n-tuple
( x1 , x2 , . . . , xn ) removes exactly one occurrence of 1 from this n-tuple). Thus, in
particular, if an n-tuple ( x1 , x2 , . . . , xn ) satisfies xn = 1, and if the number 1 occurs
an even number of times in this n-tuple, then the number 1 will occur an odd
number of times in the (n − 1)-tuple ( x1 , x2 , . . . , xn−1 ). In other words, if an n-tuple
( x1 , x2 , . . . , xn ) satisfying xn = 1 is 1-even, then the (n − 1)-tuple ( x1 , x2 , . . . , xn−1 )
is 1-odd. Hence, we obtain a map
{1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = 1} → {1-odd (n − 1) -tuples} ,
( x 1 , x 2 , . . . , x n ) 7 → ( x 1 , x 2 , . . . , x n −1 ) .
This map is easily seen to be a bijection226 . Thus, the bijection principle yields
|{1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = 1}|
= |{1-odd (n − 1) -tuples}| = (# of 1-odd (n − 1) -tuples) = dn−1 − en−1 .
But this is clearly equivalent to (340). This proves (340).]
Now, recall that
d
en = ∑ (# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k)
k =1
= (# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = 1)
| {z }
= d n −1 − e n −1
(by (340))
d
+ ∑ (|# of 1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = k)
k =2
{z }
= e n −1
(by (339) (since k≥2>1 and thus k6=1))
here, we have split off the addend for k = 1
from the sum
d
= d n −1 − e n −1 + ∑ e n −1 = d n −1 − e n −1 + ( d − 1 ) e n −1
k =2
| {z }
=(d−1)en−1
= d n −1 + ( d − 2 ) e n −1 .
226 Indeed, the map
{1-odd (n − 1) -tuples} → {1-even n-tuples ( x1 , x2 , . . . , xn ) satisfying xn = 1} ,
( x 1 , x 2 , . . . , x n −1 ) 7 → ( x 1 , x 2 , . . . , x n −1 , 1 )
is easily seen to be well-defined and inverse to it.
e n = d n −1 + ( d − 2 ) e n −1 (341)
We can attempt to solve this recurrence by substituting this equality back into itself:
e n = d n −1 + u e n −1 (by (342))
|{z}
=dn−2 +uen−2
(by (342))
n −1
n −2
=d +u
d +u e n −2
|{z}
=dn−3 +uen−3
(by (342))
= d n −1 + u d n −2 + u d n −3 + u e n −3
|{z}
=···
= ···
= d n −1 + u d n −2 + u d n −3 + u · · · + u d 0 + u e0
|{z}
=1
= d n −1 + u d n −2 + u d n −3 + u · · · + u d 0 + u
= d| n−1 + udn−2 + u2 dn−3 {z
+ u3 dn−4 + · · · + un−1 d}0 +un
n −1
= ∑ u i d n −1− i
i =0
un − dn
=
u−d
(since (82) (applied to m=n and a=u and b=d)
n −1
yields (u−d) ∑ ui dn−1−i =un −dn )
i =0
un − dn un − dn
= + un = + un since u − d = d − 2 − d = −2
u−d −2 |{z}
= d −2
1 1 n
= (dn + un ) = d + ( d − 2) n
(since u = d − 2) .
2 2
Thus we have obtained the explicit formula
1 n
d + ( d − 2) n
en = (343)
2
for each n ∈ N.
As with most such formulas, once they are known, they are easy to prove by induction.
For example, here is a quick inductive proof of (343):
[Alternative proof of (343): We shall prove (343)
by inductionon n:
1 0 1
Induction base: Comparing e0 = 1 with d + (d − 2)0 = (1 + 1) = 1, we obtain
2 |{z} | {z } 2
=1 =1
1 0
e0 = d + (d − 2)0 . In other words, (343) holds for n = 0.
2
Induction step: Let m be a positive integer. Assume (as the induction hypothesis) that
(343) holds for n = m − 1. We must show that (343) holds for n = m.
We have assumed that (343) holds for n = m − 1. In other words, we have em−1 =
1 m −1
d + (d − 2)m−1 . Now, (341) (applied to n = m) yields
2
e m = d m −1 + ( d − 2 ) e m −1
|{z}
1 m −1
=(d +(d−2)m−1 )
2
1 m −1
= d m −1 + ( d − 2 ) · d + ( d − 2 ) m −1
2
1
= d m −1 + d · d m −1 + ( d − 2 ) m −1 − d m −1 + ( d − 2 ) m −1
2
1 m −1
= d· d + ( d − 2 ) m −1 − ( d − 2 ) m −1
2
1
m −1 m −1
m −1
= d · d + ( d − 2) −2 ( d − 2)
2 |
{z }
=ddm−1 +d(d−2)m−1
1ddm−1 + d (d − 2)m−1 − 2 (d − 2)m−1
=
2 | {zm } | {z }
=d
=(d−2)(d−2)m−1 =(d−2)m
1 m
d + ( d − 2) m .
=
2
In other words, (343) holds for n = m. This completes the induction step. Thus, (343) is
proved.]
Exercise 7.8.1 is answered by (343).
Second solution of Exercise 7.8.1 (sketched). Here is a more elegant argument.
Having introduced the notion of “1-even” tuples, let us also introduce the op-
posite notion: An n-tuple ( x1 , x2 , . . . , xn ) ∈ [d]n will be called 1-odd if the number
1 occurs in it an odd number of times. Thus, any n-tuple ( x1 , x2 , . . . , xn ) ∈ [d]n is
either 1-even or 1-odd (but not both at the same time).
Let en denote the # of 1-even n-tuples in [d]n . Let on denote the # of 1-odd n-tuples
in [d]n . Thus, we must compute en .
Thus, s (1) = −1 and s (2) = s (3) = · · · = s (d) = 1. Why are we defining these
strange numbers? We will soon see.
If ( x1 , x2 , . . . , xn ) ∈ [d]n is an n-tuple, then
(
1, if ( x1 , x2 , . . . , xn ) is 1-even;
s ( x1 ) s ( x2 ) · · · s ( x n ) = (346)
−1, if ( x1 , x2 , . . . , xn ) is 1-odd.
∑ s ( x1 ) s ( x2 ) · · · s ( x n )
( x1 ,x2 ,...,xn )∈[d]n
| {z }
1, if ( x1 , x2 , . . . , xn ) is 1-even;
=
−1, if ( x , x , . . . , x ) is 1-odd
1 2 n
(
1, if ( x1 , x2 , . . . , xn ) is 1-even;
= ∑ −1, if ( x1 , x2 , . . . , xn ) is 1-odd.
( x1 ,x2 ,...,xn )∈[d]n
This sum has en many addends equal to 1 (since there are en many 1-even n-tuples
( x1 , x2 , . . . , xn ) ∈ [d]n ) and on many addends equal to −1 (since there are on many
1-odd n-tuples ( x1 , x2 , . . . , xn ) ∈ [d]n ). Hence, this sum simplifies to
en · 1 + on · (−1) = en − on .
Thus, we obtain
∑ s ( x1 ) s ( x2 ) · · · s ( x n ) = e n − o n .
( x1 ,x2 ,...,xn )∈[d]n
Hence,
en − on = ∑ s ( x1 ) s ( x2 ) · · · s ( x n ) = ∑ s (k1 ) s (k2 ) · · · s (k n )
( x1 ,x2 ,...,xn )∈[d]n (k1 ,k2 ,...,k n )∈[d]n
(here, we have renamed the summation index). On the other hand, Theorem 4.2.14
(applied to mi = d and pi,k = s (k)) yields
n d n
∏ ∑ s (k) = ∑ ∏ s (k i ) = ∑ s (k1 ) s (k2 ) · · · s (k n ) .
i =1 k =1 (k1 ,k2 ,...,k n )∈[d]n i =1
| {z } (k1 ,k2 ,...,k n )∈[d]n
=s(k1 )s(k2 )···s(k n )
In view of
d
∑ s (k) = s|{z}
(1) + s (2) + s (3) + · · · + s ( d )
k =1
|{z} |{z} |{z}
=−1 =1 =1 =1
= (−1) + 1| + 1 +{z· · · + 1} = (−1) + (d − 1) · 1 = d − 2,
d−1 times
this rewrites as
e n − o n = ( d − 2) n . (347)
Adding this equality to (344), we obtain
( e n + o n ) + ( e n − o n ) = d n + ( d − 2) n .
The trick used in the second solution above is not just slick; it has further appli-
cations. Superficially, what we did was finding en by first computing en + on and
en − on and then adding up and dividing by 2. But the “reason” why en − on was
so much easier to find than en alone is that en − on was a sum (of 1’s and (−1)’s)
over all (not just the 1-even) n-tuples ( x1 , x2 , . . . , xn ) ∈ [d]n , and the addends could
be decomposed as products s ( x1 ) s ( x2 ) · · · s ( xn ).
A more sophisticated use of this strategy can be used to solve the following
exercise ([18f-hw4s, Exercise 7]):
d
1 d
2d
∑ k (d − 2k)n .
k =0
We omit the solution for now (see [18f-hw4s, Exercise 7]). (TODO: Insert it.)
• Given n ∈ N, how many distinct subsets of [n] can you pick so that every two
subsets you have picked have a nonempty intersection? (We shall answer this
below.)
• Given n, k ∈ N, how many distinct k-element subsets of [n] can you pick so
that every two subsets you have picked have a nonempty intersection? (We
shall answer this below. Note that the case 2k > n is trivial – make sure you
see why!)
• Given n ∈ N, how many distinct subsets of [n] can you pick so that no subset
you have picked is a subset of another? (We shall answer this below.)
• Given n ∈ N, how many distinct n-tuples (i1 , i2 , . . . , in ) ∈ {0, 1}n can you pick
so that no two n-tuples you have picked differ in just a single entry? (Such
a pick is known as a single-error-detecting code. But this makes the question
sound harder than it is!)
• Given n, k ∈ N, how many distinct numbers can you pick from the set [n]
so that any two distinct numbers a, b you have picked satisfy | a − b| ≥ k ?
(Using the terminology of Exercise 3.7.1, this is just asking for the largest
of a k-lacunar
size subset of {1, 2, . . . , n}.) It is easy to seethat the answer is
n+k−1 n+k−1
. (Indeed, you can certainly pick distinct numbers
k k
with this property227 , and Exercise 3.7.1 shows that you cannot pick more228 .)
The attentive reader will notice that the pigeonhole principles also belong to
extremal combinatorics, as they answer questions like “how many distinct elements
can you pick from a given n-element set?” or “how few elements can you pick from
a given n-element set so that every element has been picked at least once?”. Our
point here is not to dwell on fundamentals like this, but to put them into a new
context.
I shall not give a proper introduction to extremal combinatorics, but I shall solve
three of the above questions to give an idea of how the subject (or at least a small
part of it) feels like. The reader can find a lot more in [Galvin17, Chapter 43
onward], [Jukna11], [Engel97] and other places.
Convention 7.9.1. The word “collection” is a synonym for “set”. For reasons
of clarity, we shall speak of “collections of sets” instead of “sets of sets”. For
example, {{1, 2} , {1, 3} , {5}} is a collection of subsets of [5].
Example 7.9.3. (a) The collection {{1, 2} , {1, 3} , {5}} is a set antichain of [5].
(b) The collection {{1, 2} , {1, 3} , {2}} is not a set antichain of [5], since {2} ⊆
{1, 2}.
227 Namely, you can pick the numbers
0k + 1, 1k + 1, 2k + 1, . . . , (q − 1) k + 1,
n+k−1
where q = . An easy computation shows that they all belong to [n] and have the
k
property required.
228 More precisely, Exercise 3.7.1 shows that you cannot pick more than n + k − 1 distinct numbers
k
with this property. But you can only pick an integer number of numbers; thus, “no more than
n+k−1 n+k−1
” is tantamount to “no more than ”.
k k
Before we prove this theorem, let us do two things. First, as a warmup, we shall
prove a similar (but much simpler) result about set chains – a dual notion to set
n
antichains. Then, we shall show an inequality saying that is the largest
bn/2c
n
of all binomial coefficients (for a fixed n ∈ N).
k
Definition 7.9.5. Let S be a set. A set chain of S means a collection C of subsets
of S such that any two distinct sets A, B ∈ C satisfy A ⊆ B or B ⊆ A.
Example 7.9.6. (a) The collection {{1, 2} , {1, 2, 5} , {1, 2, 3, 4, 5}} is a set chain of
[5].
(b) The collection {{1, 2} , {1, 3} , {1, 2, 3}} is not a set chain of [5], since {1, 2}
and {1, 3} satisfy neither {1, 2} ⊆ {1, 3} nor {1, 3} ⊆ {1, 2}.
is clearly a set chain of S, and has size n + 1. Thus, it remains to prove that any set
chain of S has size ≤ n + 1.
Indeed, let C be a set chain of S. We must thus prove that |C| ≤ n + 1.
Each set I ∈ C is a subset of S, and thus satisfies | I | ∈ {0, 1, . . . , n} (since S is an
n-element set). Hence, we can define a map
f : C → {0, 1, . . . , n} ,
I 7→ | I | .
This map f simply sends each set I ∈ C to its size. Now, we claim that this map f
is injective. Indeed, if A and B are two distinct elements of C, then we have A ⊆ B
Proof of Lemma 7.9.8 (sketched). There are many proofs for this; here is an outline of
what might be the simplest one.
n n
Theorem 4.3.10 yields = . Thus, if k > n − k, then we can replace
k n − k
n
k by n − k without changing . Hence, for the rest of this proof, we WLOG
k
assume that k ≤ n − k. Hence, 2k ≤ n, so that k ≤ n/2 and therefore k ≤ bn/2c
(since k is an integer).
n n n
/ N, then
If k ∈ =0≤ (since / N, then
≥ 0). Thus, if k ∈
k bn/2c bn/2c
Lemma 7.9.8 holds. Hence, for the rest of this proof, we WLOG assume that k ∈ N.
Combining k ∈ N with k ≤ bn/2c, we find k ∈ {0, 1, . . . , bn/2c}.
Now, we claim the following chain of inequalities:
n n n n
< < < ··· < . (348)
0 1 2 bn/2c
(In terms of Pascal’s triangle, this is simply saying that the binomial coefficients in
the n-th row of Pascal’s triangle strictly increase until the middle of the row. For
example,
for n = 4, this
is saying that 1 < 4 < 6.) Clearly, if we can prove (348),
n n n
then ≤ will follow, since is one of the binomial coefficients in
k bn/2c k
the chain (348) (because k ∈ {0, 1, . . . , bn/2c}). Thus,we onlyneed to prove (348).
n n
In order to prove (348), we need to show that < for each i ∈
i i+1
{0, 1, . . . , bn/2c − 1}. Let us do this: Let i ∈ {0, 1, . . . , bn/2c − 1}. Thus, i ≥ 0
and i ≤ bn/2c −1 ≤ n/2 − 1. Hence, i + 1 ≤ n/2, so that 2 (i + 1) ≤ n and thus
| {z }
≤n/2
i + 1 ≤ n − (i + 1) < n − i, so that n − i > i + 1. Also, i ∈ {0, 1, . . . , n} (since
| {z }
>i
229 Here,we are using the fact that if X and Y are two finite sets satisfying X ⊆ Y and | X | = |Y |,
then X = Y.
i≥0 and i ≤ n/2 − 1 < n/2 ≤ n); hence, Theorem 4.3.8 (applied to k = i) yields
n n!
= > 0 (since factorials are positive).
i i! (n − i )!
It is not hard to prove that
n n
( i + 1) = (n − i ) . (349)
i+1 i
in Theorem 7.9.4, but as we will soon see, they are the key to its proof.) For each
permutation σ ∈ Sn , we let Cσ be the collection
[Proof of Claim 1: Let σ ∈ Sn . Recall that Cσ is a set chain; thus, any two distinct
sets A, B ∈ Cσ satisfy
A ⊆ B or B ⊆ A (350)
(by the definition of “set chain”). On the other hand, A is a set antichain; thus,
no two distinct sets A, B ∈ A satisfy A ⊆ B. In other words, any two distinct sets
A, B ∈ A satisfy
A 6⊆ B. (351)
Now, each addend of the sum ∑ [ I ∈ Cσ ] is a truth value and thus equals either
I ∈A
0 or 1; moreover, the # of addends that equal 1 is precisely the # of all I ∈ A
satisfying I ∈ Cσ . Hence,
In other words, we need to show that there is at most one set I ∈ A satisfying
I ∈ Cσ .
Assume the contrary. Thus, there exist two such sets I. In other words, there exist
two distinct sets A, B ∈ A satisfying A, B ∈ Cσ . Consider these A, B. From (350),
we obtain A ⊆ B or B ⊆ A. However, from (351), we obtain A 6⊆ B. Hence, B ⊆ A
(since A ⊆ B or B ⊆ A). However, we can also apply (351) to B and A instead of A
and B. Thus, we obtain B 6⊆ A. This contradicts B ⊆ A. This contradiction shows
that our assumption was wrong, so we are done proving that there is at most one
set I ∈ A satisfying I ∈ Cσ . Hence, we have proved (353). As explained above, this
yields Claim 1.]
Now,
s= ∑ ∑ [ I ∈ Cσ ] = ∑ ∑ [ I ∈ Cσ ]
I ∈A
| {z
σ ∈ Sn
}
σ ∈ Sn
|I ∈A {z }
= ∑ ∑ ≤1
σ ∈ Sn I ∈A (by Claim 1)
(by Theorem 7.4.1, applied to X = [n]). Thus we have obtained an upper bound for
s.
In order to find a lower bound, we will need the following:
n!
Claim 2: For any I ∈ A, we have ∑ [ I ∈ Cσ ] ≥ .
σ ∈ Sn n
bn/2c
(# of all σ ∈ Sn satisfying I ∈ Cσ )
= (# of all σ ∈ Sn satisfying I = {σ (1) , σ (2) , . . . , σ (k)}) . (356)
• First, we choose the value σ (1) (provided that 1 ≤ k). There are k options
for it, since σ (1) needs to belong to the k-element set I (because we want
I = {σ (1) , σ (2) , . . . , σ (k )}).
• Next, we choose the value σ (2) (provided that 2 ≤ k). There are k − 1 options
for it, since σ (2) needs to belong to the k-element set I (because we want
I = {σ (1) , σ (2) , . . . , σ (k )}) and be distinct from σ (1).
• Next, we choose the value σ (3) (provided that 3 ≤ k). There are k − 2 options
for it, since σ (3) needs to belong to the k-element set I (because we want
I = {σ (1) , σ (2) , . . . , σ (k )}) and be distinct from σ (1) and σ (2).
• And so on, until the first k values σ (1) , σ (2) , . . . , σ (k) of σ have been cho-
sen. At this point, we have assigned k distinct elements of the set I as
values σ (1) , σ (2) , . . . , σ (k ). Thus, by the pigeonhole principle for injec-
tions, each of the k elements of I has been assigned as one of the k values
σ (1) , σ (2) , . . . , σ (k ) (since I is a k-element set). We have therefore ensured
that I = {σ (1) , σ (2) , . . . , σ (k )}. We still need to choose the remaining values
σ (k + 1) , σ (k + 2) , . . . , σ (n) of σ, though.
• Next, we choose the value σ (k + 1). There are n − k options for it, since
σ (k + 1) needs to belong to the n-element set [n] and be distinct from the k
numbers σ (1) , σ (2) , . . . , σ (k).
• Next, we choose the value σ (k + 2). There are n − k − 1 options for it, since
σ (k + 2) needs to belong to the n-element set [n] and be distinct from the
k + 1 numbers σ (1) , σ (2) , . . . , σ (k + 1).
• And so on, until all n values σ (1) , σ (2) , . . . , σ (n) have been chosen.
According to the dependent product rule, the total # of possibilities for making
these choices is
n!
k (k − 1) (k − 2) · · · 1 · (n − k ) (n − k − 1) · · · 1 = k! · (n − k )! =
| {z } | {z } n
=1·2·····k =1·2·····(n−k)
=k! =(n−k)!
k
n n!
(since Theorem 4.3.8 yields = ). Hence,
k k! · (n − k )!
∑ [ I ∈ Cσ ] = (# of all σ ∈ Sn satisfying I ∈ Cσ )
σ ∈ Sn
= (# of all σ ∈ Sn satisfying I = {σ (1) , σ (2) , . . . , σ (k)})
(by (356))
n!
= (by (357))
n
k
n! n n
≥ since Lemma 7.9.8 yields ≤ .
n k bn/2c
bn/2c
This proves Claim 2.]
Now,
n! n!
s= ∑ ∑ [ I ∈ Cσ ] ≥ ∑
n
= |A| ·
n
. (358)
I ∈A σ ∈ Sn I ∈A
| {z } bn/2c bn/2c
n!
≥
n
bn/2c
(by Claim 2)
(When n is even, these two antichains are identical.) See [Engel97, Theorem 1.1.1
(b)] for a proof of this.
Example 7.9.11. (a) The collection {{1, 2} , {1, 3} , {2, 3}} is an intersecting col-
lection of [4].
(b) The collection {{1, 2} , {1, 3} , {2}} is not an intersecting collection of [4],
since {1, 3} ∩ {2} = ∅.
Theorem 7.9.12. Let n be a positive integer. Let S be an n-element set. Then, the
maximum possible size of an intersecting collection of S is 2n−1 .
Proof of Theorem 7.9.12 (sketched). The set S is nonempty (since it is an n-element set,
but n is positive). Thus, there exists some t ∈ S. Pick such a t.
The collection
{all subsets of S that contain t}
There are 2n subsets of S in total, and each of them lies in a unique pigeonhole
(namely, each subset T lies in the pigeonhole of T). Since each pigeonhole contains
precisely two subsets of S (this is where we are using our observation that the com-
plement T of a set T is distinct from T), we thus conclude that there are precisely
2n−1 pigeonholes.
Now, the crucial observation is the following: The two sets in any given pigeon-
hole are disjoint (because they are complements of one another). Hence, J cannot
contain more than one set from any given pigeonhole (since J is an intersecting
collection, so that no two sets in J are disjoint). Thus, by the pigeonhole principle
for injections, the size of J is ≤ to the # of pigeonholes. In other words, |J| ≤ 2n−1
(since there are precisely 2n−1 pigeonholes). This is precisely what we needed to
show. Thus, Theorem 7.9.12 is proved.
Remark 7.9.13. The maximum size (2n−1 ) in Theorem 7.9.12 is achieved not just
for collections of the form {all subsets of S that contain t} for some t ∈ S. For
example, if n = 3 and S = [3], then the collection
also is an intersecting collection of S having maximum size (that is, in this case,
2n−1 = 23−1 = 4). This illustrates that the sets in an intersecting collection need
not all have an element in common.
| A ∪ B| ≤ |S| (since A ∪ B ⊆ S)
= n < 2k
). Therefore, the collection {all k-element
subsets of S} is an intersecting k-collection
n
of S. The size of this collection is , and clearly there is no intersecting k-
k
n
collection of S having higher size (since there are only many k-element sub-
k
of S). Thus, the maximum possible size of an intersecting k-collection of S is
sets
n
. This proves Theorem 7.9.16 (b).
k
(a) Assume that n ≥ 2k. Thus, n ≥ 2k > k (since k is positive), so that k < n.
The set S is nonempty (since it is an n-element set, but n is positive). Thus, there
exists some t ∈ S. Pick such a t.
The collection
{all k-element subsets of S that contain t}
n−1
is an intersecting k-collection of S (check this!), and has size (check this!).
k − 1
n−1
Thus, we have found an intersecting k-collection of S that has size .
k−1
n−1
It now remains to show that any intersecting k-collection of S has size ≤ .
k − 1
n−1
So let J be an intersecting k-collection of S. We must show that |J| ≤ .
k−1
The following elegant argument (which I have taken from [Galvin17, first proof
of Theorem 49.1] with only expositional changes) is known as “Katona’s cycle
proof”, and has seen uses in various settings (see [BorMea16] and [Frankl20] for
two surveys). Again (as already in the proof of Sperner’s theorem above) we in-
volve permutations for no obvious reason.
We WLOG assume that S = [n] (since we can otherwise just relabel the elements
of S). Recall that Sn denotes the set of all permutations of [n]. We recall that
|Sn | = n! (which we have seen, e.g., in the proof of Theorem 7.9.4).
We extend any permutation σ ∈ Sn of [n] to an n-periodic map σ : {1, 2, 3, . . .} →
[n]. That is, if σ ∈ Sn is a permutation, then we recursively define the extra values
σ (n + 1) , σ (n + 2) , σ (n + 3) , . . . by setting
σ ( n + 1) : = σ (1) ,
σ ( n + 2) : = σ (2) ,
σ ( n + 3) : = σ (3) ,
....
(Thus, explicitly, if i is a positive integer, then σ (i ) = σ ( j), where j is the unique ele-
ment of [n] satisfying i ≡ j mod n.) Thus, for each permutation σ ∈ Sn , the sequence
(σ (1) , σ (2) , σ (3) , . . .) begins with the n “original” values of σ and then continues
by repeating these n values over and over. Hence, this sequence (σ (1) , σ (2) , σ (3) , . . .)
is n-periodic. Let us also notice that if σ ∈ Sn is a permutation, and if p ∈
{0, 1, . . . , n}, then any p consecutive elements of this sequence (σ (1) , σ (2) , σ (3) , . . .)
(that is, any p elements of the form σ (i + 1) , σ (i + 2) , . . . , σ (i + p), where i ∈ N)
are distinct.
Fix a permutation σ ∈ Sn . For each i ∈ N, we define a subset
Wi (σ ) = {σ (i + 1) , σ (i + 2) , . . . , σ (i + k)}
of [n]. Thus,
These sets W0 (σ) , W1 (σ) , W2 (σ) , . . . (that is, the sets Wi (σ) for all i ∈ N) will
be called the windows of σ. 232 It is easy to see that these windows Wi (σ) are
k-element subsets of [n] (indeed, for any i ∈ N, the k elements
232 The following way of visualizing the windows of σ might be useful: Imagine the values
of σ are distinct233 , whereas all other windows of σ are repetitions of these n win-
dows234 . Hence, there are n windows of σ in total. We let Bσ denote the collection
σ (1) , σ (2) , . . . , σ (n) written on the circumference on a circle (in clockwise order); then, a win-
dow of σ is just a set of k values appearing consecutively on the circle. For example, if n = 8
and k = 3, and if σ ∈ S8 is the permutation that sends 1, 2, 3, 4, 5, 6, 7, 8 to 3, 1, 7, 4, 5, 6, 8, 2,
respectively, then the windows of σ are
W0 (σ ) = {3, 1, 7} ,
W1 (σ ) = {1, 7, 4} ,
W2 (σ ) = {7, 4, 5} ,
W3 (σ ) = {4, 5, 6} ,
W4 (σ ) = {5, 6, 8} ,
W5 (σ ) = {6, 8, 2} ,
W6 (σ ) = {8, 2, 3} ,
W7 (σ ) = {2, 3, 1} .
Two of these windows (namely, W2 (σ ) in green, and W7 (σ ) in yellow) are shown on the follow-
ing picture:
8
6 2
5 3
4 1
233 Check this! (Here, we need to recall that 0 < k < n and that σ is injective.)
234 That is,
Wn (σ ) = W0 (σ ) ,
Wn+1 (σ ) = W1 (σ ) ,
Wn+2 (σ ) = W2 (σ ) ,
....
{W0 (σ) , W1 (σ) , W2 (σ) , . . .} of all windows of σ. Thus, |Bσ | = n (since there are n
windows of σ in total).
Forget that we fixed σ. Thus, for each permutation σ ∈ Sn , we have defined a
collection
Bσ = {W0 (σ) , W1 (σ) , W2 (σ) , . . .} (359)
of “windows of σ”.
We now set 235
s := ∑ ∑ [ I ∈ Bσ ] .
I ∈J σ ∈ Sn
We shall find an upper bound and a lower bound for s, and use them to obtain
an inequality. (If you are feeling a deja-vu here: yes, we are mimicking the above
proof of Theorem 7.9.4.)
To obtain an upper bound, we observe the following:
(Indeed, this can be proved in the same way as we proved (352) above, except that
we are now using the collection Bσ instead of Cσ .) Thus,
∑ [ I ∈ Bσ ] = (# of all I ∈ J satisfying I ∈ Bσ )
I ∈J
= |J ∩ Bσ | . (361)
|J ∩ Bσ | ≤ k. (362)
This follows from the fact that the sequence (σ (1) , σ (2) , σ (3) , . . .) is n-periodic.
235 We
use the Iverson bracket notation (Definition 4.3.19).
W = Wi (σ) = {σ (i + 1) , σ (i + 2) , . . . , σ (i + k )}
(that is, L j = Wi−k+ j (σ) for each j ∈ {1, 2, . . . , k − 1}) as well as the k − 1 windows
Wi+n (σ ) = {σ (i + n + 1) , σ (i + n + 2) , . . . , σ (i + n + k )}
= {σ (i + 1 + n) , σ (i + 2 + n) , . . . , σ (i + k + n)}
= {σ (i + 1) , σ (i + 2) , . . . , σ (i + k)}
!
since the sequence (σ (1) , σ (2) , σ (3) , . . .) is n-periodic,
and thus σ (u + n) = σ (u) for each u ≥ 1
= Wi (σ)
(that is, R j = Wi+ j (σ ) for each j ∈ {1, 2, . . . , k − 1}). 237 It is easy to see that the
only windows of σ that intersect W are the 2 (k − 1) + 1 windows
L1 , L2 , . . . , Lk−1 , W, R1 , R2 , . . . , Rk−1 .
In other words,
Now, in order to profit from this observation, let us see how many of the 2 (k − 1) +
1 windows L1 , L2 , . . . , Lk−1 , W, R1 , R2 , . . . , Rk−1 can actually belong to J ∩ Bσ .
If j ∈ {1, 2, . . . , k − 1} is arbitrary, then the windows L j and R j are distinct and
do not intersect238 , and thus cannot both belong to J at the same time (since any
two distinct sets belonging to J intersect), and thus cannot both belong to J ∩ Bσ at
237 Let us visualize these 2 (k − 1) windows on an example:
Let n = 8 and k = 3, and let σ ∈ S8 be the permutation that sends 1, 2, 3, 4, 5, 6, 7, 8 to
3, 1, 7, 4, 5, 6, 8, 2, respectively. Let W = W7 (σ ) = {2, 3, 1}. Then, the following picture shows the
2 windows L1 and L2 (in blue) and the 2 windows R1 and R2 (in red) as transparent blobs:
6 2
5 3
4 1
7
.
(The numbers on the circumference of the circle are the values of σ written in clockwise order.
The yellow blob is the window W.) Note that the letter “L” has been chosen because the win-
dows L1 and L2 are “left” (in the sense of “counterclockwise from”, on the circle) of the window
W; likewise the letter “R” stands for “right”. (Furthermore, the colors blue and red have been
chosen to hint at the letters L and R.)
238 Proof. Let j ∈ {1, 2, . . . , k − 1}. The definitions of L and R yield
j j
• ...
• The collection J ∩ Bσ contains at most one of the two windows Lk−1 and Rk−1 .
In view of
( J ∩ B σ ) ∩ { L 1 , R 1 , L 2 , R 2 , . . . , L k −1 , R k −1 , W }
| {z }
={ L1 ,L2 ,...,Lk−1 ,W,R1 ,R2 ,...,Rk−1 }
= (J ∩ Bσ ) ∩ { L1 , L2 , . . . , Lk−1 , W, R1 , R2 , . . . , Rk−1 }
= J ∩ Bσ (by (364)) ,
s= ∑ ∑ [ I ∈ Bσ ] = ∑ ∑ [ I ∈ Bσ ]
I ∈J σ ∈ Sn σ ∈ Sn I ∈J
| {z } | {z }
= ∑ ∑ ≤k
σ ∈ Sn I ∈J (by Claim 1)
≤ ∑ k = |Sn | ·k = n! · k. (365)
σ ∈ Sn
|{z}
=n!
σ ( i − k + j + 1) , σ ( i − k + j + 2) , . . . , σ ( i + j + k )
of σ are distinct (since n ≥ 2k); thus, the above equalities show that the sets L j and R j are disjoint.
In other words, the sets L j and R j do not intersect. Qed.
(Indeed, this can be proved in the same way as we proved (355) above, except that
we are now using the collection Bσ instead of Cσ .) Now, how many permutations
σ ∈ Sn satisfy I ∈ Bσ ?
Let σ ∈ Sn be a permutation. Then, Bσ is the collection of all windows of σ; thus,
(since there are n windows of σ in total, and these n windows are precisely
W0 (σ) , W1 (σ) , . . . , Wn−1 (σ)). Thus, we have I ∈ Bσ if and only if we have I =
Wi (σ ) for some i ∈ {0, 1, . . . , n − 1}.
Forget that we fixed σ. We thus have shown that a permutation σ ∈ Sn satisfies
I ∈ Bσ if and only if it satisfies I = Wi (σ ) for some i ∈ {0, 1, . . . , n − 1}. Hence,
(# of all σ ∈ Sn satisfying I ∈ Bσ )
= (# of all σ ∈ Sn satisfying I = Wi (σ) for some i ∈ {0, 1, . . . , n − 1})
n −1
= ∑ (# of all σ ∈ Sn satisfying I = Wi (σ)) . (367)
i =0
(Here, the last equality sign is a consequence of the sum rule, because the sets
{σ ∈ Sn | I = Wi (σ)} for i ∈ {0, 1, . . . , n − 1} are disjoint239 .)
Now, let us fix i ∈ {0, 1, . . . , n − 1}. Then, a permutation σ ∈ Sn satisfying
I = Wi (σ ) can be constructed using the following decision procedure:
239 Proof.Assume the contrary. Thus, these sets are not disjoint. In other words, there exists a
permutation σ ∈ Sn that satisfies I = Wi (σ ) for two different values of i ∈ {0, 1, . . . , n − 1}.
Consider this σ. We have seen above that the first n windows W0 (σ ) , W1 (σ ) , . . . , Wn−1 (σ )
of σ are distinct. However, two of these n windows equal I (since σ satisfies I = Wi (σ) for
two different values of i ∈ {0, 1, . . . , n − 1}). Therefore, two of these n windows are equal.
This contradicts the fact that these n windows are distinct. This contradiction shows that our
assumption was false, qed.
Once these choices are made, we have assigned k distinct elements of the set
I as values σ (i + 1) , σ (i + 2) , . . . , σ (i + k). Thus, by the pigeonhole principle
for injections, each of the k elements of I has been assigned as one of the k
values σ (i + 1) , σ (i + 2) , . . . , σ (i + k ) (since I is a k-element set). We have
therefore ensured that I = {σ (i + 1) , σ (i + 2) , . . . , σ (i + k )} = Wi (σ). We
still need to choose the remaining n − k values of σ, though.
• Next, we choose the remaining n − k values σ (i + k + 1) , σ (i + k + 2) , . . . , σ (i + n)
of σ (in this order). These n − k values must be elements of [n] that are dis-
tinct from each other and from the already chosen k values; thus, we have
n − k options for the first of them, n − k − 1 options for the second, n − k − 2
options for the third, and so on.
According to the dependent product rule, the total # of possibilities for making
these choices is
k (k − 1) (k − 2) · · · 1 · (n − k ) (n − k − 1) · · · 1 = k! · (n − k )!.
| {z } | {z }
=1·2·····k =1·2·····(n−k)
=k! =(n−k)!
Hence,
Now, forget that we fixed i. We thus have proved (368) for each i ∈ {0, 1, . . . , n − 1}.
Now, (366) becomes
∑ [ I ∈ Bσ ] = (# of all σ ∈ Sn satisfying I ∈ Bσ )
σ ∈ Sn
n −1
= ∑ (|# of all σ ∈ Sn satisfying I = Wi (σ)) (by (367))
i =0
{z }
=k!·(n−k)!
(by (368))
n −1
= ∑ k! · (n − k)! = n · k! · (n − k)!.
i =0
Hence,
|J| · n · k! · (n − k)! = s ≤ n! · k (by (365)) .
n! · k n−1
k n! k n
|J| ≤ = · = =
n · k! · (n − k )! n k! · (n − k )! n k k−1
| {z }
n
=
k
(by Theorem 4.3.8)
(by Exercise 4.5.4 (a), applied to m = k). This proves Theorem 7.9.16 (a).
• Its states are finite tuples ( a1 , a2 , . . . , ak ) of integers with at least 2 entries (i.e.,
with k ≥ 2).
• Its moves are to insert a new entry ak + ak−1 at the end of a given tuple
( a1 , a2 , . . . , a k ).
Thus, if we start this process with the state (0, 1), then we will arrive at the state
(0, 1, 1) after one move, then at the state (0, 1, 1, 2) after another move, then at the
state (0, 1, 1, 2, 3) after a third move, and so on. After n moves, our state will be the
(n + 2)-tuple ( f 0 , f 1 , . . . , f n+1 ). Note that the state will never be the entire Fibonacci
sequence ( f 0 , f 1 , f 2 , . . .), since a state is always a finite tuple; but each Fibonacci
number will eventually appear in the state. Of course, the same process (with a
different starting state) can be used to compute not just the Fibonacci sequence, but
any (1, 1)-recurrent sequence.
Given a process, we can ask several questions about it:
• Can a certain state ever be reached by the process from a given starting state?
• Does the process exhibit periodic behavior (i.e., do its states form a periodic
sequence)?
• Is the process reversible? That is, is there a way to reconstruct a state from
the next state?
• What things change only in one direction (i.e., only get smaller or only get
larger) throughout the process?
240 or their continuous analogues: functions defined as solutions to differential equations
The last two questions in this list are sufficiently important that they have names.
Things that stay unchanged during a process are called invariants (or conserved quan-
tities) of this process; things that change only in one direction (e.g., only get smaller,
or only get larger) are called monovariants. In many cases, finding invariants or
monovariants (or both) is not just interesting in itself, but also helps answering
some of the other questions (for example, knowing that some quantity decreases at
each step of the process immediately guarantees that the process does not return
to any previous state). Here are some examples that you may have seen:
• The Euclidean algorithm for computing the gcd of two nonnegative integers
rests on the fact that if we subtract an integer from another (i.e., replace a pair
( a, b) of integers by ( a − b, b) or by ( a, b − a)), then the gcd of the two integers
does not change. In other words, the gcd is an invariant of the subtraction
operation that keeps getting used in the algorithm.241 More generally, almost
all nontrivial algorithms in mathematics are analyzed with the help of loop
invariants, which are things (e.g., quantities or statements) that never change
when the algorithm is performed.
• In the Euclidean algorithm, the sum of the two nonnegative integers decreases
at each step. Thus, it is a monovariant. (This is why the Euclidean algorithm
terminates.)
• In Exercise 1.1.5, lemmings can fall off the cliff but never come back. Thus,
the number of lemmings on the cliff is a monovariant: it can only decrease.
• Our solutions to Exercise 3.7.10 illustrate various uses of invariants and mono-
variants. (For example, in the first solution, the comb number is a monovari-
ant, whereas the number of 1s in the bitstring is an invariant. In the second
solution, load a is a monovariant, and ones a is an invariant.)
241 There are actually two versions of the Euclidean algorithm: In one version, the smaller integer
keeps getting subtracted from the larger integer; in the other version, the larger integer keeps
getting divided with remainder by the smaller integer. The gcd is an invariant for both of these
versions.
Physics has its share of invariants and monovariants, too (e.g., energy and mo-
mentum are famous invariants, while entropy is a monovariant).
There is no general theory of how to construct invariants and monovariants,
let alone find specific ones that are useful for a given problem. Doing so often
requires ingenuity, experience and luck. The best we can do is show some examples
and discuss some common threads. More can be found in [Engel98, Chapter 1],
[GelAnd17, §1.5], [Grinbe08, Kapitel 4], [Carl17, Kapitel 5] and [Zeitz17, §3.4].242
8.1. Invariants
We begin by illustrating the use of invariants on some examples. See [LeLeMe16,
§6.1] for a brief but rigorous introduction.
Exercise 8.1.1. A chunk of ice is floating in the sea. At each moment, a chunk
can break into 3 or into 5 smaller chunks. Assuming that no chunks can ever
melt, is it possible that there are precisely 100 chunks left after some time has
passed?
Solution to Exercise 8.1.2 (sketched). (a) Every move decreases the number of num-
bers written on the table by 1. Since this number was n at the onset, it is thus clear
that it will take precisely n − 1 moves to reduce it down to 1. Thus, after precisely
n − 1 moves, only one number will be left on the blackboard.
Now, we claim that this number is 1 + 2 + · · · + n. In fact, each of our moves
leaves the sum of all numbers on the blackboard unchanged (because it removes
two addends a and b and inserts the addend a + b instead). Since this sum was
1 + 2 + · · · + n at the onset, it will therefore remain 1 + 2 + · · · + n throughout the
procedure, and thus will still be 1 + 2 + · · · + n at the end. But since there is only
one number left on the blackboard at the end, this means that this number will
have to be 1 + 2 + · · · + n. Thus, in particular, this number will not depend on the
specific moves taken. Thus, Exercise 8.1.2 (a) is solved.
(b) Again, we can show (as in our above solution to Exercise 8.1.2 (a)) that after
precisely n − 1 moves, only one number will be left on the blackboard. However,
this time, this number may well depend on the specific moves taken. This does in
fact happen already for n = 2, since the two numbers 1 and 2 can be replaced by
any of 1 − 2 = −1 and 2 − 1 = +1 (depending on which of them we take to be a
and which we take to be b). Thus, Exercise 8.1.2 (b) is solved.
(c) This can be solved in the exact same way as Exercise 8.1.2 (a), except that
all sums need to be replaced by products. Thus, the number that remains on the
blackboard after n − 1 moves are made is not 1 + 2 + · · · + n but 1 · 2 · · · · · n = n!.
(But it still does not depend on the specific moves taken.) Thus, Exercise 8.1.2 (c) is
solved.
(d) Again, we can show (as in our above solution to Exercise 8.1.2 (a)) that after
precisely n − 1 moves, only one number will be left on the blackboard. Again, this
remaining number does not depend on the specific moves taken; but this time, this
is a bit trickier to prove. Namely: We define the weird-sum of k numbers a1 , a2 , . . . , ak
to be the number ( a1 + 5) + ( a2 + 5) + · · · + ( ak + 5). Then, each of our moves
leaves the weird-sum of the numbers on the blackboard unchanged (indeed, the
move removes two addends of the form a + 5 and b + 5 from this weird-sum, and
replaces them with the addend ( a + b + 5) + 5; but this new addend clearly has
the same effect as the two addends that were removed, because ( a + 5) + (b + 5) =
a + b + 10 = ( a + b + 5) + 5). Since this weird-sum was
(1 + 5) + (2 + 5) + · · · + (n + 5) = (1 + 2 + · · · + n) + 5n
at the onset, it will therefore remain (1 + 2 + · · · + n) + 5n throughout the proce-
dure, and thus will still be (1 + 2 + · · · + n) + 5n at the end. But since there is only
one number left on the blackboard at the end, this means that this number will
have to be (1 + 2 + · · · + n) + 5n − 5 (because the weird-sum of a single number a
is a + 5). Thus, in particular, this number will not depend on the specific moves
taken. Thus, Exercise 8.1.2 (d) is solved.
(e) Again, we can show (as in our above solution to Exercise 8.1.2 (a)) that after
precisely n − 1 moves, only one number will be left on the blackboard. Again,
this remaining number does not depend on the specific moves taken; but this time,
1 · 2 · · · · · ( n + 1)
(1 + 1) (2 + 1) · · · ( n + 1) = 2 · 3 · · · · · ( n + 1) =
1
= 1 · 2 · · · · · ( n + 1) = ( n + 1) !
at the onset, it will therefore remain (n + 1)! throughout the procedure, and thus
will still be (n + 1)! at the end. But since there is only one number left on the
blackboard at the end, this means that this number will have to be (n + 1)! − 1
(because the weird-product of a single number a is a + 1). Thus, in particular, this
number will not depend on the specific moves taken. Thus, Exercise 8.1.2 (e) is
solved.
(f) Again, we can show (as in our above solution to Exercise 8.1.2 (a)) that after
precisely n − 1 moves, only one number will be left on the blackboard. However,
this time, this number may well depend on the specific moves taken. For example,
2 2
if n = 3, then we can get either 12 + 22 + 32 = 34 or 12 + 22 + 32 = 170
depending on what move we do first. Thus, Exercise 8.1.2 (f) is solved.
Parity-related invariants are particularly common in contest problems. Here is
an example:
Exercise 8.1.3. The numbers 1, 2, . . . , 100 are written in a row (in this order, from
left to right). In a move, you can swap any two numbers at a distance of 2 (i.e.,
any two numbers that have exactly one number written between them). Can
you end up with the numbers 100, 99, . . . , 1 (in this order, from left to right) by a
sequence of such moves?
[Example: The analogous question for 5 instead of 100 has a positive answer:
243 For example, the move that transforms (1, 2, 3, 4, 5) into (3, 2, 1, 4, 5) causes the number 1 to move
precisely 2 positions to the right and causes the number 3 to move precisely 2 positions to the
left, and leaves all remaining numbers unmoved.
0
1 2
1
0 →
1 →
1
1
2
1
0
1 0
0
0 →
0
3
5
1
0
(where the five points are the five trees, and the number at each point is counting
the sparrows on that tree; furthermore, the red arrows are showing where the
sparrows will move in the next step).]
• First, the sparrow on tree −m and the sparrow on tree m move to the trees
−m + 1 and m − 1, respectively244 . Now, trees −m and m are empty.
• Now, we have two sparrows on tree −m + 1 and two sparrows on tree m − 1.
These four sparrows move to the trees −m + 2 and m − 2 (first one pair, then
the other)245 . Now, trees −m + 1 and m − 1 are empty.
• And so on, until all trees other than tree 0 are empty. At this point, all
sparrows have arrived on tree 0.
∑ tS (s) ,
s is a sparrow
where tS (s) is the number of the tree on which the sparrow s sits in the state S.
Thus, the charge of the initial state is 1 + 2 + · · · + n (since the sparrows in the
initial state sit on the trees 1, 2, . . . , n).
Clearly, a bimove transforms a state into another state. Now, the crucial obser-
vation is the following: When a state is transformed by a bimove, the charge of
the state either does not change or changes by n (in one or the other direction). In
order to convince ourselves of this, we let α and β be the two sparrows that move
in the bimove (where α is the sparrow that moves clockwise, and β is the sparrow
that moves counterclockwise), and we let i and j be the two trees on which they
were sitting before the bimove. Now, we analyze four possible cases:
244 These movements can be achieved by a single bimove, since tree −m + 1 is the next tree from
tree −m in clockwise order, whereas tree m − 1 is the next tree from tree m in counterclockwise
order.
245 These movements can be achieved by two bimoves, since tree − m + 2 is the next tree from tree
−m + 1 in clockwise order, whereas tree m − 2 is the next tree from tree m − 1 in counterclockwise
order.
• If i < n and j > 1, then the sparrows α and β are sitting on trees i + 1 and
j − 1 after the bimove. Thus, in this case, the charge of the state increases by
(i + 1) + ( j − 1) − i − j = 0. In other words, the charge does not change.
• If i = n and j > 1, then the sparrows α and β are sitting on trees 1 and
j − 1 after the bimove. Thus, in this case, the charge of the state increases
by246 1 + ( j − 1) − i − j = −i = −n (since i = n). In other words, the charge
decreases by n.
• If i < n and j = 1, then the sparrows α and β are sitting on trees i + 1 and
n after the bimove. Thus, in this case, the charge of the state increases by
(i + 1) + n − i − j = n + 1 − j = n + 1 − 1 = n. In other words, the charge
|{z}
=1
increases by n.
Thus, in each of the four cases, the charge either does not change or changes by n.
Therefore, the charge after the bimove is congruent to the charge before the bimove
modulo n. In other words, the two charges leave the same remainder when divided
by n.
Thus we have shown that a bimove does not change the remainder that the
charge of the state leaves when divided by n. Since the charge of the initial state is
1 + 2 + · · · + n, we thus conclude that the charge of any state that can be achieved
by a sequence of bimoves will still leave the same remainder when divided by n as
1 + 2 + · · · + n does.
Now, let us look at a state where all sparrows sit on the same tree. If this tree is
tree i, then the charge of the state is ∑ i = ni (since there are n sparrows).
s is a sparrow
Thus, if we can achieve this state by a sequence of bimoves, then ni must leave
the same remainder when divided by n as 1 + 2 + · · · + n does (according to the
previous paragraph). In other words, if we can achieve this state by a sequence
of bimoves, then we must have ni ≡ 1 + 2 + · · · + n mod n. Therefore, if we can
achieve this state by a sequence of bimoves, then we must have 1 + 2 + · · · + n ≡
ni ≡ 0 mod n (since n | ni).
246 Theword “increase” is being understood in the wide sense here: To increase a number by k
means to add k to the number, whether or not k is positive. Thus, “increase by −5” is simply
another way to say “decrease by 5”.
0 0 0 0
0 0 0 0 .
0 0 0 0
One possible move is to flip all lamps in the third column (from the left). This
results in
0 0 1 0
0 0 1 0 .
0 0 1 0
From this state, one possible further move is to flip all lamps in the second row.
This results in
0 0 1 0
1 1 0 1 .
0 0 1 0
(Note that the third lamp in the second row is now turned off again, since it has
been flipped twice.)]
∗ ∗
∗ ∗
Each move either leaves the states of the four special lamps unchanged, or flips
exactly two of them247 . Thus, the number of special lamps that are on either re-
mains unchanged or changes by 2 (in one or the other direction) when a move is
made248 . Therefore, the parity of this number never changes (i.e., if it was even,
then it stays even; if it was odd, then it stays odd). But at the onset, this number
was even (because at the onset, all four special lamps were off). Hence, after any
sequence of moves, the number of special lamps that are on will remain even. Thus,
in particular, it is impossible to achieve a state in which the four corner lamps are
on whereas all remaining lamps are off (because such a state would have exactly 1
special lamp that is on249 ). This solves Exercise 8.1.5.
Remark 8.1.1. Let us consider the lamp-flipping “game” from Exercise 8.1.5 a
bit further. What is the total number of possible states that can be achieved by a
sequence of moves (starting with the initial state in which all lamps are turned
off)?
• If the move flips one of the topmost two rows, then exactly two special lamps get flipped.
• If the move flips any other row, then none of the special lamps get flipped, so the states
of the four special lamps remain unchanged.
• If the move flips one of the leftmost two columns, then exactly two special lamps get
flipped.
• If the move flips any other column, then none of the special lamps get flipped, so the
states of the four special lamps remain unchanged.
248 Proof: Consider a move. As we have just seen, this move either leaves the states of the four special
lamps unchanged, or flips exactly two of them. If it leaves the states of the four special lamps
unchanged, then the number of special lamps that are on clearly remains unchanged. On the
other hand, if the move flips exactly two of the four special lamps, then the number of special
lamps that are on increases by 2 (if the two special lamps it flips were both off) or decreases by
2 (if the two special lamps it flips were both on) or remains unchanged (if the two special lamps
it flips were in different states – i.e., one of them was on and the other was off).
249 Here we are using the assumptions n ≥ 3 and m ≥ 3. If you don’t see why, ask yourself why
Exercise 8.1.6. Let n be an odd positive integer. You have the 2n numbers
1, 2, . . . , 2n written on a blackboard. In one move, you can erase two numbers a
and b and write the number | a − b| instead. You keep doing this until only one
number remains. Prove that this remaining number will be odd.
First solution to Exercise 8.1.6 (sketched). In the initial state of the blackboard (i.e., be-
fore you make any moves), all numbers on the blackboard are integers (in fact, they
are 1, 2, . . . , 2n in the initial state). Thus, even after you start making moves, all
numbers on the blackboard remain integers (because any move applied to integers
only produces integers).
We define the board sum to be the sum of all numbers on the blackboard. In the
initial state of the blackboard, this board sum is
2n (2n + 1)
1 + 2 + · · · + 2n = (by (9), applied to 2n instead of n)
2
= n
|{z}
2n +1 ≡ 1 (0 + 1) = 1 mod 2.
|{z}
≡1 mod 2 ≡0 mod 2
(since n is odd)
Now, it is not hard to see that (in general) a move will change the board sum.
However, the parity of the board sum will remain unchanged. In order to see this,
we need a few auxiliary observations: We first notice that every integer x satisfies
| x | ≡ x mod 2. (369)
(Indeed, if x is an integer, then | x | is always either x or − x; however, both x and
− x are congruent to x modulo 2. Thus, (369) follows.) Now, if a and b are any two
integers, then we have
−a − b + | a − b| ≡ − a − b + ( a − b) = −2b ≡ 0 mod 2,
| {z }
≡ a−b mod 2
(by (369)
(applied to x = a−b))
and thus
the integer − a − b + | a − b| is even. (370)
Now, if you apply a move, then you erase two numbers a and b from the blackboard
and write the number | a − b| instead; as a result, the board sum increases250 by
− a − b + | a − b|. Since − a − b + | a − b| is even (by (370), because a and b are
integers), this entails that the board sum increases by an even integer. Hence, the
parity of the board sum does not change.
Now, we have seen two things:
• In the initial state, the board sum is odd.
• The parity of the board sum does not change when we make a move.
Hence, after any number of moves, the board sum remains odd. Thus, the board
sum will still be odd at the very end of the process, when there is only one number
left on the blackboard. But this means that the number left on the blackboard is odd
(because the board sum at that point will be that single number). Thus, Exercise
8.1.6 is solved.
Second solution to Exercise 8.1.6 (sketched). Just as in the first solution above, we can
see that all the numbers on the blackboard remain integers (even after you start
making moves).
The odd-count will mean the number of odd numbers on the blackboard. In the
initial state of the blackboard, this odd-count is n, since exactly n of the 2n numbers
1, 2, . . . , 2n are odd. Now, how does the odd-count change when a move is applied?
• If you apply a move that erases an even number a and an even number b,
then the new number | a − b| written on the board in this move is even (since
a and b are even, so that a − b is even), and thus the odd-count remains the
same (since no odd numbers were erased and no odd numbers were written).
250 Theword “increase” is being understood in the wide sense here: To increase a number by k
means to add k to the number, whether or not k is positive. Thus, “increase by −5” is simply
another way to say “decrease by 5”.
• If you apply a move that erases an even number a and an odd number b, then
the new number | a − b| written on the board in this move is odd (since a is
even and b is odd, so that a − b is odd), and thus the odd-count remains the
same (since one odd number was erased and one odd number was written).
• If you apply a move that erases an odd number a and an even number b, then
the odd-count also remains the same (this is proved just as the preceding
claim).
• If you apply a move that erases an odd number a and an odd number b, then
the new number | a − b| written on the board in this move is even (since a and
b are odd, so that a − b is even), and thus the odd-count decreases by 2 (since
two odd numbers were erased but no odd numbers were written).
Combining these four observations, we see that if you apply a move, then the
odd-count either remains the same or decreases by 2. Thus, the parity of the odd-
count never changes. But we know that the odd-count was odd in the initial state
(in fact, the odd-count was n in the initial state, but n is odd). Hence, the odd-count
must remain odd throughout the process (since its parity never changes). Hence, at
the end of the process, when there is only one number left on the blackboard, the
odd-count will still be odd. But this means that the number left on the blackboard
is odd (because if it was even, then there would be no odd number left on the
blackboard; but this would cause the odd-count to be 0, which would contradict
the fact that it is odd). This solves Exercise 8.1.6 again.
Finally, here is a quickie problem (a popular puzzle in Russia, commonly as-
cribed to I. M. Gelfand) which shows that even the simplest processes can have
useful invariants:
Exercise 8.1.7. A milk cup contains 200 ml of milk; a tea cup contains 200 ml of
tea. You take a full spoon of milk from the milk cup and pour it into the tea cup;
then you stir the latter cup. Then you take a full spoon of milk-tea mixture from
the tea cup and pour it back into the milk cup. What is larger now: the amount
of milk in the tea cup, or the amount of tea in the milk cup?
Solution to Exercise 8.1.7 (sketched). The two amounts are the same.
Proof. Let us introduce some notations:
• Let m be the amount of milk in the milk cup (after the pourings have been
done).
• Let m0 be the amount of milk in the tea cup (after the pourings have been
done).
• Let t be the amount of tea in the tea cup (after the pourings have been done).
• Let t0 be the amount of tea in the milk cup (after the pourings have been
done).
and
a2n−1 + a2n−2 + · · · + a2n−k+1
an = (372)
an−k
for each n ≥ k.
Solution to Exercise 8.1.8. Let us first play around with the recursive equation (372).
251 because
Now, the equality (374) has a rather nice property: The subscripts on the right
hand side are precisely by 1 lower than the corresponding subscripts on the left
hand side! In other words, if we denote the left hand side by bn , then the right
hand side will be bn−1 . Thus, the equality (374) is, in a way, saying that the ratio
an + an−k
is an “invariant” of the sequence ( a0 , a1 , a2 , . . .): it does not
a n −1 a n −2 · · · a n − k +1
change as we “move up” the sequence (i.e., it does not change from n − 1 to n).
Let us now formalize this. Forget that we fixed n. We thus have proved the
equality (374) for each integer n ≥ k + 1.
Now, let us define a number
an + an−k
bn =
a n −1 a n −2 · · · a n − k +1
for each integer n ≥ k. Thus, we have defined a sequence (bk , bk+1 , bk+2 , . . .) of
rational numbers. It is easy to see that
bk = k (375)
252 .
bn = bn − 1 (377)
and
a n −1 ( a n −1 + a n − k −1 ) a n −1 ( a n −1 + a n − k −1 )
=
a n −1 a n −2 · · · a n − k a n −1 ( a n −2 a n −3 · · · a n − k )
(since an−1 an−2 · · · an−k = an−1 ( an−2 an−3 · · · an−k ))
a n −1 + a n − k −1
=
a n −2 a n −3 · · · a n − k
252 Proof of (375): For each i ∈ {1, 2, . . . , k − 1}, we have i ≤ k − 1 < k and therefore
ai = 1 (376)
k −1 k −1
(by (371), applied to n = i). Hence, ∏ ai = ∏ 1 = 1. Moreover, 0 < k (since k ≥ 2 > 0);
i =1 |{z} i =1
=1
(by (376))
thus, a0 = 1 (by (371), applied to n = 0). Finally, (372) (applied to n = k) yields
bn = bk = k (379)
(by (375)).
Now, if n is an integer satisfying n ≥ k, then
an + an−k
an + an−k = bn a n − 1 a n − 2 · · · a n − k + 1 since bn =
|{z} a n −1 a n −2 · · · a n − k +1
=k
(by (379))
= kan−1 an−2 · · · an−k+1
and thus
an = kan−1 an−2 · · · an−k+1 − an−k . (380)
We are now almost there. The equality (380) that we just proved is a new re-
currence equation for our sequence ( a0 , a1 , a2 , . . .) that can be used to prove by a
straightforward strong induction on n that all entries an of the sequence are in-
tegers. This is the same kind of argument that we have made in the solution to
Now, the definition of bk yields
ak + ak−k
bk = = ak + ak−k / ( ak−1 ak−2 · · · ak−k+1 ) = ( ak + 1) /1
a k −1 a k −2 · · · a k − k +1 |{z} | {z }
= a0 =1 = ak−1 ak−2 ··· a1
k −1
= a1 a2 ··· ak−1 = ∏ ai =1
i =1
= ak + 1 = k (since ak = k − 1) .
(since a(n−1)−k = an−k−1 and a(n−1)−1 a(n−1)−2 · · · a(n−1)−k+1 = an−2 an−3 · · · an−k ). Hence,
| {z } | {z } | {z }
= a n −2 = a n −3 = an−k
an + an−k a n −1 + a n − k −1
bn = = (by (374))
a n −1 a n −2 · · · a n − k +1 a n −2 a n −3 · · · a n − k
= bn − 1 (by (378)) .
Exercise 1.1.2 (b). But for the sake of completeness, let me give the details of this
argument:
We claim that
am ∈ Z for each m ∈ N. (381)
[Proof of (381): We proceed by strong induction on m:
Induction step: Let n ∈ N. Assume (as the induction hypothesis) that (381) holds
for m < n. We must show that (381) holds for m = n. In other words, we must
prove that an ∈ Z.
If n < k, then this is clearly true (since (371) yields an = 1 ∈ Z in this case).
Hence, we WLOG assume that n ≥ k for the rest of this proof.
Thus, (380) yields an = kan−1 an−2 · · · an−k+1 − an−k . But we have assumed that
(381) holds for m < n. In other words, am ∈ Z holds for each m ∈ N satisfying
m < n. In other words, am ∈ Z holds for each m ∈ {0, 1, . . . , n − 1}. In other words,
the n elements a0 , a1 , . . . , an−1 all belong to Z. In other words, the n elements
a0 , a1 , . . . , an−1 are integers.
Hence, in particular, the k − 1 elements an−1 , an−2 , . . . , an−k+1 are integers (since
these k − 1 elements an−1 , an−2 , . . . , an−k+1 are among the n elements a0 , a1 , . . . , an−1 ),
and the element an−k is an integer (since this element is, too, among the n ele-
ments a0 , a1 , . . . , an−1 ). Therefore, the difference kan−1 an−2 · · · an−k+1 − an−k is an
integer as well (since it is formed by multiplying and subtracting the integers k,
an−1 , an−2 , . . . , an−k+1 and an−k ). In other words, kan−1 an−2 · · · an−k+1 − an−k ∈ Z.
Hence, an = kan−1 an−2 · · · an−k+1 − an−k ∈ Z. This completes the induction step.
Thus, the proof of (381) is complete.]
Now, let n ≥ 0 be an integer. Thus, n ∈ N, so that an ∈ Z (by (381), applied
to m = n). In other words, an is an integer. Furthermore, an is positive (since
( a0 , a1 , a2 , . . .) is a sequence of positive rational numbers). Hence, an is a positive
integer. This solves Exercise 8.1.8.
Here is another example ([Gale98, Chapter 4, (4)]):254
and
a n −1 a n −2 + a n −2 a n −3 + · · · + a n − k +2 a n − k +1
an = (383)
an−k
for each n ≥ k.
254 Wenote that Exercise 8.1.9 generalizes Exercise 4.11.8 (a), because if we take k = 4, then the
sequence ( a0 , a1 , a2 , . . .) defined in Exercise 8.1.9 will be precisely the sequence (b0 , b1 , b2 , . . .) in
Exercise 4.11.8 (a).
(The sum in the numerator on the right hand side of (383) is an−1 an−2 +
k −2
an−2 an−3 + · · · + an−k+2 an−k+1 = ∑ an−i an−i−1 .)
i =1
Prove that an is a positive integer for each integer n ≥ 0.
Solution to Exercise 8.1.9 (sketched). This is similar to the above solution to Exercise
8.1.8, so we restrict ourselves to an outline.
Again, we begin by playing around with the recursive equation.
Let n be an integer satisfying n ≥ k + 2. Thus, n ≥ n − 2 ≥ k (since n ≥ k + 2);
hence, (383) holds. Multiplying both sides of (383) by an−k , we obtain
a n a n − k = a n −1 a n −2 + a n −2 a n −3 + · · · + a n − k +2 a n − k +1 . (384)
a n −2 a n − k −2 = a n −3 a n −4 + a n −4 a n −5 + · · · + a n − k a n − k −1 .
255 Subtracting this equality from (384), we find
a n a n − k − a n −2 a n − k −2 = ( a n −1 a n −2 + a n −2 a n −3 + · · · + a n − k +2 a n − k +1 )
− ( a n −3 a n −4 + a n −4 a n −5 + · · · + a n − k a n − k −1 )
= a n −1 a n −2 + a n −2 a n −3 − a n − k +1 a n − k − a n − k a n − k −1 .
Adding an−2 an−k−2 + an−k+1 an−k + an−k an−k−1 to both sides of this equality, we
obtain
a n a n − k + a n − k +1 a n − k + a n − k a n − k −1 = a n −1 a n −2 + a n −2 a n −3 + a n −2 a n − k −2 .
a n a n − k + a n − k +1 a n − k + a n − k a n − k −1 + a n − k a n −2
= a n −1 a n −2 + a n −2 a n −3 + a n −2 a n − k −2 + a n − k a n −2 .
In other words,
a n − k ( a n + a n −2 + a n − k +1 + a n − k −1 ) = a n −2 ( a n −1 + a n −3 + a n − k + a n − k −2 ) .
for each integer n ≥ k + 1. Thus, we have defined a sequence (bk+1 , bk+2 , bk+3 , . . .)
of rational numbers. It is easy to see that bk+1 is an integer (since ak−1 , ak−2 , . . . , a0
are all equal to 1, and thus all denominators involved in computing bk+1 are 1s).
Now, the equality (385) entails that
bn = bn − 1
for each integer n ≥ k + 2 (because its left hand side is bn , while its right hand side
is bn−1 ). In other words, we have bn−1 = bn for every integer n ≥ k + 2. Thus, we
get a chain of equalities bk+1 = bk+2 = bk+3 = bk+4 = · · · . From here, we can finish
as in the above solution to Exercise 8.1.8.
Here is a third example ([Gale98, Chapter 4, (3)]):
and
a n −1 a n −2 + a n −3 a n −4 + · · · + a n − k +2 a n − k +1
an = (387)
an−k
for each n ≥ k.
(The sum in the numerator on the right hand side of (387) is an−1 an−2 +
(k−1)/2
a n −3 a n −4 + · · · + a n − k +2 a n − k +1 = ∑ an−2i+1 an−2i .)
i =1
Prove that an is a positive integer for each integer n ≥ 0.
Solution to Exercise 8.1.10 (sketched). This is similar to the above solution to Exercise
8.1.8, so we restrict ourselves to an outline.
Again, we begin by playing around with the recursive equation.
Let n be an integer satisfying n ≥ k + 2. Thus, n ≥ n − 2 ≥ k (since n ≥ k + 2);
hence, (387) holds. Multiplying both sides of (387) by an−k , we obtain
a n a n − k = a n −1 a n −2 + a n −3 a n −4 + · · · + a n − k +2 a n − k +1 . (388)
a n −2 a n − k −2 = a n −3 a n −4 + a n −5 a n −6 + · · · + a n − k a n − k −1 .
8.2. Monovariants
Next we shall see some exercises illustrating the use of monovariants (i.e., quan-
tities that change only in one direction). We begin with a basic fact about sorting
sequences. First, a definition:
Definition 8.2.1. (a) We say that an n-tuple (b1 , b2 , . . . , bn ) of real numbers is
weakly increasing if b1 ≤ b2 ≤ · · · ≤ bn . (For example, the 5-tuple (1, 4, 4, 7, 9) is
weakly increasing.)
(b) Let (b1 , b2 , . . . , bn ) be an n-tuple of real numbers. We say that two entries
bi and b j (with i < j) of this n-tuple are out of order if bi > b j . (For example, the
entries 4 and 2 in the 5-tuple (1, 4, 3, 2, 5) are out of order; thus, this 5-tuple is
not weakly increasing.)
The 5-tuple has become weakly increasing after these moves. Other sequences
of moves are also possible, but they all lead to the same final result.]
Solution to Exercise 8.2.1 (sketched). In this solution, the word “n-tuple” shall always
mean “n-tuple of real numbers”.
An inversion of an n-tuple ( a1 , a2 , . . . , an ) shall mean a pair (i, j) of elements of [n]
satisfying i < j and ai > a j . Thus, the inversions of an n-tuple correspond to the
pairs of entries of this n-tuple that are out of order. (However, an inversion is not
the pair of these entries, but rather the pair of their positions.) For example, the
inversions of the 4-tuple (3, 1, 4, 2) are (1, 2), (1, 4) and (3, 4). For another example,
the inversions of the 3-tuple (2, 2, 1) are (1, 3) and (2, 3). (Note that the pairs of
entries corresponding to these inversions are both (2, 1).)
The inversion number of an n-tuple shall be defined as the number of inversions of
this n-tuple. For example, the inversion number of the 4-tuple (3, 1, 4, 2) is 3, since
it has 3 inversions. We notice that the inversion number of an n-tuple is always a
nonnegative integer (by its definition).
Now, we claim the following:
257 This is the idea underlying the sorting algorithm called bubble sort ([TAoCP3, §5.2.2]).
4, 1, 7, 3, 2, 5, 6 .
(390)
The arcs here illustrate the inversions; more precisely, there is an arc between the
i-th entry and the j-th entry whenever (i, j) is an inversion of the 7-tuple. (The
colors will be explained later.) The two adjacent entries 7 and 3 (in positions 3 and
4) are out of order. The move that swaps these two entries transforms the 7-tuple
into the following 7-tuple:
4, 1, 3, 7, 2, 5, 6 .
(391)
Again, we have represented the inversions as arcs. What do we see? The two black
arcs have stayed in their positions; the red and the green arcs have slightly moved
and changed their colors (from red to green, and from green to red); the blue arc
has disappeared. The logic behind the colors is the following: The swap involved
the 3-rd and the 4-th entry of our 7-tuple. The arc that connects these two entries
was colored blue; the arcs that contain the 3-rd but not the 4-th entry were colored
green; the arcs that contain the 4-th but not the 3-rd entry were colored red; all
remaining arcs were colored black. The behavior is no longer strange:
• The black arcs from (390) remain arcs in (391), because the relevant entries do
not change.
• The green arcs from (390) appear (slightly stretched or compressed) as red
arcs in (391), since one of the relevant entries is moved (but not far enough to
jump past the other entry and therefore destroy the inversion).
• The red arcs from (390) appear (slightly stretched or compressed) as green
arcs in (391) (for the same reason).
• The blue arc from (390) disappears in (391) (since the two relevant entries are
no longer out of order in (391)).
This analysis accounts for all arcs in (391). Thus, we see that there is precisely one
less arc in (391) than in (390). In other words, the 7-tuple in (391) has precisely
one less inversion than that in (390). In other words, our move has decreased the
inversion number by 1, exactly as Claim 1 predicted.
It is not hard (although somewhat laborious) to formalize this argument in full
generality. Instead of assigning colors to arcs, let me assign colors to the inversions
themselves. Consider a move that transforms an n-tuple a = ( a1 , a2 , . . . , an ) into an
n-tuple b = (b1 , b2 , . . . , bn ) by swapping two adjacent entries ai and ai+1 that are
out of order. (Thus, bi = ai+1 and bi+1 = ai and b j = a j for each j ∈ [n] \ {i, i + 1}.)
An inversion (u, v) of a or b will be called
(These are precisely the colors of the corresponding arcs in (390) and in (391).) It is
clear that each inversion of a or b has exactly one of these four colors (blue, green,
red and black). Moreover:
• The n-tuple a has exactly one blue inversion (namely, (i, i + 1)), whereas the
n-tuple b has no blue inversions (since its i-th and (i + 1)-st entries are not
out of order).
• The n-tuple a has as many green inversions as the n-tuple b has red inver-
sions. Indeed, there is a bijection
that sends each green inversion (u, i ) of a to the red inversion (u, i + 1) of b
and sends each green inversion (i, v) of a to the red inversion (i + 1, v) of b.
(Obviously, any green inversion of a has one of the forms (u, i ) and (i, v).)
• The n-tuple a has as many red inversions as the n-tuple b has green inver-
sions. Indeed, there is a bijection
that sends each red inversion (u, i + 1) of a to the green inversion (u, i ) of
b and sends each red inversion (i + 1, v) of a to the green inversion (i, v)
of b. (Obviously, any red inversion of a has one of the forms (u, i + 1) and
(i + 1, v).)
• The n-tuple a has as many black inversions as the n-tuple b has black inver-
sions. Indeed, the black inversions of a are identical with the black inversions
of b.
This accounting shows that the n-tuple a has exactly one more inversion than the n-
tuple b has. In other words, the inversion number of a equals the inversion number
of b plus 1. Thus, the move that transformed a into b had the effect of decreasing
the inversion number by 1. This proves Claim 1.258 ]
Now, Claim 1 shows that the inversion number of our n-tuple is a monovariant:
it keeps decreasing. Let us make this more precise:
n
At the onset, the inversion number of our n-tuple is at most (since every
2
inversionof the n-tuple is a pair (i, j) of elements of [n] satisfying i < j; but there
n
are only such pairs259 ). Claim 1 shows that this inversion number decreases
2
time you make a move. Hence, after kmoves,
by 1every this inversion number will
n n
be − k. Therefore, if you make more than successive moves, then the in-
2 2
n n
version number becomes smaller than − = 0, which is clearly impossible
2 2
(since the inversion number ofann-tuple is always a nonnegative integer). Thus,
n n
you cannot make more than successive moves. Hence, after at most
2 2
moves, you will obtain an n-tuple that does not allow for any further moves. But
such an n-tuple must necessarily be weakly increasing (because it does not allow
for any further moves, so it has no two adjacent entries that are out of order260 ;
but this
means that its entries weakly increase from left to right). Thus, after at
n
most moves, you will obtain a weakly increasing n-tuple. This solves Exercise
2
258 A more formal exposition of this proof can be found in [Grinbe15, §7.80, proof of (1072)]. (Note
that the notation ` (a) used in [Grinbe15, §7.80, (1072)] is exactly what we call the inversion
number of a here, whereas the notation a ◦ sk used in [Grinbe15, §7.80, (1072)] is the result of
swapping the k-th and (k + 1)-st entries of the n-tuple a. Thus, [Grinbe15, (1072)] says precisely
that a move (in our sense) decreases the inversion number of an n-tuple by 1. The fact that
we are working with n-tuples of real numbers whereas [Grinbe15, §7.80, (1072)] is stated for
n-tuples of integers is immaterial; this makes no difference for the proof.)
259 Proof. There is a bijection
(byTheorem
4.3.12). In other words, the number of pairs (i, j) of elements of [n] satisfying i < j
n
is .
2
260 because any two adjacent entries that are out of order would create an opportunity for a move
8.2.1.
Our next exercise ([Grinbe08, Aufgabe 4.16]) is again about lamps in a rectangu-
lar grid (just like Exercise 8.1.5):
Exercise 8.2.2. Let n and m be two positive integers. You have a rectangular
n × m-grid of lamps (i.e., a table with n rows and m columns, with a lamp in
each of its nm cells). A line shall mean a row or a column of the grid; thus, there
are n + m lines in total (namely, n rows and m columns). You say that a line is
bright if at least half of all lamps in this line are turned on.
In a move, you can choose a line, and flip all lamps in this line. (To “flip” a
lamp means to turn it on if it was off, and to turn it off if it was on. Note that
our definition of a move is exactly the same as in Exercise 8.1.5.)
Prove that (starting with an arbitrary state of the lamps – not necessarily all
turned off) you can always find a sequence of moves after which every line is
bright.
[Example: Let us represent a lamp turned off by the number 0, and a lamp
turned on by the number 1. Consider the following starting state (for n = 3 and
m = 4):
0 0 1 1
1 1 0 0 . (392)
0 0 1 0
In this state, the first two rows (from the top) are bright, and so is the third
column (from the left); but the remaining lines are not bright. However, we can
make all lines bright by the following sequence of moves: First, we flip all lamps
in the first and second columns; then, we flip all lamps in the second row. The
resulting state is
1 1 1 1
1 1 1 1 ,
1 1 1 0
and this does have the property that all lines are bright.]
Solution to Exercise 8.2.2 (sketched). We define the total brightness of a state to be the
# of all lamps that are turned on in this state. For example, the state shown in (392)
has total brightness 5. Note that the total brightness of any state is a nonnegative
integer that is ≤ nm (since there are only nm lamps in total).
Let me recall that any move consists in picking a line and flipping all lamps in
this line. We shall call a move lightbringing if the line getting picked was not bright
before the move. For example, if we start from the state (392), then flipping all
lamps in the topmost row is not a lightbringing move (since the topmost row was
already bright before the move), but flipping all lamps in the bottommost row is a
lightbringing move (since the bottommost row was not bright before the move).
[Proof of Claim 1: Consider any lightbringing move. Let ` be the line that is picked
in this move. Thus, the move consists in flipping all lamps in this line `. Since this
move is lightbringing, we thus conclude that the line ` is not bright before this
move (by the definition of “lightbringing”). In other words, less than half of the
lamps in line ` are turned on before the move (by the definition of a “bright” line).
In other words, before the move, the line ` has fewer turned-on lamps than it has
turned-off lamps. But the move turns all the former lamps off and turns all the
latter lamps on (because the move flips all lamps in `). Hence, the move turns
fewer lamps off than it turns on (since the line ` has fewer turned-on lamps than
it has turned-off lamps before the move). Hence, the move increases the total # of
lamps that are turned on. In other words, the move increases the total brightness
of the state (since the total brightness of a state was defined as the total # of lamps
that are turned on). Therefore, the move increases the total brightness of the state
by at least 1 (since the total brightness is an integer, and thus, if it is increased, it
must necessarily be increased by at least 1). This proves Claim 1.]
Now, let us start with an arbitrary state, and keep making lightbringing moves
until this is no longer possible. (That is, we keep making lightbringing moves as
long as there is any line that is not bright; we stop when there are no such lines left
any more.) I claim that this process will end after at most nm moves. Indeed, Claim
1 shows that any lightbringing move increases the total brightness of a state by at
least 1. Hence, if we manage to make nm + 1 moves, then the total brightness will
be at least nm + 1 (since the total brightness was nonnegative in the initial state, and
has been increased by 1 in each of our nm + 1 moves); but this would contradict the
fact that the total brightness of any state is ≤ nm (and thus < nm + 1). Thus, we
cannot make nm + 1 moves. Hence, our process will stop after at most nm moves.
The resulting state (at the end of our process) will have the property that every line
is bright (since otherwise, it would have a line that is not bright, and therefore we
could apply one more lightbringing move to it). Thus, we have found a sequence
of moves after which every line is bright. This solves Exercise 8.2.2.
Here is yet another lamp puzzle ([Grinbe08, Aufgabe 4.20]), albeit stated in terms
of flags rather than lamps:
Exercise 8.2.3. A country has finitely many towns, some of which are connected
by roads. We say that two towns are each others’ neighbors if they are connected
by a direct road (not passing through any other town). (No town counts as its
own neighbor.)
Each town flies a flag, which has a certain color. We shall briefly say “A town
T flies a color c” for “A town T flies a flag of color c”.
R B
Y Y
B
.
Here, the colors of the nodes represent the colors of the flags hoisted by the
respective towns, and the letters inside the nodes represent them as well (for the
convenience of anyone reading this in black-and-white). (“Y” means “yellow”;
“R” means “red”; “B” means “blue”.) Now, a revolution can happen (e.g.) in
the yellow-flagged town at the bottom right of the country. The plurality of this
town’s neighbors are flying blue flags (in fact, both of its neighbors are), so the
R B
Y B
B
.
Next, a revolution can happen (e.g.) in the blue-flagged town at the bottom
of the country. The plurality of this town’s neighbors (namely, two of its three
neighbors) are flying yellow flags; thus, this town becomes yellow too:
R B
Y B
Y
. (393)
Y B
Y B
Y
.
The country is now stable: No further revolutions can happen. (This does not
mean that each town has the same flag color as a plurality of its neighbors; it
only means that no other color has a plurality among its neighbors.)]
B Y
Y Y → B B →
B Y
Y Y → ··· .
Some things can be said about the variant of the exercise in which all possible
revolutions are happening simultaneously (e.g., each night, at midnight, every
town whose flag color differs from that of a plurality of its neighbors undergoes
a revolution). In this case, I suspect that the country will either become stable,
or will end up oscillating between two states from a certain day on. A similar
result (albeit not quite the same, as it includes a rule for tiebreaking between
equinumerous pluralities) appears in [GolTch83, Theorem 2.1].
Solution to Exercise 8.2.3 (sketched). A couple shall mean a set { a, b} of two towns a
and b that are connected by a (direct) road. A couple { a, b} shall be called discordant
if the towns a and b fly different colors; otherwise, it shall be called non-discordant.
(Of course, these concepts depend on the state of the country; a discordant couple
can become non-discordant after a revolution, and vice versa.)
Define the discord of a state to be the # of all discordant couples in this state. (For
example, the discord of the state shown in (393) is 5. The discord of a state can
be read off its pictorial representation, as it is simply the # of segments whose two
endpoints have different colors – at least if we don’t have two towns connected by
more than one direct road.)
The discord of a state is thus a nonnegative integer.
Now, we claim the following:
• If a couple does not include t, then the revolution does not change the discordant/non-
discordant status of the couple (i.e., if the couple was discordant before the
revolution, then it stays discordant; if it was non-discordant, then it stays
non-discordant).
• If a couple has the form {t, x }, where x is a neighbor of t flying the color
d, then this couple {t, x } was non-discordant before the revolution (since t
also had the color d before the revolution) but becomes discordant after the
revolution (because the color of t changes). Note that there are exactly δ such
couples (since δ is the # of t’s neighbors that are flying the color d).
• If a couple has the form {t, y}, where y is a neighbor of t flying the color c,
then this couple {t, y} was discordant before the revolution (since t had the
color d, and since c 6= d) but becomes non-discordant after the revolution
(because the color of t changes to c). Note that there are exactly γ such
couples (since γ is the # of t’s neighbors that are flying the color c).
• If a couple has the form {t, z}, where z is a neighbor of t flying a color distinct
from d and c, then this couple {t, z} was discordant before the revolution and
remains so after the revolution.
This accounts for all couples. Thus, the revolution causes exactly δ non-discordant
couples to become discordant, and causes exactly γ discordant couples to become
non-discordant. The total # of discordant couples thus decreases by γ − δ. Since
γ − δ > 0, this shows that the total # of discordant couples decreases. Thus, Claim
1 is proven.]
The rest of the solution is now essentially a repetition of the “infinite descent”
argument we have seen in the discussion of Exercise 5.3.1. Namely, Claim 1 shows
that each revolution decreases the discord of the state. But the discord of any state
is a nonnegative integer, and thus cannot decrease indefinitely. More concretely: If
the discord of the original state was N, then the discord cannot decrease more than
N times without becoming negative. Thus, we cannot have more than N successive
revolutions. This solves Exercise 8.2.3.
The following exercise is a variation on Exercise 8.1.3 – with a different answer,
however:
Exercise 8.2.4. The numbers 1, 2, . . . , 99 are written in a row (in this order, from
left to right). In a move, you can swap any two numbers at a distance of 2 (i.e.,
any two numbers that have exactly one number written between them). Can
you end up with the numbers 99, 98, . . . , 1 (in this order, from left to right) by a
sequence of such moves?
[See the Example in Exercise 8.1.3 for how such moves look like.]
261 Notethat we are not going to use any “new” monovariants in this argument; instead, we shall
use Exercise 8.2.1, thus in a way reusing the monovariant we already used to solve Exercise 8.2.1.
solving: the tactic of inverting a problem. In our case, this meant interchanging
the starting state and the desired goal. This is a useful tactic in its own right (and
can be useful even when the moves are not reversible; in such cases one will have
to define a new kind of moves, which undo the original moves). It is known as
“working backwards” and is briefly discussed in [Engel98, §14.3].
The next exercise is another quasi-geometric puzzle:
1.4 2.2
A 3 C
3.1
2 3.6
(with the edges labeled by their respective lengths). Now, in Exercise 8.2.5 (a), if
you start in the town A, then you travel to the town C, then to D, then to C, and
afterwards just keep moving around between C and D. In Exercise 8.2.5 (b), if
you start in the town D, then you travel to the town A, then to B, then to A, and
afterwards just keep moving around between B and A.]
We notice that Exercise 8.2.5 (b) can be restated in terms of the cowboys from
Exercise 5.2.5. Indeed, in the latter language, it says that the paths of the bullets
do not form any closed polygonal path (other than “2-gons”) whenever n ≥ 2 (not
necessarily odd).
Solution to Exercise 8.2.5 (sketched). (a) The trick is to realize that each leg of your
journey is longer than the previous one, unless it leads you straight back to the
town you just came from. Here are the details: We claim the following:
Claim 1: We have | A1 A2 | ≤ | A2 A3 | ≤ | A3 A4 | ≤ · · · .
[Proof of Claim 1: We must show that | Ai−1 Ai | ≤ | Ai Ai+1 | for each integer i ≥ 2.
So let i ≥ 2 be an integer. We have Ai−1 6= Ai (since you don’t ever travel from
a town directly to itself). From the way the journey A1 A2 A3 · · · was defined, we
know that Ai+1 is the town that is farthest away from Ai . Hence, | Ai Ai+1 | ≥
| Ai X | for every town X 6= Ai . We can apply this to X = Ai−1 (since Ai−1 6= Ai ),
and conclude that | Ai Ai+1 | ≥ | Ai Ai−1 | = | Ai−1 Ai |. In other words, | Ai−1 Ai | ≤
| Ai Ai+1 |. This is precisely what we needed to show. Thus, Claim 1 is proven.]
[Proof of Claim 2: Assume that A3 6= A1 . Then, the line segments A1 A2 and A2 A3
are distinct. Hence, | A1 A2 | 6= | A2 A3 | (since we assumed that the distances between
the towns are distinct). However, Claim 1 yields | A1 A2 | ≤ | A2 A3 |. Combining this
with | A1 A2 | 6= | A2 A3 |, we obtain | A1 A2 | < | A2 A3 |. Thus, Claim 2 follows.]
Now, assume that A3 6= A1 . We must prove that you never come back to the
town A1 . Indeed, assume the contrary. Thus, you do come back to the town A1
at some point. In other words, there exists an integer i ≥ 2 such that Ai = A1 .
Consider this i. Note that Ai = A1 6= A2 (since you don’t ever travel from a town
directly to itself), and thus i 6= 2. Hence, i ≥ 3 (since i ≥ 2).
Now, Claim 1 yields | A1 A2 | ≤ | A2 A3 | ≤ | A3 A4 | ≤ · · · , so that | A2 A3 | ≤
264 . Hence, A A
| A 3 A 4 | ≤ · · · ≤ | A i −1 A i | | 2 3 | ≤ | Ai−1 Ai |. But Claim 2 yields
| A1 A2 | < | A2 A3 |. Thus,
| A 1 A 2 | < | A 2 A 3 | ≤ | A i −1 A i | = | A i A i −1 | = | A 1 A i −1 | (394)
(since Ai = A1 ). Also, Ai−1 6= Ai (since you don’t ever travel from a town directly
to itself), and thus Ai−1 6= Ai = A1 .
However, from the way the journey A1 A2 A3 · · · was defined, we know that A2 is
the town that is farthest away from A1 . Hence, | A1 A2 | ≥ | A1 X | for every town X 6=
A1 . Applying this to X = Ai−1 , we obtain | A1 A2 | ≥ | A1 Ai−1 | (since Ai−1 6= A1 ).
This contradicts (394). This contradiction shows that our assumption was wrong.
Hence, Exercise 8.2.5 (a) is solved.
(b) Exercise 8.2.5 (b) can be solved by the exact same argument as Exercise 8.2.5
(a), just with all inequality signs reversed (i.e., we have to replace every “≤” by an
“≥” and likewise).
The next exercise (which is similar in many ways to Exercise 8.2.3) models the
typical failure of breakout rooms at a Zoom conference:
264 Ifi = 3, then this chain of inequalities is a trivial chain with only one number and no inequality
signs. But as you can easily see, this does not invalidate the argument that we are now going to
make.
Exercise 8.2.6. Several people are in a building with several rooms. Each minute,
one person leaves a room and moves to another that has more people (not count-
ing the person who is moving). (That is: If a person was in a room with m other
people, he moves to a room with more than m other people.) Prove that eventu-
ally, all of the people will end up in the same room.
[Example: Let us assume that the starting state is (4, 2, 2), by which we mean
that there are 4 people in one room, 2 in another, and 2 in a third room. Now,
one of the two people from the second room may move into the third, resulting
in the state (4, 1, 3). Then, one person from the third room may move into the
first, resulting in (5, 1, 2). Then, the single inhabitant from the second room may
move into the first, resulting in (6, 0, 2). Two more moves later, we obtain the
state (8, 0, 0), which means that everybody is in the first room.]
Solution to Exercise 8.2.6 (sketched). A dispersed couple shall mean a 2-element set {u, v}
consisting of two people u and v that are in different rooms. (Of course, this no-
tion depends on the state.) Define the dispersion of a state to be the # of dispersed
couples in that state. (For example, the state (4, 2, 2) in the above example has dis-
persion 4 · 2 + 4 · 2 + 2 · 2 = 20.) Clearly, the dispersion of a state is a nonnegative
integer.
Now, we claim the following:
[Proof of Claim 1: Consider what happens in a given minute. Namely, one person
leaves a room and moves to another that has more people (not counting the person
who is moving). Let p be this person; let M be the room that p is leaving; let N
be the room that p is entering. Then, room N has more people than room M (not
counting p), because p is moving to a room with more people.
Let m be the # of people in room M (not counting p), and let n be the # of people
in room N (not counting p). Then, n > m (since room N has more people than
room M), so that n − m > 0. It is now easy to see that this move decreases the
dispersion of the state by n − m (since n dispersed couples disappear265 , and m
new dispersed couples appear266 ). Since n − m > 0, this entails that the dispersion
of the state decreases. Thus, Claim 1 is proven.]
The rest of the solution is now essentially a repetition of the “infinite descent”
argument we have seen in the discussion of Exercise 5.3.1 (and again in the solution
to Exercise 8.2.3). Namely, Claim 1 shows that the dispersion of the state decreases
each minute. But the dispersion of any state is a nonnegative integer, and thus
cannot decrease indefinitely. More concretely: If the dispersion of the original state
was N, then the dispersion cannot decrease more than N times without becoming
negative. Thus, the moves cannot go on for more than N minutes.
265 Namely, the n couples of the form { p, x } with x ∈ N were dispersed before the move but are no
longer dispersed after the move.
266 Namely, the m couples of the form { p, x } with x ∈ M were not dispersed before the move but
Hence, after at most N moves, we must arrive at a state where no person can
move any more. But what does it mean that no person can move? If there is any
dispersed couple { p, q}, then at least one of the two people p and q can move267 .
Hence, if no person can move, then there is no dispersed couple, and therefore all
of the people must be in the same room. Thus, after at most N moves, we must
arrive at a state where all of the people are in the same room (because we know
that after at most N moves, we must arrive at a state where no person can move
any more). This solves Exercise 8.2.6.
Next, a more advanced monovariant problem:
Exercise 8.2.7. Consider a hotel with an infinite number of rooms, arranged se-
quentially on the ground floor. The rooms are labelled (from left to right) by
integers i ∈ Z, with room i being adjacent to rooms i − 1 and i + 1. (To be spe-
cific, room i − 1 is left of room i, while room i + 1 is right of room i.) Thus, the
hotel looks as follows:
··· ···
↑ ↑ ↑ ↑ ↑ ↑
room −2 room −1 room 0 room 1 room 2 room 3
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel).
A finite number of violinists are staying in the hotel; each room has at most
one violinist in it. Each night, some two violinists staying in adjacent rooms (if
two such violinists exist) decide they cannot stand each other’s noise, and move
apart: One of them moves to the nearest unoccupied room to the left, while
the other moves to the nearest unoccupied room to the right. (The two violin-
ists move simultaneously, so one moving away does not prevent the other from
moving. Only two violinists move in any given night.) This keeps happening for
as long as there are two violinists in adjacent rooms.
Prove that this moving will stop after a finite number of days (i.e., there will
be a day when no two violinists are in adjacent rooms any more).
[Example: Let us assume that initially, there are 5 violinists (named a, b, c, d, e),
arranged as follows:
267 Proof:
Assume that there is a dispersed couple { p, q}. We claim that at least one of the two people
p and q can move. Indeed, we WLOG assume that the room containing p has at least as many
people in it as the room containing q (otherwise, we can just interchange p with q). Then, the
room containing p has (strictly) more people than the room containing q if we don’t count q
(because not counting q decreases the head count of the latter room by 1). Therefore, q can move
from the latter room into the former room (according to the rules of the game). Thus, at least
one of the two people p and q can move (in this case, q). Qed.
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel). On the first night, let’s say
the violinists a and b tire of each other’s presence and move apart; this results in
the following state:
··· a b c d e ···
Now, let’s say that violinists b and c move apart on the next night, resulting in
··· a b d c e ···
··· a b c d e ···
··· a b c d e ···
··· a b c d e ···
··· a b c d e ···
Solution to Exercise 8.2.7 (sketched). Note that each room has at most one violinist
staying in it in the initial state. This property remains valid in all later states as
well, since violinists can only move into unoccupied rooms.
Let us regard the violinists as indistinguishable (i.e., we don’t care which violinist
is in which room, but only care about which rooms are occupied).268
Thus, we can identify any state with the finite subset {i ∈ Z | room i is occupied}
of Z (since each room has at most one violinist staying in it). Let us make this iden-
tification; thus, states are finite subsets of Z. For example, the state shown in (395)
is the subset {3, 4, 6, 7, 9}, provided that the rooms shown in (395) are the rooms
268 Indeed, the identities of the violinists are clearly immaterial to the problem at hand.
1, 2, . . . , 11.
Thus, any move removes two consecutive integers j and j + 1 from the state and
inserts two new integers into the state (one of which is < j while the other is
> j + 1). More precisely: If S is a state and j is an integer such that both j and j + 1
belong to S, then there is a move that transforms S into the state
(S \ { j, j + 1})
∪ {the largest integer < j that does not belong to S}
∪ {the smallest integer > j + 1 that does not belong to S} .
Claim 1: Whenever two violinists move apart, the entropy of the state
increases.
[Proof of Claim 1: Consider two violinists moving apart. Let j and j + 1 be the
rooms where they live before the move, and let p and q be the rooms where they
live after the move, labelled in such a way that p < j and q > j + 1. Then, q > j + 1,
so that q ≥ j + 2 (since q and j + 1 are integers) and thus
the violinists never move “too far” away from their original rooms; more precisely,
they will always stay within 3N rooms of the interval between the leftmost and the
rightmost room occupied in the initial state. We shall now make this precise.
Let S0 be the initial state. Consider a sequence of g (successive) moves, starting
from state S0 and leading to states S1 , S2 , S3 , . . . , Sg in this order (i.e., the first move
transforms state S0 into state S1 ; the next move transforms state S1 into state S2 ; and
so on). Thus, in any one of the states S0 , S1 , . . . , Sg , there are exactly N violinists
in the hotel (since the # of violinists in the hotel never changes, and always equals
N), and thus exactly N occupied rooms (since each occupied room has exactly one
violinist in it). In other words, we have
N = | S0 | = | S1 | = · · · = S g . (396)
We WLOG assume that N > 0 (since otherwise, there are no violinists at all in the
hotel, and the exercise becomes trivial). Thus, the sets S0 , S1 , . . . , Sg are nonempty
finite sets (because (396) shows that each of them has N elements); therefore, their
minima and maxima are well-defined. Let α = min (S0 ) and ω = max (S0 ).
Now, we shall see that the violinists don’t spread “too fast” through the hotel.
To be more specific, we claim the following:
Claim 2: We have min (Si+1 ) ≥ min (Si ) − 1 for each i ∈ {0, 1, . . . , g − 1}.
[Proof of Claim 2: Let i ∈ {0, 1, . . . , g − 1}. We must show that min (Si+1 ) ≥
min (Si ) − 1.
Indeed, assume the contrary. Thus, min (Si+1 ) < min (Si ) − 1. Hence, min (Si+1 ) +
1 < min (Si ), so that min (Si ) > min (Si+1 ) + 1.
The room min (Si+1 ) is occupied in state Si+1 (since min (Si+1 ) ∈ Si+1 ). However,
all rooms269 k < min (Si ) are unoccupied in state Si (since min (Si ) is the smallest
element of Si ). Thus, in particular, the room min (Si+1 ) is unoccupied in state Si
(since min (Si+1 ) < min (Si ) − 1 < min (Si )). Thus, we have shown that the room
min (Si+1 ) is occupied in state Si+1 but not in state Si . Therefore, the move that
transforms state Si into state Si+1 must place a violinist in room min (Si+1 ). Let us
denote this violinist by p, and let us refer to this move as “the move Si → Si+1 ”.
Let r be the room which violinist p occupies in state Si (that is, before this move).
Then, r ≥ min (Si ) (since all rooms k < min (Si ) are unoccupied in state Si ), so
that r ≥ min (Si ) > min (Si ) − 1 > min (Si+1 ). Hence, in the move Si → Si+1 , the
violinist p moves left (since p moves from room r to room min (Si+1 )).
Recall again that all rooms k < min (Si ) are unoccupied in state Si . Hence, the
room min (Si+1 ) + 1 is unoccupied in state Si (because min (Si+1 ) + 1 < min (Si )).
Moreover, min (Si+1 ) < min (Si+1 ) + 1 < r (since r ≥ min (Si ) > min (Si+1 ) + 1). In
other words, the room min (Si+1 ) + 1 lies strictly between the two rooms min (Si+1 )
and r.
269 We
are identifying each integer with the corresponding room of our hotel. Thus, “rooms k <
min (Si )” means “rooms k to the left of room min (Si )”.
Now, recall the nature of moves: When two violinists move apart, only one of
them moves left, and this violinist moves to the nearest unoccupied room to its
left. Thus, in the move Si → Si+1 , the violinist p moves to the nearest unoccupied
room to the left of room r (since he moves left, and since he is originally in room r).
This nearest unoccupied room, however, cannot be the room min (Si+1 ), because
the room min (Si+1 ) + 1 is also unoccupied in state Si and lies strictly between the
two rooms min (Si+1 ) and r (so that it is also to the left of room r but is nearer to r
than min (Si+1 )). Hence, in the move Si → Si+1 , the violinist p cannot move to the
room min (Si+1 ). But this contradicts the fact that (as we have seen above) the move
Si → Si+1 does place the violinist p in room min (Si+1 ). This contradiction shows
that our assumption was wrong. Hence, min (Si+1 ) ≥ min (Si ) − 1 is proved. This
proves Claim 2.]
We next introduce another notation. If S is any state (i.e., any finite subset of Z),
then we define the subset S−0+ of Z by
S −0+ = S ∪ { s + 1 | s ∈ S } ∪ { s − 1 | s ∈ S }
= {i ∈ Z | i ∈ S or i − 1 ∈ S or i + 1 ∈ S} .
In other words, S−0+ is the set of all integers i that belong to S themselves or have
a neighbor (that is, i − 1 or i + 1) belong to S. If we identify each integer with the
corresponding room in our hotel, then we can restate this as follows: S−0+ is the
set of all rooms that are occupied or adjacent to an occupied room (assuming that
S is the set of all occupied rooms)270 . Clearly, for any state S, we have
S −0+ ≤ 3 · | S | (397)
S ⊆ S −0+ . (398)
Our next claim shows that if at least one of three consecutive rooms is occupied
at some point, then this property will remain valid in all future states (even though
it will not always be the same room that is occupied, or even the same # of rooms):
[Proof of Claim 3: Let i ∈ {0, 1, . . . , g − 1}. We must show that Si−0+ ⊆ Si−+01+ .
In other words, we must show that every k ∈ Si−0+ satisfies k ∈ Si−+01+ . So, let us
consider any k ∈ Si−0+ . We shall show that k ∈ Si−+01+ .
We have k ∈ Si−0+ . In other words, at least one of the three numbers k − 1, k and
k + 1 belongs to Si . In other words, at least one of the three rooms k − 1, k and k + 1
is occupied in state Si .
270 For example, if S = {2, 4, 8, 9}, then S−0+ = {2, 4, 8, 9} ∪ {3, 5, 9, 10} ∪ {1, 3, 7, 8} =
{ 1, 2, 3, 4, 5, 7, 8, 9, 10}.
We must show that k ∈ Si−+01+ . In other words, we must show that at least one of
the three numbers k − 1, k and k + 1 belongs to Si+1 . In other words, we must show
that at least one of the three rooms k − 1, k and k + 1 is occupied in state Si+1 .
The state Si+1 is obtained from the state Si by a move. Let us consider all possi-
bilities for how this move can affect rooms k − 1, k and k + 1 (recalling that at least
one of these three rooms must be occupied in state Si ):
• If there are violinists in all three rooms k − 1, k and k + 1 before the move,
then at least one of these three violinists will remain in his room after the
move (since a move only displaces two violinists).
These five possibilities cover all the possible cases (since we know that at least
one of the three rooms k − 1, k and k + 1 is occupied in state Si ). Thus, in each
possible case, we have shown that there is a violinist in at least one of the three
rooms k − 1, k and k + 1 after the move. In other words, at least one of the three
rooms k − 1, k and k + 1 is occupied in state Si+1 . As we explained above, this
completes the proof of Claim 3.]
Let us draw some conclusions from Claim 3. It is not true that S0 ⊆ S1 ⊆ · · · ⊆
Sg , since an occupied room can become unoccupied after a move. However, Claim
3 shows that we have
S0−0+ ⊆ S1−0+ ⊆ · · · ⊆ S−
g
0+
. (399)
[Proof of Claim 4: Before I prove this formally, let me sketch what is going on
(as the formal proof does a good job of obscuring this). Consider how the state
evolves from S0 to Sm . With every move Si → Si+1 , the smallest element of the
state (i.e., the leftmost occupied room) shifts to the left by at most 1 (because of
Claim 2). For the initial state S0 , this smallest element is α (since α = min (S0 )).
Hence, if the smallest element of Sm is some integer β ≤ α (that is, we have β =
min (Sm ) ≤ α), then each integer j ∈ [ β, α] must be the smallest element of some
intermediate state between S0 and Sm (since otherwise, the smallest element would
have “jumped over” j, which is impossible given that it only shifts to the left by at
most 1 at each step). Hence, each integer j ∈ [ β, α] must be occupied in one of these
intermediate states. In other words, each integer j ∈ [ β, α] belongs to some Sk (with
k ∈ {0, 1, . . . , m}), and therefore also to Sk−0+ (since Sk ⊆ Sk−0+ ), and therefore also
to Sm−0+ (since (399) yields S−0+ ⊆ S−0+ ). This yields a lower bound on the size of
k m
Sm−0+ : Namely, it yields S−0+ ≥ α − β + 1. If β ≤ α − 3N, then this lower bound
m
entails Sm −0+ ≥ 3N + 1 > 3N, which contradicts the easily established fact that
Sm−0+ ≤ 3 · | S | = 3N. Hence, we must have β > α − 3N, and this is precisely
m
|{z}
=N
what Claim 4 claims.
Here is the proof in all its boring detail. We must show that min (Sm ) > α − 3N.
Assume the contrary. Thus, min (Sm ) ≤ α − 3 |{z}N < α = min (S0 ).
>0
Now, let j ∈ [min (Sm ) , min (S0 )] be arbitrary. We shall show that j ∈ Sm−0+ .
Indeed, we have j ∈ [min (Sm ) , min (S0 )]. In other words, j ∈ Z and min (Sm ) ≤
j ≤ min (S0 ).
There exists some k ∈ {0, 1, . . . , m} satisfying min (Sk ) ≤ j (for example, k = m
will work, since min (Sm ) ≤ j). Consider the smallest such k. Then, min (Sk ) ≤
j; however, if k 6= 0, then min (Sk−1 ) > j (since otherwise, k would not be the
smallest element of {0, 1, . . . , m} to satisfy min (Sk ) ≤ j). From this, it is easy to
see that min (Sk ) = j. Indeed, assume the contrary. Thus, min (Sk ) 6= j, so that
min (Sk ) < j (since min (Sk ) ≤ j) and therefore k 6= 0 (since otherwise, we would
have k = 0, so that min (Sk ) = min (S0 ) ≥ j, which would contradict min (Sk ) < j).
Hence, min (Sk−1 ) > j (because we said that if k 6= 0, then min (Sk−1 ) > j), so
that min (Sk−1 ) ≥ j + 1 (since min (Sk−1 ) and j are integers). But k ∈ {1, 2, . . . , m}
(since k ∈ {0, 1, . . . , m} and k 6= 0), so that k − 1 ∈ {0, 1, . . . , m − 1}. Hence, Claim
2 (applied to i = k − 1) yields min (Sk ) ≥ min (Sk−1 ) − 1 ≥ j (since min (Sk−1 ) ≥
j + 1). This contradicts min (Sk ) < j. This contradiction shows that our assumption
was false. Hence, we obtain min (Sk ) = j. Thus, j = min (Sk ) ∈ Sk ⊆ Sk−0+ (by
(398)).
However, (399) yields Sk−0+ ⊆ Sm −0+ (since k ∈ {0, 1, . . . , m }). Hence, j ∈ S−0+ ⊆
k
Sm−0+ .
Now, forget that we fixed j. We thus have proved that j ∈ Sm −0+ for each j ∈
[min (Sm ) , min (S0 )]. In other words, [min (Sm ) , min (S0 )] ⊆ Sm −0+ . Hence,
−0+
|[min (Sm ) , min (S0 )]| ≤ Sm ≤ 3 · | Sm | (by (397))
|{z}
=N
(by (396))
= 3N,
so that
In other words, min (Sm ) > α − 3N. This proves Claim 4.]
[Proof of Claim 6: Let j ∈ Sm . Thus, j ≥ min (Sm ) > α − 3N (by Claim 4) and
j ≤ max (Sm ) < ω + 3N (by Claim 5). Combining these two inequalities, we obtain
j ∈ [α − 3N + 1, ω + 3N − 1] (since j is an integer).
Forget that we fixed j. We thus have shown that j ∈ [α − 3N + 1, ω + 3N − 1] for
each j ∈ Sm . In other words, Sm ⊆ [α − 3N + 1, ω + 3N − 1]. This proves Claim 6.]
We note that ω = max (S0 ) ≥ min (S0 ) = α and thus |{z} | {z− 1} > α −
ω + 3N
≥α >−3N +1
(since N >0)
3N + 1. Hence, the interval [α − 3N + 1, ω + 3N − 1] is nonempty, and its size is
|[α − 3N + 1, ω + 3N − 1]| = (ω + 3N − 1) − (α − 3N + 1) + 1 = ω − α + 6N − 1.
Now, we can use (e.g.) the pigeonhole principle: Claim 1 entails that the entropy
of the state increases with every move. Thus,
(the entropy of S0 ) < (the entropy of S1 ) < · · · < the entropy of Sg .
Hence, the entropies of the g + 1 states S0 , S1 , . . . , Sg are distinct. Therefore, these
g + 1 states S0 , S1 , . . . , Sg must themselves be distinct. However, all these g + 1 states
S0 , S1 , . . . , Sg are subsets of the set [α − 3N + 1, ω + 3N − 1] (by Claim 6). Hence,
we have found g + 1 distinct subsets of the set [α − 3N + 1, ω + 3N − 1]. By the
pigeonhole principle, this entails that
in his own house. As long as an unhappy member exists, we can pick an unhappy
member and move him into the other house. We keep doing these moves until no
more unhappy members exist. (We make these moves sequentially; we don’t move
several unhappy members simultaneously.)
I claim that these moves cannot go on forever (and thus, at some point, we will
end up with no more unhappy members). Indeed, I define a discordant couple to be
a two-element set {u, v} of two parliament members that are mutual enemies but
are in the same house. (Of course, this concept depends on the state.) I define the
discord of a state to be the # of discordant couples in that state. Now, the discord of
a state is always a nonnegative integer. Moreover, each of our moves decreases the
m
discord (this is easy to check: if a member is unhappy, then he has more than
2
m 272
enemies in his own house, and thus fewer than enemies in the other house ;
2
the move thus decreases his contribution to the discord273 ). Hence, by the same
kind of argument as in the above solution to Exercise 8.2.3, we see that the moves
cannot go on forever (since the discord is a nonnegative integer and thus cannot
keep decreasing forever). Hence, eventually, the moves will have stopped. In the
resulting subdivision of the parliament, no member will be unhappy (since an
unhappy member would enable a further move), which means that each member
m
has at most enemies in his own house. Thus, Exercise 8.2.8 is solved.
2
Remark 8.2.3. Exercise 8.2.8 would be false if the notion of an “enemy” was not
mutual. For instance, if we take m = 3, and if 0, 1, 2, 3, 4 are five parliament
members with each i ∈ {0, 1, 2, 3, 4} having enemies (i + 1) %5, (i + 2) %5 and
(i + 3) %5, then there is no way to prevent one of them from having more than
3
enemies in his own house, no matter how the parliament is subdivided into
2
two houses.
Exercise 8.3.1. Let n be a positive integer. Let Z be the set of all pairs ( x, y) ∈ [n]2
satisfying x ⊥ y and x + y > n. (For example, if n = 5, then
Z = {(1, 5) , (2, 5) , (3, 4) , (3, 5) , (4, 3) , (4, 5) , (5, 1) , (5, 2) , (5, 3) , (5, 4)} . )
1
Find ∑ .
( x,y)∈ Z xy
A B .
Compare the area of the red region with that of the blue region.
(Here, ABC is an isosceles right-angled triangle with right angle at A. We have
erected semicircles with diameters AB and AC, both pointing into the inside of
triangle ABC. We have also drawn a quarter-circle with center A and radius
AB = AC bordered by the points B and C. The red region is formed by removing
the two semicircles from the quarter-circle. The blue region is the (set-theoretical)
intersection of the two semicircles.)
(b) Let n ∈ N. Let σ be a permutation of [n]. Let j ∈ {0, 1, . . . , n}. Prove that
it. A corner in common does not suffice.) Show that at least one square remains
uninfected no matter how long you wait.
[Example: If n = 3 and m = 5, then we may have the following initial state
(where “X” stands for an infected square):
X
X .
X
X X
X X .
X
X X
X X X .
X X
X X X
X X X .
X X X
For the next exercise, imagine n students coming to a party; each student, on
arrival, leaves his coat on the coatrack. When the party ends, the students leave one
by one, each taking a (uniformly) random coat back from the coatrack. (We assume
that no student leaves before all students have entered.) The probability that each
1
student gets his original coat back is . What is the probability that no student
n!
1
gets his original coat back? The somewhat surprising answer is “approximately ,
e
where e is Euler’s number” (and the approximation becomes the better the larger
n is). The following exercise makes this precise:
The next exercise is about the “four-numbers game”. Assume you have four
integers a, b, c, d written (in counterclockwise order) on the circumference of a circle:
a
c
b .
These four integers subdivide the circle into four arcs. To make a difference move
means to replace these four integers by their consecutive (absolute-value) differ-
ences (i.e., on each of the four arcs of the circle, we write the absolute value of the
difference between the two integers placed on the endpoints of the arc; then, we
erase the original integers). In other words, here is what a difference move does:
d d
|c − d| |d − a|
a → a
c c
|b − c| | a − b|
b b
|c − d| |d − a|
|b − c| | a − b|
.
• After four difference moves, all four integers on the circle will be even.
• After 4k difference moves (where k ∈ N), all four integers on the circle will
be divisible by 2k .
• If the four integers on the circle are nonnegative, then a difference move can-
not increase the largest of them.
• No matter what four integers we start with, we will always end up with
0, 0, 0, 0 if we make sufficiently many difference moves.
The following exercise (which redefines a difference move as a map D on the set
of 4-tuples of integers) states these conjectures in a rigorous fashion and asks you
to prove them:
(| a − b| , |b − c| , |c − d| , |d − a|) ∈ Z4 .
Exercise 8.3.8. The Leibniz triangle is a distant relative of Pascal’s triangle. Here
are its first few rows:
k =0
.
1 k =1
n=0 → .
1
1 1 k =2
n=1 → .
2 2
1 1 1 k =3
n=2 → .
3 6 3
1 1 1 1 k =4
n=3 → .
4 12 12 4
1 1 1 1 1 k =5
n=4 → .
5 20 30 20 5
1 1 1 1 1 1 k =6
n=5 → .
6 30 60 60 30 6
1 1 1 1 1 1 1
n=6 →
7 42 105 140 105 42 7
(a) Prove that the numbers T (n, k) are uniquely determined by this.
(b) Find an explicit formula for T (n, k).
Exercise 8.3.9. Let n and k be two positive integers. You have nk identical coins
distributed in n piles. Whenever two piles have an even number of coins in
total, you are allowed to move coins between these piles in such a way that the
numbers of coins on these two piles become equal. Such a move will be called
a balancing move. (For example, if you have a pile with 3 coins and a pile with
9 coins, then a balancing move will change these two piles into two piles with
6 coins each. Each balancing move only changes two piles.) The distribution of
coins is said to be level if all piles have the same number of coins.
Prove the following:
(a) If n is a power of 2, then any distribution of nk coins in n piles can be made
level by a sequence of balancing moves.
(b) If n is not a power of 2, then there is a distribution of nk coins in n piles
(for an appropriate k) that cannot be made level by any sequence of balancing
moves.
[Example: If n = 5 and k = 3, and if the original distribution is (2, 4, 1, 4, 4)
(that is, the first pile has 2 coins, the second has 4 coins, the third has 1 coin,
etc.), then here is one sequence of balancing moves that can be applied to this
distribution (where we are underlining the piles that are being balanced in the
next step):
silo, at least half of all the pears in the silo, and at least half of all the peaches in
the silo?
Exercise 8.3.11. Let a, b ∈ N. The “toads and frogs” puzzle is a one-player game
played on a 1 × ( a + b + 1) horizontal strip of squares. Initially, the leftmost a
squares are occupied by toads (one toad per square); the rightmost b squares
are occupied by frogs (one frog per square); the one remaining square is empty.
Thus, for example, for a = 3 and b = 5, the strip of squares looks as follows:
T T T F F F F F
(where “T” stands for a toad, and where “F” stands for a frog). A move in this
game is one of the following four operations:
• A toad moves one square to the right, assuming that the square it moves
to is empty. This is called a toad slide.
• A toad moves two squares to the right, assuming that the square it moves
to is empty and the square inbetween is occupied by a frog. (That is, a toad
jumps over a single frog into an empty square to its right.) This is called a
toad jump.
• A frog moves one square to the left, assuming that the square it moves to
is empty. This is called a frog slide.
• A frog moves two squares to the left, assuming that the square it moves to
is empty and the square inbetween is occupied by a toad. (That is, a frog
jumps over a single toad into an empty square to its left.) This is called a
frog jump.
The objective of the game is to achieve (by a sequence of moves, starting with
the initial state described above) the state in which the leftmost b squares are
occupied by frogs, the rightmost a squares are occupied by toads, and the one
remaining square is empty. For example, here is a way to achieve this objective
when a = 2 and b = 2:
toad slide
T T F F −→ T T F F
frog jump frog slide
−→ T F T F −→ T F T F
toad jump toad jump
−→ T F F T −→ F T F T
frog slide frog jump
−→ F T F T −→ F F T T
toad slide
−→ F F T T .
(See Definition 3.3.1 and Definition 4.3.19 for the notations used in Exercise 8.4.3.)
The next few exercises are about single-player games (aka nondeterministic pro-
cesses):
In one move, you can break a chocolate bar into two by splitting it along one of
the (horizontal or vertical) lines that divide it (unless it is already a 1 × 1-square).
For example:
move move
−→ −→ .
(a) What is the smallest number of moves necessary to break up the entire bar
into 1 × 1-squares?
(b) What is the largest number of moves necessary to break up the entire bar
into 1 × 1-squares?
Exercise 8.4.5. A circle is split into 6 sectors, and a number has been written in
each sector. These numbers are 1, 0, 1, 0, 0, 0 in clockwise order, as shown in the
following picture:
0
1 1
0 0
0
In one move, you can add 1 to any two numbers written in adjacent sectors.
Can you ever ensure that all six sectors have the same number written in them?
Exercise 8.4.7. Fix two positive integers a and b. Consider a + b bowls, numbered
1, 2, . . . , a + b. Initially, each of the bowls 1, 2, . . . , a contains an apple, and each
of the bowls a + 1, a + 2, . . . , a + b contains a pear. A move consists of picking two
numbers i, j ∈ [ a + b] satisfying i < a + b and j > 1 and i ≡ j mod 2, and moving
an apple from bowl i to bowl i + 1 and a pear from bowl j to bowl j − 1. (We
assume that these fruits do exist in these bowls; otherwise, the move cannot be
made. It is allowed for several fruits to lie in one bowl at the same time.)
The goal is to end up with each of the bowls 1, 2, . . . , b containing a pear and
each of the bowls b + 1, b + 2, . . . , b + a containing an apple. Show that this goal
can be reached if and only if the product ab is even.
Exercise 8.4.8. Consider a hotel with an infinite number of rooms, arranged se-
quentially on the ground floor. The rooms are labelled by integers i ∈ Z, with
room i being adjacent to rooms i − 1 and i + 1. A finite number of violinists are
staying in the hotel (it is possible for two violinists to be staying in the same
room). Each night, two violinists staying in the same room decide they cannot
stand each other’s noise, and move to the two adjacent rooms (i.e., if they were
in room i, they move to rooms i − 1 and i + 1). (Only two violinists move in any
given night.) This keeps happening for as long as there are two violinists staying
in the same room.
Prove that this moving will stop after a finite number of days (i.e., there will
be a day when no two violinists share a room any more).
[Example: Let us assume that initially, there are 5 violinists (named a, b, c, d, e),
arranged as follows:
a d
··· c ··· (400)
b e
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel). On the first night, let’s say
the violinists a and b tire of each other’s presence and move apart; this results in
the following state:
b d
··· a ··· .
c e
On the next night, the violinists b and c decide to move apart, and we obtain the
following state:
c
··· a b d ··· .
e
On the next night, the violinists c and e decide to move apart, and we obtain the
state
··· a b c d e ··· .
Now, no two violinists occupy the same room any more, so no further moves can
happen.]
Our last two exercises on this homework set are about sequences of rational
numbers that turn out to be integer sequences (not unlike the ones in Section 4.11
and Subsection 8.1.3):
and
t2n−1 + qtn−1 tn−2 + t2n−2
tn = for each n ≥ 3.
t n −3
Prove that tn is a positive integer for each integer n ≥ 0.
9.1. Primes
9.1.1. Definition and examples
We begin with the definition of a prime:
Definition 9.1.1. Let p be an integer greater than 1. We say that p is prime if the
only positive divisors of p are 1 and p. A prime integer is often just called a
prime.
Note that we required p to be greater than 1 here. Thus, 1 does not count as
prime even though its only positive divisor is 1 itself.
Example 9.1.2. (a) The integer 5 is a prime, since its only positive divisors are 1
and 5.
(b) The integer 6 is not a prime, since it has positive divisors beyond just 1 and
6. (For example, 2 is one of its positive divisors.)
(c) None of the integers 4, 6, 8, 10, 12, 14, 16, . . . (that is, the multiples of 2 that
are larger than 2) is a prime. Indeed, if p is any of these numbers, then p has a
positive divisor other than 1 and p (namely, 2), and therefore does not meet the
definition of “prime”.
(d) None of the integers 6, 9, 12, 15, 18, . . . (that is, the multiples of 3 that are
larger than 3) is a prime. The reason for this is similar to that in Example 9.1.2
(c).
Many proofs of this theorem are known; for example, six proofs can be found
in [AigZie14, Chapter 1]. We shall give two proofs here; but first, let us show that
every integer n > 1 is divisible by at least one prime:
Proposition 9.1.4. Let n > 1 be an integer. Then, there exists at least one prime
p such that p | n.
Proof of Proposition 9.1.4 (sketched). (See [19s, proof of Proposition 2.13.8] for de-
tails.) This is another application of the extremal principle: There exists a divisor of
n that is larger than 1 (for example, n itself is such a divisor). Let q be the smallest
such divisor. Then, q | n and q > 1.
We now claim that q is a prime. Indeed, assume the contrary. Thus, q is not a
prime; in other words, 1 and q are not the only positive divisors of q (by Definition
9.1.1). In other words, q has a positive divisor d distinct from 1 and q. Consider this
d. We have d | q | n and d > 1 (since d is a positive integer distinct from 1). Thus,
d is a divisor of n that is larger than 1. Hence, d ≥ q (since q is the smallest such
divisor). However, d | q entails d ≤ q (since d and q are both positive). Combining
this with d ≥ q, we obtain d = q, which contradicts the fact that d is distinct from
q. This contradiction shows that our assumption was wrong. Hence, q is a prime.
Thus, there exists at least one prime p such that p | n (namely, p = q). This proves
Proposition 9.1.4.
We can now step to the proofs of Theorem 9.1.3:
First proof of Theorem 9.1.3 (sketched). (See [19s, proof of Theorem 2.13.43] for de-
tails.) The following classical argument goes back to Euclid’s Elements: Let ( p1 , p2 , . . . , pk )
be any finite list of primes. We shall find a new prime p that is distinct from
p1 , p2 , . . . , p k .
Indeed, set n = p1 p2 · · · pk + 1. It is easy to see that n > 1. Hence, Proposition
9.1.4 shows that there exists at least one prime p such that p | n. Consider this p.
For each i ∈ {1, 2, . . . , k }, we have pi - 1 (since pi is a prime, so that pi > 1) and
thus
Proof of Proposition 9.1.5 (sketched). (See [19s, proof of Proposition 2.13.4] for de-
tails.) Let i ∈ {1, 2, . . . , p − 1}. We must prove that i is coprime to p. In other
words, we must prove that gcd (i, p) = 1.
From i ∈ {1, 2, . . . , p − 1}, we see that i is positive and satisfies i ≤ p − 1 < p.
Proposition 3.4.4 (f) yields gcd (i, p) | i and gcd (i, p) | p. From gcd (i, p) | i, we
obtain |gcd (i, p)| ≤ |i | (by Proposition 3.1.3 (b)). This rewrites as gcd (i, p) ≤ i
(since gcd (i, p) and i are positive). Hence, gcd (i, p) ≤ i < p.
But p is prime; thus, the only positive divisors of p are 1 and p. However,
gcd (i, p) is a positive divisor of p (since gcd (i, p) | p). Thus, gcd (i, p) must be
either 1 or p. Since gcd (i, p) < p, we thus conclude gcd (i, p) = 1. Proposition 9.1.5
is proven.
Proof of Proposition 9.1.6 (sketched). (See [19s, proof of Proposition 2.13.5] for a dif-
ferent proof.) We are in one of the following two cases:
Case 1: We have a%p = 0.
Case 2: We have a%p 6= 0.
Let us first consider Case 1. In this case, we have a%p = 0. However, Proposition
3.3.2 (b) (applied to n = p and u = a) yields that we have p | a if and only if
a%p = 0. Thus, p | a (since a%p = 0). Hence, Proposition 9.1.6 is proved in Case 1.
Let us now consider Case 2. In this case, we have a%p 6= 0. But Proposition
3.3.2 (a) (applied to n = p and u = a) yields that a%p ∈ {0, 1, . . . , p − 1} and
a%p ≡ a mod p. Combining a%p ∈ {0, 1, . . . , p − 1} with a%p 6= 0, we find a%p ∈
{0, 1, . . . , p − 1} \ {0} = {1, 2, . . . , p − 1}. Hence, Proposition 9.1.5 (applied to i =
a%p) yields that a%p is coprime to p. In other words, gcd ( a%p, p) = 1. But
Proposition 3.4.4 (e) (applied to p and a instead of a and b) yields
This is easy to prove using the above propositions (see [19s, solution to Exercise
2.13.1] for a detailed proof).
The following property of primes ([19s, Theorem 2.13.6]) is probably one of the
most important ones:
Proof of Theorem 9.1.8. Clearly, Theorem 9.1.8 is true if p | a. Hence, for the rest of
this proof, we WLOG assume that we don’t have p | a.
However, Proposition 9.1.6 shows that we have either p | a or p ⊥ a. Thus, p ⊥ a
(since we don’t have p | a). However, p | ab. Hence, Theorem 3.5.6 (applied to p, a
and b instead of a, b and c) yields p | b. Thus, p | a or p | b. This proves Theorem
9.1.8.
Hint to the proof of Proposition 9.1.9. This is easy to prove by induction on k (with
the induction step relying on Theorem 9.1.8). Alternatively, this can be derived
from Exercise 3.5.4 and Proposition 9.1.6. (See [19s, proof of Proposition 2.13.7] for
the latter proof.)
We notice that Proposition 9.1.9 is, in some way, saying that primes “act like
0” in the following sense: It is well-known that a product of numbers is 0 if and
only if one of the factors is 0. Proposition 9.1.9 says something similar: It says
that a product of integers is divisible by a prime p if and only if one of its factors is
divisible by p. (To be more precise, the proposition only claims the “only if” part of
this sentence; but the “if” part is obvious.) This analogy becomes even more vivid
if we replace the wording “divisible by p” by the (equivalent) wording “congruent
to 0 modulo p”. This foreshadows the existence of the finite field F p , which we will
later get to define.
Solution to Exercise 9.1.1. (a) Let p > 2 be a prime. We must show that p is odd.
Indeed, assume (for the sake of contradiction) that p is even. Hence, 2 | p. Thus,
2 is a positive divisor of p. However, p is prime. In other words, the only positive
divisors of p are 1 and p (by the definition of “prime”). Thus, 2 must be either 1 or
p (since 2 is a positive divisor of p). Since 2 is not 1, we thus conclude that 2 is p.
In other words, 2 = p. This contradicts p > 2. This contradiction shows that our
assumption was false.
Hence, p is not even. In other words, p is odd. This proves Exercise 9.1.1 (a).
(b) Let p > 3 be a prime. We must prove that p ≡ 1 mod 6 or p ≡ 5 mod 6.
Indeed, p > 3 > 2. Hence, Exercise 9.1.1 (a) shows that p is odd. In other words,
p ≡ 1 mod 2 (by Exercise 3.3.2 (d), applied to u = p). In other words, 2 | p − 1. In
other words, there exists an integer c such that p − 1 = 2c. Consider this c. From
p − 1 = 2c, we obtain p = 2c + 1.
In the above solution to Exercise 9.1.1 (a), we have showed that p is not even. A
similar argument can be used to show that we don’t have p ≡ 0 mod 3 276 .
276 Here are the details:
2 0
case (for example, 2 ≡ 0 mod 2 is true, but ≡ mod 2 is false). Neverthe-
2 2
less, it holds if n is prime and k < n, as the following exercise shows:277
Exercise 9.1.2. Let p be a prime. Let a and bbe two integers such that a ≡
a b
b mod p. Let k ∈ {0, 1, . . . , p − 1}. Prove that ≡ mod p.
k k
Solution to
Exercise
9.1.2.
Our plan is the following: First, we shall prove the con-
a b
gruence k! ≡ k! mod p; then, we will argue that k! ⊥ p, and thus (using
k k
Lemma 3.5.11) we will be able the k! from this congruence.
to cancel
a b
We begin by proving k! ≡ k! mod p. Indeed, (117) (applied to n = a)
k k
yields
a ( a − 1) ( a − 2) · · · ( a − k + 1)
a
= .
k k!
Multiplying this equality by k!, we find
a
k! = a ( a − 1) ( a − 2) · · · ( a − k + 1)
k
= ∏ ( a − s) . (402)
s∈{0,1,...,k−1}
However, a
|{z} −s ≡ b − s mod p for each s ∈ {0, 1, . . . , k − 1}. Hence, (41) (ap-
≡b mod p
plied to S = {0, 1, . . . , k − 1} and as = a − s and bs = b − s and n = p) yields
∏ ( a − s) ≡ ∏ (b − s) mod p. Hence,
s∈{0,1,...,k−1} s∈{0,1,...,k−1}
a b
k!
k
= ∏ ( a − s) ≡ ∏ (b − s) = k!
k
mod p
s∈{0,1,...,k−1} s∈{0,1,...,k−1}
(by (403)).
Now, k ≤ p − 1 (since k ∈ {0, 1, . . . , p − 1}) and k! = 1 · 2 · · · · · k. We shall next
show that k! ⊥ p.
Let i ∈ {1, 2, . . . , k}. Then, i ∈ {1, 2, . . . , k} ⊆ {1, 2, . . . , p − 1} (since k ≤ p − 1).
Thus, i is coprime to p (by Proposition 9.1.5). In other words, i ⊥ p.
277 Exercise 9.1.2 is [Grinbe19c, Proposition 5.5] (with u and v renamed as a and b).
Forget that we fixed i. We thus have shown that each i ∈ {1, 2, . . . , k } satisfies
i ⊥ p. Thus, Exercise 3.5.4 (applied to c = p and ai = i) yields 1 · 2 · · · · · k ⊥ p.
In other k! ⊥ p (since k! = 1 · 2 · · · · · k). Therefore,
words, Lemma
3.5.11 (applied
a b a b
to k!, , and p instead of a, b, c and n) yields ≡ mod p (since
k k k k
a b
k! ≡ k! mod p). This proves Exercise 9.1.2.
k k
As a further example, here is a problem from the 12th University of Michigan
Undergraduate Mathematics Competition in 1995 ([VelWag20, Problem 28]):
Exercise 9.1.3. Let n be a positive integer. Prove that n is prime if and only if
1 1 1
there is a unique pair ( j, k ) of positive integers satisfying − = .
j k n
Solution to Exercise 9.1.3 (sketched). We shall prove the following four claims:
Once these four claims are proved, Exercise 9.1.3 will follow by combining Claim
2 with Claim 4. (Claims 1 and 3 serve ancillary roles in proving other claims.) So
let us prove these four claims:
[Proof of Claim 1: Assume that n > 1. Then, n − 1 and (n − 1) n are positive
1 1 1
integers, and an easy computation reveals that − = . Hence,
n−1 ( n − 1) n n
1 1 1
there is at least one pair ( j, k ) of positive integers satisfying − = (namely,
j k n
( j, k) = (n − 1, (n − 1) n)). This proves Claim 1.]
[Proof of Claim 2: Assume that n is prime. Thus, n > 1. Now, let ( j, k ) be
1 1 1
a pair of positive integers satisfying − = . We shall show that ( j, k) =
j k n
( n − 1, ( n − 1 n
) ) .
1 1 1 1 1 1 1
Indeed, we have − = , so that = − < and thus j < n. Hence,
j k n n j |{z}
k j
>0
we cannot have n | j 278 . Also, from j < n, we see that n − j is a positive integer.
Also, n − j cannot be n (since n − j < n).
|{z}
>0
1 1 1 k−j
Also, = − = , so that jk = n (k − j). Now, n | n (k − j) = jk. Hence,
n j k jk
Theorem 9.1.8 (applied to p = n, a = j and b = k) yields that n | j or n | k. Thus,
we have n | k (since we cannot have n | j). In other words, k = na for some a ∈ Z.
Consider this a.
Now, recall that jk = n (k − j). In view of k = na, this rewrites as jna = n (na − j).
We can cancel n from this equality (since n > 0), and thus obtain ja = na − j. Hence,
(n − j) ( a + 1) = na − ja +n − j = na − (na − j) + n − j = n.
|{z}
=na− j
Exercise 9.1.4. Let n be an integer. Prove that n can be represented in the form
n = u2 − v2 for some u, v ∈ Z if and only if n 6≡ 2 mod 4.
n
Exercise 9.1.5. Let be a positive integer. Prove that n can be represented in the
u
form n = uv − for some u, v ∈ Z satisfying v ≥ u ≥ 3 if and only if n is
2
neither a prime nor a power of 2.
The following exercise is among the first results in the deep topic of interplays
between primes and Pascal’s triangle:
p −1
Exercise 9.1.7. Let p be a prime. Let k ∈ {0, 1, . . . , p − 2}. Prove that ∑ ik ≡
i =0
0 mod p.
[Hint: Exercise 9.1.6 (b) might help.]
Theorem 9.1.10 is often abbreviated “FLT” or “Little Fermat”. The word “little”
in the name of this theorem is to distinguish it from “Fermat’s Last Theorem”, a
much more difficult result only proven in the 1990s.
Note that Exercise 3.3.5 is the particular case of Theorem 9.1.10 (a) for p = 3 (and
a = n).
We will outline two proofs of Theorem 9.1.10. The first relies on the following
lemma:
n = p) yields
p
p k p−k
( a + b) = ∑
p
a b
k =0
k
p −1
p p p
|{z} |{z} ∑
p −0 k p−k p− p
= a 0
b + a b + a p b|{z}
0 k =1
k p
| {z } =1 =b p | {z } | {z } = b0 =1
=1 ≡0 mod p =1
(by (119)) (since Exercise (by (124))
9.1.6
(a)
p
yields p| )
k
here, we have split off the addends for k = 0 and
for k = p from the sum
p −1
≡b +p
∑ 0ak b p−k +a p = b p + a p = a p + b p mod p.
|k=1 {z }
=0
Remark 9.1.12. We have used Lemma 9.1.11 to prove Theorem 9.1.10 (b) above;
conversely, Lemma 9.1.11 can easily be derived from Theorem 9.1.10 (b). This
might suggest that Lemma 9.1.11 is just a one-trick tool for the proof of Theorem
9.1.10 (b). However, when properly generalized, Lemma 9.1.11 becomes much
stronger and more useful than Theorem 9.1.10 (b) can ever get! Indeed, there is
a “grown-up” version of Lemma 9.1.11, which no longer requires a and b to be
integers but rather allows them to be any two commuting elements of a ring (see
any course on abstract algebra for the meanings of these words). A down-to-
earth example of this is when a and b are two n × n-matrices with integer entries
satisfying ab = ba; the “grown-up” version of Lemma 9.1.11 (a) then says that
( a + b) p ≡ a p + b p mod p, in the sense that each entry of the matrix ( a + b) p is
congruent to the corresponding entry of a p + b p modulo p.
Thus, Lemma 9.1.11 in the form we stated it above is merely the tip of an
iceberg. Fortunately, the proof we gave for it applies almost verbatim to the
generalization (which is known as “Idiot’s Binomial Formula” or “Freshman’s
Dream”, as it allows replacing the p-th power of a sum by a sum of p-th powers
in certain situations).
Theorem 9.1.13 (Euler’s theorem). Let n be a positive integer. We let φ (n) denote
the number of all i ∈ {1, 2, . . . , n} satisfying i ⊥ n. (This notation was already
used in Exercise 4.5.6.)
Let a ∈ Z be coprime to n. Then, aφ(n) ≡ 1 mod n.
Discussion of Exercise 9.1.9. The last digit of a positive integer n is n%10 (that is, the
7
remainder of n upon division by 10). So we need to compute 77 %10.
Since 7 is coprime to 10, we can apply Theorem 9.1.13 to n = 10 and a = 7. We
thus get 7φ(10) ≡ 1 mod 10. Since φ (10) = 4, this rewrites as 74 ≡ 1 mod 10. (This is
also not hard to check directly, using 72 = 49 ≡ −1 mod 10.) Hence, if we write 77
in the form 77 = 4a + b for some a, b ∈ N, then
a
7
77 = 74a+b = |{z}
74a ·7b = |{z}
74 · 7b ≡ |{z}
1a ·7b = 7b mod 10
a ≡1 mod 10 =1
=(74 )
7 7
and therefore 77 %10 = 7b %10. This gives us an easy way to compute 77 %10
provided that b is small enough (so we can compute 7b %10).
Now, how do we write 77 in the form 77 = 4a + b for some a, b ∈ N, with smallest
possible b ? The answer is, of course, that we take a = 77 //4 and b = 77%4
Proposition 3.3.2 (d) yields 77 = 77 //4 · 4 + 77 %4 = 4 77 //4 +
(because
77 %4 ). Thus, let us set a = 77 //4 and b = 77 %4. As we have seen, we have
7
77 %10 = 7b %10. It remains to compute 7b %10.
We first compute b: We have 7 ≡ −1 mod 4 and thus 77 ≡ (−1)7 = −1 mod 4, so
that 77 %4 = (−1) %4 = 3. (Of course, we could also have used Theorem 9.1.13 to
7
obtain this, in the same way as we used it to show 77 %10 = 7b %10. But powers of
−1 are easy enough to take by hand!) Hence, b = 77 %4 = 3 and thus
7 b = 73 = 72
|{z} ·7 ≡ (−1) · 7 ≡ 3 mod 10,
=49≡−1 mod 10
Theorem 9.1.13 can also be used to explain why certain rational numbers (such
2
as = 0.285714 279 ) have purely periodic decimal expansions, while others (such
7
1 1
as = 0.083 = 0.0833333 . . . or = 0.50 = 0.50000 . . .) have their periods start
12 2
only after some initial nonrepeating block. We refer [ConradE, §4] to the details of
this.280
Let us now outline a proof of Theorem 9.1.13:
Proof of Theorem 9.1.13 (sketched). (See [19s, proof of Theorem 2.15.3] for details.) It
is easy to see (using Proposition 3.4.4) that gcd (0, n) = gcd (n, n). Hence, 0 ⊥ n
holds if and only if n ⊥ n.
Set
C = {i ∈ {0, 1, . . . , n − 1} | i ⊥ n} .
A moment’s thought reveals that |C | = φ (n) 281 .
279 The bar ( ) over the “285714” means that we are repeating 285714 over and over. So 0.285714 =
0.285714285714285714 . . ..
280 Here is the rule, in a nutshell: A fraction a (where a and b are two integers with b 6 = 0) has a
b
purely periodic decimal expansion if and only if b ⊥ 10 (in other words, 2 - b and 5 - b); other-
wise, it has an eventually periodic decimal expansion (which may be a finite decimal expansion,
1
such as = 0.5 = 0.50). This can be proven using Theorem 9.1.13.
2
281 Proof. The definition of C yields
(since |C | = φ (n)).
On the other hand, every i ∈ C satisfies ai ≡ ( ai ) %n mod n (since Proposition
3.3.2 (a) (applied to u = ai) yields ( ai ) %n ≡ ai mod n). Multiplying these congru-
ences over all i ∈ C, we obtain
Now, we claim that the product ∏ (( ai ) %n) on the right hand side of this equal-
i ∈C
ity has the same factors as the product ∏ i, just in a different order. In other words,
i ∈C
the map
C → C,
i 7→ ( ai ) %n
is bijective. In order to prove this, we must first show that this map is well-defined:
we obtain
|C | = φ (n) .
[Proof of Claim 1: Let i ∈ C. Proposition 3.3.2 (a) (applied to u = ai) yields that
( ai ) %n ∈ {0, 1, . . . , n − 1}.
From a ⊥ n and i ⊥ n, we obtain ai ⊥ n (by Theorem 3.5.10). In other words,
n ⊥ ai. However, Proposition 3.4.4 (e) yields gcd (n, ai ) = gcd (n, ( ai ) %n), so that
gcd (n, ( ai ) %n) = gcd (n, ai ) = 1 (since n ⊥ ai) and thus n ⊥ ( ai ) %n. In other
words, ( ai ) %n ⊥ n. Combining this with ( ai ) %n ∈ {0, 1, . . . , n − 1}, we obtain
( ai ) %n ∈ C (by the definition of C). This proves Claim 1.]
Thus, we can define a map
f : C → C,
i 7→ ( ai ) %n.
Consider this map f .
Claim 2: The map f is injective.
[Proof of Claim 2: Let i and j be two elements of C such that f (i ) = f ( j). We must
prove that i = j.
We have f (i ) = f ( j). In view of f (i ) = ( ai ) %n (by the definition of f ) and
f ( j) = ( aj) %n, this rewrites as ( ai ) %n = ( aj) %n. Because of Proposition 3.3.4
(applied to u = ai and v = aj), this entails that ai ≡ aj mod n. By Lemma 3.5.11, we
can “cancel” a from this congruence (since a ⊥ n), and obtain i ≡ j mod n. However,
both i and j belong to C and thus belong to {0, 1, . . . , n − 1} (by the definition of
C). Hence, from i ≡ j mod n, we can easily obtain that i = j 282 .
Now, forget that we fixed i and j. We thus have proven that if i and j are two
elements of C such that f (i ) = f ( j), then i = j. In other words, f is injective.]
Claim 3: The map f is a bijection.
[Proof: Claim 2 shows that f is injective. Hence, Corollary 6.2.9 (a) (applied to
X = C) shows that f is a permutation of C. Thus, f is bijective. This proves Claim
3.]
Now, we know that f is a bijection from C to C. Thus, we can substitute f (i ) for
i in the product ∏ i. So we obtain
i ∈C
the rest of this proof, we WLOG assume that p - a. Thus, Theorem 9.1.10 (a) yields
a p−1 ≡ 1 mod p. In other words, p | a p−1 − 1. Hence, p | a p−1 − 1 | a a p−1 − 1 .
But as we have explained, this completes the proof of Theorem 9.1.10 (b).
The number φ (n) defined in Theorem 9.1.13 has further properties; thus, let us
introduce a name for it:
Example 9.1.15. (a) We have φ (12) = 4, since the number of all i ∈ {1, 2, . . . , 12}
that are coprime to 12 is 4 (indeed, these i are 1, 5, 7 and 11).
(b) We have φ (13) = 12, since the number of all i ∈ {1, 2, . . . , 13} that are
coprime to 13 is 12 (indeed, these i are 1, 2, . . . , 12).
(c) We have φ (14) = 6, since the number of all i ∈ {1, 2, . . . , 14} that are
coprime to 14 is 6 (indeed, these i are 1, 3, 5, 9, 11, 13).
(d) We have φ (1) = 1, since the number of all i ∈ {1, 2, . . . , 1} that are coprime
to 1 is 1 (indeed, the only such i is 1).
We will later come back to Euler’s totient function φ, to give an “explicit” for-
mula for it (using the prime factorization). For now, we observe that the sequence
(φ (1) , φ (2) , φ (3) , . . .) is Sequence A000010 in the OEIS (where, as usual, lots of
its properties and references can be found).
14 = 1 + 13 = 7 + 7 = 3 + 5 + 6 = 2 + 3 + 4 + 5.
and many others. In particular, we can always insert a factor equal to 1 into any
such decomposition (since 1a = a for each a ∈ Z), so we can find infinitely many
such decompositions. Thus, let us restrict ourselves to considering only the de-
compositions with no factor equal to 1. By trial and error, we eventually find the
decomposition
2020 = 2 · 2 · 5 · 101,
which cannot be “refined” since the numbers 2, 2, 5, 101 are prime and thus cannot
be further decomposed. Recall that a prime number is precisely an integer p > 1
that cannot be decomposed into a product of two integers > 1. Thus, a decompo-
sition of n into a product of positive integers > 1 cannot be further decomposed
if and only if all its factors are primes. Such a decomposition (or, to be pedantic,
the list of its factors) is called a prime factorization of n. Thus, for example, the de-
composition 2020 = 2 · 2 · 5 · 101 (or, to be pedantic, the list (2, 2, 5, 101)) is a prime
factorization of 2020. Likewise, 2021 = 43 · 47 is a prime factorization of 2021.
It is worth memorizing these prime factorizations if you plan on participating in any
mathematical contests in the years 2020 and 2021, as there is a tradition in contests to
involve the current year as a number in problems. For example, problem B6 on the Putnam
contest 2017 asked for the # of all 64-tuples ( x0 , x1 , . . . , x63 ) with x0 , x1 , . . . , x63 being distinct
elements of the set [2017] and satisfying 2017 | x0 + x1 + 2x2 + 3x3 + · · · + 63x63 . The
solution relied heavily on the fact that 2017 is prime. Problem A3 on the Putnam contest
2015 relied on the fact that 2015 = 5 · 13 · 31 is a prime factorization of 2015. Problem
B1 on the Putnam contest 2013 involved the number 2013, but only used the fact that it
is odd. While there are many problems in which the year number could be replaced by
any positive integer, my experience suggests that whenever some specific property of the
number is used, it is usually easy to read off that property from the prime factorization of
the number.
Now, it is natural to ask two questions: Does any positive integer n have a prime
factorization, and is it unique? It is easy to see that the answer to the first question
is “yes” (essentially because you can start with the trivial decomposition n = n
and then keep “refining” it until it is no longer possible; all you need to show is
that this cannot go on forever, but this can easily be done using a monovariant).
If you are pedantic, then the answer to the second question is “no”: For example,
the number 12 has the three prime factorizations 2 · 2 · 3, 2 · 3 · 2 and 3 · 2 · 2. But
these three prime factorizations only differ in the order of their factors; they are
not distinct in any useful sense. Formally speaking, these factorizations (written as
lists (2, 2, 3), (2, 3, 2) and (3, 2, 2)) are permutations of each other. Let us define this
notion formally:283
Example 9.2.2. (a) The 4-tuple (2, 1, 1, 3) is a permutation of the 4-tuple (3, 1, 2, 1).
In fact, if we denote the 4-tuple (3, 1, 2, 1) by ( p1 , p2 ,
p3 , p4 ), then there exists
a permutation σ of the set [4] such that (2, 1, 1, 3) = pσ(1) , pσ(2) , pσ(3) , pσ(4) .
(Actually, there exist two such permutations σ: One of them sends 1, 2, 3, 4 to
3, 2, 4, 1, while the other sends 1, 2, 3, 4 to 3, 4, 2, 1.)
(b) Any k-tuple is a permutation
of itself. Indeed, if ( p1 , p2 , . . . , pk ) is any k-
tuple, then ( p1 , p2 , . . . , pk ) = p σ (1) , p σ (2) , . . . , p σ ( k ) if we let σ be the identity
map id : [k ] → [k ].
283 We will use the notation from Definition 7.2.1; thus, [k ] means the set {1, 2, . . . , k}.
Next, for the sake of consistency, let us formally repeat our above definition of a
prime factorization:
Definition 9.2.3. Let n be a positive integer. A prime factorization of n means a
tuple ( p1 , p2 , . . . , pk ) of primes such that n = p1 p2 · · · pk .
(b) If p is a prime, then the only prime factorization of p is the 1-tuple ( p).
and i ∈ N, then the only prime factorization of p is the
p is a prime
(c) If i
We are finally ready to state and prove the so-called Fundamental Theorem of Arith-
metic:
Theorem 9.2.5. Let n be a positive integer.
(a) There exists a prime factorization of n.
(b) Any two prime factorizations of n are permutations of each other.
We shall soon sketch a proof of this theorem; first, let us introduce a notation
(which will only be used in this section):
Definition 9.2.6. Let L be the set of all finite lists of positive integers. We define
a binary relation ∼ on L as follows: Given two lists p and q of positive integers,
we set p ∼ q if and only if the list p is a permutation of q.
284 Proof. Assume that ` = 0. Then, (q1 , q2 , . . . , q` ) = (q1 , q2 , . . . , q0 ) = (). Also, k ≤ ` = 0 and thus
k = 0. Hence, ( p1 , p2 , . . . , pk ) = ( p1 , p2 , . . . , p0 ) = (). But obviously, () ∼ (). In other words,
( p1 , p2 , . . . , pk ) ∼ (q1 , q2 , . . . , q` ) (since ( p1 , p2 , . . . , pk ) = () and (q1 , q2 , . . . , q` ) = ()). Hence, we
have proved that ( p1 , p2 , . . . , pk ) ∼ (q1 , q2 , . . . , q` ) under the assumption that ` = 0.
( p 1 , p 2 , . . . , p i −1 , p i +1 , p i +2 , . . . , p k , p i ) ∼ ( p 1 , p 2 , . . . , p k ) .
Since the relation ∼ is symmetric, this entails
( p 1 , p 2 , . . . , p k ) ∼ ( p 1 , p 2 , . . . , p i −1 , p i +1 , p i +2 , . . . , p k , p i ) . (408)
On the other hand, m/q` is an integer (since q` | m) and is positive (since m and
q` are positive) and satisfies m/ q` < m/1 = m. Thus, our induction hypothesis
|{z}
>1
shows that Theorem 9.2.5 (b) holds for n = m/q` . In other words, any two prime
factorizations of m/q` are permutations of each other.
Let us now find two such prime factorizations to apply this fact to. We notice the
following:
q1 q2 · · · q`−1 = m/q`
Hence, Proposition 9.2.7 (c) (applied to ( p1 , p2 , . . . , pi−1 , pi+1 , pi+2 , . . . , pk ), (q1 , q2 , . . . , q`−1 )
and pi instead of ( a1 , a2 , . . . , ak ), (b1 , b2 , . . . , b` ) and c) yields that
( p 1 , p 2 , . . . , p k ) ∼ ( p 1 , p 2 , . . . , p i −1 , p i +1 , p i +2 , . . . , p k , p i )
∼ (q1 , q2 , . . . , q`−1 , pi )
= (q1 , q2 , . . . , q`−1 , q` ) (since pi = q` )
= ( q1 , q2 , . . . , q ` ) .
Exercise 9.2.1. Prove that there are infinitely many primes p that satisfy p ≡
2 mod 3.
286 The following manipulations tacitly use the fact that the relation ∼ is an equivalence relation.
Solution to Exercise 9.2.1 (sketched). The following solution is rather similar to our
first proof of Theorem 9.1.3 above, but is somewhat complicated by the need to
keep track of the p ≡ 2 mod 3 condition.
We define a 2 mod 3-prime to mean a prime p that satisfies p ≡ 2 mod 3. Thus,
we need to show that there are infinitely many 2 mod 3-primes.
Let ( p1 , p2 , . . . , pk ) be any finite list of 2 mod 3-primes. We shall find a new
2 mod 3-prime p that is distinct from p1 , p2 , . . . , pk .
Indeed, set n = 3p1 p2 · · · pk − 1. It is easy to see that n > 0. Hence, Theorem
9.2.5 (a) shows that there exists a prime factorization of n. Let (q1 , q2 , . . . , q` ) be
this prime factorization. Thus, (q1 , q2 , . . . , q` ) is an `-tuple of primes such that
n = q1 q2 · · · q` . In other words, q1 , q2 , . . . , q` are primes and satisfy n = q1 q2 · · · q` .
We now claim that at least one of the primes q1 , q2 , . . . , q` must be a 2 mod 3-
prime.
[Proof: Assume the contrary. Thus, none of the primes q1 , q2 , . . . , q` is a 2 mod 3-
prime.
Note that n = 3p1 p2 · · · pk −1 ≡ 0 − 1 = −1 ≡ 2 mod 3. Hence, n ≡ 2 6≡ 0 mod 3,
| {z }
≡0 mod 3
so that 3 - n.
Let i ∈ {1, 2, . . . , `}. Then, qi is not a 2 mod 3-prime (since none of the primes
q1 , q2 , . . . , q` is a 2 mod 3-prime). In other words, qi 6≡ 2 mod 3 (since qi is a prime).
Moreover, qi | n (since n = q1 q2 · · · q` ) and thus qi 6≡ 0 mod 3 (because if we had
qi ≡ 0 mod 3, then we would have 3 | qi | n, which would contradict 3 - n).
However, the remainder qi %3 is either 0, 1 or 2 (since qi %3 ∈ {0, 1, 2}). Thus, qi
must be congruent to one of the three numbers 0, 1 and 2 modulo 3 (by Proposition
3.3.4, because 0%3 = 0 and 1%3 = 1 and 2%3 = 2). In other words, we have
qi ≡ 0 mod 3 or qi ≡ 1 mod 3 or qi ≡ 2 mod 3. Since we know that qi 6≡ 0 mod 3 and
qi 6≡ 2 mod 3, we thus conclude that qi ≡ 1 mod 3.
Now, forget that we fixed i. We thus have shown that qi ≡ 1 mod 3 for each
` `
i ∈ {1, 2, . . . , `}. Hence, ∏ qi ≡ ∏ 1 = 1 mod 3. Therefore, n = q1 q2 · · · q` =
i =1 |{z} i =1
≡1 mod 3
`
∏ qi ≡ 1 mod 3. This contradicts n ≡ 2 6≡ 1 mod 3. This contradiction shows that
i =1
our assumption was false. Hence, at least one of the primes q1 , q2 , . . . , q` must be a
2 mod 3-prime.]
Now we have shown that at least one of the primes q1 , q2 , . . . , q` must be a
2 mod 3-prime. In other words, there exists some j ∈ {1, 2, . . . , `} such that q j is
a 2 mod 3-prime. Consider this j. Clearly, q j | n (since n = q1 q2 · · · q` ).
Set p = q j . Thus, p is a 2 mod 3-prime (since q j is a 2 mod 3-prime) and satisfies
p = q j | n.
For each i ∈ {1, 2, . . . , k}, we have pi - −1 (since pi is a prime, so that pi > 1) and
thus
9.3. p-valuations
9.3.1. The p-valuation of an integer
The prime factorization of a positive integer n provides an easy way to tell how
often n can be divided by p without remainder (i.e., how high a power of p divides
n): namely, as often as p appears in this prime factorization. This number is com-
monly known as the p-valuation of n. Let us define it in slightly greater generality
(for any integer n, not just positive integers) and in more detail ([19s, Definition
2.13.23]):
• We set ∞ + ∞ = ∞.
• For each integer k, we declare the inequalities k < ∞ and ∞ > k and k ≤ ∞
and ∞ ≥ k to be true, and the inequalities k ≥ ∞ and ∞ ≤ k and k > ∞
and ∞ < k to be false.
(This being said, ∞ is not supposed to be a “first class citizen” of the number
system. In particular, differences of the form k − ∞ are not defined, since any
definition of k − ∞ would break some of the familiar rules of arithmetic. The only
operations that we shall subject ∞ to are addition, minimum and maximum.)
for each k ∈ Z ∪ {∞}. It is not hard to see that basic properties of inequalities
(such as “if a ≤ b and b ≤ c, then a ≤ c”) and of addition (such as “( a + b) + c =
a + (b + c)”) and of the interaction between inequalities and addition (such as “if
a ≤ b, then a + c ≤ b + c”) are still valid in Z ∪ {∞} (that is, they still hold if we
plug ∞ for one or more of the variables).287 However, of course, we cannot “cancel”
∞ from equalities (i.e., we cannot cancel ∞ from a + ∞ = b + ∞ to obtain a = b) or
inequalities.
Example 9.3.2. (a) We have v3 (18) = 2. Indeed, 2 is the largest m ∈ N such that
3m | 18 (because 32 = 9 | 18 but 33 = 27 - 18).
(b) We have v3 (14) = 0. Indeed, 0 is the largest m ∈ N such that 3m | 14
(because 30 = 1 | 14 but 31 = 3 - 14).
(c) We have v3 (51) = 1. Indeed, 1 is the largest m ∈ N such that 3m | 51
(because 31 = 3 | 51 but 32 = 9 - 51).
(d) We have v3 (0) = ∞ (by Definition 9.3.1 (b)).
Definition 9.3.1 (a) can be restated in the following more intuitive way: Given a
prime p and a nonzero integer n, we let v p (n) be the number of times we can divide
n by p without leaving Z. Definition 9.3.1 (b) is consistent with this restatement,
because we can clearly divide 0 by p infinitely often without leaving Z. From this
point of view, the following lemma should be obvious:
Proof of Lemma 9.3.3 (sketched). (See [19s, Lemma 2.13.25] for a detailed proof.) In
the n = 0 case, we have both pi | n and v p (n) ≥ i (since v p (n) = v p (0) = ∞ ≥ i).
Thus, WLOG assume that n 6= 0. Hence, v p (n) is defined as the largest m ∈ N
287 For algebraists: The set Z ∪ {∞} equipped with the operations max and + as “addition” and
“multiplication” and with the relation ≤ is a totally ordered commutative semiring. The same
is true if max is replaced by min. These two semirings are known as the tropical semirings over
Z. See [SpeStu09] for more about them.
such that pm | n. Therefore, pv p (n) | n holds, but pv p (n)+1 | n does not. From this, it
is easy to see that pi | n holds if v p (n) ≥ i, but not if v p (n) < i. But this is precisely
the claim of Lemma 9.3.3.
Proof of Corollary 9.3.4 (sketched). (See [19s, Corollary 2.13.26] for a detailed proof.)
Lemma 9.3.3 (applied to i = 0) shows that p | n if and only if v p (n) ≥ 1. In other
words, p | n if and only if v p (n) 6= 0 (since v p (n) ≥ 1 is equivalent to v p (n) 6= 0).
Taking the contrapositive of this claim, we obtain precisely Corollary 9.3.4.
Using the p-valuation, we can decompose a nonzero integer into the product of
a power of p and an integer coprime to p:
Proof of Lemma 9.3.5 (sketched). (See [19s, Lemma 2.13.27] for a detailed proof.) The
definition of v p (n) yields v p (n) ∈ N and pv p (n) | n and pv p (n)+1 - n.
(a) Set u = n/pv p (n) ; thus, u is nonzero (since n is nonzero) and satisfies n =
upv p (n) . It remains to show that u ⊥ p. But we have ppv p (n) = pv p (n)+1 - n = upv p (n) .
Cancelling the (nonzero) factor pv p (n) from this non-divisibility, we find p - u, and
thus p ⊥ u (by Proposition 9.1.6, applied to a = u). In other words, u ⊥ p. This
proves Lemma 9.3.5 (a).
(b) Let i ∈ N and w ∈ Z be such that w ⊥ p and n = wpi . We must prove that
v p (n) = i.
Assume the contrary. Thus, v p (n) 6= i. But pi | n (since n = wpi ) and thus
v p (n) ≥ i (by Lemma 9.3.3). Hence, v p (n) > i (since v p (n) 6= i) and therefore
v p (n) ≥ i + 1. Equivalently, we have pi+1 | n (by Lemma 9.3.3, applied to i + 1
instead of i). In other words, ppi | wpi (since pi+1 = ppi and n = wpi ). Cancelling
the (nonzero) factor pi from this divisibility, we find p | w. Hence, gcd ( p, w) =
| p| = p > 1. On the other hand, gcd ( p, w) = gcd (w, p) = 1 (since w ⊥ p). These
two facts clearly contradict each other.
This contradiction shows that our assumption was false. Hence, v p (n) = i must
hold. This proves Lemma 9.3.5 (b).
The next theorem is crucial for computing and bounding p-valuations:
(
1, if q = p;
(d) We have v p (q) = for any prime q.
0, if q 6= p
Note that Theorem 9.3.6 (a) determines v p ( ab) exactly (in terms of v p ( a) and
v p (b)), but Theorem 9.3.6 (b) merely gives a lower bound on v p ( a + b). There
is no way to improve on this, since v p ( a) and v p (b) do not uniquely determine
v p ( a + b ).
Proof of Theorem 9.3.6 (sketched). (See [19s, Theorem 2.13.28] for a more detailed proof.)
(a) Let a and b be two integers. We must prove that v p ( ab) = v p ( a) + v p (b).
If a = 0, then this boils down to ∞ = ∞, which is obvious. Thus, we WLOG
assume that a 6= 0. Likewise, we WLOG assume that b 6= 0. Hence, ab 6= 0.
Lemma 9.3.5 (a) (applied to n = a) shows that there exists a nonzero integer x
such that x ⊥ p and a = xpv p (a) . Likewise, there exists a nonzero integer y such that
y ⊥ p and b = ypv p (b) . Consider these x and y. From x ⊥ p and y ⊥ p, we obtain
xy ⊥ p (by Theorem 3.5.10). Furthermore, multiplying the equalities a = xpv p (a)
and b = ypv p (b) , we obtain
v p ( a) v p (b)
ab = xp yp = ( xy) pv p (a)+v p (b) .
Thus, Lemma 9.3.5 (b) (applied to n = ab, i = v p ( a) + v p (b) and w = xy) shows
that v p ( ab) = v p ( a) + v p (b). This proves Theorem 9.3.6 (a).
(b) Let a and b be two integers. We must prove that v p ( a + b) ≥ min v p ( a) , v p (b) .
We WLOG assume that a 6= 0 and b 6= 0 (as the other cases are easy). Thus,
v p ( a) ∈ N and vp (b) ∈ N.
Let m = min v p ( a) , v p (b) . Thus, m ∈ N and v p ( a) ≥ m. Hence, Lemma
9.3.3 (applied to n = a and i = m) yields pm | a. In other words, a ≡ 0 mod pm .
Similarly, b ≡ 0 mod pm . Adding these two congruences together, we obtain a + b ≡
0 + 0 = 0 mod pm . In other words, pm | a + b. This, in turn, leads to v p ( a + b) ≥ m
(by Lemma
9.3.3, applied to n = a + b and i = m). That is, v p ( a + b) ≥ m =
min v p ( a) , v p (b) . This proves Theorem 9.3.6 (b).
(c) This follows from Lemma 9.3.4 (applied to n = 1), since p - 1 (because | p| =
p > 1 = |1|). (
1, if q = p;
(d) Let q be a prime. We must prove that v p (q) =
0, if q 6= p.
This requires us to prove two things: First, we must show that v p ( p) = 1; second,
we must show that v p (q) = 0 if q 6= p.
Let us prove v p ( p) = 1 first. Indeed, 1 ⊥ p (by Exercise 3.5.1 (a)) and p = 1 · p1 .
Thus, Lemma 9.3.5 (b) (applied to n = p, i = 1 and w = 1) yields v p ( p) = 1.
It remains to show that v p (q) = 0 if q 6= p. Thus, let us assume that q 6= p.
Hence, Proposition 9.1.7 (applied to q and p instead of p and q) yields q ⊥ p. Also,
q = q · p0 (since p0 = 1). Therefore, Lemma 9.3.5 (b) (applied to n = q, i = 0 and
w = q) yields v p (q) = 0. This completes our proof of Theorem 9.3.6 (d).
Proof of Corollary 9.3.7 (sketched). (See [19s, Corollary 2.13.29] for details.) This fol-
lows straightforwardly by induction on k, using Theorem 9.3.6 (a) (as well as The-
orem 9.3.6 (c) for the induction base).
The following simple properties of p-valuations are left to the reader to prove:288
Another useful property of p-valuations is how they transform gcds into minima:
Lemma 9.3.12. Let a and b be two elements of N ∪ {∞}. Assume that the logical
equivalence
( a ≥ j) ⇐⇒ (b ≥ j) (409)
holds for each j ∈ N. Then, a = b.
(by (411)).
Now, let i ∈ {1, 2, . . . , k }. Then, Lemma 9.3.3 (applied to ni and j instead of n and
i) yields that p j | ni if and only if v p (ni ) ≥ j. In other words, we have the logical
equivalence
p j | ni ⇐⇒ v p (ni ) ≥ j .
(413)
Forget that we fixed i. We thus have proved the equivalence (413) for each i ∈
{ 2, . . . , k}.
1,
Proof of Proposition 9.3.13 (sketched). (See [19s, Proposition 2.13.30] for details.)
From the definition of a prime factorization, we know that ( a1 , a2 , . . . , ak ) is a
tuple of primes such that n = a1 a2 · · · ak . Now, from n = a1 a2 · · · ak , we obtain
v p ( n ) = v p ( a1 a2 · · · a k ) = v p ( a1 ) + v p ( a2 ) + · · · + v p ( a k ) (by Corollary 9.3.7)
(
1, if ai = p;
= ∑ v p ( ai ) = ∑ 0, if ai 6= p
i ∈{1,2,...,k} i ∈{1,2,...,k}
| {z }
1, if a = p;
i
=
0, if a 6 = p
i
(by Theorem 9.3.6 (d),
applied to q= ai (since ai is a prime))
= (the number of i ∈ {1, 2, . . . , k} such that ai = p) · 1
+ (the number of i ∈ {1, 2, . . . , k} such that ai 6= p) · 0
= (the number of i ∈ {1, 2, . . . , k} such that ai = p)
= (the number of times p appears in the tuple ( a1 , a2 , . . . , ak )) .
This proves Proposition 9.3.13.
(where the product sign “ ∏ ” means a product over all primes p). But first, let
p prime
me explain why the product in this equality makes sense. This product is infinite
(as there are infinitely many primes), so this is not a priori obvious. Fortunately, it
is the simplest possible kind of an infinite product – one that has only finitely many
factors different from 1. Let me quickly explain the meaning of such products. I
begin by defining their additive analogues – i.e., sums that have only finitely many
addends different from 0:
A pedantic reader may observe that Definition 9.3.14 above might possibly clash
with our old definition of finite sums (Definition 4.1.1), since it applies both to
finite and infinite sets S. However, this clash is harmless, because when S is finite,
Definition 9.3.14 agrees with Definition 4.1.1 (since a sum does not change when
vanishing addends are removed from it).
Definition 4.1.1 allows us to make sense of infinite sums when all but finitely
many of their addends are zero. Such sums are called finitely supported sums, and
satisfy many of the nice properties of finite sums (see [Grinbe15, Subsection 2.14.15]
for details). They are, in many ways, much simpler than the convergent infinite
sums of analysis; in particular, they can be computed in finite time (simply by
throwing away all the zero addends and summing the finitely many addends that
remain).
Let us now state the multiplicative analogue of Definition 9.3.14:
For example,
2 · 9 · 3 · 1| · 1 · 1{z· 1 · · ·}· = 2 · 9 · 3 = 54
infinitely many 1’s
Convention 9.3.16. Here and in the following, the symbol “ ∏ ” means a prod-
p prime
uct ranging over all primes p. This is an infinite product, but can sometimes
make sense (according to Definition 9.3.15).
Proof of Theorem 9.3.17 (sketched). (a) (See [19s, Lemma 2.13.32 (a)] for details.) Let
p be a prime such that p > |n|. Then, Proposition 3.1.3 (b) yields p - n (since
| p| = p > |n|), and thus Corollary 9.3.4 yields v p (n) = 0. This proves Theorem
9.3.17 (a).
(b) (See [19s, Lemma 2.13.32 (b)] for details.) For every prime p > |n|, we have
v p (n) = 0 (by Theorem 9.3.17 (a)) and thus pv p (n) = p0 = 1. Thus, a prime p can
satisfy v p (n) 6= 0 only if p ≤ |n|. Therefore, only finitely many primes p satisfy
v p (n) 6= 0 (since only finitely many primes p satisfy p ≤ |n|). In other words, the
product ∏ pv p (n) has only finitely many factors different from 1. This proves
p prime
Theorem 9.3.17 (b).
(d) (See [19s, Corollary 2.13.33] for details.) Assume that n is positive. Theorem
9.2.5 (a) shows that there exists a prime factorization ( a1 , a2 , . . . , ak ) of n. Consider
this ( a1 , a2 , . . . , ak ). Thus, a1 , a2 , . . . , ak are primes satisfying n = a1 a2 · · · ak . For
each prime p, we have
(the number of i ∈ {1, 2, . . . , k} such that ai = p) = v p (n) (415)
(by Proposition 9.3.13). Now, consider the product a1 a2 · · · ak . This product a1 a2 · · · ak
is a product of primes, and each prime p appears in it precisely v p (n) times (by
(415)). Hence, this product equals ∏ pv p (n) . Thus, a1 a2 · · · ak = ∏ pv p (n) , so
p prime p prime
v p (n)
that n = a1 a2 · · · ak = ∏ p . This proves Theorem 9.3.17 (d).
p prime
(c) (See [19s, Corollary 2.13.34] for details.) Apply Theorem 9.3.17 (d) to |n|
instead of n, and use Proposition 9.3.8 to simplify the result.
Theorem 9.3.17 (c) greatly demystifies the “multiplicative structure” of the pos-
itive integers (i.e., the way positive integers behave under multiplication), as long
as one is not interested in addition and subtraction. A rule of thumb is that, if an
exercise about integers involves no + and − signs, then Theorem 9.3.17 (c) and
the properties of p-valuations might simplify it significantly. We will see several
examples of this below. One of the basic tools here is that divisibility relations can
be reduced to inequalities between p-valuations:
Proposition 9.3.18. Let n and m be integers. Then, n | m if and only if each prime
p satisfies v p (n) ≤ v p (m).
Proof of Proposition 9.3.18 (sketched). (See [19s, Proposition 2.13.35] for details.) We
must prove the following two claims:
[Proof of Claim 1: Assume that n | m. In other words, there exists some integer b
such that m = nb. Consider this b. Now, each prime p satisfies
v p (m) = v p (nb) (since m = nb)
= v p (n) + v p (b) (by Theorem 9.3.6 (a), applied to a = n)
| {z }
≥0
≥ v p (n) ,
so that v p (n) ≤ v p (m). This proves Claim 1.]
[Proof of Claim 2: Assume that each prime p satisfies v p (n) ≤ v p (m). We must
prove that n | m.
If m = 0, then this is obvious. Thus, we WLOG assume that m 6= 0. Hence, for
each prime p, we have v p (m) ∈ N and thus v p (m) < ∞. In particular, v2 (m) < ∞.
We assumed that each prime p satisfies v p (n) ≤ v p (m). Thus, in particular,
v2 (n) ≤ v2 (m) < ∞, so that n 6= 0.
The statement of Claim 2 does not change if we replace n and m by |n| and
|m|, respectively (because of Proposition 3.1.3 (a) and Proposition 9.3.8). Hence, we
WLOG assume that n and m are nonnegative. Assume this. Then, n and m are
positive (since n 6= 0 and m 6= 0). Thus, Theorem 9.3.17 (d) yields
n= ∏ pv p (n) . (416)
p prime
Similarly,
m= ∏ pv p (m) . (417)
p prime
We have assumed that each prime p satisfies v p (n) ≤ v p (m). In other words,
each prime p satisfies v p (m) − v p (n) ≥ 0 and therefore pv p (m)−v p (n) ∈ Z. Now, set
The infinite product in this equality has only finitely many factors different from 1
(for essentially the same reason as in Theorem 9.3.17 (b)), and thus is well-defined.
Moreover, this product is an integer (since we have shown that each prime p satis-
fies pv p (m)−v p (n) ∈ Z; but this is saying that all factors of this product are integers).
Thus, c is an integer. Multiplying the equalities (416) and (418), we obtain
! !
nc = ∏ pv p (n) ∏ pv p (m)−v p (n) = ∏ pv p (m) = m (by (417)) .
p prime p prime p prime
In other words, m = nc. Hence, n | m. This completes the proof of Claim 2.]
Now, Claim 1 and Claim 2 are both proved; hence, Proposition 9.3.18 follows.
The next
corollary says that an integer n is determined up to sign by the family
v p (n) p prime of its p-valuations for all primes p:
Proof of Corollary 9.3.19. (a) Each prime p satisfies v p (n) ≤ v p (m) (since (419) yields
v p (n) = v p (m)). Hence, Proposition 9.3.18 shows that n | m. However, the same
argument (with the roles of n and m interchanged) shows that m | n (since n and
m play symmetric roles in Corollary 9.3.19 (a)). Thus, Proposition 3.1.3 (c) (applied
to a = n and b = m) yields |n| = |m|. This proves Corollary 9.3.19 (a).
(b) Assume that n and m are nonnegative. Thus, |n| = n and |m| = m. However,
Corollary 9.3.19 (a) yields |n| = |m|. Hence, n = |n| = |m| = m. This proves
Corollary 9.3.19 (b).
We can also describe the gcd of several integers via p-valuations:
Corollary 9.3.21. Let n be a nonzero integer. Let a and b be two integers. Assume
that
a ≡ b mod pv p (n) for every prime p. (421)
Then, a ≡ b mod n.
Proof of Corollary 9.3.21 (sketched). (See [19s, Exercise 2.13.9] for details and for an
alternative proof.) We must prove that a ≡ b mod n. If a = b, then this is obvious.
Thus, we WLOG assume that a 6= b. Hence, a − b 6= 0, so that v p ( a − b) ∈ N for
every prime p.
Let p be any prime. Then, (421) yields a ≡ b mod pv p (n) . In other words, pv p (n) |
a − b. In view of Lemma 9.3.3 (applied to v p (n) and a − b instead of i and n), this
entails that v p ( a − b) ≥ v p (n). In other words, v p (n) ≤ v p ( a − b).
Now, forget that we fixed p. We thus have proven that each prime p satisfies
v p (n) ≤ v p ( a − b). In view of Proposition 9.3.18 (applied to m = a − b), this entails
that n | a − b. In other words, a ≡ b mod n. This proves Corollary 9.3.21.
The p-valuation of a positive integer n is easily read off its canonical factorization:
Corollary 9.3.22. For each prime p, let b p be a nonnegative integer. Assume that
only finitely many primes p satisfy b p 6= 0. Let n = ∏ pb p . Then,
p prime
Proof of Corollary 9.3.22 (sketched). (See [19s, Corollary 2.13.37] for the details.) We
have n = ∏ pb p ; thus, the number n has a prime factorization
p prime
2, 2, . . . , 2, 3, 3, . . . , 3, 5, 5, . . . , 5, . . .
| {z } | {z } | {z }
b2 times b3 times b5 times
in which each prime p appears b p times. (This is a finite list, since only finitely
many primes p satisfy b p 6= 0.) Hence, Corollary 9.3.22 follows from Proposition
9.3.13 (applied to p = q).
Note that the word “positive” in Exercise 9.3.1 cannot be dispensed with (for a
counterexample, set a = −1 and b = −1 and n = 2).
Solution to Exercise 9.3.1. If n = 0, then Exercise 9.3.1 is easy to solve290 . Thus, for
the rest of this solution, we WLOG assume that n 6= 0. Hence, n > 0.
We shall first show the following:
a= ∏ pv p ( a) . (422)
p prime
Exercise 9.3.2. Let k be a positive integer. Let w be a rational number such that
wk is an integer. Prove that w is an integer.
Exercise 9.3.2 can be restated as follows: If the k-th root of an integer is rational,
then this root is an integer. In other words, if an integer is not a k-th power of an
integer, then its k-th root is irrational.
√ This makes
√ √ it completely straightforward to
check (e.g.) that the numbers 2 and 3 5 and 97 35 are irrational.
Solution to Exercise 9.3.2. If w = 0, then this is obvious. Thus, for the rest of this
solution, we WLOG assume that w 6= 0.
The number w is rational. Thus, we can write w in the form w = m/n for some
integers m and n with n 6= 0. Consider these m and n. Note that m = nw (since
w = m/n) and thus m 6= 0 (since n 6= 0 and w 6= 0).
From w = m/n, we obtain wk = (m/n)k = mk /nk . Hence, mk /nk is an integer
(since wk is an integer). Thus, nk | mk .
However, Proposition 9.3.18 (applied to nk and mk instead of n and m) shows
that nk | mk if and only if each prime p satisfies v p nk ≤ v p mk . Hence,
each prime p satisfies v p nk ≤ v p mk (423)
(since we have nk | mk ).
Now, let p be a prime. Then, v p (n) and v p (m) are integers (since n 6= 0 and
m 6= 0). We have v p nk = kv p (n) (by Corollary 9.3.9, applied to a = n) and
Prove that the set of all finitary sequences of nonnegative integers is countable.
Solution to Exercise 9.3.3 (sketched). There are various ways of solving Exercise 9.3.3,
but a particularly short one can be obtained using prime factorization:
Let P = {1, 2, 3, . . .} be the set of all positive integers. Let F be the set of all
finitary sequences of nonnegative integers. We must prove that F is countable. We
shall achieve this by constructing a bijection from F to P.
Let ( p1 , p2 , p3 , . . .) = (2, 3, 5, 7, 11, . . .) be the sequence of all primes, listed in in-
creasing order with no repetitions. (This is indeed a well-defined infinite sequence,
because Theorem 9.1.3 shows that there are infinitely many primes.) Now, define a
map
α : F → P,
( a1 , a2 , a3 , . . .) 7→ p1a1 p2a2 p3a3 · · · .
(Note that the product p1a1 p2a2 p3a3 · · · in this definition is a well-defined positive
integer, since only finitely many of its factors are different from 1 (because only
finitely many positive integers n satisfy an 6= 0).) Conversely, define a map
β : P → F,
n 7 → v p1 ( n ) , v p2 ( n ) , v p3 ( n ) , . . . .
(Note that the sequence v p1 (n) , v p2 (n) , v p3 (n) , . . . in this definition is indeed
finitary, because Theorem 9.3.17 (a) entails that v pi (n) = 0 for all primes pi > |n|.)
Now, the maps α and β are mutually inverse. (Indeed, α ◦ β = id follows easily
from Theorem 9.3.17 (d), whereas β ◦ α = id follows easily from Corollary 9.3.22.)
Thus, the map α is invertible, i.e., a bijection. Hence, we have found a bijection
from F to P. Since the set P is countable, we thus conclude that F is also countable.
This solves Exercise 9.3.3.
Here is another exercise in which primes do not appear, yet are crucial for its
solution:
Exercise 9.3.4. Let a, b and c be three integers such that gcd ( a, b, c) = 1 and
c 6= 0. Prove that there is a positive integer x such that a + bx ⊥ c.
Note that the claim of Exercise 9.3.4 can also be restated as “there exists an entry
of the arithmetic progression ( a + b, a + 2b, a + 3b, . . .) that is coprime to c”. This
stands to reason, since the assumption gcd ( a, b, c) = 1 rules out the existence of a
nontrivial divisor shared by all entries of this arithmetic progression and c (where
“nontrivial” means “larger than 1”). However, this heuristic argument is not a
proof, since it is not hard to imagine that each entry of this arithmetic progression
could have some nontrivial divisor in common with c, but a different divisor de-
pending on the entry. Nevertheless, this theoretical possibility does not actually
happen, and Exercise 9.3.4 is true. However, the reasons for this are subtler than
it may appear. Before we solve this exercise, let us prove two simple but useful
lemmas:
Lemma 9.3.23. Let n and m be two integers that don’t satisfy n ⊥ m. Then, there
exists a prime q that divides both n and m.
Proof of Lemma 9.3.23. Proposition 3.4.3 (a) shows that the number gcd (n, m) is a
nonnegative integer. Proposition 3.4.4 (f) (applied to a = n and b = m) yields
gcd (n, m) | n and gcd (n, m) | m.
We are in one of the following two cases:
Case 1: We have gcd (n, m) ≤ 1.
Case 2: We have gcd (n, m) > 1.
Let us first consider Case 1. In this case, we have gcd (n, m) ≤ 1. However, if we
had gcd (n, m) = 1, then we would have n ⊥ m (by the definition of “coprime”),
which would contradict the assumption that we don’t have n ⊥ m. Hence, we can-
not have gcd (n, m) = 1. Thus, gcd (n, m) 6= 1. Combining this with gcd (n, m) ≤ 1,
we obtain gcd (n, m) < 1. Therefore, gcd (n, m) = 0 (since gcd (n, m) is a non-
negative integer). Thus, 0 = gcd (n, m), so that 2 | 0 = gcd (n, m) | n and
2 | 0 = gcd (n, m) | m. In other words, 2 divides both n and m. Hence, there
exists a prime q that divides both n and m (namely, q = 2). This proves Lemma
9.3.23 in Case 1.
Let us now consider Case 2. In this case, we have gcd (n, m) > 1. Hence, Propo-
sition 9.1.4 (applied to gcd (n, m) instead of n) yields that there exists at least one
prime p such that p | gcd (n, m). Consider this p. Thus, p | gcd (n, m) | n and
p | gcd (n, m) | m. In other words, p divides both n and m. Hence, there exists a
prime q that divides both n and m (namely, q = p). This proves Lemma 9.3.23 in
Case 2.
We have now proved Lemma 9.3.23 in both Cases 1 and 2. This shows that
Lemma 9.3.23 always holds.
We note that the converse of Lemma 9.3.23 is also true: If there exists a prime q
that divides both n and m, then n and m don’t satisfy n ⊥ m. (This is pretty easy
to show; do it!)
Our next lemma is no less simple:
Lemma 9.3.24. Let S be a finite set of primes. Let q be a prime such that q ∈
/ S.
Then, q ⊥ ∏ p.
p∈S
For example, Lemma 9.3.24 (applied to S = {2, 7, 11} and q = 3) yields that
3 ⊥ 2 · 7 · 11.
Proof of Lemma 9.3.24. Write the finite set S in the form S = { p1 , p2 , . . . , pk } (where
p1 , p2 , . . . , pk are distinct). Thus, ∏ p = p1 p2 · · · pk .
p∈S
Now, let i ∈ {1, 2, . . . , k }. Then, pi ∈ { p1 , p2 , . . . , pk } = S. Hence, pi is a prime
(since S is a set of primes). Moreover, we cannot have pi = q (since pi = q would
yield pi = q ∈ / S, which would contradict pi ∈ S). Thus, the primes pi and q are
distinct. Hence, Proposition 9.1.7 (applied to p = pi ) yields pi ⊥ q.
Forget that we fixed i. We thus have shown that each i ∈ {1, 2, . . . , k } satisfies
pi ⊥ q. Hence, Exercise 3.5.4 (applied to ai = pi and c = q) yields p1 p2 · · · pk ⊥ q.
In other words, q ⊥ p1 p2 · · · pk (by Proposition 3.5.4). In other words, q ⊥ ∏ p
p∈S
(since ∏ p = p1 p2 · · · pk ). This proves Lemma 9.3.24.
p∈S
xb = bx = ( a + bx ) − |{z}
a ≡ 0 − 0 = 0 mod q.
| {z }
≡0 mod q ≡0 mod q
(since q| a+bx) (since q| a)
a = ( a + bx ) −b |{z}
x ≡ 0 − b · 0 = 0 mod q.
| {z }
≡0 mod q ≡0 mod q
(since q| a+bx) (since q| x)
equivalences:
(m | b1 and m | b2 and m | b3 )
⇐⇒ (m | bi for all i ∈ {1, 2, 3})
⇐⇒ (m | bi for all i ∈ {1, 2, . . . , 3}) (since {1, 2, 3} = {1, 2, . . . , 3})
⇐⇒ (m | gcd (b1 , b2 , . . . , b3 )) (by Theorem 3.4.14 (applied to k = 3))
⇐⇒ (m | gcd (b1 , b2 , b3 )) (since gcd (b1 , b2 , . . . , b3 ) = gcd (b1 , b2 , b3 )) .
Thus, we have proved the equivalence (m | b1 and m | b2 and m | b3 ) ⇐⇒ (m | gcd (b1 , b2 , b3 )).
Exercise 9.3.5. Let a be an integer, and let n be a positive integer. Let φ (n) be
defined as in Theorem 9.1.13. Prove that an ≡ an−φ(n) mod n.
Note that Exercise 9.3.5 competes with Theorem 9.1.13 over the claim of being
the natural generalization of Fermat’s Little Theorem: Indeed, Exercise 9.3.5 gener-
alizes Theorem 9.1.10 (b) just like Theorem 9.1.13 generalizes Theorem 9.1.10 (a).
Solution to Exercise 9.3.5 (sketched). We shall only give the main steps; see [19s, Ex-
ercise 2.16.3] for a similar solution written out in full detail.
First, let us show that an−φ(n) is an integer (in order to be sure that the congruence
an ≡ an−φ(n) mod n makes sense in the first place!). Indeed, in Theorem 9.1.13, we
have defined φ (n) to be the # of all i ∈ {1, 2, . . . , n} that satisfy i ⊥ n. Hence,
However, let us set j = v p (n). Then, v p (n) ≥ j, so that p j | n (by Lemma 9.3.3,
applied to i = j). Hence, Proposition 3.1.3 (b) readily yields p j ≤ |n|. In other
words, p j ≤ n (since p j and n are positive). Thus,
1 ≤ p1 ≤ p2 ≤ · · · ≤ p j ≤ n.
This shows that the j numbers p1 , p2 , . . . , p j all belong to the set {1, 2, . . . , n}. More-
over, none of these j numbers is coprime to n (since they are all divisible by p, and
thus have the divisor p in common with n, which shows that their gcd with n is
≥ p). Hence, these j numbers p1 , p2 , . . . , p j all belong to the set of all i ∈ {1, 2, . . . , n}
that don’t satisfy i ⊥ n. Hence, this set has at least j many elements (because the j
numbers p1 , p2 , . . . , p j are distinct). In other words,
In view of Lemma 9.3.3 (applied to j and an−φ(n) instead of i and n), this entails
that p j | an−φ(n) . In other words, an−φ(n) ≡ 0 mod p j . Hence,
In other words, an ≡ an−φ(n) mod pv p (n) (since j = v p (n)). Thus, (425) is proved in
Case 1.
Let us now consider Case 2. In this case, we have p ⊥ a. In other words, a ⊥ p.
We shall now show that aφ(n) ≡ 1 mod pv p (n) . Once this is proved, the claim (425)
will quickly follow.
It is tempting to obtain aφ(n) ≡ 1 mod pv p (n) by applying Theorem 9.1.13. How-
ever, this is not so easy, since we don’t know whether a ⊥ n; we only know that the
weaker statement a ⊥ p is true. We need to work around this.
Fortunately, Exercise 9.3.4 is here to help. We set i = v p (n). Then, v p (n) ≥ i,
so that pi | n (by Lemma 9.3.3). Furthermore, Exercise 3.5.5 yields a1 ⊥ pi (since
a ⊥ p). In other words, a ⊥ pi . Hence, it is easy to see that gcd a, pi , n = 1 293 .
Thus, Exercise 9.3.4 (applied to b = pi and c = n) yields that there is a positive
integer x such that a + pi x ⊥ n. Consider this x. Set b = a + pi x. Thus, b − a = pi x
293 Proof.Let m = gcd a, pi , n . Then, m is a common divisor of a, pi and n (by the definition of a
gcd). Hence, m | a and m | pi and m | n. However, Theorem 3.4.7 (applied to b = pi ) yields that
we have the following logical equivalence:
m | a and m | pi ⇐⇒ m | gcd a, pi .
m = 1.
Proof of Lemma 9.3.26 (sketched). (See [19s, Exercise 2.17.2 (a)] for details296 .) Each
n
addend of the sum ∑ [k | i ] is either 0 or 1. Namely, an addend [k | i ] is 1 if i is a
i =1
n
294 Indeed, [19s, Exercise 2.17.2 (c)] says that v p (n!) = ∑ n//pi instead of v p (n!) = ∑ i
.
i ≥1 i ≥1 p
However,
this is equivalent, since an easy application of Proposition 3.3.5 yields that n//pi =
n
for any i ∈ N.
pi
295 We are using the Iverson bracket notation (Definition 4.3.19) again.
296 but notice that [19s, Exercise 2.17.2 (a)] talks about n//k instead of n (which, however, is the
j k
k jnk
same number, since an easy application of Proposition 3.3.5 shows that n//k = )
k
Proof of Lemma 9.3.27 (sketched). (See [19s, Exercise 2.17.2 (b)] for details.) Let k =
v p (n). Then, k is the largest m ∈ N such that pm | n (by the definition of v p (n)).
Hence, pk | n but pk+1 - n. Thus, the k numbers p1 , p2 , . . . , pk divide n, but none
of the numbers pk+1 , pk+2 , pk+3 , . . . does. In other words, the statement pi | n holds
for each i ∈ {1, 2, . . . , k}, but is false for each i ∈ {k + 1, k + 2, k + 3, . . .}. Hence,
the truth value pi | n equals 1 for each i ∈ {1, 2, . . . , k }, but equals 0 for each
i ∈ {k + 1, k + 2, k + 3, . . .}. Therefore, the sum ∑ pi | n has k addends equal to
i ≥1
1, while remaining addends are 0. Therefore, this sum equals k. In other words,
i all
∑ p | n = k = v p (n). This proves Lemma 9.3.27.
i ≥1
(In the last step of this computation, we have interchanged the two summation
n
signs “ ∑ ” and “ ∑ ”. Make sure you understand why this is legitimate!297 ) But
m =1 j ≥1
each positive integer j satisfies
n h
n i
pj
= ∑ p j
| i by Lemma 9.3.26, applied to k = p j
i =1
n h i
= ∑ pj | m (428)
m =1
(here, we have renamed the summation index i as m). Thus, (427) becomes
n h
i n n
v p (n!) = ∑ ∑ p | m = ∑
j
= ∑
j ≥1 m =1 pj i ≥1 p
i
| ${z % } j≥1
n
=
pj
(by (428))
(here, we have renamed the summation index j as i). This proves Theorem 9.3.25.
We shall give two solutions to Exercise 9.3.6: one using binomial coefficients,
and one using p-valuations. The first solution is shorter and neater, but the second
illustrates a generalizable method.
First solution to Exercise 9.3.6. We have m ≤ n + m (since (n + m) − m = n ≥ 0).
Hence, Theorem 4.3.8 (applied to n + m and m instead of n and k) yields
n+m (n + m)! (n + m)!
= = (since (n + m) − m = n) .
m m! · ((n + m) − m)! m! · n!
However,
Theorem 4.3.15 (applied to n + m and m instead of n and k) yields
n+m n+m (n + m)! (n + m)!
∈ Z. In view of = , this rewrites as ∈ Z. In
m m m! · n! m! · n!
other words, m! · n! | (n + m)!. In other words, n!m! | (n + m)! (since m! · n! = n!m!).
This solves Exercise 9.3.6.
297 It is not always legitimate to interchange two infinite sums, even if both are well-defined. Fortu-
n
nately, one of our two summation signs – viz., “ ∑ ” – is a finite sum.
m =1
Second solution to Exercise 9.3.6 (sketched). Proposition 9.3.18 (applied to n!m! and
(n + m)! instead of n and m) shows that we have n!m! | (n + m)! if and only if
each prime p satisfies v p (n!m!) ≤ v p ((n + m)!). Thus, it suffices to show that each
prime p satisfies v p (n!m!) ≤ v p ((n + m)!).
Let us show this. Let p be a prime. We must prove that v p (n!m!) ≤ v p ((n + m)!).
Theorem 9.3.25 (applied to n + m instead of n) yields
n+m
v p ((n + m)!) = ∑ . (429)
i ≥1 pi
Recall that our goal is to prove that v p (n!m!) ≤ v p ((n + m)!). In view of (429)
and (430), this is equivalent to proving that
n m n+m
∑ i + ∑ pi ≤ ∑ pi .
i ≥1 p i ≥1 i ≥1
In view of
n m n m
∑ p i
+ i
p
= ∑ i + ∑ i = v p (n!m!) (by (430))
i ≥1 i ≥1 p i ≥1 p
and
n+m
∑ pi
= v p ((n + m)!) (by (429)) ,
i ≥1
this rewrites as v p (n!m!) ≤ v p ((n + m)!). But this is precisely what we wanted to
show. Hence, Exercise 9.3.6 is solved again.
Let us prove something less straightforward using de Polignac’s formula. For
example, let us prove the following ([Grinbe15, Exercise 3.25]):
(2a)! (2b)!
Exercise 9.3.7. Let a, b ∈ N. Prove that ∈ Z.
a!b! ( a + b)!
( q1 a1 ) ! · ( q2 a2 ) ! · · · · · ( q n a n ) !
q1 −1
∈ Z.
( a1 ! ) · ( a 2 ! ) q2 −1 · · · · · ( a n ! ) q n −1 · ( a 1 + a 2 + · · · + a n ) !
Note that Exercise 9.3.7 is a particular case of Exercise 9.3.8 (namely, the case for
n = 2 and q1 = 2 and q2 = 2 and a1 = a and a2 = b). Thus, solving Exercise 9.3.8
will automatically solve Exercise 9.3.7.
Before we solve Exercise 9.3.8, we pave our way with a lemma about floors (which
will play a similar role to the inequality buc + bvc ≤ bu + vc in our above second
solution to Exercise 9.3.6):
There are various ways to prove this lemma. A particularly easy one proceeds
by WLOG assuming that each of u1 , u2 , . . . , un belongs to the half-open interval
[0, 1) (because subtracting an integer from any single ui changes both sides of the
inequality in question by the same amount299 ). In this case, Lemma 9.3.28 quickly
boils down to the following:
Proof of Lemma 9.3.29. It is easy to see that Lemma 9.3.29 holds for n = 0 300 .
Hence, for the rest of this proof, we WLOG assume that we don’t have n = 0.
Hence, n > 0 (since n ∈ N).
Let k = bu1 + u2 + · · · + un c. Thus, k is an integer (since the floor of any real
is an integer). Furthermore, the sum u1 + u2 + · · · + un is nonnegative (since its
addends u1 , u2 , . . . , un are nonnegative). In other words, u1 + u2 + · · · + un ≥ 0.
From this, we easily see that k ≥ 0 301 .
k
Now, I claim that at least one j ∈ {1, 2, . . . , n} satisfies u j ≥ .
qj
k
[Proof: Assume the contrary. Hence, no j ∈ {1, 2, . . . , n} satisfies u j ≥ . In other
qj
k k
words, each j ∈ {1, 2, . . . , n} satisfies u j < . Adding these n inequalities u j <
qj qj
299 This technique is rather similar to the periodicity argument we used in our second solution to
Exercise 1.1.3 above (in Subsection 4.7.2).
300 Proof. Assume that n = 0. Then, u + u + · · · + u = u + u + · · · + u = (empty sum) = 0, so
1 2 n 1 2 0
that bu1 + u2 + · · · + un c = b0c = 0. Also, from n = 0, we obtain
n 0
∑ bqi ui c = ∑ bqi ui c = (empty sum) = 0 ≥ 0 = bu1 + u2 + · · · + un c
i =1 i =1
(since bu1 + u2 + · · · + un c = 0). Thus, we have proved Lemma 9.3.29 under the assumption
that n = 0. Qed.
301 Proof. We have 0 ≤ u + u + · · · + u (since u + u + · · · + u ≥ 0). Thus, 0 is an integer that is
1 2 n 1 2 n
≤ u1 + u2 + · · · + u n .
Recall that bu1 + u2 + · · · + un c was defined as the largest integer that is ≤ u1 + u2 + · · · + un .
Hence, if m is an integer that is ≤ u1 + u2 + · · · + un , then bu1 + u2 + · · · + un c ≥ m. Applying
this to m = 0, we obtain bu1 + u2 + · · · + un c ≥ 0 (since 0 is an integer that is ≤ u1 + u2 + · · · +
un ). Hence, k = bu1 + u2 + · · · + un c ≥ 0.
302 Proof.
Recall that q j u j was defined as the largest integer that is ≤ q j u j . Hence, if m is an integer
that is ≤ q j u j , then q j u j ≥ m. Applying this to m = k, we obtain q j u j ≥ k (since k is an
integer that is ≤ q j u j ).
n
303 . From this, it easily follows that ∑ bqi ui c ≥ q j u j 304 .
Hence,
i =1
n
∑ b qi ui c ≥
q j u j ≥ k = b u1 + u2 + · · · + u n c .
i =1
b q i u i c = b q i wi c + q i v i (433)
303 Proof of (431): Let i ∈ {1, 2, . . . , n}. Then, ui is nonnegative (since u1 , u2 , . . . , un are nonnegative).
Hence, qi ui is nonnegative (since qi is positive (because q1 , q2 , . . . , qn are n positive integers)). In
other words, qi ui ≥ 0. That is, 0 ≤ qi ui . Thus, 0 is an integer that is ≤ qi ui .
Recall that bqi ui c was defined as the largest integer that is ≤ qi ui . Hence, if m is an integer
that is ≤ qi ui , then bqi ui c ≥ m. Applying this to m = 0, we obtain bqi ui c ≥ 0 (since 0 is an
integer that is ≤ qi ui ). This proves (431).
304 Proof. We have
n
∑ ∑ ∑
b qi ui c = b qi ui c = q j u j + b qi ui c
i =1 i ∈{1,2,...,n} i ∈{1,2,...,n};
| {z }
|{z} i6= j ≥0
= ∑ (by (431))
i ∈{1,2,...,n}
(here, we have split off the addend for i = j from the sum)
∑ 0 = qj uj .
≥ qj uj +
i ∈{1,2,...,n};
i6= j
| {z }
=0
305 Proof. Let i ∈ {1, 2, . . . , n}. It is clear that b x c is an integer for each x ∈ R. Applying this to x = ui ,
we conclude that bui c is an integer. In other words, vi is an integer (since vi = bui c).
Forget that we fixed i. We thus have shown that vi is an integer for each i ∈ {1, 2, . . . , n}. In
other words, v1 , v2 , . . . , vn are n integers.
306 Proof. Let i ∈ {1, 2, . . . , n }. Applying (1) to x = u , we obtain b u c ≤ u < b u c + 1. Hence,
i i i i
bui c ≤ ui , so that ui − bui c ≥ 0. Now, wi = ui − bui c ≥ 0. In other words, wi is nonnegative.
Forget that we fixed i. We thus have shown that wi is nonnegative for each i ∈ {1, 2, . . . , n}.
In other words, w1 , w2 , . . . , wn are nonnegative.
307 . Hence,
n n n n
∑ b qi ui c = ∑ (bqi wi c + qi vi ) = ∑ b q i wi c + ∑ qi vi
i =1 i =1 i =1 i =1
| {z }
=bqi wi c+qi vi | {z }
(by (433)) ≥bw1 +w2 +···+wn c
(by (432))
n
≥ b w1 + w2 + · · · + w n c + ∑ q i v i . (434)
i =1
307 Proof of (433): Let i ∈ {1, 2, . . . , n}. Adding the two equalities wi = ui − bui c and vi = bui c
together, we obtain wi + vi = (ui − bui c) + bui c = ui .
However, qi is an integer (since q1 , q2 , . . . , qn are n integers), and vi is an integer (since
v1 , v2 , . . . , vn are n integers). Thus, the product qi vi of these two integers must also be an in-
teger. In other words, qi vi ∈ Z. Therefore, (163) (applied to y = qi wi and k = qi vi ) yields
bqi wi + qi vi c = bqi wi c + qi vi . In view of qi wi + qi vi = qi (wi + vi ) = qi ui , this rewrites as
| {z }
= ui
bqi ui c = bqi wi c + qi vi . Qed.
n
308 Proof of (435): The sum ∑ vi is an integer (since its addends v1 , v2 , . . . , vn are n integers). In other
i =1
n n n
words, ∑ vi ∈ Z. Therefore, (163) (applied to y = ∑ wi and k = ∑ vi ) yields
i =1 i =1 i =1
$ % $ %
n n n n
∑ wi + ∑ v i = ∑ wi + ∑ vi .
i =1 i =1 i =1 i =1
In view of
n n n n
∑ wi +∑ vi = ∑ (ui − bui c) + ∑ bui c
i =1 i =1 i =1 i =1
|{z} |{z}
=ui −bui c =bui c
(by the definition of wi ) (by the definition of vi )
n n
= ∑ |(ui − bu{z
i c + b ui c) = ∑ ui
i =1 i =1
}
= ui
= u1 + u2 + · · · + u n ,
this rewrites as $ %
n n
b u1 + u2 + · · · + u n c = ∑ wi + ∑ vi .
i =1 i =1
n
In view of ∑ wi = w1 + w2 + · · · + wn , this rewrites as
i =1
n
b u 1 + u 2 + · · · + u n c = b w1 + w2 + · · · + w n c + ∑ v i .
i =1
Qed.
Forget that we fixed j. We thus have proved (437) for each j ∈ {1, 2, . . . , n}. Thus,
(436) becomes
v p ( a 1 ! ) q1 −1 · ( a 2 ! ) q2 −1 · · · · · ( a n ! ) q n −1
n q j −1 n aj
= ∑ v p aj ! = ∑ ∑ qj − 1
j =1 | {z $ %} j=1 i≥1 pi
aj | {z }
= ∑ ( q j −1 ) n
i ≥1 pi =∑ ∑
i ≥1 j =1
(by (437))
n aj
= ∑ ∑ qj − 1
pi
. (438)
i ≥1 j =1
(here, we have renamed the summation indices i and j of the two sums as s and i,
respectively).
On the other hand, (q1 a1)!, (q2 a2 )!, . . . , (qn an )! are n integers. Thus, Corollary
9.3.7 (applied to n and q j a j ! instead of k and a j ) yields
(by (439)).
Forget that we fixed p. We thus have shown that each prime p satisfies
v p ( a 1 ! ) q1 −1 · ( a 2 ! ) q2 −1 · · · · · ( a n ! ) q n −1 · ( a 1 + a 2 + · · · + a n ) !
≤ v p ((q1 a1 )! · (q2 a2 )! · · · · · (qn an )!) .
( a 1 ! ) q1 −1 · ( a 2 ! ) q2 −1 · · · · · ( a n ! ) q n −1 · ( a 1 + a 2 + · · · + a n ) !
| (q1 a1 )! · (q2 a2 )! · · · · · (qn an )!.
In other words,
( q1 a1 ) ! · ( q2 a2 ) ! · · · · · ( q n a n ) !
q1 −1
∈Z
( a1 ! ) · ( a 2 ! ) q2 −1 · · · · · ( a n ! ) q n −1 · ( a 1 + a 2 + · · · + a n ) !
∏
(the number of positive divisors of n) = v p (n) + 1
p prime
and
∏
(the number of divisors of n) = 2 v p (n) + 1 .
p prime
The next exercise extends the notion of the p-adic valuation of an integer to a
rational number:
Exercise 9.3.10. Fix a prime p. For each nonzero rational number r, define an
integer w p (r ) (called the extended p-adic valuation of r) as follows: We write r
in the form r = a/b for two nonzero integers a and b, and we set w p (r ) =
v p ( a) − v p (b). (It also makes sense to set w p (0) = ∞, but we shall not concern
ourselves with this border case in this exercise.)
(a) Prove that this is well-defined – i.e., that w p (r ) does not depend on the
precise choice of a and b satisfying r = a/b.
(b) Prove that w p (n) = v p (n) for each nonzero integer n.
(c) Prove that w p ( ab) = w p ( a) + w p (b) for any two nonzero rational numbers
a and b.
(d) Prove that w p ( a + b) ≥ min w p ( a) , w p (b) for any two nonzero rational
numbers a and b if a + b 6= 0.
(e) Prove that r = ∏ pw p (r) for any positive rational number r. (This is a
p prime
generalization of the canonical factorization to rational numbers.)
a1 a2 · · · a u | ( a1 + a2 + · · · + a u ) m .
The next two exercises are parts of what is known as the lifting-the-exponent
lemma:
Exercise 9.3.12. Let p be a nonnegative integer (not necessarily prime). Let a and
b be two integers such that a ≡ b mod p.
(a) Prove that a p ≡ b p mod p2 .
i i i
(b) Prove that a p ≡ b p mod pi+1 for each i ∈ N. (Keep in mind that a p means
i
a( p ) .)
Exercise 9.3.13. Let p be a prime. Let a and b be two integers such that a ≡ b 6≡
0 mod p. Let n be a positive integer.
(a) Prove that v p ( an − bn ) ≥ v p ( a − b) + v p (n).
(b) Prove that v p ( an − bn ) = v p ( a − b) + v p (n) if p 6= 2.
(c) Prove that v p ( an − bn ) = v p ( a − b) + v p (n) if p = 2 and a ≡ b mod 4.
(d) Find an example where p = 2 and a ≡ b mod 2 and v p ( an − bn ) >
v p ( a − b ) + v p ( n ).
0 1 k −1
v p (( Nc)!) = c p + p + · · · + p − k.
is an integer.
(b) Show that this integer furthermore is divisible by nk−bk/2c when n is prime
and a1 , a2 , . . . , ak are positive.
The next exercise gives yet another variation on Fermat’s Little Theorem:
n −1
This might sound familiar to algebraists: Indeed, if a is prime, then ∏ an − ak is the
k =0
order of the general linear group GLn (Fa ) over the finite field Fa , whereas n! is the order of
the symmetric group Sn . Thus, if a is prime, then Exercise 9.3.16 follows from Lagrange’s
theorem, as the symmetric group Sn embeds as a subgroup into GLn (Fa ) (via the embed-
ding that identifies each permutation with its permutation matrix). More generally, this
argument can be made when a is a power of a prime (not necessarily a prime itself), since
there is a finite field of size a in this case. However, this slick argument does not work when
a is not a power of a prime. I am not aware of any way how to generalize it to arbitrary a;
it appears to be a dead end, at least if solving Exercise 9.3.16 for general a is the goal.
The following exercise is an analogue of Proposition 9.3.11 for lowest common
multiples310 :
310 See Section 3.6 for the definition of lowest common multiples and their most important properties.
See [Chen20, OTIS Excerpts, Chapter 13] and [AndDos10, Chapter 3] and [AndDos12,
Chapter 3] for more about p-valuations.
The next exercise expands on the idea of Exercise 9.2.1:
We note that Exercise 9.2.1 and both parts of Exercise 9.3.19 are particular cases
of Dirichlet’s theorem, which says that if a and b > 0 are two coprime integers,
then there are infinitely many primes p that satisfy p ≡ a mod b. This theorem is
deep and difficult (all known proofs use some kind of analysis, often complex); the
three particular cases we just mentioned are among the few cases that have known
simple proofs.
The next exercise generalizes Exercise 9.1.7:
The next exercise is a fundamental property of the Euler totient function, origi-
nally found by Gauss:
Exercise 9.3.21. For any positive integer n, we let φ (n) denote the number of all
i ∈ {1, 2, . . . , n} satisfying i ⊥ n.
Prove that
∑ φ (d) = n for any positive integer n.
d|n
Here, the summation sign “ ∑ ” means a sum over all positive divisors d of n.
d|n
(For example, ∑ φ (d) = φ (1) + φ (3) + φ (5) + φ (15).)
d|15
The next exercise is somewhat similar to Exercise 9.3.1: It says that any equality
of the form ab = cd, where a, b, c, d are integers, can be “explained” by decomposing
a, b, c, d further into products.
Exercise 9.3.22. Let a, b, c, d be four integers such that ab = cd. Prove that there
exist four integers x, y, z, w such that
The next exercise is one of the simplest forms of what is known as the Chinese
Remainder Theorem:
Exercise 9.3.23. Let m and n be two positive integers. Prove that the map
The Chinese Remainder Theorem has several more advanced forms, but even
Exercise 9.3.23 has many uses. Here is just one application:
Exercise 9.3.24. For any positive integer n, we let φ (n) denote the number of all
i ∈ {1, 2, . . . , n} satisfying i ⊥ n.
Prove that φ (mn) = φ (m) · φ (n) for any two coprime positive integers m and
n.
Exercise 9.3.24 is known as the multiplicativity of the Euler totient function. One of
its consequences is the following “explicit” formula for φ (n):
Exercise 9.3.25. Let n be a positive integer. Let φ (n) denote the number of all
i ∈ {1, 2, . . . , n} satisfying i ⊥ n. Prove that
1
φ (n) = ∏ ( p − 1) p v p (n)−1
= n· ∏ 1− .
p prime; p prime;
p
p|n p|n
311 Hence, if we have a product of nonzero integers and we want to know whether
this product is a square, we can “cancel” any squares from this product. Thus, for
1! · 2! · · · · · (2 · 2)!
example, we can see that is not a perfect square by observing
3!
311 To wit, the “⇐=” direction of this equivalence is obvious, while the “=⇒” direction is easiest to
prove using the uniqueness of prime decomposition.
that
1! · 2! · · · · · (2 · 2)! 1! · 2! · 3! · 4!
= 1! · |{z}
= |{z} 2! · |{z}
4! = 1 · 1 · 2 · 1 · 2 · 3 · 4
2! 3!
=1 =1·2 =1·2·3·4
2 2
= 2 · 3 · 4 ∼ 3,
where in the last step we have “cancelled” the perfect squares 22 and 42 . If you
“cancel” strategically, you can do these computations fairly quickly, as any two
successive factorials k! and (k + 1)! mostly “cancel” each other.)
Based on the above table, it appears that q = n always does the job (although
sometimes there is a second value that also does it). So we need to prove that
1! · 2! · · · · · (2n)!
is a perfect square. (440)
n!
To do this, we shall try to combine as many factors as we can into perfect squares
(inspired by our above “cancelling” strategy). To wit, the numerator of our fraction
is
The right hand side is a perfect square (since n is even, so that 2n/2 ∈ Z). Thus,
(440) is proved, and the problem is solved.312
[Remark: This exercise is a puzzle I found on reddit.
The claim (440) can also be proved by a straightforward induction on n.
312 See [Grinbe15, Exercise 3.5 (c)] for this argument in more detail.
If neither n nor n + 1 is a perfect square, then n is the only q ∈ {1, 2, . . . , 2n} for
1! · 2! · · · · · (2n)!
which is a perfect square. I don’t know of a nice and simple proof
q!
of this, but a somewhat laborious proof (using a result of Erdös) can be found at
https://math.stackexchange.com/a/3325448/ .]
(where in the last step we brought the tm+1 tm term to the right hand side so it
could join the rather similar terms there). The 4tm tm−1 − tm+1 tm on the right hand
side rewrites as tm (4tm−1 − tm+1 ); but this looks familiar! Indeed, our induction
hypothesis (applied to n = m − 1) yields tm+1 = 4tm−1 − tm−3 , so that 4tm−1 −
tm+1 = tm−3 . We can now continue our above chain of equivalent transformations
of our goal:
But the equality 1 = tm tm−3 − tm−2 tm−1 follows from the very definition of tm ,
1 + t m −1 t m −2
which (as we recall) says tm = . So we have reduced the equality in
t m −3
question (that is, tm+2 = 4tm − tm−2 ) to an equality we know to be true. We now
need to walk this argument backwards and we have our induction step.
Did you spot the gap? You can see that there is a gap, since we have never used
the base values (t0 = t1 = t2 = 1). But it is not hard to see that the problem would
not remain true if the base values were replaced by arbitrary numbers. Something
has to give.
The problem is that we applied the induction hypothesis to n = m − 1. But
the induction hypothesis said that Exercise 1.1.2 (a) holds for all integers n ≥ 2
satisfying n < m. Thus, in order to apply it to n = m − 1, we need to know that
m − 1 is an integer satisfying m − 1 ≥ 2 and m − 1 < m. Of course, m − 1 is
an integer and satisfies m − 1 < m. But m − 1 ≥ 2 is not automatically satisfied;
it holds for m ≥ 3, but not for m = 2. Thus, we need to treat the m = 2 case
separately. So much for a strong induction not needing an induction base! (Of
course, technically it is true: We are not doing an induction base; we are just special-
casing a special case in the induction step. But the difference is just organizational.)
So we need to verify the claim of Exercise 1.1.2 (a) for m = 2. This means
verifying that t4 = 4t2 − t0 . This is not the most challenging part of the problem,
so I stop here.
One last thing about (a): If you look again at the above induction, you might
notice that we only ever applied the induction hypothesis to n = m − 1. This
means that we did not need the “strength” of strong induction; we can just as well
restate the argument as a (standard) induction on n. The case m = 2 then becomes
an actual (de-jure, not just de-facto) induction base. I think the resulting proof is a
little bit easier to write up.
(b) We will separately prove the two statements that
and that
tn is an integer for each integer n ≥ 0. (442)
To be pedantic, (441) does not even have to be proved, since it is implicit in the
problem statement (“a sequence (t0 , t1 , t2 , . . .) of positive rational numbers”). (The
reason why I put the “positive” in the statement is to pre-empt any question about
1 + t n −1 t n −2
“what happens if the expression has a zero in the denominator?”. If
t n −3
we know that all entries of the sequence are positive, then of course there cannot
be any zero denominators.) Just for the sake of completeness: The reason that tn is
positive for each integer n ≥ 0 is that the sequence (t0 , t1 , t2 , . . .) was defined recur-
sively with three positive base values (t0 , t1 , t2 are all positive) and a recursive rule
1 + t n −1 t n −2
(tn = ) that produces a positive tn when given positive tn−1 , tn−2 , tn−3 .
t n −3
So to speak, the sequence (t0 , t1 , t2 , . . .) never has a chance to escape the positive
numbers. To make this argument formal (which you don’t need to do on any con-
tests, given how trivial it is), you can argue by strong induction, similarly to how
1 + t n −1 t n −2
we are soon going to prove (442) (but using the recursive rule tn =
t n −3
instead of part (a)).
Let us now prove (442). We proceed by strong induction on n.
Induction step: Fix an integer m ≥ 0, and we assume (as induction hypothesis)
that (442) holds for all n < m. We must now prove that (442) holds for n = m. In
other words, we must prove that tm is an integer.
First assume that m ≥ 4. Then, m − 2 ≥ 2; thus, we can apply Exercise 1.1.2
(a) to n = m − 2, and thus obtain tm = 4tm−2 − tm−4 . The induction hypothesis
then yields that tm−2 and tm−4 are integers (since m − 2 and m − 4 are integers
≥ 0 and satisfy m − 2 < m and m − 4 < m), and so tm is an integer as well (since
tm = 4tm−2 − tm−4 ). So we are done with the induction step in the case when m ≥ 4.
It remains to cover the remaining cases. These are the cases when m < 4, that is,
m ∈ {0, 1, 2, 3}. In other words, we need to show that t0 , t1 , t2 , t3 are integers. This
is straightforward (and has been already done in the problem statement). Thus the
induction step is complete. Hence, (442) is proved.
(Note that this was a real strong induction: We applied the induction hypothesis
to two different values of n, none of which was m − 1.)
Having proved (441) and (442), we are done with Exercise 1.1.2 (b).
k
Now, we shall prove explicit formulas for the values x + for k ∈ {0, 1, . . . , n − 1}.
n
Namely:
r + 1} ≤ qn + n = (q + 1) n.
nx +k < g +1 + k = qn + r + 1 + k = qn + k| +{z
|{z} |{z}
< g +1 =qn+r ≤n
n ≤ qn + k + r = qn + r +k ≤ nx + k
(q + 1) n = qn + |{z}
| {z }
≤ k +r = g≤nx
with
n −1 n −r −1 n −1
k k k
∑ x+
n
= ∑ x+
n
+ ∑ x+
n
k =0 k =0 | {z } k=n−r | {z }
=q = q +1
(by (443)) (by (444))
n −r −1 n −1
= ∑ q + ∑ ( q + 1)
k =0 k = n −r
| {z } | {z }
=(n−r )q =r ( q +1)
(since this sum has n−r addends) (since this sum has r addends)
= (n − r ) q + r (q + 1) = qn + r = g = bnx c .
n2 + n + 1. (Indeed, the multinomial theorem yields the exact result, but we don’t
need it; all we need is that it is some sum of such monomials.) Thus, in order
2
to prove that abc divides ( a + b + c)n +n+1 , it will suffice to show that abc divides
each of these monomials ai b j ck . So let us do this.
Let us fix three nonnegative integers i, j, k satisfying i + j + k = n2 + n + 1. We
must prove that abc | ai b j ck .
If all of i, j, k are nonzero (thus ≥ 1), then this is true for obvious reasons. Thus,
we WLOG assume that i, j, k are not all nonzero. So at least one of i, j, k is zero.
Now abc | ai b j ck is no longer obvious, but we can try to use our assumptions
a | bn and b | cn and c | an to our advantage. These assumptions allow us to “trade”
a bn for an a, or a cn for a b, or an an for a c in the term ai b j ck . We hope that by
a few such “trades”, we can transform ai b j ck into a monomial where each of a, b, c
appears at least once (whence the monomial is divisible by abc).
Which “trades” we need to make depends on the values of i, j, k. We distinguish
between two cases:
Case 1: Exactly one of i, j, k is zero.
Case 2: Exactly two of i, j, k are zero.
(These are the only possibilities, because we already know that at least one of
i, j, k is zero, whereas the condition i + j + k = n2 + n + 1 rules out the possibility
that all of i, j, k are zero).
Let us first consider Case 1. In this case, exactly one of i, j, k is zero.
Notice the cyclic symmetry in the problem: If we cyclically permute a, b, c (that
is, replace a, b, c by b, c, a, respectively) and simultaneously cyclically permute i, j, k,
then neither the assumptions nor the claim of the problem change. Thus, we can
cyclically permute the numbers i, j, k at will (as long as we remember to permute
a, b, c along with them). By doing so, we can always guarantee that i = 0 (because
we know that at least one of the three numbers i, j, k is zero, and we can bring this
number to the front by a cyclic permutation). Thus, WLOG assume that i = 0.
Hence, j and k are nonzero (since exactly one of i, j, k is zero). In other words, j ≥ 1
and k ≥ 1. Our monomial ai b j ck thus has no a, but at least one b and at least one c
in it.
We now want to “trade” a bn for an a, or, if this is impossible (because we don’t
have a bn ), to “trade” n copies of cn for b’s and then trade the resulting bn for an a.
We need to be careful not to “sell” all our b’s in the trade, so we should “trade” bn
only if we have at least one b left after that – i.e., if j ≥ n + 1. Thus, we distinguish
between the following two subcases:
Subcase 1.1: We have j ≥ n + 1.
Subcase 1.2: We have j < n + 1.
In Subcase 1.1, we have j ≥ n + 1. Hence, bn+1 | b j . But a | bn . Multiplying
this divisibility by b, we find314 ab | bn b = bn+1 | b j . Also, c | ck (since k ≥ 1).
314 We are using the following basic fact of number theory here: If x and y are two integers satisfying
x | y, then xb | yb.
then after the first “lemming collision” they will look as follows:
←
−−→ ←
− −
→ ←
−
M1 : 1 2 3 4 5 ;
−−
← → ←
− −
→ ←
−
M2 : 2 1 3 4 5 .
equal throughout the ordeal, both on M1 and M2 (because collisions never change the speeds).
But the M2 -lemmings are much easier to analyze than the M1 -lemmings. After
all, collisions don’t matter on M2 . Thus, each M2 -lemming keeps walking in the
direction it has always been walking. As a consequence, each M2 -lemming even-
tually falls off the cliff (since the speeds are constant and nonzero, and the ridge is
finite). In other words, there are eventually no lemmings on M2 any more. Accord-
ing to Observation 1, this means that there are eventually no lemmings on M1 any
more. In other words, each M1 -lemming eventually falls off the cliff. This solves
the exercise.
Note that the above solution shows something better than the exercise asked for:
Namely, it shows that if the ridge has length d and the speed of each lemming is v,
then there will be no lemmings on the ridge after time d/v. Indeed, this is clearly
what happens on M2 (since each M2 -lemming just walks with speed v in a fixed
direction), and therefore (by Observation 1) is also what happens on M1 .
The next proof does not (at least directly) show this stronger result, but is prob-
ably easier to come up with:
Second solution to Exercise 1.1.5 (sketched). Consider the initial state. If the leftmost
lemming is walking left, then it will reach the left cliff undisturbed and fall off
it. If the leftmost lemming is walking right, then it will either reach the right cliff
undisturbed and fall off it, or it will collide with another lemming and bounce
off, which will then send it moving left and eventually falling off the left cliff
(undisturbed, since there won’t be any other lemming for it to collide with; it will
stay the leftmost lemming on the ridge until it falls). In either case, the leftmost
lemming will eventually fall off the cliff. After this happens, another lemming will
become the leftmost lemming, and thus (by the same argument) will also eventually
fall off the cliff. Repeat this argument once for each lemming (strictly speaking, this
means arguing by induction). This shows that eventually, all lemmings will have
fallen off the cliff (although it does not offer a good bound on how soon).
When two lemmings collide at equal speeds, the result is the same on M1 and on M2 as long as
you don’t distinguish between the lemmings: You still have two lemmings walking in the same
directions at the same speeds. The only difference is that the two lemmings have traded places
on M1 .
on the clothesline such that s/2 of them are black and the other s/2 white. We shall
refer to such a pick as a balanced pick. (Let’s not call it “color-balanced” for brevity.)
Thus, part (a) claims that we can find a balanced pick if n = 40 and s = 10, whereas
part (b) claims that we can find a balanced pick if n = 26 and s = 10.
We shall prove a more general claim ([18s-hw2s, Exercise 7]). Namely, we shall
prove the following:
Claim 1: Set q = n//s and r = n%s (where we are using the notations //
and % introduced in Definition 3.3.1). Assume that there is no balanced
pick. Then, r ≥ 2q and s > 2q + r.
Claim 1 will solve part (a) of our problem, since r ≥ 2q is violated for n = 40 and
s = 10; it will also solve part (b), since s > 2q + r is violated for n = 26 and s = 10.
[Proof of Claim 1: We have s/2 ∈ Z (since s is even). Also, q and r are the quotient
and the remainder of division of n by s (since q = n//s and r = n%s). Thus, q ∈ Z,
r ∈ {0, 1, . . . , s − 1} and n = qs + r. From r ∈ {0, 1, . . . , s − 1}, we obtain r < s.
Thus, s > r.
We must prove that r ≥ 2q and s > 2q + r. If q = 0, then this is obvious (because
r ≥ 0 and s > r). Hence, we WLOG assume that q 6= 0. Thus, q ≥ 1. Therefore,
n = q s + |{z} r ≥ s, so that n − s + 1 ≥ 1.
|{z}
≥1 ≥0
Number the socks by 1, 2, . . . , n in the order in which they appear on the clothes-
line. For any m ∈ N, let [m] denote the m-element set {1, 2, . . . , m}.
For each i ∈ [n − s + 1], define the integer
1
bi = (the number of black socks among socks i, i + 1, . . . , i + s − 1)
2
1
− (the number of white socks among socks i, i + 1, . . . , i + s − 1) .
2
(446)
(This comes from the fact that each sock is either black or white; see [18s-hw2s,
solution to Exercise 7] for a detailed proof.)
The equality (446) shows that if we invert the colors of all socks (simultaneously),
then all the numbers b1 , b2 , . . . , bn−s+1 change signs. Hence, we can WLOG assume
that b1 ≥ 0 (since otherwise, we can invert the colors of all socks, and then b1 will
change sign). Assume this.
Note that each i ∈ [n − s + 1] satisfies
(by (445)).
Hence,
q + qs/2 + g ≤ |{z}
n /2 = (qs + r ) /2 = qs/2 + r/2.
=qs+r
Subtracting qs/2 from both sides of this inequality, we find
q + g ≤ r/2. (449)
Hence, r/2 ≥ q + g ≥ q, so that r ≥ 2q.
|{z}
≥0
It remains to prove that s > 2q + r. From n = qs + r, we obtain n − r = qs. Thus,
(the number of black socks among socks n − r + 1, n − r + 2, . . . , n)
= (the number of black socks among socks qs + 1, qs + 2, . . . , n)
= (the number of black socks among socks qs + 1, qs + 2, . . . , qs + r )
(since n = qs + r )
= g.
But there is a sock n − s + 1 on our clothesline (since n − s + 1 ≥ 1). Let p be the
number of black socks among the s − r socks n − s + 1, n − s + 2, . . . , n − r. Thus,
clearly, p ≤ s − r.
From (447), we obtain
(the number of black socks among socks n − s + 1, n − s + 2, . . . , n)
= bn−s+1 +s/2 ≥ 1 + s/2.
| {z }
≥1
(by (448))
Hence,
1 + s/2
≤ (the number of black socks among socks n − s + 1, n − s + 2, . . . , n)
= (the number of black socks among socks n − s + 1, n − s + 2, . . . , n − r )
| {z }
=p
+ (the number of black socks among socks n − r + 1, n − r + 2, . . . , n)
| {z }
=g
= p + g ≤ (s − r ) + (r/2 − q) = s − r/2 − q.
|{z} |{z}
≤ s −r ≤r/2−q
(by (449))
Subtracting s/2 from both sides of this inequality, we find 1 ≤ s/2 − r/2 − q, so that
s/2 − r/2 − q ≥ 1 > 0. Multiplying this inequality by 2, we obtain s − r − 2q > 0,
so that s > 2q + r. This completes the proof of Claim 1.]
Thus, Exercise 1.1.6 is solved.
[Remark: I have heard that Claim 1 is an “if and only if”: If we don’t have r ≥ 2q
and s > 2q + r, then there exists a way to place n/2 black and n/2 white socks
on a clothesline such that there is no balanced pick. I don’t currently remember a
proof.]
bc (b − c) (b + c) + ca (c − a) (c + a) + ab ( a − b) ( a + b)
= ( a − b) ( a − c) (b − c) ( a + b + c) .
But how to find this? There are several options. The easiest approach is by
identifying and factoring out divisors. The most elementary implementation of
this approach is the following. We treat b and c as constants, and consider our
polynomial as a polynomial in the single variable a. Recall that if a polynomial in a
variable x has a root x0 , then this polynomial is divisible by the linear polynomial
x − x0 . Now, the polynomial
P ( a) := bc (b − c) (b + c) + ca (c − a) (c + a) + ab ( a − b) ( a + b)
P (b) = bc (b − c) (b + c) + cb (c − b) (c + b) + bb (b − b) (b + b)
| {z }
=0
= bc (b − c) (b + c) + cb (c − b) (c + b) = bc ((b − c) + (c − b)) (b + c) = 0.
| {z }
=0
320 Algebraists will not need Occam’s Razor here: They know that the ring of polynomials in the
three variables a, b, c over (say) Q is a unique factorization domain (this holds more generally
for any polynomial ring over a field), and therefore a polynomial divisible by two coprime
polynomials like a − b and a − c must necessarily be divisible by their product. But justifying
this without using abstract algebra is not easy. (Our approach of treating b and c as constants,
in particular, makes this argument rather slippery, because b and c might be equal and then
the polynomials a − b and a − c are no longer coprime.) Fortunately, we don’t need to justify
this step in order to solve the problem – it is merely used to find a factorization of a specific
polynomial, which, once found, can be proved by direct computation.
bc (b − c) (b + c) +ca (c − a) (c + a) + ab ( a − b) ( a + b)
| {z } | {z } | {z }
= b2 − c2 = c2 − a2 = a2 − b2
= bc b2 − c2 + ca c2 − a2 + ab a2 − b2
a3 a 1
= b3 c − bc3 + c3 a − ca3 + a3 b − ab3 = det b3 b 1
c3 c 1
(by the definition of the determinant)
a3 − c2 a a 1 here, we subtracted the c2 -multiple
• If x, y ∈ R, then
| xy| = | x | · |y| . (450)
| x | + |y| ≥ | x + y| . (451)
The same reasoning (but with the variables cyclically permuted) yields
|c − a| + | a − b| ≥ |b − c| and (453)
| a − b| + |b − c| ≥ |c − a| . (454)
(Note that at least one of these three inequalities is an equality. The best way to see
this is to imagine the three numbers a, b, c as points on the real axis; then, one of
the three lies between the two others, and then the corresponding inequality is an
equality. But we won’t need this.)
Now, b2 − c2 = (b + c) (b − c), so that
Again, the same reasoning (but with the variables cyclically permuted) yields
c2 − a2 = c · | c − a | + a · | c − a | and
a2 − b2 = a · | a − b | + b · | a − b | .
b2 − c2 + c2 − a2 + a2 − b2
= (b · |b − c| + c · |b − c|) + (c · |c − a| + a · |c − a|) + ( a · | a − b| + b · | a − b|)
= a · (|c − a| + | a − b|) +b · (| a − b| + |b − c|) +c · (|b − c| + |c − a|)
| {z } | {z } | {z }
≥|b−c| ≥|c− a| ≥| a−b|
(by (453)) (by (454)) (by (452))
≥ a · |b − c| + b · |c − a| + c · | a − b|
(here we have multiplied three inequalities with a, b, c, respectively; this was al-
lowed since a, b, c are nonnegative). In view of
ca − ab}
| {z + − bc}
|ab {z + bc − ca}
| {z
=(− a)(b−c) =(−b)(c− a) =(−c)( a−b)
this rewrites as
Now, we can get rid of the absolute value signs in the problem. Indeed, we have
b2 ≤ c , so that b − c ≤ 0 and thus b − c = − b − c = c − b2 . Likewise,
2 2 2 2 2 2 2 2
b2 − c2 + c2 − a2 + a2 − b2
| {z } | {z } | {z }
= c2 − b2 = c2 − a2 = b2 − a2
= c2 − b2 + c2 − a2 + b2 − a2 = 2 c2 − a2
= 2 (c + a) (c − a) (455)
and
2b (c − a) ≤ 2 (c + a) (c − a) . (457)
Thus, it remains to prove (457). But this is easy to check directly: We have b ≤ c ≤
c + a (since a ≥ 0), thus 2b ≤ 2 (c + a). We can multiply both sides of this inequality
a ≥ c − c = 0), and thus obtain 2b (c − a) ≤ 2 (c + a) (c − a).
by c − a (since c − |{z}
≤c
This proves (457); thus, Exercise 1.1.8 (a) is solved.
[Remark: The first solution to Exercise 1.1.8 (a) is longer, but it has a redeeming
quality: It generalizes to n variables instead of 3. The corresponding result is that
if a1 , a2 , . . . , an are n nonnegative reals, then
n n
∑ | a i −1 a i − a i a i +1 | ≤ ∑ a2i − a2i+1 ,
i =1 i =1
are n + 1 elements of the n-element set {0, 1, . . . , n − 1} (since they are remainders
upon division by n), and thus at least two of them must be equal (by the Pigeonhole
Principle)322 . In other words, there exist two integers u and v with 0 ≤ u < v ≤ n
and bu %n = bv %n. Consider these u and v. From u < v, we obtain u + 1 ≤ v (since
u and v are integers). Also, 0 ≤ u, thus 1 ≤ u + 1 ≤ v ≤ n. Hence, both u + 1 and
v belong to {1, 2, . . . , n}.
The integers bv and bu leave the same remainder when divided by n (since
bv %n = bu %n); thus, bv ≡ bu mod n (by Proposition 3.3.4, applied to bv and bu
instead of u and v). In other words, n | bv − bu . In view of
bv − bu = ( a1 + a2 + · · · + a v ) − ( a1 + a2 + · · · + a u )
|{z} |{z}
= a1 + a2 +···+ av = a1 + a2 +···+ au
(by the definition of bv ) (by the definition of bu )
= a u +1 + a u +2 + · · · + a v (since u < v) ,
this rewrites as n | au+1 + au+2 + · · · + av . Hence, there exist some p, q ∈ {1, 2, . . . , n}
with p ≤ q and n | a p + a p+1 + · · · + aq (namely, p = u + 1 and q = v). This solves
Exercise 1.1.9.
First solution to Exercise 3.7.1. Forget that we fixed n and S. We thus need to prove
the following claim:
Claim 1: Let n ∈ N. Let S be a k-lacunar subset of {1, 2, . . . , n}. Then,
n+k−1
|S| ≤ .
k
[Proof of Claim 1: We apply strong induction on n:
Induction step: Let m ∈ N. Assume (as the induction hypothesis) that Claim 1
holds for all n < m. We must prove that Claim 1 holds for n = m.
Note that k ≥ 1 (since k is a positive integer), so that m + |{z}
k −1 ≥ m + 1 − 1 =
≥1
m+k−1 m+k−1
m ≥ 0. Hence, ≥ 0, so that 0 ≤ . Also, m − k < m (since k > 0).
k k
We have assumed (as the induction hypothesis) that Claim 1 holds for all n <
m. In other words, if n ∈ N satisfies n < m, and if S is a k-lacunar subset of
{1, 2, . . . , n}, then
n+k−1
|S| ≤ . (458)
k
Now, let us prove that Claim 1 holds for n = m. Let S be a k-lacunar subset of
{1, 2, . . . , m}. We shall show that
m+k−1
|S| ≤ . (459)
k
m+k−1
If |S| = 0, then this is definitely true (since we have 0 ≤ ). Thus, we
k
WLOG assume that |S| 6= 0. Hence, the set S is nonempty. Also, the set S is
finite (since it is a subset of the finite set {1, 2, . . . , m}). Therefore, Proposition 2.1.2
shows that the set S has a maximum. Let w be this maximum. Thus, w ∈ S ⊆
{1, 2, . . . , m}. Hence, 1 ≤ w ≤ m, so that m ≥ 1. Now, |{z} m +k − 1 ≥ 1 + k − 1 = k,
≥1
m+k−1 m+k−1
so that ≥ 1. Therefore, if |S| = 1, then |S| = 1 ≤ (since
k k
m+k−1
≥ 1), and thus (459) is proved in this case. Hence, we WLOG assume
k
that |S| 6= 1. But w ∈ S, so that |S \ {w}| = |S| − 1 6= 0 (since |S| 6= 1). In other
words, the set S \ {w} is nonempty.
Now, each g ∈ S \ {w} satisfies g ≤ w − k 323 and therefore g ≤ |{z}w −k ≤ m − k
≤m
and consequently g ∈ {1, 2, . . . , m − k } (since g ∈ S \ {w} ⊆ S ⊆ {1, 2, . . . , m}
323 Proof.Let g ∈ S \ {w}. Thus, g 6= w and g ∈ S \ {w} ⊆ S. But each s ∈ S satisfies s ≤ w (since w
is the maximum of S). Applying this to s = g, we obtain g ≤ w (since g ∈ S). Hence, w − g ≥ 0,
so that |w − g| = w − g.
Recall that the set S is k-lacunar. In other words, every two distinct elements u, v ∈ S satisfy
|u − v| ≥ k (by the definition of “k-lacunar”). Applying this to u = w and v = g, we obtain
|w − g| ≥ k (since w and g are distinct (because g 6= w)). In other words, w − g ≥ k (since
|w − g| = w − g). Thus, w ≥ g + k and therefore g ≤ w − k. Qed.
entails g ≥ 1) 324 . In other words, S \ {w} ⊆ {1, 2, . . . , m − k }. But recall that the
set S \ {w} is nonempty; thus, there exists some x ∈ S \ {w}. Consider this x. We
have x ∈ S \ {w} ⊆ {1, 2, . . . , m − k}, so that 1 ≤ x ≤ m − k, thus m − k ≥ 1 ≥ 0
and therefore m − k ∈ N.
Furthermore, it is easy to see that any subset of a k-lacunar subset is itself k-
lacunar; hence, the set S \ {w} is k-lacunar (because it is a subset of the k-lacunar
set S). Thus, S \ {w} is a k-lacunar subset of {1, 2, . . . , m − k } (since S \ {w} ⊆
{1, 2, . . . , m − k}). Hence, (458) (applied to m − k and S \ {w} instead of n and S)
yields
(m − k) + k − 1 m−1
|S \ {w}| ≤ = .
k k
Now, recall that |S \ {w}| = |S| − 1, so that
m−1 m+k−1
|S| = |S \ {w}| +1 ≤ +1 = .
| {z } k k
m−1
≤
k
Thus, (459) is proved.
Forget that we fixed S. We thus have showed that if S is a k-lacunar subset of
m+k−1
{1, 2, . . . , m}, then |S| ≤ . In other words, Claim 1 holds for n = m. This
k
completes the induction step; thus, Claim 1 is proved.]
The second solution of Exercise 3.7.1 is more direct, and relies on the following
basic fact of enumerative combinatorics (known as the sum rule): If S1 , S2 , . . . , Sk are
k disjoint finite sets, then the set S1 ∪ S2 ∪ · · · ∪ Sk is finite and satisfies
| S1 ∪ S2 ∪ · · · ∪ S k | = | S1 | + | S2 | + · · · + | S k | . (460)
(Note that “disjoint” means “pairwise disjoint”; i.e., the k sets S1 , S2 , . . . , Sk are said
to be disjoint if and only if every two distinct elements i and j of {1, 2, . . . , k } satisfy
Si ∩ S j = ∅.) Note that this is a generalization of Theorem 2.3.6 to multiple (not
just 2) disjoint sets.
Second solution to Exercise 3.7.1. For each i ∈ {1, 2, . . . , k }, we define a set
Si = { s + i | s ∈ S } .
Roughly speaking, Si is just the set S shifted to the right by a distance of i (on the
real axis). Hence, Si has the same size as S; that is, we have
324 Weare here following the convention that {1, 2, . . . , m − k} is the empty set when m − k ≤ 0.
(Although we shall soon see that we don’t have m − k ≤ 0.)
On the other hand, since S is k-lacunar, it is easy to see that the k sets S1 , S2 , . . . , Sk
are disjoint326 . Hence, (460) yields
k k
| S1 ∪ S2 ∪ · · · ∪ S k | = | S1 | + | S2 | + · · · + | S k | = ∑ | Si | = ∑ | S | = k · | S | .
i =1 i =1
|{z}
=|S|
(by (461))
Therefore,
k · |S| = |S1 ∪ S2 ∪ · · · ∪ Sk | ≤ n + k − 1.
n+k−1
Dividing both sides of this inequality by k, we find |S| ≤ . This solves
k
Exercise 3.7.1 again.
325 Proof.We must show that Si ⊆ {2, 3, . . . , n + k } for each i ∈ {1, 2, . . . , k}. Let us do this.
So let i ∈ {1, 2, . . . , k}. Thus, 1 ≤ i ≤ k.
Let z ∈ Si . Thus, z ∈ Si = {s + i | s ∈ S}, so that z = s + i for some s ∈ S. Consider this
s. We have s ∈ S ⊆ {1, 2, . . . , n}, so that 1 ≤ s ≤ n. Now, z = |{z} i ≥ 1 + 1 = 2 and
s + |{z}
≥1 ≥1
z = |{z} i ≤ n + k. Combining these two inequalities, we obtain 2 ≤ z ≤ n + k and thus
s + |{z}
≤n ≤k
z ∈ {2, 3, . . . , n + k }.
Forget that we fixed z. We thus have shown that z ∈ {2, 3, . . . , n + k } for each z ∈ Si . In other
words, Si ⊆ {2, 3, . . . , n + k }. This completes our proof.
326 Proof. We must prove that S ∩ S = ∅ for every two distinct elements i and j of {1, 2, . . . , k }.
i j
Thus, let i and j be two distinct elements of {1, 2, . . . , k }. We must prove that Si ∩ S j = ∅.
We WLOG assume that i ≤ j (since otherwise, we can swap i with j). Hence, j − i ≥ 0. Thus,
| j − i | = j − i.
Let t ∈ Si ∩ S j . Thus, t ∈ Si ∩ S j ⊆ Si = {s + i | s ∈ S}. In other words, there exists some
s ∈ S such that t = s + i. Consider this s. From t = s + i, we obtain t − i = s ∈ S. Similarly,
t − j ∈ S. Moreover, i 6= j (since i and j are distinct) and thus t − i 6= t − j. Hence, the elements
t − i and t − j of S are distinct.
Recall that the set S is k-lacunar. In other words, every two distinct elements u, v ∈ S satisfy
|u − v| ≥ k (by the definition of “k-lacunar”). Applying this to u = t − i and v = t − j, we obtain
|(t − i ) − (t − j)| ≥ k. In other words, | j − i | ≥ k (since (t − i ) − (t − j) = j − i). In other words,
j − i ≥ k (since | j − i | = j − i). Therefore, j ≥ i + k > k (since i > 0). On the other hand, from
j ∈ {1, 2, . . . , k}, we obtain j ≤ k. This contradicts j > k.
Forget that we fixed t. We thus have obtained a contradiction for each t ∈ Si ∩ S j . Hence, there
exists no t ∈ Si ∩ S j . In other words, Si ∩ S j is an empty set. That is, Si ∩ S j = ∅. This completes
our proof.
Third solution to Exercise 3.7.1 (sketched). This was suggested by one of the students.
We let q = (n − 1) //k, and we subdivide the set {1, 2, . . . , n} into q + 1 integer
intervals
I0 = {1, 2, . . . , k } ,
I1 = {k + 1, k + 2, . . . , 2k } ,
I2 = {2k + 1, 2k + 2, . . . , 3k } ,
...,
Iq−1 = {(q − 1) k + 1, (q − 1) k + 2, . . . , qk } ,
Iq = {qk + 1, qk + 2, . . . , n} .
{1, k + 1, 2k + 1, 3k + 1, . . . , pk + 1}
for some p ∈ N ∪ {−1} (this allows p = −1, in which case S will be the empty
set). In other words, the k-lacunar subset S is left-flush if its smallest element is
as small as possible (that is, 1), its second-smallest element is as small as possible
(that is, k + 1, because S has to be k-lacunar), its third-smallest element is as small
n+k−1
as possible (that is, 2k + 1), etc.. It is easy to see that the inequality |S| ≤
k
holds when the k-lacunar subset S is left-flush. Now, it remains to show that
we can transform any k-lacunar subset into a left-flush k-lacunar subset without
changing its size. But it is fairly clear how to do this: Just keep decreasing the
smallest element until no longer possible (i.e., until it hits 1); then do the same
with the second-smallest element (which will end up at k + 1 because the subset
must remain k-lacunar); then do the same with the third-smallest element; and so
on.
Now, forget that we fixed a, b. We thus have shown that any a, b ∈ N satisfying
a + b = k satisfy gcd ( f a , f b ) = f gcd(a,b) . Renaming the variables a and b as n and
m in this statement, we obtain the following: Any n, m ∈ N satisfying n + m = k
satisfy gcd ( f n , f m ) = f gcd(n,m) . In other words, Exercise 3.7.2 is true for n + m = k.
This completes the induction step. Thus, Exercise 3.7.2 is solved.
327 because Proposition 3.4.4 (b) yields gcd ( a, b) = gcd (b, a) and gcd ( f a , f b ) = gcd ( f b , f a )
328 Strictlyspeaking, this can be proved by strong induction.
329 Proof. Assume that a = 0. Then, gcd ( a, b ) = b (this has already been proved during our above
proof of Theorem 3.4.5) and thus b = gcd ( a, b). Furthermore, from a = 0, we obtain f a = f 0 = 0
and therefore
qed.
m ·2
m 2 m m
22 − 1 = 22 − 1 = 22 − 1 22 + 1
330 Proof.Proposition 3.4.4 (f) yields gcd ( Fm , 2) | Fm and gcd ( Fm , 2) | 2. But gcd ( Fm , 2) is a nonneg-
ative integer (by Proposition 3.4.3 (a)). Hence, from gcd ( Fm , 2) | 2, we conclude that gcd ( Fm , 2)
is a nonnegative divisor of 2. Since the only nonnegative divisors of 2 are 1 and 2, we thus have
either gcd ( Fm , 2) = 1 or gcd ( Fm , 2) = 2. But gcd ( Fm , 2) = 2 is impossible, since this would
yield 2 = gcd ( Fm , 2) | Fm , which would contradict 2 - Fm . Hence, the only option that remains
is gcd ( Fm , 2) = 1.
that was proved in our solution to Exercise 1.1.1. (Our proof of this equality made
no use of the assumption that n be even.) Thus, for each integer n ≥ 2, we have
n
2
∏ ((2k − 1)!) · 2n n!
1! · 2! · · · · · (2n)!
= k =1 (by (466))
( n + 1) ! ( n + 1) !
!
n
n!
= ∏ ((2k − 1)!)2 · 2n ·
k =1
|{z}
2
( n + 1) !
=(2(n−1)/2 ) ·2 | {z }
1
=
n+1
!
n 2
1
= ∏ ((2k − 1)!)2 · 2(n−1)/2 · 2 ·
k =1
n+1
! !2
n
2
= ∏ ((2k − 1)!) · 2(n−1)/2 · n + 1
k =1
! !2
n
2(n−1)/2
= ∏ ((2k − 1)!) · n + 1 ·2 (n + 1) . (467)
k =1
| {z }
a perfect square when n is odd
(indeed, the denominator n+1
is cancelled by the (2n−1)!
factor in the product)
1! · 2! · · · · · (2n)!
Now, we want to find odd positive integers n for which is a
( n + 1) !
perfect square. If n ≥ 2 is such an integer, then (466) suggests that 2 (n + 1) should
be a perfect square331 . In other words, we should have 2 (n + 1) = u2 for some
u2 u2
u ∈ Z. Solving this equation for n, we obtain n = − 1. For to be an
2 2
integer, u should be even (check this!), so that u = 2v for some v ∈ Z. Thus,
u2 (2v)2
n= −1 = − 1 = 2v2 − 1.
2 2
1! · 2! · · · · · (2n)!
So we have shown that is a perfect square whenever n ≥ 2 is
( n + 1) !
an integer of the form n = 2v2 − 1 for some v ∈ Z. It is clear that any integer of
this form is odd, and furthermore there are infinitely many integers of this form
that are ≥ 2. Thus, there are infinitely many odd positive integers n for which
1! · 2! · · · · · (2n)!
is a perfect square (namely, all integers of the form n = 2v2 − 1
( n + 1) !
for v ∈ Z satisfying v ≥ 2).
331 At least this is a sufficient condition. (It is also necessary, but this needs a bit more thought.)
∑ as = ∑ as + ∑ as + · · · + ∑ as .
s∈S s ∈ S1 s ∈ S2 s ∈ Sm
{0, 1, . . . , n − 1} ,
{n, n + 1, . . . , 2n − 1} ,
{2n, 2n + 1, . . . , 3n − 1} ,
...,
{(m − 1) n, (m − 1) n + 1, . . . , mn − 1}
(each containing exactly n numbers). Hence, Proposition A.2.2 shows that the sum
mn−1
k
∑ x+ can be split into m smaller sums as follows:
k =0 n
mn−1
k
∑ x+ n
k =0
n −1 2n−1 3n−1 mn−1
k k k k
= ∑ x+ + ∑ x+ + ∑ x+ +···+ ∑ x+
k =0
n k=n
n k=2n
n k=(m−1)n
n
m −1 ( i +1) n −1 m −1 n −1
k k + in
= ∑ ∑ x + = ∑ ∑ x +
n n
i =0 i =0 k =0 |
| k=in {z
{z }
k
}
k + in
$ %
n −1 = x +i +
= ∑ x+ n
k =0 n
(here, we have substituted k+in
for k in the sum)
m −1 n −1 m −1
k
= ∑ ∑ x+i+
n
= ∑ bnx + ni c
i =0 i =0
|k=0
| {z }
{z } =bnx c+ni
=bn( x +i )c (by Proposition A.2.3,
(by Exercise 1.1.3, applied to nx and ni instead of x and k)
applied to x +i instead of x)
m −1 m −1 m −1 m −1
= ∑ (bnx c + ni ) = ∑ bnxc + ∑ ni = m bnxc + n ∑ i
i =0
| {z } |i={z
i =0 0
} i =0
| {z }
=mbnx c m −1 =0+1+···+(m−1)
=n ∑ i =1+2+···+(m−1)
i =0
= m bnx c + n (1 + 2 + · · · + (m − 1))
| {z }
(m − 1) ((m − 1) + 1)
=
2
(by (9), applied to m−1 instead of n)
(m − 1) ((m − 1) + 1) n ( m − 1)
= m bnx c + n = m bnx c + m
| {z2 } 2
( m − 1) m n ( m − 1)
=n =m
2 2
n ( m − 1)
= m bnx c + .
2
If m < 5, then we can see this easily from m%5 = m and m//5 = 0. Thus,
we WLOG assume that m ≥ 5. Hence, m − 2 and m − 1 are nonnegative integers.
Since these two nonnegative integers m − 2 and m − 1 are < m, we can thus apply
Exercise 3.7.6 to n = m − 2 and to n = m − 1 (by our induction hypothesis). We
thus obtain
f m−1 ≡ f (m−1)%5 · 3(m−1)//5 mod 5
and
f m−2 ≡ f (m−2)%5 · 3(m−2)//5 mod 5.
Adding these two congruences, we obtain
This rewrites as
(since the recursive definition of the Fibonacci sequence yields f m = f m−1 + f m−2 ).
Our goal is now to deduce (468) from this congruence. In order to do so, it suffices
to show that
(because then, combining (469) with (470) will immediately yield (468) by the tran-
sitivity of congruence).
The proof of (470) is an easy case distinction. Indeed, Proposition 3.3.2 (a) (ap-
plied to n = 5 and u = m) yields that m%5 ∈ {0, 1, 2, 3, 4} and m%5 ≡ m mod 5.
Symmetry of congruence yields m ≡ m%5 mod 5 (since m%5 ≡ m mod 5). Since
m%5 ∈ {0, 1, 2, 3, 4}, we are in one of the following five cases:
Case 1: We have m%5 = 0.
Case 2: We have m%5 = 1.
Case 3: We have m%5 = 2.
Case 4: We have m%5 = 3.
Case 5: We have m%5 = 4.
Before I get to any of these cases, let me say a few generalities. We want to know
how the numbers k//5 and k%5 change when an integer k is incremented (i.e.,
increased by 1). The answer is fairly easy:
We leave the proofs of these two observations to the reader.332 Observation 1 entails
that (
(m − 1) //5, if 5 - m;
m//5 = (471)
(m − 1) //5 + 1, if 5 | m
and (
(m − 2) //5, if 5 - m − 1;
(m − 1) //5 = (472)
(m − 2) //5 + 1, if 5 | m − 1.
With these equalities in hand, let us analyze the above five cases.
We begin with Case 1. In this case, we have m%5 = 0. Thus, m ≡ m%5 = 0 mod 5.
m −1 ≡ 0 − 1 ≡ 4 mod 5 and |{z}
Thus, |{z} m −2 ≡ 0 − 2 ≡ 3 mod 5. From these
≡0 mod 5 ≡0 mod 5
three congruences, it easily follows (using Proposition 3.3.2 (c)) that m%5 = 0
and (m − 1) %5 = 4 and (m − 2) %5 = 3. Let us next express (m − 1) //5 and
(m − 2) //5 through m//5. Indeed, m%5 = 0 entails 5 | m, hence m//5 =
(m − 1) //5 + 1 (because of (471)). Solving this for (m − 1) //5, we obtain (m − 1) //5 =
m//5 − 1. Furthermore, (m − 1) %5 = 4 6= 0 entails 5 - m − 1 and therefore
(m − 1) //5 = (m − 2) //5 (by (472)). Thus, (m − 2) //5 = (m − 1) //5 = m//5 −
1. Now,
Next, let us handle Case 2. In this case, we have m%5 = 1. Thus, m ≡ m%5 =
m −1 ≡ 1 − 1 = 0 mod 5 and |{z}
1 mod 5. Thus, |{z} m −2 ≡ 1 − 2 ≡ 4 mod 5.
≡1 mod 5 ≡1 mod 5
From these three congruences, it easily follows (using Proposition 3.3.2 (c)) that
m%5 = 1 and (m − 1) %5 = 0 and (m − 2) %5 = 4. Let us next express (m − 1) //5
and (m − 2) //5 through m//5. Indeed, m%5 = 1 6= 0 entails 5 - m, hence
m//5 = (m − 1) //5 (because of (471)). Solving this for (m − 1) //5, we obtain
(m − 1) //5 = m//5. Furthermore, (m − 1) %5 = 0 entails 5 | m − 1 and therefore
(m − 1) //5 = (m − 2) //5 + 1 (by (472)). Thus, (m − 2) //5 = (m − 1) //5 −1 =
| {z }
=m//5
m//5 − 1. Now,
then
( c 0 , c 1 , . . . , c m −1 ) = ( d 0 , d 1 , . . . , d m −1 ) . (474)
Now, we need to prove that Lemma A.2.4 holds for k = m. So let (c0 , c1 , . . . , cm )
and (d0 , d1 , . . . , dm ) be two (m + 1)-tuples of elements of {0, 1, −1} satisfying
c m 3 m + c m − 1 3 m − 1 + · · · + c 0 30 = d m 3 m + d m − 1 3 m − 1 + · · · + d 0 30 . (475)
Then,
and similarly
cm 3m + cm−1 3m−1 + · · · + c0 30 ≡ c0 mod 3.
Hence,
c 0 ≡ c m 3 m + c m − 1 3 m − 1 + · · · + c 0 30
= dm 3m + dm−1 3m−1 + · · · + d0 30 (by (475))
≡ d0 mod 3.
But c0 and d0 both are elements of {0, 1, −1}, and thus can only be congruent
modulo 3 if they are equal333 . Thus, from c0 ≡ d0 mod 3, we obtain c0 = d0 . Thus,
c0 30 = d0 30 . Subtracting the latter equality from the equality (475), we obtain
333 Indeed, it is easy to check that no two distinct elements of {0, 1, −1} are congruent modulo 3.
334 Proof.
Assume the contrary. Thus, some positive integer a has two different balanced ternary
expressions
a = 3k + ck−1 3k−1 + ck−2 3k−2 + · · · + c0 30 (476)
and
a = 3 m + d m − 1 3 m − 1 + d m − 2 3 m − 2 + · · · + d 0 30 . (477)
Consider this a and these two expressions. We WLOG assume that m ≤ k (otherwise, we could
just switch the roles of the two expressions). We set ck = 1; thus, (476) rewrites as
dk 3k + dk−1 3k−1 + · · · + d0 30
= d k 3 k + d k − 1 3 k − 1 + · · · + d m + 1 3 m + 1 + d m 3 m + d m − 1 3 m − 1 + · · · + d 0 30
|{z} |{z} | {z }
=0 =0 =0
(since m ≤ k)
= 0 · 3k + 0 · 3k−1 + · · · + 0 · 3m+1 + dm 3m + dm−1 3m−1 + · · · + d0 30
| {z }
=0
m m −1
= d m 3 + d m −1 3 + · · · + d0 30 .
(by (480)). Lemma A.2.4 thus shows that (c0 , c1 , . . . , ck ) = (d0 , d1 , . . . , dk ) (since (c0 , c1 , . . . , ck )
and (d0 , d1 , . . . , dk ) are two (k + 1)-tuples of elements of {0, 1, −1}). Hence, in particular, we
have ck = dk . In other words, dk = ck = 1 6= 0. If we had m < k, then we would have dk = 0
(since we have set dm+1 = 0, dm+2 = 0, . . ., dk = 0), which would contradict dk 6= 0. Thus, we
cannot have m < k. Hence, we have m ≥ k, and therefore m = k (since m ≤ k). Now,
( c0 , c1 , . . . , c k ) = ( d0 , d1 , . . . , d k ) = ( d0 , d1 , . . . , d m ) (since k = m) .
As a consequence, the two expressions (476) and (477) are identical; this contradicts our assump-
tion that they be different. This contradiction proves that our assumption was wrong, qed.
This is clearly a balanced ternary expression of b. Hence, we have shown that b has
some balanced ternary expression in Case 2.
Finally, let us consider Case 3. In this case, we have r = 2. Thus, b = 3q + |{z}
r =
=2
3q + 2, so that b + 1 = (3q + 2) + 1 = 3q + 3 = 3 (q + 1). But now, from q > 0, we
obtain q + 1 < 3q + 1 < 3q + 2 = b. Recall that our induction hypothesis says that
every positive integer a satisfying a < b has some balanced ternary expression. We
can apply this to a = q + 1 (since q + 1 is a positive integer and satisfies q + 1 < b).
Thus, we conclude that q + 1 has some balanced ternary expression. Let
bounded from below by a bound that keeps moving down” is not “being
bounded from below”. I hope that this tripwire I inserted makes clear why
the termination of the algorithm is not obvious. Here is one way to fix the
argument: Each of the steps decreases the sum of the ci by 2, while increasing
n by at most 1. So it decreases n + (c0 + c1 + · · · + cn ) by at least 2 − 1 = 1.
And n + (c0 + c1 + · · · + cn ) is really bounded from below, namely by −1
(because each of the ci is ≥ −1), which shows that it cannot decrease by at
least 1 indefinitely.
338 Proof.Assume that T has no 1-marked entries. Hence, every cyan entry of T is 2-marked (since
otherwise it would be 1-marked, but T has no 1-marked entries). However, exactly pn entries of
the table T are cyan (since T has n columns, and exactly p entries in any column are cyan). All
of these pn entries are therefore 2-marked (since every cyan entry of T is 2-marked). This entails
that at least pn entries of T are 2-marked. Therefore, at least pq entries of T are 2-marked (since
n ≥ pq). But this is precisely what we wanted to show.
p |{z}
≥q
maximum339 . In other words, the largest 1-marked entry of T exists. Let M be this
largest 1-marked entry. Since M is 1-marked, this entry M is either cyan or red but
not both. In other words, we are in one of the following two cases:
Case 1: The entry M is cyan but not red.
Case 2: The entry M is red but not cyan.
Let us consider Case 1. In this case, the entry M is cyan but not red. Recalling the
definitions of the cyan and red markings, we can restate this as follows: The entry
M is one of the p largest entries in its column, but not one of the q largest entries
in its row. Let R denote the row of T that contains M. Thus, M is not one of the q
largest entries of R (since M is not one of the q largest entries in its row). Hence, the
q largest entries of R are larger than M, and therefore cannot be 1-marked (since M
is the largest 1-marked entry of T). But the q largest entries of R are red (because
they are the q largest entries in a row of T), and thus must be either 1-marked or
2-marked. Since we have just shown that they cannot be 1-marked, we conclude
that they must be 2-marked. So we have shown that the q largest entries of R are
2-marked.
Note that p > 0 (since otherwise, T would not have any cyan entries at all; but we
know that the entry M is cyan). Thus, p ≥ 1, so that p − 1 ∈ N. Also, p − 1 ≤ m − 1
(since p ≤ m).
Let us now remove the row R from the m × n-table T. The result is an (m − 1) ×
n-table T 0 . Note that the table T 0 and the row R have no entries in common (since
the entries of T are all distinct). Also, all entries of the table T 0 are distinct (for the
same reason). Let us pause this proof for an example:
Example A.2.5. For this example, let m = 4 and n = 4 and p = 2 and
1 2 11 9
12 4 3 8
q = 2, and let T be the m × n-table 5 6 13 7 . Then, the cyan entries
10 14 16 15
are 10, 12, 6, 14, 13, 16, 9, 15, whereas the red entries are 9, 11, 8, 12, 7, 13, 15, 16.
Thus, the 2-marked entries are 9, 12, 13, 15, 16, whereas the 1-marked entries are
6, 7, 8, 10, 11, 14. Hence, M (the largest 1-marked entry) is 14. This entry M = 14
is cyan, so we are in Case 1. The row Rcontaining the entry M = 14 is the last
1 2 11 9
row of T. Hence, T 0 = 12 4 3 8 .
5 6 13 7
We do not copy the cyan and red markings from T to T 0 , but instead we mark
some of the entries in T 0 as follows: In each column of T 0 , we mark the p − 1 largest
entries with a cyan marker. In each row of T 0 , we mark the q largest entries with a
red marker. Since we have (m − 1) + n = m + n} −1 = k + 1 − 1 = k, our induction
| {z
= k +1
339 Here we are using the Extremal Principle – specifically, the version thereof that says that any
nonempty finite set of integers has a largest element (i.e., a maximum). This is exactly the claim
of Proposition 2.1.2.
• We will never use the notation ab for the product of two numbers a and
b. Instead, we will denote this product by a · b. This will allow us to use
the notation ab for things like the bitstring ( a, b) without worrying about
ambiguity.
340 Here is a very brief outline of this proof: Given a bitstring a, let n a denote the number of 0s in a
(that is, the number of entries of a equal to 0), and let k a denote the number of 1s in a. Induct
on k a . Within the induction step, induct on n a . We must prove that any sequence of moves that
can be applied successively to a must have an end. To this end, we consider the first entry of
a. If this first entry is 1, then this 1 will never be involved in any move (since a move can only
involve a 1 that has a 0 in front of it) and will never move away from its first position; thus, we
can as well pretend it does not exist, and thus our claim reduces to the situation with one fewer
1 (to which we can apply the induction hypothesis). On the other hand, if the first entry of a
is 0, then our sequence of moves (if long enough) will eventually result in this 0 being involved
in a move (since otherwise, we can as well pretend it does not exist, which again reduces the
problem to the induction hypothesis). Once this happens, the first entry becomes 1, so we are
back in the first case. When fleshing out this proof, keep in mind that we are doing an induction
within an induction; make sure to clarify which of the two induction hypotheses is being used
at which point!
Thus, we have transformed each nontrivial a-comb into an a0 -comb. This trans-
formation is easily seen to be a 1-to-1 correspondence, because an a0 -comb cannot
contain more than one mobile entry (check this!). Hence,
Therefore,
exactly how the bitstring a◦ looks like: It consists of k a many 1s, followed by n a + c a
many 0s. This shows that a◦ is uniquely determined by a (without knowing the
specific sequence of moves used to construct it).
It remains to show that the number of moves needed to reach a◦ is also uniquely
determined by a. But this is clear, since we have already seen that this number of
moves is c a . Exercise 3.7.10 (b) is thus completely solved.
Second solution to Exercise 3.7.10 (sketched). If a = a1 a2 . . . an is a bitstring and b is an
element of {0, 1}, then ba shall denote the bitstring ba1 a2 . . . an (that is, the bitstring
obtained by inserting b at the front of a). For example, if a = 1011 and b = 0, then
ba = 01011.
For any bitstring a, we let ones a denote the number of 1s in a (that is, the number
of entries of a that are equal to 1). (This was denoted by k a in the previous proof.)
For example, ones (01001) = 2. It is clear that any bitstring c satisfies
and
ones (0c) = ones c. (484)
Also, we let ε denote the empty bitstring; then,
ones ε = 0. (485)
Notice that the formulas (485), (484) and (483) (taken together) can be used to
compute the integers ones a for all bitstrings a. In fact, a bitstring a is either empty
(in which case ones a is determined by (485)), or begins with a 0 (in which case we
can use (484) to express ones a through ones c for a shorter bitstring c), or begins
with a 1 (in which case we can use (483) to express ones a through ones c for a
shorter bitstring c). Moreover, these formulas provide a unique way of computing
ones a (because for each bitstring a, only one of these three formulas has ones a on
its left hand side). Thus, if we forget how we originally defined ones a, then we
can use the formulas (485), (484) and (483) as a recursive definition of the integers
ones a for every bitstring a.
We notice that the two formulas (484) and (483) can be combined into a single
formula using the Iverson bracket notation (Definition 4.3.19): For any bitstring c
and any b ∈ {0, 1}, we have
(Indeed, this boils down to (484) when b = 0, and boils down to (483) when b = 1.
Since b is either 0 or 1, we thus conclude that (486) always holds.)
For any bitstring a, we let zeros a denote the number of 0s in a (that is, the
number of entries of a that are equal to 0). (This was denoted by n a in the previous
proof.) For example, zeros (01001) = 3. It is clear that any bitstring c satisfies
and
zeros (0c) = 1 + zeros c. (488)
Also, the empty bitstring ε satisfies
zeros ε = 0. (489)
Again, the formulas (489), (488) and (487) (taken together) can be used as a recur-
sive definition of the integers zeros a for every bitstring a.
We notice that the two formulas (488) and (487) can be combined into a single
formula using the Iverson bracket notation: For any bitstring c and any b ∈ {0, 1},
we have
zeros (bc) = [b = 0] + zeros c. (490)
(Indeed, this boils down to (488) when b = 0, and boils down to (487) when b = 1.
Since b is either 0 or 1, we thus conclude that (490) always holds.)
We shall now define another integer load a for any bitstring a. We define it
recursively, by setting
load ε = 0 (491)
and
load (0c) = load c + 2ones c − 1 (492)
and
load (1c) = load c (493)
for any bitstring c. This is a valid definition of load a, for the same reason as
why the formulas (485), (484) and (483) provide a valid recursive definition of the
integers ones a for every bitstring a.
| {z }ε +2 − 1 + 2 − 1 + 2 − 1 + 4 − 1
= load
=0
= 2 − 1 + 2 − 1 + 2 − 1 + 4 − 1 = 6.
We notice that
Indeed, this is clear from the recursive definition of load a, since the 2ones c − 1 on
the right hand side of (492) is always a nonnegative integer (because ones c ≥ 0
and thus 2ones c − 1 ≥ 20 − 1 = 0).
We notice that the two formulas (492) and (493) can be combined into a single
formula using the Iverson bracket notation: For any bitstring c and any b ∈ {0, 1},
we have
load (bc) = load c + [b = 0] · (2ones c − 1) . (495)
(Indeed, this boils down to (492) when b = 0, and boils down to (493) when b = 1.
Since b is either 0 or 1, we thus conclude that (495) always holds.)
We now claim that when we apply a move to a bitstring a,
We shall state this claim in a slightly more formal way. First, we define a notation:
We shall use the notation “a → b” to say that a bitstring b is obtained by applying
a move to a bitstring a. Now, we claim the following:
and
ones (bk bk−1 . . . b1 100d) = ones (bk bk−1 . . . b1 01d)
and
zeros (bk bk−1 . . . b1 100d) = zeros (bk bk−1 . . . b1 01d) + 1.
But
Thus, we have shown that load (100d) = load (01d) − 1 and ones (100d) = ones (01d)
and zeros (100d) = zeros (01d) + 1. In other words, Claim 2 holds for k = 0.
Induction step: Let ` ∈ N. Assume (as the induction hypothesis) that Claim 2
holds for k = `. We must prove that Claim 2 holds for k = ` + 1.
Let b1 , b2 , . . . , b`+1 be any elements of {0, 1}. We must show that
and
ones (b`+1 b` . . . b1 100d) = ones (b`+1 b` . . . b1 01d) (498)
and
zeros (b`+1 b` . . . b1 100d) = zeros (b`+1 b` . . . b1 01d) + 1. (499)
The induction hypothesis says that Claim 2 holds for k = `. Hence, we have
and
ones (b` b`−1 . . . b1 100d) = ones (b` b`−1 . . . b1 01d) (501)
and
zeros (b` b`−1 . . . b1 100d) = zeros (b` b`−1 . . . b1 01d) + 1. (502)
Let c = b` b`−1 . . . b1 100d and c0 = b` b`−1 . . . b1 01d. Thus, the three equalities
(500), (501) and (502) can be rewritten as
load c = load c0 − 1
(503)
and
ones c = ones c0
(504)
and
zeros c = zeros c0 + 1.
(505)
b`+1 c
|{z} = b`+1 b` b`−1 . . . b1 100d = b`+1 b` . . . b1 100d
=b` b`−1 ...b1 100d
and
b`+1 c0
|{z} = b`+1 b` b`−1 . . . b1 01d = b`+1 b` . . . b1 01d.
=b` b`−1 ...b1 01d
In light of these two equalities, we can rewrite the three equalities (514), (511) and
(508) as
load (b`+1 b` . . . b1 100d) = load (b`+1 b` . . . b1 01d) − 1
and
ones (b`+1 b` . . . b1 100d) = ones (b`+1 b` . . . b1 01d)
and
zeros (b`+1 b` . . . b1 100d) = zeros (b`+1 b` . . . b1 01d) + 1.
But these are precisely the three equalities (497), (498) and (499). So the latter three
equalities are proved.
Now, forget that we fixed b1 , b2 , . . . , b`+1 . We thus have proved the equalities
(497), (498) and (499) for any ` + 1 elements b1 , b2 , . . . , b`+1 of {0, 1}. In other words,
Claim 2 holds for k = ` + 1. This completes the induction step, so that Claim 2 is
proved.]
[Proof of Claim 1: We have a → b. In other words, the bitstring b is obtained
by applying a move to a (by the definition of the notation “a → b”). In other
words, the bitstring b is obtained from a by picking two consecutive entries 01
and replacing them by 100. In other words, there exist some k, ` ∈ N and some
elements b1 , b2 , . . . , bk , d1 , d2 , . . . , d` of {0, 1} such that
and
b = bk bk−1 . . . b1 100d1 d2 . . . d` (516)
(indeed, bk , bk−1 , . . . , b1 are the entries of a to the left of the two consecutive entries
01 that are being replaced, whereas d1 , d2 , . . . , d` are the entries of a to the right of
these two consecutive entries 01). Consider these k, ` and these b1 , b2 , . . . , bk , d1 , d2 , . . . , d` .
Claim 2 (applied to d = d1 d2 . . . d` ) yields
and
ones (bk bk−1 . . . b1 100d1 d2 . . . d` ) = ones (bk bk−1 . . . b1 01d1 d2 . . . d` )
and
In view of (515) and (516), these three equalities rewrite as load b = load a − 1 and
ones b = ones a and zeros b = zeros a + 1. This proves Claim 1.]
Next, we introduce a notation for chains of moves. Namely, if a0 , a1 , . . . , ak are
several bitstrings343 , then the notation “a0 → a1 → · · · → ak ” shall mean that every
i ∈ {1, 2, . . . , k} satisfies ai−1 → ai (that is, every bitstring in the chain a0 → a1 →
· · · → ak is obtained from the preceding one by a move). Now, from Claim 1, we
can easily derive the following:
Claim 3: Let a0 , a1 , . . . , ak be bitstrings such that a0 → a1 → · · · → ak .
Then, load ( ak ) = load ( a0 ) − k and ones ( ak ) = ones ( a0 ) and zeros ( ak ) =
zeros ( a0 ) + k.
[Proof of Claim 3: This is straightforward to prove by induction on k (using Claim
1 in the induction step). Alternatively, we can proceed as follows: For each i ∈
{1, 2, . . . , k}, we have ai−1 → ai (since a0 → a1 → · · · → ak ), and therefore Claim 1
(applied to a = ai−1 and b = ai ) yields
load ( ai ) = load ( ai−1 ) − 1 (517)
and
ones ( ai ) = ones ( ai−1 ) (518)
and
zeros ( ai ) = zeros ( ai−1 ) + 1. (519)
Now, combining the equalities (518) for all i ∈ {1, 2, . . . , k}, we obtain
ones ( ak ) = ones ( ak−1 ) = ones ( ak−2 ) = · · · = ones ( a0 ) .
Hence, ones ( ak ) = ones ( a0 ) is proved. Furthermore, the telescope principle (specif-
ically, an application of Theorem 4.1.16) yields
k
∑ (load (ai ) − load (ai−1 )) = load (ak ) − load (a0 ) ,
i =1
so that
k k
load ( ak ) − load ( a0 ) = ∑ (|load (ai ) −{zload (ai−1 ))} = ∑ (−1)
i =1 i =1
=−1
(by (517))
= k · (−1) = −k.
Therefore, load ( ak ) = load ( a0 ) − k. Finally, the telescope principle (specifically, an
application of Theorem 4.1.16) yields
k
∑ (zeros (ai ) − zeros (ai−1 )) = zeros (ak ) − zeros (a0 ) ,
i =1
343 Note that the notation ai stands for a bitstring, not for a single entry of a bitstring here.
so that
k k
zeros ( ak ) − zeros ( a0 ) = ∑ |(zeros (ai ) −{zzeros (ai−1 ))} = ∑ 1
i =1 i =1
=1
(by (519))
= k · 1 = k.
In other words, zeros ( ak ) = zeros ( a0 ) + k. This completes the proof of Claim 3.]
We can now reap the consequences of Claim 3:
11 . . . 1}
| {z 00 . . . 0}
| {z .
some number of 1s some number of 0s
Here, “some number” is allowed to mean “0”; thus, for example, 111 and 00 and
the empty bitstring ε are sorted.
It is easy to see that each sorted bitstring is immovable (since it contains no two
consecutive entries 01). Now, we claim that the converse is true as well:
[Proof of Claim 5: This is easy to see in a few moments of thought, but since we
have made a habit of proving everything by induction in this solution, let us prove
Claim 5 by induction as well.
The length ` (c) of a bitstring c is defined as the number of its entries. For ex-
ample, the bitstring 010 has length ` (010) = 3. Now, we shall prove Claim 5 by
induction on ` ( a):
Induction base: It is easy to see that Claim 5 holds for ` ( a) = 0. 344 This
344 Indeed, if ` ( a) = 0, then a is the empty bitstring ε, and thus a is sorted (since ε is sorted) and
satisfies load a = load ε = 0.
Our induction hypothesis says that Claim 5 holds for ` ( a) = m. In other words,
if a is any immovable bitstring satisfying ` ( a) = m, then
a is sorted and satisfies load a = 0. (520)
Now, let us prove that Claim 5 holds for ` ( a) = m + 1. Let a be an immovable
bitstring such that ` ( a) = m + 1. Then, a is not the empty bitstring (since a has
length ` ( a) = m + 1 > m ≥ 0). Hence, a has a well-defined first entry. In other
words, we can write a in the form a = ba0 for some b ∈ {0, 1} and some bitstring
a0 . Moreover, from a = ba0 , we see that the length of a is exactly by 1 larger than
the length of a0 (since b is a single entry). In other words, ` ( a) = ` ( a0 ) + 1. Hence,
` ( a0 ) = ` ( a) − 1 = m (since ` ( a) = m + 1).
Recall that the bitstring a is immovable. In other words, no move can be applied
to a (by the definition of “immovable”). Hence, the bitstring a contains no two
consecutive entries 01 (because if it would contain two such consecutive entries,
then we could apply a move to a that would replace these entries by 100; but this
would contradict the preceding sentence). Thus, in particular, the bitstring a cannot
begin with 01.
But the bitstring a contains the bitstring a0 as a contiguous segment (since a =
ba ). Hence, the bitstring a0 is immovable345 . Thus, a0 is an immovable bitstring
0
a=0 a0
|{z} =0 00 . . . 0}
| {z = 00 . . . 0}
| {z .
= 00 . . . 0}
| {z
some number of 0s some number of 0s
some number of 0s
Assume the contrary. Thus, the string a0 is not immovable. In other words, some move can
345 Proof.
be applied to a0 (by the definition of “immovable”). Hence, the bitstring a0 contains two con-
secutive entries 01 (since any move requires two consecutive entries 01). Therefore, the bitstring
a contains two consecutive entries 01 as well (since the bitstring a contains the bitstring a0 as a
contiguous segment). This contradicts the fact that the bitstring a contains no two consecutive
entries 01. Hence, our assumption was wrong, qed.
Thus, in Case 1, we have shown that the bitstring a is sorted and satisfies load a = 0.
Let us next consider Case 2. In this case, we have b = 1. Thus, a = |{z} b a0 = 1a0 .
=1
Hence, the bitstring a is sorted346 . Moreover, from a = 1a0 , we obtain
= 0.
Thus, in Case 2, we have shown that the bitstring a is sorted and satisfies load a = 0.
Hence, in each of the two Cases 1 and 2, we have shown that the bitstring a is
sorted and satisfies load a = 0. Thus, this always holds.
Now, forget that we fixed a. We thus have proved that if a is any immovable
bitstring satisfying ` ( a) = m + 1, then a is sorted and satisfies load a = 0. In other
words, Claim 5 holds for ` ( a) = m + 1. This completes the induction step. Thus,
Claim 5 is proved.]
Using Claim 3 and Claim 5, we can now easily see the following:
346 Proof. The bitstring a0 is sorted. In other words, a0 has the form a0 =
11 . . . 1}
| {z 00 . . . 0}
| {z (by the definition of “sorted”). Hence,
some number of 1s some number of 0s
a=1 a0
|{z} =1 11 . . . 1}
| {z 00 . . . 0}
| {z .
= 11 . . . 1}
| {z 00 . . . 0}
| {z
some number of 1s some number of 0s
some number of 1s some number of 0s
11 . . . 1}
| {z 00 . . . 0}
| {z
some number of 1s some number of 0s
(by the definition of “sorted”). In other words, there exist numbers p, q ∈ N such
that
ak = 11 . . . 1} 00
| {z . . . 0} .
| {z (521)
p many 1s q many 0s
must also show that the number of moves used to obtain a◦ from a is uniquely
determined by a.
We have assumed that a◦ is obtained from a by performing moves. Let a0 , a1 , . . . , ak
be the bitstrings obtained in this sequence of moves (starting with a and ending
with a◦ ). Thus, a0 → a1 → · · · → ak and a0 = a and ak = a◦ . Note that the number
of moves used to obtain a◦ from a through this sequence is k.
Now, the bitstring a◦ is immovable. In other words, the bitstring ak is immovable
(since ak = a◦ ). Hence, Claim 6 yields that
k = load a
and
ak = 11 . . . 1}
| {z 00 . . . 0}
| {z .
ones a many 1s zeros a+load a many 0s
Thus,
a◦ = ak = 11 . . . 1}
| {z 00 . . . 0}
| {z .
ones a many 1s zeros a+load a many 0s
This equality shows that a◦ is uniquely determined by a (since the right hand side
of this equality is clearly uniquely determined by a). Furthermore, k is uniquely
determined by a (since k = load a). In other words, the number of moves used to
obtain a◦ from a is uniquely determined by a (since the number of moves used to
obtain a◦ from a is k). Thus, Exercise 3.7.10 (b) is solved.
[Remark: The first and the second solution to Exercise 3.7.10 given above differ
mostly in their presentation. At their core, they are doing the same thing. For
example, the comb number of a bitstring a (as defined in the first solution) is pre-
cisely the number load a (as defined in the second solution). Thus, Claim 1 in the
first solution is equivalent to Claim 1 in the second. The proofs of the two Claims
1 are different, but the way they are used is also the same except for the presen-
tation. The main difference is that the first solution involved some combinatorial
handwaving (in defining a 1-to-1 correspondence between nontrivial a-combs and
a0 -combs) while the second instead relied on rigorous induction arguments. This
allowed the first solution to be shorter, at the (probable) expense of readability. I
think of the two solutions as more or less the same argument, with the first solution
being how a combinatorialist would write it up, while the second solution is how
a computer scientist would write it up.]
Solution to Exercise 4.5.1. Let i ∈ {1, 2, . . . , n}. Then, ai is an odd integer (since
a1 , a2 , . . . , an are n odd integers). Thus, Exercise 3.3.2 (d) (applied to u = ai ) yields
that ai ≡ 1 mod 2. In other words, 2 | ai − 1. In other words, there exists an integer
ci such that ai − 1 = 2ci . Consider this ci .
Forget that we fixed i. Thus, for each i ∈ {1, 2, . . . , n}, we have constructed an
integer ci such that ai − 1 = 2ci . Hence, for each i ∈ {1, 2, . . . , n}, we have
ai = 2ci + 1 (522)
discard multiples of 4 the moment they appear (rather than, as we did, at the end
of the computation). This is allowed because of (40). Another simplification can be
obtained by “making the sum cyclic”: Namely, we WLOG assume that n ≥ 1 (since
the case n = 0 is trivial). We set an+1 = a1 and cn+1 = c1 . Then,
n n +1
∑ c k +1 = ∑ ck (here, we have substituted k for k + 1 in the sum)
k =1 k =2
n n n
= n +1 = ∑ c k + c 1 = ∑ c k .
∑ ck + c|{z} (523)
k =2 k =2
= c1 k =1
Furthermore, the equality (522) holds not only for all i ∈ {1, 2, . . . , n}, but also for
i = n + 1 (since an+1 = a1 and cn+1 = c1 ). Therefore, we can apply (522) to each
i ∈ {1, 2, . . . , n + 1}. Now,
a 1 a 2 + a 2 a 3 + · · · + a n −1 a n + a n a 1
|{z}
= a n +1
= a 1 a 2 + a 2 a 3 + · · · + a n −1 a n + a n a n +1
n n
= ∑ ak
|{z}
a k +1 = ∑ (|2ck + 1) {z
(2ck+1 + 1)
k =1 k =1
|{z} }
=2ck +1 =2ck+1 +1 =4ck ck+1 +2ck +2ck+1 +1
(by (522)) (by (522))
n n n n n
= ∑ (4ck ck+1 + 2ck + 2ck+1 + 1) = ∑ 4ck ck+1 + ∑ 2ck + ∑ 2ck+1 + ∑1
k =1 k =1 k =1 k =1 k =1
| {z } | {z } | {z } |{z}
n n n = n ·1= n
= 4 ∑ c k c k +1 =2 ∑ c k =2 ∑ c k +1
k =1 k =1 k =1
n
=2 ∑ c k
k =1
(by (523))
n n n n n
= 4 ∑ c k c k +1 + 2 ∑ c k + 2 ∑ c k + n = 4 ∑ c k c k +1 + 4 ∑ c k + n
k =1 k =1 k =1 k =1 k =1
!
n n
=4 ∑ c k c k +1 + ∑ c k +n ≡ 0 + n = n mod 4.
k =1 k =1
| {z }
≡0 mod 4
Note how much simpler the computation has become after we integrated the last
addend an a1 into the sum.
ab = |ab −{za − b} + a + b = xa + yb + a + b = ( x + 1) a + (y + 1) b.
= xa+yb
347 Proof.We have a | y and y 6= 0 (since y is positive). Hence, Proposition 3.1.3 (applied to y instead
of b) yields that | a| ≤ |y|. But |y| = y (since y is positive) and | a| = a (since a is positive). Hence,
a = | a| ≤ |y| = y. In other words, y ≥ a.
n−1
m n
we obtain = . Thus, Exercise 4.5.4 (a) is solved in Case 1.
n m m−1
Let us now consider Case 2. In this case, we have m > 0. Hence, m ≥ 1 (since
m ∈ N), so that m − 1 ∈ N. Hence, (117) yields
n ( n − 1) ( n − 2) · · · ( n − m + 1) n ( n − 1) ( n − 2) · · · ( n − m + 1)
n
= =
m m! m · ( m − 1) !
m
(since m! = m · (m − 1)!). Multiplying both sides of this equality by , we find
n
m n ( n − 1) ( n − 2) · · · ( n − m + 1)
m n
= ·
n m n m · ( m − 1) !
1 n ( n − 1) ( n − 2) · · · ( n − m + 1)
= ·
( m − 1) ! | {zn }
=(n−1)(n−2)(n−3)···(n−m+1)
1
= · ( n − 1) ( n − 2) ( n − 3) · · · ( n − m + 1)
( m − 1) !
( n − 1) ( n − 2) ( n − 3) · · · ( n − m + 1)
= .
( m − 1) !
n−1
m n
Comparing this with (524), we obtain = . Thus, Exercise 4.5.4 (a)
n m m−1
is solved in Case 2.
We have now solved Exercise 4.5.4 (a) in both Cases 1 and 2. This completes the
solution to Exercise 4.5.4 (a).
n−1
m n
(b) Exercise 4.5.4 (a) yields = . Multiplying both sides of this
n m −1
m
n n−1
equality by n, we obtain m =n . But Theorem 4.3.15 (applied to n − 1
m m− 1
n−1 n−1
and m − 1 instead of n and k) yields ∈ Z. In other words, is
m − 1 m − 1
n n
an integer. Also, is an integer (for similar reasons). Now, from m =
m m
n−1 n−1
n
n , we obtain n | m (since is an integer). Hence, Theorem
m−1 m m− 1
n n
3.4.11 (applied to a = n, b = m and c = ) yields n | gcd (n, m) · .
m m
But n 6= 0 (since n > 0). Hence, Proposition 3.1.3 (d) (applied to a = n and b=
n
gcd (n, m) ·
n n m
gcd (n, m) · ) yields that n | gcd (n, m) · if and only if ∈
m m n
n
gcd (n, m) ·
m n
Z. Therefore, ∈ Z (since n | gcd (n, m) · ). Therefore,
n m
n
gcd (n, m) ·
gcd (n, m) n m
= ∈ Z.
n m n
n−i
n j n
we obtain = . This proves (525).]
j i i j−i
n−i
n j n
Next, we observe that all four binomial coefficients , , and
j i i j−i
that appear in (525) belong to Z (because of Theorem 4.3.15). Hence, (525) entails
n n j
| . (526)
i j i
Furthermore, (117) yields
n ( n − 1) ( n − 2) · · · ( n − i + 1)
n 1
= = · n ( n − 1) ( n − 2) · · · ( n − i + 1)
i i! i!
1 i −1
= · ∏ (n − k) . (527)
i! k=0
1 i −1
j
= · ∏ ( j − k) . (528)
i i! k=0
1 i −1 1 i −1
j n
= · ∏ ( j − k) < · ∏ (n − k) = (530)
i i! k=0 i! k=0 i
| {z }
i −1
< ∏ (n−k)
k =0
(by (529))
1
(by (528)). (Note that we have tacitly used the fact that > 0 here.)
i!
Also, each of the factors j − k on the right hand side of (528) is positive (because
for each k ∈ {0, 1, . . . , i − 1}, we have j − |{z}
k > j − i ≥ 0). Thus, the entire right
< i
j j
hand side of (528) is positive. Therefore, > 0, so that 6= 0. From (530), we
i i
n j n n n
obtain > > 0, so that 6= 0. Hence, gcd , is a positive
i i i i j
integer (by Proposition 3.4.3 (b)).
n n
Recall that we must prove that gcd , > 1. Indeed, assume the
i j
n n n n
contrary. Hence, gcd , ≤ 1, so that gcd , = 1 (since
i j i j
n n n n
gcd , is a positive integer). In other words, ⊥ . Combin-
i j i j
n j
ing this with (526), we conclude that | (by Theorem 3.5.6, applied to
i i
n n j n
a= ,b= and c = ). Hence, Proposition 3.1.3 (b) (applied to a =
i j i i
j n j j n j
and b = ) yields ≤ (since 6= 0). Since > > 0, we
i i i
i i i
n n j j
have = and = . Thus,
i i i i
n n j j
= ≤ = ,
i i i i
n j
which contradicts > . This contradiction shows that our assumption was
i i
false. Hence, Exercise 4.5.5 is solved.
X → Y, i 7→ n − i
and
Y → X, i 7→ n − i
are easily seen to be well-defined (because gcd (i, n) = gcd (n − i, n) for each i ∈ Z,
and because i < n/2 holds if and only if n − i > n/2) and mutually inverse (since
n − (n − i ) = i for each i ∈ Z); thus, they are bijections. Hence, we conclude that
| X | = |Y |, so that | T | = | X | + |Y | = |Y | + |Y | = 2 · |Y |, and therefore | T | is even.
|{z}
=|Y |
In other words, φ (n) is even; this solves Exercise 4.5.6 (a).
(b) This can be solved using Gauss’s “doubling trick”, which we have already
seen when solving Exercise 4.1.2. To wit, let us assume that n > 1. Let T be the set
1
of all i ∈ {1, 2, . . . , n} satisfying i ⊥ n. Then, we must prove that ∑ i = nφ (n).
i∈T 2
But notice that n ∈ / T (as we already saw in the solution to Exercise 4.5.6 (a) above);
thus, the map
T → T, i 7→ n − i
is easily seen to be well-defined (because gcd (i, n) = gcd (n − i, n) for each i ∈ Z)
and therefore a bijection (since it is its own inverse). Hence, we can substitute n − i
for i in the sum ∑ i. We thus obtain ∑ i = ∑ (n − i ). Now, Gauss’s “doubling
i∈T i∈T i∈T
trick” tells us that
2· ∑i = ∑i+ ∑i = ∑ i + ∑ (n − i )
i∈T i∈T i∈T i∈T i∈T
|{z}
= ∑ ( n −i )
i∈T
= n − i )) = ∑ n = n | T | = nφ (n)
∑ |(i + ({z
i∈T i∈T
}
=n
1
(since the definition of φ (n) yields | T | = φ (n)). Therefore, ∑ i = nφ (n). This
i∈T 2
solves Exercise 4.5.6 (b).
Indeed, each k ≥ 1 satisfies f k+1 = f k + f k−1 (by the definition of the Fibonacci
sequence) and thus f k = f k+1 − f k−1 and therefore
fk f − f k −1 1 1
= k +1 = − . (531)
f k −1 f k +1 f k −1 f k +1 f k −1 f k +1
Now,
n n n n
fk 1 1 1 1
S (n) = ∑ = ∑ − = ∑ − ∑
f 1 f k +1
k=2 | k−{z k =2
f k −1 f k +1 f
k =2 k −1
f
k =2 k +1
}
1 1
= −
f k −1 f k +1
(by (531))
n −1 n +1
1 1
= ∑ fk − ∑ fk
|k={z 1
} |k={z3
}
n +1 1 1 1 n +1 1 1 1
=∑ − − =∑ − −
k =1 f k f n f n +1 k =1 f k f1 f2
here, we have substituted k for k − 1 in the first sum,
and substituted k for k + 1 in the second sum
! !
n +1 n +1
1 1 1 1 1 1
= ∑ − − − ∑ − −
k =1
f k f n f n + 1 k =1
f k f1 f2
1 1 1 1
= + − − . (532)
f1 f2 fn f n +1
∞fk
The sum we are looking for is ∑ = lim S (n). But (532) makes this
k =2 f k −1 f k +1 n→∞
limit easy to compute: As n goes to ∞, the Fibonacci numbers f n go to ∞ as well348 ,
1 1
and thus goes to 0, whence also goes to 0. Now,
fn f n +1
∞
fk 1 1 1 1
∑ f k−1 f k+1 = nlim
→∞
S (n) = lim
n→∞ f 1
+ − −
f 2 f n f n + 1
(by (532))
k =2
1 1 1 1
= + since and go to 0 as n goes to ∞
f1 f2 fn f n +1
1 1
= + (since f 1 = 1 and f 2 = 1)
1 1
= 2.
348 There are various ways to see this. For example, it is easy to check that the sequence ( f 2 , f 3 , f 4 , . . .)
is a strictly increasing sequence of positive integers, and thus goes to ∞. Alternatively, one can
use Theorem 2.3.1 to see not only that f n goes to ∞ (since ϕn → ∞ whereas ψn → 0), but also to
see how exactly f n grows (viz., exponentially).
349 To i i+1 i k n
wit, part (a) uses = − , while part (b) uses (−1) =
k k+1 k+1 k
n−1 n−1
(−1)k − (−1)k−1 . (Both of these equalities follow from Theorem 4.3.7.)
k k−1
350 Induction on n for part (a), and induction on m for part (b).
√ √
1+ 5 1− 5
Solution to Exercise 4.5.9. Let n ∈ N. Let ϕ = and ψ = be the two
2 2
solutions of the quadratic equation X 2 − X − 1 = 0. Then, Theorem 2.3.1 yields
√ !n √ !n
1 n 1 n 1 1+ 5 1 1− 5
fn = √ ϕ − √ ψ = √ −√
5 5 5 2 5 2
| {z } | {z }
√ n √ n
1+ 5 1− 5
= =
2n 2n
√ √ !
1+ 5 1− 5
since ϕ = and ψ =
2 2
√ n √ n
1 1+ 5 1 1− 5
= √ · −√ ·
5 2n 5 2n
| {z } | {z }
1 √ n 1 √ n
=√ · (1+ 5 ) =√ · (1− 5 )
5·2 n 5·2 n
n n
1 √ 1 √
=√ · 1| +{z 5} − √ · 1| −{z 5}
5 · 2n √ 5 · 2n √
= 5+1 =− 5+1
1 √ n 1 √ n
=√ · 5+1 −√ · − 5+1
5 · 2n | {z } 5 · 2n | {z }
n n √ k n−k n n √ k n−k
=∑ ( 5) 1 =∑ ( − 5) 1
k =0 k k =0 k
(by Theorem√ 4.3.16, (by Theorem√ 4.3.16,
applied to x = 5 and y=1) applied to x =− 5 and y=1)
n √ k n √ k
1 n 1 n
=√
5 · 2n
· ∑ k
5 n−k
1|{z} − √ − 5
5 · 2n
· ∑1|{z}
k
n−k
k =0 =1 k =0
√ k =1
{z } |
=(−1)k ( 5)
n √ k n √ k
1 n 1 n
= √ ·∑ 5 − √ ·∑ (−1) k
5
5 · 2n k =0 k 5 · 2n k =0 k
!
n √ k n √ k
1 n n
=√ · ∑ 5 −∑ (−1)k 5 . (533)
5·2 n
k =0
k k =0
k
But
n
n √ k n
n √ k
∑ k 5 − ∑ k (− 1 ) k
5
k =0 k =0
n √ k √ k
n n
= ∑ 5 − (−1) k
5
k =0 |
k k
{z }
n √ k
= 1−(−1)k ( 5)
k
n
n √ k
= ∑ 1 − (−1)k 5 .
k =0
k
we obtain
n √ k n √ k
n n
∑ k 5 − ∑ k (− 1 ) k
5
k =0 k =0
2n+1
n √ k
= ∑ k
1 − (−1) k
5
k =0
|{z}
= ∑
k ∈{0,1,...,2n+1}
n √ k
= ∑ k
1 − (−1) k
5
k∈{0,1,...,2n+1}
n √ k
n √ k
= ∑ 1 − (−1) k
5 + ∑ 1 − (−1) k
5
k k
k∈{0,1,...,2n+1}; k∈{0,1,...,2n+1};
| {z } | {z }
k is even
=1 k is odd
=−1
(since k is even) (since k is odd)
(here, we used Theorem 4.1.20)
n √ k
n √ k
= ∑ k
( 1 − 1 ) 5 + ∑ k
( 1 − (− 1 )) 5
k∈{0,1,...,2n+1}; k∈{0,1,...,2n+1};
| {z } | {z }
=0 =2
k is even k is odd
n √
k
n √ k
= ∑ k
·0 5 + ∑ k
·2 5
k∈{0,1,...,2n+1}; k∈{0,1,...,2n+1};
k is even k is odd
| {z }
=0
n √ k √ k
n
= ∑ k
·2 5 =2 ∑ k
5
k∈{0,1,...,2n+1}; k∈{0,1,...,2n+1};
k is odd k is odd
n
√ 2i+1
=2 ∑ 2i + 1
5 (534)
i ∈{0,1,...,n}
is a bijection351 ).
351 Thisis just saying that the odd integers in {0, 1, . . . , 2n + 1} are 1, 3, 5, . . . , 2n + 1 (and these num-
bers are all distinct).
(here, we have renamed the summation index i as k). Multiplying both sides of this
equality by 2n−1 , we obtain
n
n
2 n −1
· fn = ∑ 5k .
k =0
2k + 1
Solution to Exercise 4.5.10 (a). For each m ∈ N, define the positive integer m! F by
m! F = f 1 f 2 · · · f m . (535)
(This is indeed a positive integer, because it is easy to see that the Fibonacci num-
bers f 1 , f 2 , . . . , f m all are positive352 .)
We first show the following auxiliary fact:
[Proof
of Claim 1: We have k ≤ n, thus n ≥ k ≥ 0 (since k ∈ N). The definition of
n
yields
k F
n f n f n−1 · · · f n−k+1 , if n ≥ k ≥ 0;
= f k f k −1 · · · f 1
k F 0, otherwise
f n f n −1 · · · f n − k +1
= (since n ≥ k ≥ 0) .
f k f k −1 · · · f 1
In view of
f n f n −1 · · · f n − k +1 = ( f n f n −1 · · · f 1 ) / ( f n − k f n − k −1 · · · f 1 )
| {z } | {z }
= f 1 f 2 ··· f n = f 1 f 2 ··· f n−k
=n! F =(n−k)! F
(since n! F was defined to be f 1 f 2 ··· f n ) (since (n−k)! F was defined to be f 1 f 2 ··· f n−k )
We have assumed that (538) holds for k < p. Hence, we can apply (538) to
k = p − 2 (since p − 2 ∈ N and p − 2 < p). Thus, we obtain
a( p−2)+n ≡ a p−2 mod an . (540)
However, p ≥ 2. Hence, (537) (applied to p instead of n) yields
a p = 1 + a p −1 a p −2 . (541)
Also, n ≥ 0, so that p + n ≥ p ≥ 2. Hence, (537) (applied to p + n instead of n)
yields
a p+n = 1 + a( p+n)−1 a( p+n)−2 = 1 + a( p−1)+n a( p−2)+n
| {z } | {z }
≡ a p−1 mod an ≡ a p−2 mod an
(by (539)) (by (540))
(since ( p + n) − 1 = ( p − 1) + n and ( p + n) − 2 = ( p − 2) + n)
≡ 1 + a p−1 a p−2 = a p mod an (by (541)) .
Thus, a p+n ≡ a p mod an is proved in Case 3.
We have now proved a p+n ≡ a p mod an in each of the three Cases 1, 2 and 3.
Hence, a p+n ≡ a p mod an always holds. In other words, (538) holds for k = p. This
completes the induction step. Thus, (538) is proven.]
This solves Exercise 4.8.1 (a).
Let us now forget the sequence ( a0 , a1 , a2 , . . .) defined in Exercise 4.8.1. Instead,
we shall prove a general property of a wider class of sequences:
Theorem A.4.1. Let ( a0 , a1 , a2 , . . .) be any sequence of integers. Assume that we
have
ak+n ≡ ak mod an for any k ∈ N and n ∈ N. (542)
Then:
(a) If u, v ∈ N satisfy u | v, then au | av .
(b) For any n, m ∈ N, we have gcd ( an , am ) = agcd(n,m) .
Proof of Theorem A.4.1. We shall prove Theorem A.4.1 (b) first, since Theorem A.4.1
(a) follows easily from it. Of course, it is not much harder to prove Theorem A.4.1
(a) independently, by strong induction on v (or induction on v/u).
(b) This will be a calque of our solution to Exercise 3.4.1 (b). Why innovate when
you can just imitate?
We shall prove Theorem A.4.1 (b) by strong induction on n + m:
Induction step: Let k ∈ N. Assume (as the induction hypothesis) that Theorem
A.4.1 (b) is true for n + m < k. We must prove that Theorem A.4.1 (b) is true for
n + m = k.
So let n, m ∈ N be such that n + m = k. We must show that gcd ( an , am ) =
agcd(n,m) .
Note that n and m play symmetric roles in this claim353 , and thus can be swapped
353 because Proposition 3.4.4 (b) yields gcd ( an , am ) = gcd ( am , an ) and gcd (n, m) = gcd (m, n)
Now, forget that we fixed n, m. We thus have shown that any n, m ∈ N satisfying
n + m = k satisfy gcd ( an , am ) = agcd(n,m) . In other words, Theorem A.4.1 (b) is
true for n + m = k. This completes the induction step. Thus, Theorem A.4.1 (b) is
proved.
(a) Let us now prove Theorem A.4.1 (a). This is easy after part (b) has already
been shown:
Let u, v ∈ N be such that u | v. We must show that au | av .
We have u | v. Thus, Proposition 3.4.4 (i) (applied to a = u and b = v) yields
gcd (u, v) = |u| = u (since u ≥ 0). But Theorem A.4.1 (b) (applied to n = u and
354 Proof.Assume that n = 0. Thus, an = a0 = 0. But Proposition 3.4.4 (a) (applied to m instead
(m) = |m| = m (since m ≥ 0). But Proposition 3.4.4 (b) yields
m, 0) = gcd
of a) yields gcd (
qed.
m = v) yields
(since agcd(n,m) ≥ 0 (by (544), applied to gcd (n, m) instead of n)). This solves
Exercise 4.8.1 (c).
Proof of Proposition A.4.2 (sketched). Clearly, the sum ∑ 1 equals the number
k∈{1,2,...,n};
b|k
of all k ∈ {1, 2, . . . , n} that are multiples of b (by (60)). In other words, this sum
equals the number of all multiples of b in the set {1, 2, . . . , n}. But these multiples
are precisely 1b, 2b, 3b, . . . , (n//b) b. Hence, their number is n//b (see Definition
3.3.1 (a) for the meaning of this notation). Thus, we obtain ∑ 1 = n//b =
k∈{1,2,...,n};
b|k
jnk
(by Proposition 3.3.5, applied to n and b instead of u and n), so Proposition
b
A.4.2 is proven. (See [Grinbe16, Proposition 1.1.11] for a detailed proof.)
The next lemma is even simpler:
Lemma A.4.3. Let n be a positive integer. Let k ∈ {1, 2, . . . , n}. Then,
∑ 1 = d (k) . (546)
b∈{1,2,...,n};
b|k
∑ 1
b∈{1,2,...,n};
b|k
= (the number of all b ∈ {1, 2, . . . , n} satisfying b | k) · 1
= (the number of all b ∈ {1, 2, . . . , n} satisfying b | k) . (547)
= ∑ ∑ 1 = ∑ d ( k ) = d (1) + d (2) + · · · + d ( n ) .
k∈{1,2,...,n} b∈{1,2,...,n}; k∈{1,2,...,n}
b|k
| {z }
=d(k)
(by Lemma A.4.3)
The formula (548) appears twice in [19fco]: once as [19fco, Exercise 1.3.6] (where
two proofs are given) and once again as [19fco, Corollary 1.6.5] (with a different,
combinatorial proof). We shall briefly outline the first two proofs as well as another
using derivatives of polynomials:
First proof of (548) (sketched). We WLOG assume that n 6= 0 (since the case n = 0 is
easily checked by hand). Hence, n ≥ 1, so that n − 1 ∈ N. Now,
n n n
n n n k n
∑ k k = 0 0 + ∑ |{z} k
k
= ∑ n·
n k
k =0 k = 1 k =1
| {z } k | {z }
=0 =n· n−1
n =
k−1
(by Exercise 4.5.4 (a),
applied to m=k)
n n n −1
n−1 n−1 n−1
= ∑ n· =n ∑ =n ∑
k =1
k−1 k =1
k−1 k =0
k
| {z }
=2n −1
(by Corollary 4.3.17,
applied to n−1 instead of n)
Dividing both sides of this equality by 2, we obtain (548). This proves (548) again.
(here, we have split the sum at k = n; that is, we have applied (84) to 0, n and 2n
instead of u, v and w). But
2n n −1
2n 2n
∑ k
= ∑ 2n − k
k = n +1 k =0 | {z }
2n
=
k
(since Theorem 4.3.10
(applied
to2n instead
of n)
2n 2n
yields = )
k 2n − k
here, we have substituted 2n − k for k in the sum,
since the map {0, 1, . . . , n − 1} → {n + 1, n + 2, . . . , 2n}
that sends each k to 2n − k is a bijection
n −1 n
2n 2n 2n
= ∑ = ∑ −
k =0
k k =0
k n
n −1
n 2n 2n 2n
(since ∑ = ∑ + ). Hence, (550) becomes
k =0 k k =0 k n
n 2n
2n 2n
2 2n
= ∑ + ∑ k
k =0
k k = n +1
| {z }
n 2n 2n
=∑ −
k =0 k n
n n n
2n 2n 2n 2n 2n
= ∑ +∑ − = 2· ∑ − .
k =0
k k =0
k n k =0
k n
n 2n
Solving this equality for ∑ , we obtain
k =0 k
n
2n 1 2n
∑ k 2
2n
= · 2 +
n
. (551)
k =0
This already solves Exercise 4.8.3 (b). But let us simplify this a bit further (getting
1
rid of the ) when n is positive. Namely, assume that n is positive. Then, Exercise
2
2n − 1
n 2n
4.5.4 (a) (applied to 2n and n instead of n and m) yields = . This
2n n n−1
2n − 1
1 2n n 1
rewrites as = (since = ). Now, (551) becomes
2 n n−1 2n 2
n
2n 1 2n 1 2n 1 2n
∑ k = 2 · 2 + n = 2 ·2 + 2 n
2n
k =0 | {z } | {z }
=22n−1
2n − 1
=
n−1
2n − 1
= 22n−1 + . (552)
n−1
Note that this is not true for n = 0. Division by 0 is not a good idea!
Thus, Exercise 4.8.4 (a) is saying that Sn,m = 0 for each m ∈ {0, 1, . . . , n − 1},
whereas Exercise 4.8.4 (b) is saying that Sn,n = n!x1 x2 · · · xn . The reason why
we have introduced S p,m for general p (not just for p = n) is that we want to induct
on p. (We could just as well induct on n, but it is somewhat easier to keep n fixed.)
Now, we claim that the S p,m satisfy the following recurrence relation:
356 We
are working with numbers here rather than elements of a noncommutative ring, so the
complicated sum ∑ vσ(1) vσ(2) · · · vσ(n) from [Grinbe15, Exercise 6.51 (b)] can be simplified
σ ∈ Sn
to n!v1 v2 · · · vn .
[Proof of Claim 1: First of all, both p and p − 1 belong to the set {0, 1, . . . , n} (since
p ∈ {1, 2, . . . , n}). Thus, [ p] and [ p − 1] are subsets of [n].
If I is any subset of [n], then we define a number z I by
z I : = y + ∑ xi . (554)
i∈ I
(Thus, in particular, z∅ = y + (empty sum) = y.) The definition of S p,m now yields
| {z }
=0
m
= ∑ (−1) y + ∑ xi
p−| I |
S p,m
I ⊆[ p] i∈ I
| {z }
=z I
(by (554))
= ∑ (−1) p−| I | zm
I . (555)
I ⊆[ p]
(Indeed, this follows from the same argument that we used to prove (555), but now
applied to p − 1 and k instead of p and m.)
We shall call a subset of [ p]
• red if it contains p;
• green if it does not contain p.
Thus, each subset of [ p] is either red or green (but not both). Hence, the sum on
the right hand side of (555) can be split up as follows:
∑ (−1) p−| I | zm
I = ∑ (−1) p−| I | zm
I + ∑ (−1) p−| I | zm
I .
I ⊆[ p] I ⊆[ p]; I ⊆[ p];
I is red I is green
We shall now take a closer look at the two sums on the right hand side of this.
The green subsets I of [ p] are the subsets of [ p] that do not contain p (by the
definition of “green”). In other words, they are just the subsets of [ p] \ { p}. Since
[ p] \ { p} = [ p − 1], this means that they are just the subsets of [ p − 1]. Hence, we
can rewrite the summation sign ∑ as ∑ . So we obtain
I ⊆[ p]; I ⊆[ p−1]
I is green
∑ (−1) p−| I | zm
I = ∑ (−1) p−| I | zm
I . (557)
I ⊆[ p]; I ⊆[ p−1]
I is green
The red subsets are a bit more complicated. If I is a red subset of [ p], then I
contains p (by the definition of “red”), and thus is not a subset of [ p − 1]. However,
we can obtain a subset of [ p − 1] by removing p from I. Conversely, if J is a subset
of [ p − 1], then we can obtain a red subset of [ p] by inserting p into J. Let us make
this more formal: We have two maps
{red subsets of [ p]} → {subsets of [ p − 1]} ,
I 7→ I \ { p}
and
{subsets of [ p − 1]} → {red subsets of [ p]} ,
J 7→ J ∪ { p} .
These two maps are mutually inverse; thus, they are invertible, i.e., they are bijec-
tions. In particular, the map
{subsets of [ p − 1]} → {red subsets of [ p]} ,
J 7→ J ∪ { p}
is a bijection. Hence, we can substitute J ∪ { p} for I in the sum
∑ (−1) p−| I | zm
I .
I ⊆[ p];
I is red
As a result, we obtain
∑ (−1) p−| I | zm
I = ∑ (−1) p−| J ∪{ p}| zm
J ∪{ p}
I ⊆[ p]; J ⊆[ p−1]
I is red
= y + ∑ xi + x p = z I + x p . (560)
i∈ I
| {z }
=z I
(by (554))
∑ (−1) p−| I | zm
I
I ⊆[ p];
I is red
∑
m
=− (−1) p−| I | z I + x p . (561)
I ⊆[ p−1]
= ∑ (−1) p−| I | zm
I + ∑ (−1) p−| I | zm
I
I ⊆[ p]; I ⊆[ p];
I is red I is green
| {z } | {z }
p−| I | m
=− ∑ (−1) (z I + x p ) = ∑ (−1) p−| I | zm
I
I ⊆[ p−1] I ⊆[ p−1]
(by (561)) (by (557))
∑ ∑
m
=− (−1) p−| I | z I + x p + (−1) p−| I | zm
I
I ⊆[ p−1] I ⊆[ p−1]
∑ ∑
m
= (−1) p−| I | zm
I − (−1) p−| I | z I + x p
I ⊆[ p−1] I ⊆[ p−1]
m
= ∑ (−1) p−| I | zm
I − zI + xp . (562)
I ⊆[ p−1]
Now, let us simplify the difference inside the big parentheses on the right hand
side. Fix a subset I of [ p − 1]. Then, Theorem 4.3.16 (applied to m, z I and x p instead
of n, x and y) yields
m
m k m − k m −1 m k m − k
m
= ∑ = ∑
m m−m
zI + xp zI xp zI xp + zm
I xp
k =0
k k =0
k m | {z }
0
| {z }
=1 = x p =1
(by (124))
m −1
m k m−k
= ∑ z x
k I p
+ zm
I .
k =0
Hence,
!
m −1
m k m−k
∑
m
zm
I − zI + xp = zm
I − z I x p + zm
I
k =0
k
m −1
m k m−k
=− ∑ z x
k I p
. (563)
k =0
Forget that we fixed I. We thus have proved (563) for each subset I of [ p − 1].
Now, (562) becomes
m
S p,m = ∑ (−1) p−| I | m
zI − zI + xp
I ⊆[ p−1] | {z }
m −1 m k m−k
=− ∑ z xp
k =0 k I
(by (563))
!
m −1
m −1
m k m−k m k m−k
= ∑ (−1) p−| I | − ∑
k
zI xp = − ∑ (−1) p−| I |
∑ k
zI xp
I ⊆[ p−1] k =0 I ⊆[ p−1] k = 0
m −1
m k m−k
=− ∑ ∑ (−1) p−| I | z x
k I p
I ⊆[ p−1] k =0
| {z }
| {z } =−(−1) p−| I |−1
m −1 =−(−1)( p−1)−| I |
= ∑ ∑
k =0 I ⊆[ p−1] (since p−| I |−1=( p−1)−| I |)
m −1 m
=− ∑ ∑ − (−1) ( p−1)−| I |
k
zkI x m
p
−k
k =0 I ⊆[ p−1]
m −1
m k m−k
= ∑ ∑ (−1) ( p−1)−| I |
z x
k I p
k =0 I ⊆[ p−1]
m −1 m −1
m m−k m m−k
= ∑ k
xp ∑ (−1) zI = ∑
( p−1)−| I | k
k
x p S p−1,k .
k =0 I ⊆[ p−1] k =0
| {z }
=S p−1,k
(by (556))
Induction step: Let q ∈ {0, 1, . . . , n − 1}. Assume (as the induction hypothesis)
that Claim 2 holds for p = q. We must prove that Claim 2 holds for p = q + 1.
We have assumed that Claim 2 holds for p = q. In other words, we have
Sq,k = 0 (566)
Forget that we fixed m. We thus have shown that Sq+1,m = 0 for each m ∈
{0, 1, . . . , q}. In other words, Claim 2 holds for p = q + 1. This completes the
induction step. Thus, Claim 2 is proved.]
Claim 2 yields part (a) of Exercise 4.8.4 rather quickly (see below for the details).
In order to solve part (b) as well, we need another claim:
In other words, Claim 3 holds for p = q + 1. This completes the induction step.
Thus, Claim 3 is proved.]
Let us now finish the solution of Exercise 4.8.4:
(a) Let m ∈ {0, 1, . . . , n − 1}. Then, Claim 2 (applied to p = n) yields
Sn,m = 0.
Sn,n = n!x1 x2 · · · xn .
(for all I ⊆ [n]) as sums of products of y’s and xi ’s and then observing that the
“ ∑ (−1)n−| I | operator” causes all such products other than (permutations of)
I ⊆[n]
x1 x2 · · · xn to cancel each other. This argument (albeit only in the particular case
y = 0, which is a bit simpler) can be found in [18f-hw3s, solution to Exercise 6].
and
y p−1 y( p−1)−1 · · · y( p−1)−k
b p−1,k = by the definition of b p−1,k
y k +1
y p −1 y p −2 · · · y p − k −1 1
= = · y p −1 y p −2 · · · y p − k −1
y k +1 y k +1 | {z }
=y p−1 y p−2 ···y p−k ·y p−k−1
1 1
= · y p −1 y p −2 · · · y p − k · y p − k −1 = · y p − k −1 · y p −1 y p −2 · · · y p − k .
y k +1 y k +1
Subtracting these two equalities from one another, we obtain
1 1
b p,k − b p−1,k = · y p · y p −1 y p −2 · · · y p − k − ·y · y p −1 y p −2 · · · y p − k
y k +1 y k +1 p − k −1
1
= · y p − y p − k −1 · y p −1 y p −2 · · · y p − k . (572)
y k +1
On the other hand, y p = 1 − x p (by the definition of y p ) and y p−k−1 = 1 − x p−k−1
(by the definition of y p−k−1 ). Subtracting these two equalities from one another, we
obtain
p − k −1
p
y p − y p − k −1 = (1 − x ) − 1 − x = x p − k −1 − x p
p − k −1
1 − x k +1
= |x {z } = y k +1 1 − y p − k −1 .
| {z } =1 − y p − k −1
= y k +1
(since yk+1 is (since y p−k−1 =1− x p−k−1 )
k
defined as 1− x ) + 1
= y p −1 y p −2 · · · y p − k − y p −1 y p −2 · · · y p − k · y p − k −1
= y p −1 y p −2 · · · y p − k · 1 − y p − k −1 = 1 − y p − k −1 · y p −1 y p −2 · · · y p − k ,
b p,p−1 = c p,p−1 .
with
c p,p−1 = y p−1 y p−2 · · · y p−( p−1) by the definition of c p,p−1
= y p −1 y p −2 · · · y 1 ,
S p − S p−1 = 1.
p −1 p −2
Sp = ∑ b p,k = b p,p−1 + ∑ b p,k (since p − 1 ≥ 0) .
k =0 k =0
( p−1)−1 p −2
S p −1 = ∑ b p−1,k = ∑ b p−1,k (since ( p − 1) − 1 = p − 2) .
k =0 k =0
In view of
p −2
∑
b p,k − b p−1,k
k =0 | {z }
=c p,k −c p,k+1
(by Claim 1
(since k≤ p−2< p−1 and thus p−1≥k))
p −2 p −2
∑ ∑
= c p,k − c p,k+1 = −c p,k+1 − −c p,k
k =0 | {z } k =0
=(−c p,k+1 )−(−c p,k )
p −2
here, we have renamed the
∑
= −c p,i+1 − −c p,i
i =0
summation index k as i
= −c p,( p−2)+1 − −c p,0
by Corollary 4.1.17, applied to u = 0 and v = p − 2 and ai = −c p,i
= c p,0 − c p,( p−2)+1 = c p,0 − c p,p−1 (since ( p − 2) + 1 = p − 1) ,
this becomes
p −2
b p,p−1 + ∑ b p,k − b p−1,k = c p,p−1 + c p,0 − c p,p−1
S p − S p −1 =
|k=0
| {z }
=c p,p−1 {z }
(by Claim 2) =c p,0 −c p,p−1
= c p,0 = y p−1 y p−2 · · · y p−0 by the definition of c p,0
= (empty product) = 1.
Hence,
n n
here, we have renamed the
∑ ∑ ( S s − S s −1 )
n= S p − S p −1 =
p =1 s =1
summation index p as s
= Sn − S1 − 1
|{z} |{z}
n −1 0−1
= ∑ bn,k =S0 = ∑ b0,k
k =0 k =0
(by the definition of Sn ) (by the definition of S0 )
Exercise 4.8.5 is easily seen to be the particular case of Proposition A.4.4 for
m = 0. Our below proof of Proposition A.4.4 is a lazy adaptation of our above
solution to Exercise 4.8.5.
Proof of Proposition A.4.4. We proceed precisely as in the above solution to Exercise
4.8.5 until the point where we define S p . From that point on, we proceed as follows:
For each p ∈ {m, m + 1, . . . , n}, set
p −1
Tp = ∑ b p,k .
k=m
(Note that if m = 0, then Tp is the S p from our above solution to Exercise 4.8.5.)
Now, we claim the following:
Tp − Tp−1 = c p,m .
In view of
p −2
∑
b p,k − b p−1,k
k=m | {z }
=c p,k −c p,k+1
(by Claim 1
(since k≤ p−2< p−1 and thus p−1≥k))
p −2 p −2
∑ c p,k − c p,k+1 = ∑
= −c p,k+1 − −c p,k
k=m | {z } k=m
=(−c p,k+1 )−(−c p,k )
p −2
here, we have renamed the
∑
= −c p,i+1 − −c p,i
i =m
summation index k as i
= −c p,( p−2)+1 − −c p,m
by Corollary 4.1.17, applied to u = m and v = p − 2 and ai = −c p,i
= c p,m − c p,( p−2)+1 = c p,m − c p,p−1 (since ( p − 2) + 1 = p − 1) ,
this becomes
p −2
b p,p−1 + ∑ b p,k − b p−1,k = c p,p−1 + c p,m − c p,p−1 = c p,m .
Tp − Tp−1 =
| {z } k=m
=c p,p−1 | {z }
(by Claim 2) =c p,m −c p,p−1
Hence,
n
∑ y p −1 y p −2 · · · y p − m
p = m +1
n n
here, we have renamed the
∑ ∑
= Tp − Tp−1 = ( Ts − Ts−1 )
p = m +1 s = m +1
summation index p as s
= Tn − T(m+1)−1
|{z} | {z }
n −1 m −1
= ∑ bn,k = Tm = ∑ bm,k
k=m k=m
(by the definition of Tn ) (by the definition of Tm )
a a1 a2
0
, , , . . . must be the Fibonacci sequence. In other words,
0! 1! 2!
an
= fn for each n ∈ N
n!
(where ( f 0 , f 1 , f 2 , . . .) is the Fibonacci sequence). In other words,
plicit formula for them. But this is laborious. A simpler solution can be given using
an utterly trivial lemma:
357 Indeed, for each n ≥ 2, we have the three equalities
an = uan−1 + vbn−1 ;
a = uan−2 + vbn−2 ;
n −1
bn−1 = ubn−2 + van−2 .
Eliminating bn−1 and bn−2 from them (for example, by using the first equality to express bn−1
through an and an−1 , then using the second equality to express bn−2 through an−1 and an−2 ,
then substituting the resulting two expressions into the third equality), we obtain
an = 2uan−1 + v2 − u2 an−2 .
Thus, the sequence ( a0 , a1 , a2 , . . .) is 2u, v2 − u2 -recurrent. Similarly, the same holds for the
A2 − 2uA − v2 − u2 I2 wn = 0 for each n ∈ N.
| {z }
=0
s+d ( a + b) + ( a − b) s−d ( a + b) − ( a − b)
= =a and = = b.
2 2 2 2
This proves Lemma A.4.5.
Harmless as it is, Lemma A.4.5 suggests a useful trick: Any two numbers can
be reconstructed from their sum and their difference. Sometimes, these sums and
differences are easier to handle than the original two numbers, so it can be a good
idea to work with the sum and the difference for as long as possible. Nothing is
lost when doing so, since Lemma A.4.5 allows recovering the original numbers.
Let us now solve Exercise 4.8.7 using this trick:
Solution to Exercise 4.8.7. For each n ∈ N, we define two numbers
s n = a n + bn and d n = a n − bn .
!
an+2 − 2uan+1 − v2 − u2 an
this rewrites as = 0. In other words, an+2 − 2uan+1 −
bn+2 − 2ubn+1 − v2 − u2 bn
recurrent. The main advantage of this argument is its generalizability (to more than two se-
quences and higher-order recurrences).
(by the recursive definition of the sequences ( a0 , a1 , a2 , . . .) and (b0 , b1 , b2 , . . .)) and
therefore
and
The equality (577) holding for each n ≥ 1 shows that the sequence (s0 , s1 , s2 , . . .)
is a geometric progression with ratio u + v. Therefore,
358 For the sake of completeness, here is the (entirely straightforward) proof of (579):
We shall prove (579) by induction on n:
Induction base: We have s0 = (u + v)0 s0 (since (u + v)0 s0 = s0 ). In other words, (579) holds
| {z }
=1
for n = 0.
Induction step: Let m ∈ N. Assume (as the induction hypothesis) that (579) holds for n = m.
We must prove that (579) holds for n = m + 1.
We have assumed that (579) holds for n = m. In other words, we have sm = (u + v)m s0 .
But m + 1 ≥ 1; hence, (577) (applied to n = m + 1) yields sm+1 = (u + v) s(m+1)−1 =
| {z }
=sm =(u+v)m s0
(u + v) (u + v)m s0 = (u + v)m+1 s0 . In other words, (579) holds for n = m + 1. This completes
| {z }
=(u+v)m+1
the induction step. Thus, (579) is proved.
359 The proof of (580) is analogous to the proof of (579), once the obvious changes are made (viz., we
must use (578) instead of (577), and we must replace sk and u + v by dk and u − v, respectively).
1
= (u + v)n s0 + (u − v) n
d0
2 |{z} |{z}
= a0 +b0 = a0 −b0
(by the definition of s0 ) (by the definition of d0 )
1
(u + v)n ( a0 + b0 ) + (u − v)n ( a0 − b0 )
=
2
and
sn − dn
bn = (by (576))
2
1
= sn − dn
2
|{z} |{z}
=(u+v)n s0 n
=(u−v) d0
(by (579)) (by (580))
1 n
= (u + v) s0 − (u − v)n d0
2 |{z} |{z}
= a0 +b0 = a0 −b0
(by the definition of s0 ) (by the definition of d0 )
1
(u + v)n ( a0 + b0 ) − (u − v)n ( a0 − b0 ) .
=
2
This solves Exercise 4.8.7.
(In words: bq + 1c is the smallest nonnegative integer that is greater than q.)
m = min {k ∈ N | k ≥ m} .
Proof of Lemma A.4.7. This is even more obvious than Lemma A.4.6. The number
m is an element of the set {k ∈ N | k ≥ m} (since m ∈ N and m ≥ m), but every
element of this set is ≥ m (because every element of this set is a k ∈ N satisfying
k ≥ m). Hence, the number m is the smallest element of the set {k ∈ N | k ≥ m}.
In other words, m = min {k ∈ N | k ≥ m}. This proves Lemma A.4.7.
√
√ to Exercise 4.8.8. Let us first fix n ∈ N. Then, 8n + 1√> 0; therefore, we
Solution
8n + 1 − 1 0−1 8n + 1 − 1
have > > −1. Hence, (581) (applied to q = ) yields
2 2 2
$√ % ( √ )
8n + 1 − 1 8n + 1 − 1
+ 1 = min k ∈ N | k > . (583)
2 2
In order to do so, let us take a look at the sequence ( a0 , a1 , a2 , . . .). The sequence
( 0 , a1 , a2 , . . .) contains each positive integer i exactly i times. Thus, it contains
a
the integer 1 exactly once, the integer 2 exactly twice, the integer 3 exactly thrice,
and so on. Hence, this sequence contains a total of 1 + 2 + · · · + k entries that are
≤ k. Since this sequence is furthermore weakly increasing, we know that these
1 + 2 + · · · + k entries are precisely the first 1 + 2 + · · · + k entries of the sequence
( a0 , a1 , a2 , . . .) (since otherwise, the sequence would have an entry ai > k to the left
of an entry a j ≤ k; but this would contradict the fact that the sequence is weakly
increasing). In other words, they are the entries a0 , a1 , . . . , a(1+2+···+k)−1 .
Thus we have shown that the entries of the sequence ( a0 , a1 , a2 , . . .) that are ≤ k
are precisely the entries a0 , a1 , . . . , a(1+2+···+k)−1 . In other words, an entry am of the
sequence ( a0 , a1 , a2 , . . .) is ≤ k if and only if m ∈ {0, 1, . . . , (1 + 2 + · · · + k ) − 1}. In
other words, for each m ∈ N, we have the logical equivalence
( am ≤ k) ⇐⇒ (m ∈ {0, 1, . . . , (1 + 2 + · · · + k) − 1}) .
Applying this to m = n, we obtain the following chain of equivalences:
( an ≤ k )
⇐⇒ (n ∈ {0, 1, . . . , (1 + 2 + · · · + k) − 1})
⇐⇒ ( n ≤ (1 + 2 + · · · + k ) − 1) (since n ∈ N)
⇐⇒ (n < 1 + 2 + · · · + k) (since n and 1 + 2 + · · · + k are integers)
k ( k + 1) k ( k + 1)
⇐⇒ n< since 1 + 2 + · · · + k =
2 2
⇐⇒ (8n < 4k (k + 1))
(here, we have multiplied both sides of our inequality by 8)
⇐⇒ (8n + 1 < 4k (k + 1) + 1)
(here, we have added 1 to both sides of our inequality)
⇐⇒ 8n + 1 < (2k + 1)2 since 4k (k + 1) + 1 = (2k + 1)2
√
⇐⇒ 8n + 1 < 2k + 1
here, we have taken the square root on both sides
√
of the inequality; this is legitimate because 8n + 1
and 2k + 1 are positive reals
√
⇐⇒ 8n + 1 − 1 < 2k
(here, we have subtracted 1 from both sides of the inequality)
√ !
8n + 1 − 1
⇐⇒ <k
2
(here, we have divided both sides of the inequality by 2)
√ !
8n + 1 − 1
⇐⇒ k> .
2
an = min {k ∈ N | k ≥ an }
= min {k ∈ N | an ≤ k}
(since the statement “k ≥ an ” is equivalent to “an ≤ k”)
( √ )
8n + 1 − 1
= min k ∈ N | k >
2
since the statement “an ≤ k” is equivalent
√
8n + 1 − 1
to “k > ” (by (584))
2
$√ %
8n + 1 − 1
= +1 (by (583))
2
√ !
1√ 8n + 1 − 1 1√
1 1
= 8n + 1 + since +1 = 8n + 1 + .
2 2 2 2 2
Since each of f (d) and g (d) is either 0 or 1, we thus conclude that both f (d) and
g (d) must
equal 1. Thus, in particular,
f (d) = 1. But the definition of f yields
d d d d
f (d) = ∈ Z . Hence, ∈ Z = f (d) = 1, so that ∈ Z. Likewise, ∈ Z.
a a a b
360 We are using Definition 4.3.19.
d d
Thus, we have shown that and are integers. These integers are furthermore
b a
d d
positive (since d, a and b are positive). Hence, their ratio / is a well-defined
b a
d d d d a
rational number. In other words, / ∈ Q. But this contradicts / = / Q.
∈
b a b a b
This contradiction shows that our assumption was wrong. Hence, we have shown
that the function f + g is not periodic. This solves Exercise 4.8.9 (b).
(An alternative choice of functions f and g that results in the same conclusion
can be obtained by setting
2πx 2πx
f ( x ) = cos and g ( x ) = cos .
a b
Again, these f and g have the property that ( f + g) (d) cannot equal ( f + g) (0) = 2
d d
for d > 0, because this would cause and to be integers.)
b a
n−1 n−1
k−1 k
n n
k−1 k+1
n+1 n+1
k k+1
(where edges have been drawn to connect binomial coefficients that appear on the
same side of the equation). It can be contrasted with the similar identity
n−1 n−1
n n+1 n n+1
= (587)
k−1 k+1 k k k−1 k+1
which also holds for all n, k ∈ Z. However, the latter identity (which is sometimes
also called “Star of David theorem”, as it involves the exact same six binomial
coefficients as Exercise 4.8.10) can be proved by straightforward computations (see
[19fco-hw2s, Exercise 5] for the proof), and can be generalized to
n−r n−r
n n+s n n+s
=
k−s k+r k k k−s k+r
for any r, s ∈ Z, whereas Exercise 4.8.10 has neither a straightforward proof nor
such a generalization. This should not be very surprising: gcds are more compli-
cated than products.
This being said, let me give a solution to Exercise 4.8.10 now. It will rely on the
following lemmas:
Lemma A.4.8. Let u, v, w ∈ Z and m ∈ Z. Then, we have the following logical
equivalence:
Proof of Lemma A.4.9. There are many ways to prove Lemma A.4.9; in particular,
each of the three parts of this lemma can be proved separately. The following line
of argument is probably thequickest:
n−1
n
(c) We must prove that n = (n − k) / N, then this equality is
. If k ∈
k k
obvious361 . Hence, for the rest of this proof, we WLOG assume that k ∈ N. Thus,
(117) (applied to n − 1 instead of n) yields
n−1 (n − 1) ((n − 1) − 1) ((n − 2) − 2) · · · ((n − 1) − k + 1)
=
k k!
( n − 1) ( n − 2) ( n − 3) · · · ( n − k ) 1
= = · ( n − 1) ( n − 2) ( n − 3) · · · ( n − k ) .
k! k!
Multiplying both sides of this equality by n, we find
n−1
1
n = n · · ( n − 1) ( n − 2) ( n − 3) · · · ( n − k )
k k!
1
= · n · ( n − 1) ( n − 2) ( n − 3) · · · ( n − k )
k! | {z }
=n(n−1)(n−2)···(n−k)
=n(n−1)(n−2)···(n−k+1)·(n−k)
1
= · n ( n − 1) ( n − 2) · · · ( n − k + 1) · ( n − k )
k!
n ( n − 1) ( n − 2) · · · ( n − k + 1)
n
= (n − k) · = (n − k) .
| k!
{z } k
n
=
k
(by (117))
n−1
n
n = ( k + 1) .
( k + 1) − 1 k+1
Hence,
n−1 n−1
n
( k + 1) =n =n (since (k + 1) − 1 = k)
k+1 ( k + 1) − 1 k
n
= (n − k) (by Lemma A.4.9 (c)) .
k
n−1 n−1
n
A= , B= , C= ,
k−1 k k+1
n n+1 n+1 n
D= , E= , F= , M= .
k−1 k k+1 k
M − A = B; (588)
E − M = D, (589)
C + M = F. (590)
These three equalities are clear from Theorem 4.3.7 upon a look at a picture of
Pascal’s triangle, in which the entries A, B, C, D, E, F and M are arranged as
follows:
A B
D M C
E F
(where each of the entries A, B, C, D, E, F is adjacent to M). 362
We also need two less trivial equalities. Namely, we claim that
− nA − (k + 1) C + (n + 1 − k) E = M. (591)
n−1
[Proof of (591): From A = , we obtain
k−1
n−1
n
nA = n =k (by Lemma A.4.9 (a))
k−1 k
| {z }
=M
= kM.
362 For the sake of completeness, here are detailed proofs of (588), (589) and (590):
Proof of (588): Theorem 4.3.7 yields
n−1 n−1
n
= + = A + B.
k k−1 k
| {z } | {z }
=A =B
n
Hence, M = = A + B, so that M − A = B. This proves (588).
k
Proof of (589): Theorem 4.3.7 (applied to n + 1 instead of n) yields
( n + 1) − 1 ( n + 1) − 1
n+1
= + = D + M.
k k−1 k
| {z } | {z }
n n
= =D = =M
k−1 k
n+1
Hence, E = = D + M, so that E − M = D. This proves (589).
k
Proof of (590): Theorem 4.3.7 (applied to n + 1 and k + 1 instead of n and k) yields
( n + 1) − 1 ( n + 1) − 1
n+1
= + = M + C = C + M.
k+1 ( k + 1) − 1 k+1
| {z } | {z }
n n
= =M = =C
k k+1
n+1
Hence, F = = C + M. This proves (590).
k+1
n
From C = , we obtain
k+1
n n
( k + 1) C = ( k + 1) = (n − k) (by Lemma A.4.9 (b))
k+1 k
| {z }
=M
= (n − k) M.
( n + 1) − 1
n
Also, we have M = = (since n = (n + 1) − 1), and therefore
k k
( n + 1) − 1
n+1
( n + 1) M = ( n + 1) = (n + 1 − k)
k k
| {z }
=E
(by Lemma A.4.9 (c), applied to n + 1 instead of n)
= (n + 1 − k) E,
so that
(n + 1 − k) E = (n + 1) M.
Now,
nA − (k + 1) C + (n + 1 − k ) E = −kM − (n − k ) M + (n + 1) M = M.
− |{z}
| {z } | {z }
=kM =(n−k) M =(n+1) M
− nB − (n + 1 − k) D + (k + 1) F = M. (592)
− n |{z}
B − (n + 1 − k ) |{z}
D + (k + 1) |{z}
F
= M− A = E− M =C + M
(by (588)) (by (589)) (by (590))
= − n ( M − A ) − ( n + 1 − k ) ( E − M ) + ( k + 1) ( C + M )
= −nM + nA − (n + 1 − k) E + (n + 1 − k) M + (k + 1) C + (k + 1) M
= (−nM + (n + 1 − k) M + (k + 1) M) − (−nA − (k + 1) C + (n + 1 − k) E)
| {z } | {z }
=2M =M
(by (591))
= 2M − M = M.
M = −n |{z}
A − (k + 1) |{z}
C + (n + 1 − k ) |{z}
E
≡0 mod x ≡0 mod x ≡0 mod x
≡ −n · 0 − (k + 1) · 0 + (n + 1 − k) · 0 = 0 mod x.
B − (n + 1 − k ) |{z}
M = −n |{z} D + (k + 1) |{z}
F
≡0 mod y ≡0 mod y ≡0 mod y
≡ −n · 0 − (n + 1 − k) · 0 + (k + 1) · 0 = 0 mod y.
and
n−1
n n+1
y = gcd |{z}
B , D , F = gcd , , ,
|{z} |{z} k k−1 k+1
n−1
n n+1
= = =
k k−1 k+1
this rewrites as
n−1 n−1
n n+1 n n+1
gcd , , = gcd , , .
k−1 k+1 k k k−1 k+1
This solves Exercise 4.8.10.
Proof of Lemma A.5.1. We have ac ≡ bc mod nc. In other words, nc | ac − bc. In other
words, nc | ( a − b) c (since ac − bc = ( a − b) c). But Proposition 3.1.5 (applied to n
and a − b instead of a and b) yields that n | a − b holds if and only if nc | ( a − b) c.
Thus, n | a − b holds (since nc | ( a − b) c holds). In other words, a ≡ b mod n. This
proves Lemma A.5.1.
Solution to Exercise 4.10.1. We know that k! is a positive integer; hence, k! 6= 0.
n
Theorem 4.3.15 yields that ∈ Z for each n ∈ Z. Hence, the sequence
k
( a0 , a1 , a2 , . . .) is well-defined.
Let v = uk!. Then, v is a positive integer (since u and k! are positive integers).
We shall now prove that every i ∈ N satisfies ai = ai+v .
Indeed, let i ∈ N. Set j = i + v. Thus, j = i + |{z}
v ≡ i mod v.
≡0 mod v
Applying (117) to n = i, we obtain
i ( i − 1) ( i − 2) · · · ( i − k + 1)
i
= .
k k!
Multiplying both sides of this equality by k!, we find
k −1
i
· k! = i (i − 1) (i − 2) · · · (i − k + 1) = ∏ (i − s) . (593)
k s =0
i j
But the definition of ai yields ai = %u. Similarly, a j = %u. Now,
k k
i j
ai = %u = %u = a j = ai+v (since j = i + v).
k k
Forget that we fixed i. We thus have shown that every i ∈ N satisfies ai = ai+v .
In other words, the sequence ( a0 , a1 , a2 , . . .) is v-periodic (by the definition of “v-
periodic”). In other words, the sequence ( a0 , a1 , a2 , . . .) is uk!-periodic (since v =
uk!). This solves Exercise 4.10.1.
y0 = 0, y1 = 1, and
yn = uyn−1 + vyn−2 for each n ≥ 2.
In other words, (596) holds for i = n. This completes the induction step. Thus,
(596) is proved.]
Now, let a, b ∈ N satisfy a | b. We must prove that x a | xb . But (596) (applied to
i = a) yields x a = λy a . Similarly, xb = λyb . However, (595) yields y a | yb . In other
words, there exists an integer c such that yb = y a c (by Definition 3.1.2). Consider
this c. We have xb = λ yb = λy a c = x a c. Since c is an integer, we thus have
|{z} |{z}
=y a c =xa
x a | xb . This solves Exercise 4.10.2.
(since m + 1 ≥ 2).
Also, p ≥ m ≥ 1. Hence, p + 1 ≥ 2. But the sequence ( x0 , x1 , x2 , . . .) is ( a, b)-
recurrent. In other words, every n ≥ 2 satisfies xn = axn−1 + bxn−2 (by the defini-
tion of “( a, b)-recurrent”). Applying this equality to n = p + 1, we obtain
x p +1 y m − x p y m +1
| {z }
= aym +bym−1
(by (599))
= x p+1 ym − x p ( aym + bym−1 ) = x p+1 ym − x p aym − x p bym−1
= x p+1 − ax p ym − x p bym−1 = bx p−1 ym − x p bym−1
| {z }
=bx p−1
(by (600))
= (−b) x p ym−1 − x p−1 ym . (601)
This rewrites as
x p +1 y m − x p y m +1
= (−b) (−b)m−1 x p−m+1 y0 − x p−m y1
= (−b) x p y m −1 − x p −1 y m
| {z } | {z }
=(−b)m−1 ( x p−m+1 y0 − x p−m y1 ) =(−b)m
holds for any p ∈ N satisfying p ≥ m. In other words, (597) holds for q = m (and
any p ∈ N satisfying p ≥ m). This completes the induction step. Thus, (597) is
proved. In other words, Proposition A.5.3 is proved.
This solves Exercise 4.10.3. (An alternative proof of Proposition A.5.3 can be
given using the matrix approach, similar to our second solution to Exercise 4.9.2.)
for each n ∈ N satisfying n ≥ m. In other words, we must prove that (602) holds
for each integer n ≥ m.
We shall prove this by induction on n:
Induction base: Comparing xm−m ym+m = 0 with xm ym − (−1)m+m xm ym =
| {z } | {z }
= x0 =0 =1
(since m+m=2m is even)
xm ym − xm ym = 0, we obtain xm−m ym+m = xm ym − (−1)m+m xm ym . In other words,
(602) holds for n = m.
Hence,
(since k + k = 2k).
From k ≥ m, we obtain k − m ∈ N. Hence, Exercise 4.9.4 (applied to 1, k − m and
k + m instead of b, n and m) yields
x k − m y k + m + x k − m +1 y k + m +1 = x k y k + x k +1 y k +1 .
In other words,
x k − m +1 y k + m +1 = x k y k + x k +1 y k +1 − x k − m y k + m . (604)
x k − m +1 y k + m +1 = x k y k + x k +1 y k +1 − x y
| k−m{z k+m}
= xk yk −(−1)k+m xm ym
= xk yk + xk+1 yk+1 − xk yk − (−1)k+m xm ym
k+m k+m
= xk+1 yk+1 − (−1) xm ym = xk+1 yk+1 + − (−1) xm ym
| {z }
=(−1)k+m+1
But we have gcd ( a, b − a) = gcd ( a, b) (this has already been proved during our
proof of Theorem 3.4.5). Furthermore, Lemma A.5.4 yields
Now, forget that we fixed a, b. We thus have shown that any a, b ∈ N satisfying
a + b = k satisfy gcd ( x a , xb ) = xgcd(a,b) . In other words, Exercise 4.10.5 is true for
a + b = k. This completes the induction step. Thus, Exercise 4.10.5 is solved.
364 becauseProposition 3.4.4 (b) yields gcd ( a, b) = gcd (b, a) and gcd ( x a , xb ) = gcd ( xb , x a )
365 Proof.
Assume that a = 0. Then, gcd ( a, b) = b (this has already been proved during our above
proof of Theorem 3.4.5) and thus b = gcd ( a, b). Furthermore, from a = 0, we obtain x a = x0 = 0
and therefore
qed.
This generalization does not simplify the problem, but it is so nice I couldn’t leave
it unexplored.366
So let us try to solve the generalized problem. The most straightforward ap-
proach is to try to find the m that satisfies
√ (607)√explicitly (in terms of n and g). The
function that sends each m ∈ N to m + 1 − m ∈ R is strictly decreasing (check
this!) and thus injective; hence, if there is an m ∈ N satisfying (607), then this
m is unique. Furthermore, it can be computed explicitly by solving the equation
(607) for m. More generally, for any fixed nonnegative real a ≤ 1, we can solve the
equation √ √
a = x+1− x (608)
in the unknown x ≥ 0; the solution is always
a − 1/a 2
x= (609)
2
p √ n
(check this!). We can apply this to a = g + 1 − g (indeed, it is easy to see
p √
that the number g + 1 − g is positive and ≤ 1; therefore, the same holds for its
n-th power a), and thus we find that the solution m is given by
p √ n p √ n !2
g+1−
g − 1/ g+1− g
m=
2
p √ n p √ n !2
g+1− g − g+1+ g
= (610)
2
(by fairly simple computations367 ). It thus remains to prove that this m is an ele-
ment of N. Thus, we must prove the following theorem:
366 See also [GelAnd17, Problem 941] or [Tomesc85, Problem 1.4] for a variant of this generalization
in which the minus signs are replaced by plus signs.
367 Specifically, we have to notice that 1/
p √ p √
g+1− g = g + 1 + g and thus
p √ n
p √ n
1/ g+1− g = g+1+ g .
√
Theorem A.5.5. Let g ∈ N and n ∈ N. Let λ = g + 1 − g and µ = g + 1 +
p p
√
g. Let
µ − λn 2
n
m= .
2
√ √
Then, we have m ∈ N and λn = m + 1 − m.
We will give two proofs of Theorem A.5.5 and sketch a third one. First, let us
prove an auxiliary lemma:
Lemma A.5.6. Let u and v be two numbers. Let n ∈ N. Then,
n k n−k
n n
(u + v) + (u − v) = 2 ∑ k
v u (611)
k∈{0,1,...,n};
k is even
and
n k n−k
n n
(u + v) − (u − v) = 2 ∑ k
v u . (612)
k∈{0,1,...,n};
k is odd
(by Theorem 4.3.16, applied to x = v and y = u). Also, u − v = (−v) + u and thus
n
n
(u − v) = ((−v) + u) = ∑
n n
(−v)k un−k (614)
k =0
k
(by Theorem 4.3.16, applied to x = −v and y = u). Adding this equality to the
(u + v)n + (u − v)n
n n
n k n−k n
= ∑ v u +∑ (−v)k un−k
k =0
k k =0
k | {z }
=(−1)k vk
n n
n k n−k n
= ∑ v u +∑ (−1)k vk un−k
k =0
k k =0
k
n
n k n−k n
= ∑ k
v u +
k
k k n−k
(−1) v u
k =0 | {z }
|{z}
= ∑ n
k∈{0,1,...,n} = 1+(−1)k vk un−k
k
n
= ∑ k
k
1 + (−1) vk un−k
k∈{0,1,...,n}
n
∑ k k n−k
= 1 + (−1) v u
k∈{0,1,...,n};
k | {z }
k is even
=1
(since k is even)
n
∑ k k n−k
+ 1 + (−1) v u
k∈{0,1,...,n};
k | {z }
k is odd
=−1
(since k is odd)
(since each k ∈ {0, 1, . . . , n} is either even or odd)
n n
= ∑ k
k n−k
(1 + 1) v u + ∑ k
(1 + (−1)) vk un−k
k∈{0,1,...,n}; k∈{0,1,...,n};
| {z } | {z }
=2 =0
k is even k is odd
n n
= ∑ k
k n−k
· 2v u + ∑ k
· 0vk un−k
k∈{0,1,...,n}; k∈{0,1,...,n};
k is even k is odd
| {z }
=0
n n k n−k
= ∑ k
· 2vk un−k =2 ∑ k
v u .
k∈{0,1,...,n}; k∈{0,1,...,n};
k is even k is even
=0
n n k n−k
= ∑ k
k n−k
· 2v u =2 ∑ k
v u .
k∈{0,1,...,n}; k∈{0,1,...,n};
k is odd k is odd
µ − λn 2
n
First proof of Theorem A.5.5. We have m = ≥ 0 (since the square of
2 √ √
any real is nonnegative) and thus m + 1 ≥ 1 ≥ 0. Hence, m + 1 and m are
well-defined.
p √ p √
Multiplying the equalities λ = g+1− g and µ = g+1+ g, we obtain
p √ p √ p 2 √
λµ = g+1− g g+1+ g = g + 1 − ( g )2
| {z } | {z }
=g
= g +1
= ( g + 1) − g = 1. (615)
Hence, the numbers λ andpµ are nonzero and p are each other’s inverses; in partic-
√
ular, λ = 1/µ. But µ = g+1+ g ≥ g + 1 ≥ 1 (since g + 1 ≥ 1); hence,
1/µ ≤ 1/1 = 1 and thus λ = 1/µ ≤ 1. Also, µ ≥ 1 > 0 and thus 1/µ > 0 and
therefore λ = 1/µ > 0. Now, µ ≥ 1 ≥ λ (since λ ≤ 1), so that µn ≥ λn (since n ≥ 0
µn − λn
and since µ > 0 and λ > 0). Therefore, µn − λn ≥ 0, so that ≥ 0. Now,
2
µ − λn 2
n
from m = , we obtain
2
s
√ µ − λn 2
n
µn − λn √
m= = since x2 = | x | for each x ∈ R
2 2
n
µ −λ n
µn − λn
= since ≥0 . (616)
2 2
2
µn − λn
Furthermore, from m = , we obtain
2
2 2
µn − λn µn + λn
m+1 = +1 =
2 2
2 2
a−b
a+b
(by the equality +1 = , which holds for any two numbers a
2 2
and b). Hence,
s
√ µ + λn 2
n
µn + λn √
m+1 = = since x = | x | for each x ∈ R
2
2 2
µn + λn µn + λn
= since ≥ 0 (because µ > 0 and λ > 0) .
2 2
p √ p √
From λ = g + 1 − g and µ = g + 1 + g, we obtain
p √ n p √ n
µn − λn = g+1+ g − g+1− g
n √ k p
n−k
=2 ∑ ( g)
k | {z } |
g+1
k∈{0,1,...,n}; {z }
k is odd = gk/2
=( g+1)(n−k)/2
p √
by (612), applied to u = g + 1 and v = g
n k/2
=2 ∑ k
g ( g + 1)(n−k)/2 .
k∈{0,1,...,n};
k is odd
(since n = 2r).
Now, the odd elements of the set {0, 1, . . . , 2r } are 1, 3, 5, . . . , 2r − 1. In other
words, the odd elements of the set {0, 1, . . . , 2r } are the elements 2i − 1 for i ∈
{1, 2, . . . , r }. Hence, the map
{1, 2, . . . , r } → {k ∈ {0, 1, . . . , 2r } | k is odd} ,
i 7→ 2i − 1
We thus obtain
2r k/2
∑ k
g ( g + 1)(2r−k)/2
k∈{0,1,...,2r };
k is odd
2r
= ∑ 2i − 1
g(2i−1)/2 ( g + 1)(2r−(2i−1))/2
i ∈{1,2,...,r }
| {z } | {z }
= g(i−1)+1/2 =( g+1)(r−i)+1/2
(since (2i −1)/2=(i −1)+1/2) (since (2r −(2i −1))/2=(r −i )+1/2)
2r
= ∑ 2i − 1
g(i−1)+1/2 ( g + 1)(r−i)+1/2
i ∈{1,2,...,r }
| {z } | {z }
= gi−1 g1/2 =( g+1)r−i ( g+1)1/2
(because i −1 and 1/2 are (because r −i and 1/2 are
nonnegative (since i ∈{1,2,...,r } nonnegative (since i ∈{1,2,...,r }
entails i ≥1 and thus i −1≥0)) entails i ≤r and thus r −i ≥0))
2r
= ∑ 2i − 1
gi−1 g1/2 ( g + 1)r−i ( g + 1)1/2
| √
i ∈{1,2,...,r } √
|{z} {z }
= g = g +1
√
2r
∑ g i −1 g ( g + 1 ) r − i g + 1
p
=
i ∈{1,2,...,r }
2i − 1
√ p
2r
= g· g+1· ∑ 2i − 1
g i −1 ( g + 1 ) r − i .
i ∈{1,2,...,r }
√
2r + 1 k/2
m= ∑ k
g ( g + 1)(2r+1−k)/2 (621)
k∈{0,1,...,2r +1};
k is odd
(since n = 2r + 1).
Now, the odd elements of the set {0, 1, . . . , 2r + 1} are 1, 3, 5, . . . , 2r + 1. In other
words, the odd elements of the set {0, 1, . . . , 2r + 1} are the elements 2i + 1 for
i ∈ {0, 1, . . . , r }. Hence, the map
2r
rem 4.3.15 yields that ∈ Z), and the powers gi−1 and ( g + 1)r−i are integers as well
2i − 1
(since i ∈ {1, 2, .. . , r } entails i − 1 ∈ N and r − i ∈ N). Therefore, each addend of the sum
2r
∑ gi−1 ( g + 1)r−i is an integer. Hence, the sum itself is an integer as well.
i ∈{1,2,...,r } 2i −1
We thus obtain
2r + 1 k/2
∑ k
g ( g + 1)(2r+1−k)/2
k∈{0,1,...,2r +1};
k is odd
2r + 1
= ∑ 2i + 1
g(2i+1)/2 ( g + 1)(2r+1−(2i+1))/2
i ∈{0,1,...,r }
| {z } | {z }
= gi+1/2 =( g+1)r−i
(since (2i +1)/2=i +1/2) (since (2r +1−(2i +1))/2=r −i)
2r + 1
= ∑ 2i + 1
gi+1/2 ( g + 1)r −i
i ∈{0,1,...,r }
| {z }
= gi g1/2
(because i and 1/2 are
nonnegative)
2r + 1 i 1/2
= ∑ 2i + 1
g g ( g + 1)r −i
i ∈{0,1,...,r } √
|{z}
= g
2r + 1 i √
= ∑ 2i + 1
g g ( g + 1)r −i
i ∈{0,1,...,r }
√
2r + 1 i
= g· ∑ 2i + 1
g ( g + 1)r −i .
i ∈{0,1,...,r }
[Proof of Claim 3: The integer n is either even or odd. We thus are in one of the
following two cases:
Case 1: The integer n is even.
Case 2: The integer n is odd.
n is even. Hence, Claim
Let us first consider Case 1. In this case, √the integer p
√
1 yields that there is an integer u such that m = g · g + 1 · u. Consider this
√ √ p
u. Squaring both sides of the equality m = g · g + 1 · u, we obtain m =
√ p 2
g · g + 1 · u = g ( g + 1) u2 ∈ Z (since g, g + 1 and u are integers). Thus,
Claim 3 is proved in Case 1.
Let us now consider Case 2. In this case, √ the integer n is odd. Hence, Claim 2
√
yields that there is an integer u such that m = g · u. Consider this u. Squaring
√ √ √ 2
both sides of the equality m = g · u, we obtain m = g · u = gu2 ∈ Z (since
g and u are integers). Thus, Claim 3 is proved in Case 2.
We have now proved Claim 3 in both Cases 1 and 2. Hence, Claim 3 always
holds.]
Claim 3 yields m ∈ Z. Hence, m ∈ N (since m ≥ 0). This completes the proof of
Theorem A.5.5.
Second proof of Theorem A.5.5. As in the first√proof of √
Theorem A.5.5 above, we can
n
show that m ≥ 0 and λµ = 1 and λ = m + 1 − m. It remains to show that
m ∈ N.
µ − λn 2
n
Multiplying both sides of the equality m = by 4, we find
2
1n = µ2n + λ
= µ2n + λ2n − 2 · |{z} 2n
− 2. (623)
=1
p √ p √
Now, from λ = g+1− g and µ = g+1+ g, we obtain
2n 2n
p √ 2n p √ 2n
µ +λ = g+1+ g + g+1− g
2n √ k p
2n−k
=2 ∑ ( g )
k | {z } |
g + 1
k∈{0,1,...,2n}; {z }
k/2
=g
k is even =( g+1)(2n−k)/2
p √ !
by (611), applied to g + 1, g and 2n
instead of u, v and n
2n k/2
=2 ∑ k
g ( g + 1)(2n−k)/2 . (624)
k ∈{0,1,...,2n};
k is even
Now, the even elements of the set {0, 1, . . . , 2n} are 0, 2, 4, . . . , 2n. In other words,
the even elements of the set {0, 1, . . . , 2n} are the elements 2i for i ∈ {0, 1, . . . , n}.
Hence, the map
We thus obtain
2n k/2
∑ k
g ( g + 1)(2n−k)/2
k∈{0,1,...,2n};
k is even
2n
= ∑ 2i
g2i/2 ( g + 1)(2n−2i)/2
i ∈{0,1,...,n}
|{z} | {z }
| {z } = gi =( g+1)n−i
n (since 2i/2=i) (since (2n−2i )/2=n−i)
=∑
i =0
n
2n i
= ∑ 2i
g ( g + 1) n −i . (625)
i =0
The sum on the right hand side of this equality is an integer370 ; but we shall fur-
thermore show that it is an odd integer. In other words, we shall show that
n
2n
∑ 2i gi ( g + 1)n−i is odd. (626)
i =0
370 Indeed, 2n
for each i ∈ {0, 1, . . . , n}, the binomial coefficient is an integer (since Theo-
2i
2n
rem 4.3.15 yields that ∈ Z), and the powers gi and ( g + 1)n−i are integers as well
2i
i∈ {0, 1, . . . , n} entails i ∈ N and n − i ∈ N). Therefore, each addend of the sum
(since
n 2n i
∑ g ( g + 1)n−i is an integer. Hence, the sum itself is an integer as well.
i =0 2i
g ≡ 0 mod 2. Now,
n
2n
∑ 2i gi ( g + 1)n−i
i =0
n
2n 2n
=∑ g i n −i
( g + 1) + g 0 ( g + 1 ) n −0
i =1
2i |{z} 2 · 0 |{z} | {z }
≡0 mod 2 | {z } =1 =( g+1)n
(since 2| g| gi 2n
(because i ≥1)) = =1
0
(by (119))
n
n
2n
≡ ∑ 2i
0 ( g + 1)n−i + g +1 ≡ (0 + 1)n = 1n = 1 mod 2.
i =1
|{z}
| {z } ≡0 mod 2
=0
2n i n
In other words, ∑ g ( g + 1)n−i is odd. Thus, (626) is proved in Case 1.
i =0 2i
Let us now consider Case 2. In this case, the integer g is odd. Hence, g ≡ 1 mod 2,
so that g +1 ≡ 1 + 1 = 2 ≡ 0 mod 2. Now,
|{z}
≡1 mod 2
n −i
n n
2n i 2n i n−i
∑ 2i
g g+1 ≡ ∑ 2i
g0
i =0 i =0
| {z }
≡0 mod 2
n −1
2n i 2n
= ∑ 2i
g 0 n −i
|{z} +
2n
n−n
gn 0|{z}
i =0 =0 | {z } =00 =1
(since n−i ≥1 =1
(because i ≤n−1)) (by (124))
n
n −1
2n i
= ∑ 2i
g 0 + gn = gn = g ≡ 1n = 1 mod 2.
|i=0
|{z}
{z } ≡1 mod 2
=0
2n i n
In other words, ∑ g ( g + 1)n−i is odd. Thus, (626) is proved in Case 2.
i =0 2i
We have now proved (626) in both Cases 1 and
2. Hence, (626) always holds.]
n 2n i
We have thus shown that the integer ∑ g ( g + 1)n−i is odd. In other words,
i =0 2i
n
2n i
∑ 2i
g ( g + 1)n−i = 2u + 1 (627)
i =0
for each n ≥ 3.
Proving this guess is easy: Just rewrite the four values mn , mn−1 , mn−2 , mn−3 on
both sides of (629) using (628), and then use the equalities
n n −1 n −2 n −3
2 2 2 2
µ = (4g + 3) µ − (4g + 3) µ + µ ,
n n −1 n −2 n −3
λ2 = (4g + 3) λ2 − (4g + 3) λ2 + λ2 ,
1n = (4g + 3) 1n−1 − (4g + 3) 1n−2 + 1n−3
(which follow from the fact that µ2 , λ2 and 1 are roots of the polynomial X 3 −
(4g + 3) X 2 + (4g + 3) X − 1).
Thus, the sequence (m0 , m1 , m2 , . . .) is (4g + 3, − (4g + 3) , 1)-recurrent. Since the
first three entries of this sequence are integers (indeed, m0 = 0 ∈ Z and m1 = g ∈ Z
and m2 = 4g ( g + 1) ∈ Z), we thus conclude (by strong induction on n) that all its
entries mn are integers (since 4g + 3, − (4g + 3) and 1 are integers). In other words,
mn is an integer for all n ∈ N. Since we also know that mn ≥ 0, we thus conclude
that mn ∈ N for all n ∈ N. This proves Theorem A.5.5.
Now, let us solve Exercise 4.10.6 at last. Indeed, set g = 1. Define λ,√µ and m as
√ in
Theorem A.5.5. Then, Theorem A.5.5 yields that m ∈ N and λ = m + 1 − m.
n
But
p √ √ √
λ = g + 1 − g = | 1{z+ 1} − |{z} 1 (since g = 1)
√
= 2 =1
√
2 − 1,
=
√ n √ n √ √
so that λn = 2 − 1 . Hence, 2 − 1 = λn = m + 1 − m. Thus, we have
√ n √ √
found an m ∈ N such that 2 − 1 = m + 1 − m. This shows that such an
m exists. Thus, Exercise 4.10.6 is solved.
signs). Yet a look at the first 10 or so entries of the sequence suggests a much
slower growth – polynomial perhaps. This is not a rigorous argument – the growth
behavior of a sequence is not determined by its first 10 entries, or by its first 1000
entries for that matter – but it is a remarkable observation that calls for explanation.
Guided by this observation, one might look for a polynomial formula for an – that
is, a polynomial P such that an = P (n) for all n ∈ N. Making the reasonable
assumption that deg P shouldn’t be too large, one can then find P using polynomial
interpolation. The result is the formula (630). Of course, this does not substitute
for a rigorous proof of (630).
Hence, (
j √ n k 2u − 1, if n is even;
1+ 2 =
2u, if n is odd.
Since 2u is even and 2u − 1 is odd, the claim of the exercise thus follows.
The same argument can be used to prove the following more general result:
For the sake of completeness, here is a proof of this theorem (following the above
plan):
√ √
Proof of Theorem A.5.7. Let λ = m + q and µ = m − q.
Taking square roots on all sides of the inequality chain m2 < q < (m + 1)2 , we
√
obtain m < q < m + 1 (since all of m, q and m + 1 are nonnegative reals). Hence,
√ √ √ √
µ = m − q < 0 (since m < q) and µ = m − q > −1 (since q < m + 1). From
µ < 0, we see that µ is negative, so that |µ| = −µ. Hence, |µ| = −µ < 1 (since
µ > −1). Thus, |µ|n ≤ 1 (since |µ| is nonnegative), so that |µn | = |µ|n ≤ 1.
√ √
From λ = m + q and µ = m − q, we obtain
√ n √ n n √ k n−k
n n
λ + µ = (m + q) + (m − q) = 2 ∑ ( q) m
k | {z }
k∈{0,1,...,n};
k is even =qk/2
√
(by (611), applied to u = m and v = q)
n k/2 n−k
=2 ∑ k
q m . (632)
k∈{0,1,...,n};
k is even
n k/2 n−k
The sum ∑ q m is an integer371 . Let us denote this integer by
k∈{0,1,...,n}; k
k is even
u. Thus,
n k/2 n−k
u= ∑ k
q m .
k∈{0,1,...,n};
k is even
Hence, (632) rewrites as λn + µn
= 2u. Hence, 2u = λn + µn .
Now, we are in one of the following two cases:
Case 1: The integer n is even.
Case 2: The integer n is odd.
Let us first consider Case 1. In this case, the integer n is even. Hence, αn ≥ 0 for
each positive real α. Applying this to α = µ, we obtain µn ≥ 0. Thus, |µn | = µn , so
that µn = |µn | ≤ 1. Also, µ 6= 0 (since µ < 0), so that µn 6= 0 and thus µn > 0 (since
µn ≥ 0).
The integer 2u − 1 satisfies 2u − 1 ≤ λn (since 2u = λn + µn ≤ λn + 1) and
|{z}
≤1
k + a n −1 a n −2
For each integer n ≥ 3, we have an = (by the definition of the
a n −3
sequence ( a0 , a1 , a2 , . . .)) and thus
a n a n −3 = k + a n −1 a n −2
and therefore
an an−3 − an−1 an−2 = k. (633)
Applying this to n = 3, we find a3 a3−3 − a3−1 a3−2 = k. In view of a3−3 = a0 = 1
and a3−1 = a2 = m and a3−2 = a1 = 1, this rewrites as a3 · 1 − m · 1 = k. Hence,
a3 · 1 = m · 1 + k = m + k, so that a3 = a3 · 1 = m + k.
Now, we will show the following:
a u a u −3 − a u −1 a u −2 = k = a u −1 a u −4 − a u −2 a u −3
a u a u −3 + a u −2 a u −3 = a u −1 a u −4 + a u −1 a u −2 .
In view of
a u −1 a u −4 + a u −1 a u −2 = a u −1 ( a u −4 + a u −2 ) = ( a u −4 + a u −2 ) a u −1 = ( a u −2 + a u −4 ) a u −1
and
a u a u −3 + a u −2 a u −3 = ( a u + a u −2 ) a u −3 ,
this rewrites as ( au + au−2 ) au−3 = ( au−2 + au−4 ) au−1 . This proves Observation 1.]
The core of our argument will be the following two observations:
( a u + a u −2 ) a u −3 = ( a u −2 + a u −4 ) a u −1 = ( q + 1 ) a u −3 a u −1 . (636)
| {z }
=(q+1) au−3
in the Hint). However, the latter statement is true and not hard to prove: Namely,
both subsequences ( a0 , a2 , a4 , a6 , . . .) and ( a1 , a3 , a5 , a7 , . . .) are (mq + m + q − 1, −1)-
recurrent. In other words, we have
for each integer n ≥ 4. The proof of this fact (best made using Observations 2 and
3 alone, forgetting the original definition of our sequence) is left to the reader.
Now, I claim that the geometric progression bq0 , bq1 , bq2 , bq3 , . . . is a subse-
( a + i0 d, a + i1 d, a + i2 d, a + i3 d, . . .)
is a subsequence of the sequence A a,d (since the sequence A a,d consists of the num-
bers a + id for all i ∈ N).
However, for each n ∈ N, we have
a+ in d = a + m + s q 0 + q 1 + · · · + q n −1 d
|{z}
=m+s(q0 +q1 +···+qn−1 )
0 1 n −1
= |a +{zmd} + s q + q + · · · + q d
=b
| {z }
=ds(q0 +q1 +···+qn−1 )
0 1 n −1
ds q + q + · · · + q
= b + |{z}
=br
0 1 n −1
= b+b r
|{z} q +q +···+q
= q −1
(since q=1+r)
= b + b ( q − 1 ) q 0 + q 1 + · · · + q n −1
| {z }
= q n −1
(by Exercise 2.1.1, applied to q instead of b)
n n
= b + b (q − 1) = bq
and thus
bqn = a + in d.
In other words,
bq0 , bq1 , bq2 , bq3 , . . . = ( a + i0 d, a + i1 d, a + i2 d, a + i3 d, . . .) . (638)
Indeed, assume that the arithmetic progression A a,d contains a three-term geo-
0 1 2
metric progression bq , bq , bq as a subsequence. In other words, there exist reals
b and q and nonnegative integers i, j, k satisfying i < j < k and
so that
2
0 = bq0 bq2 − bq1 = ( a + id) ( a + kd) − ( a + jd)2
| {z } | {z } |{z}
= a+id = a+kd = a+ jd
2 2 2
= (i − 2j + k) ad + ik − j d = d · (i − 2j + k) a + ik − j d .
We can cancel d from this equality (since d 6= 0), and thus obtain
0 = (i − 2j + k ) a + ik − j2 d.
In other words,
(i − 2j + k) a = − ik − j2 d. (639)
If we knew that i − 2j + k 6= 0, then we could divide the equality (639) by d (i − 2j + k )
(since d 6= 0), and thus obtain
− ik − j2
a
= ∈Q (since i, j, k are integers) ,
d i − 2j + k
which would complete the proof of Claim 2. Thus, it remains to show that i − 2j +
k 6= 0.
Indeed, assume the contrary. Thus, i − 2j + k = 0, so that 2j = i + k and therefore
i+k
j= . Hence,
2
i+k 2 k−i 2
2
ik − j = ik − =− >0
2 2
(since k − i > 0 (because i < k)). Hence, ik − j2 6= 0. Thus, both factors ik − j2 and
d on the right hand side of (639) are nonzero (since d 6= 0). Hence, the entire right
hand side of (639) is nonzero. Thus, the left hand side is nonzero as well. That is,
(i − 2j + k) a 6= 0. But this contradicts (i − 2j + k) a = 0. This contradiction shows
| {z }
=0
that our assumption was false. Hence, i − 2j + k 6= 0 is proved, and our proof of
Claim 2 is complete.]
A few words are in order about the somewhat baroque construction of m and
b in the proof of Claim 1. When the numbers a and d have the same sign and a
is nonzero, we don’t need to go through this ordeal; we can just set m = 0 and
b = a and start our geometric subsequence directly at the first entry of A a,d (that is,
start it with a). However, if a and d have different signs, then an infinite geometric
subsequence of A a,d cannot start with a, since only finitely many entries of A a,d
have the same sign as a (but a geometric subsequence starting with a would have
infinitely many such entries). Thus, we need to throw away the first few entries of
A a,d until we are only left with entries that are nonzero and have the same sign as
d. This is what m and b are for. Namely, m is the number of entries we need to
throw away, and b is the new first entry after throwing away.
x m −6 x m = x m −3 ( x m −5 + x m −1 ) . (641)
x m −3 x m −9 = x m −6 ( x m −4 + x m −8 ) . (642)
375 Here are the details of this computation: Comparing
x 8 + x 8−4 + x 8−8 = 4 + 1 + 1 = 6
|{z} |{z} |{z}
=4 = x4 =1 = x0 =1
with
6 x 8−3 x 8−4 x8−5 = 6,
|{z} |{z} |{z}
= x5 =1 = x4 =1 = x3 =1
we obtain x8 + x8−4 + x8−8 = 6x8−3 x8−4 x8−5 . In other words, Exercise 4.11.6 (a) holds for n = 8.
Now,
x m −6 ( x m + x m −4 + x m −8 )
= x 6 xm + x m −6 ( x m −4 + x m −8 )
| m−
{z } | {z }
= x m −3 ( x m −5 + x m −1 ) = x m −3 x m −9
(by (641)) (by (642))
= x m −3 ( x m −5 + x m −1 ) + x m −3 x m −9 = x m −3 ( x m −1 + x m −5 + x m −9 )
| {z }
=6xm−4 xm−5 xm−6
(by (640))
= xm−3 · 6xm−4 xm−5 xm−6 = 6xm−3 xm−4 xm−5 xm−6 . (643)
This shows that xk is an integer (since all the numbers 6, xk−3 , xk−4 , xk−5 and xk−8 on the right
hand side are integers). In other words, Exercise 4.11.6 (b) holds for n = k. This completes the
induction step. Thus, Exercise 4.11.6 (b) is solved.
a m −3 = x m −1 x m −2 x m −3 x m −4 (647)
a m −2 = x m x m −1 x m −2 x m −3 (648)
a m −1 = x m +1 x m x m −1 x m −2 (649)
x m +2 x m −4 = x m −1 ( x m +1 + x m −3 ) . (650)
x m +1 x m −5 = x m −2 ( x m + x m −4 ) . (651)
Now,
a + a = x m +1 x m x m −1 x m −2 + x m x m −1 x m −2 x m −3
| m{z−}1 | m{z−}2
= x m +1 x m x m −1 x m −2 = x m x m −1 x m −2 x m −3
(by (649)) (by (648))
= x m x m −2 x m −1 ( x m +1 + x m −3 )
| {z }
= x m +2 x m −4
(by (650))
= x m x m −2 x m +2 x m −4
and
a + a = x m x m −1 x m −2 x m −3 + x m −1 x m −2 x m −3 x m −4
| m{z−}2 | m{z−}3
= x m x m −1 x m −2 x m −3 = x m −1 x m −2 x m −3 x m −4
(by (648)) (by (647))
= x m −1 x m −3 x m −2 ( x m + x m −4 )
| {z }
= x m +1 x m −5
(by (651))
= x m −1 x m −3 x m +1 x m −5 .
( a m −1 + a m −2 ) ( a m −2 + a m −3 ) x m x m −2 x m +2 x m −4 · x m −1 x m −3 x m +1 x m −5
am = =
a x m −2 x m −3 x m −4 x m −5
m −4
since am−1 + am−2 = xm xm−2 xm+2 xm−4
and am−2 + am−3 = xm−1 xm−3 xm+1 xm−5
and am−4 = xm−2 xm−3 xm−4 xm−5
= x m +2 x m +1 x m x m −1 .
In other words, (645) holds for n = m. This completes the induction step. Thus,
(645) is proved. In other words, Exercise 4.11.7 (b) is solved.
(a) Let n ∈ N. We must prove that an is an integer. If n = 0, then this is obvious
(since we know that a0 is an integer). Thus, for the rest of this proof, we WLOG
assume that n 6= 0. Hence, n ≥ 1 (since n ∈ N).
Hence, Exercise 4.11.7 (b) yields an = xn+2 xn+1 xn xn−1 . However, for each m ∈
N, the number xm is an integer (by Exercise 4.11.6 (b), applied to m instead
of n). In other words, all entries of the sequence ( x0 , x1 , x2 , x3 , . . .) are integers.
Hence, in particular, the four numbers xn+2 , xn+1 , xn , xn−1 are integers (since these
four numbers are entries of the sequence ( x0 , x1 , x2 , x3 , . . .)). Thus, their prod-
uct xn+2 xn+1 xn xn−1 is an integer as well. In other words, an is an integer (since
an = xn+2 xn+1 xn xn−1 ). This solves Exercise 4.11.7 (a).
bm −4 = x m − 2 x m − 4
(since (m − 4) + 2 = m − 2).
Our induction hypothesis says that (652) holds for each n ≥ 0 satisfying n < m.
Thus, in particular, (652) holds for n = m − 3 (since m − 3 ≥ 0 and m − 3 < m). In
other words, we have bm−3 = x(m−3)+2 xm−3 . In other words,
bm −3 = x m − 1 x m − 3
(since (m − 3) + 2 = m − 1).
Our induction hypothesis says that (652) holds for each n ≥ 0 satisfying n < m.
Thus, in particular, (652) holds for n = m − 2 (since m − 2 ≥ 0 and m − 2 < m). In
other words, we have bm−2 = x(m−2)+2 xm−2 . In other words,
bm −2 = x m x m − 2
(since (m − 2) + 2 = m).
378 Proof.
Assume that m < 4. We must verify that bm = xm+2 xm .
We have m ∈ {0, 1, 2, 3} (since m is an integer satisfying m ≥ 0 and m < 4).
The equalities (250) say that each of the four numbers b0 , b1 , b2 , b3 equals 1. In other words,
bk = 1 for each k ∈ {0, 1, 2, 3}. Applying this to k = m, we find bm = 1 (since m ∈ {0, 1, 2, 3}).
On the other hand, m < 4 < 6 and therefore xm = 1 (by (246), applied to n = m). Furthermore,
m + 2 < 6 (since m < 4 = 6 − 2) and therefore xm+2 = 1 (by (246), applied to n = m + 2). Now,
comparing bm = 1 with xm xm+2 = 1, we obtain bm = xm+2 xm . Qed.
|{z} | {z }
=1 =1
Our induction hypothesis says that (652) holds for each n ≥ 0 satisfying n < m.
Thus, in particular, (652) holds for n = m − 1 (since m − 1 ≥ 0 and m − 1 < m). In
other words, we have bm−1 = x(m−1)+2 xm−1 . In other words,
bm −1 = x m + 1 x m − 1
(since (m − 1) + 2 = m + 1).
From m ≥ 4, we obtain m + 2 ≥ 4 + 2 = 6. Hence, (247) (applied to n = m + 2)
yields
x(m+2)−3 x(m+2)−1 + x(m+2)−5
x m +2 =
x(m+2)−6
x m −1 ( x m +1 + x m −3 )
= (653)
x m −4
(since (m + 2) − 3 = m − 1 and (m + 2) − 1 = m + 1 and (m + 2) − 5 = m − 3 and
(m + 2) − 6 = m − 4).
However, m ≥ 4. Thus, (251) (applied to n = m) yields
bm − 2 ( bm − 1 + bm − 3 ) x m x m −2 ( x m +1 x m −1 + x m −1 x m −3 )
bm = =
bm −4 x m −2 x m −4
since bm−1 = xm+1 xm−1 and bm−2 = xm xm−2
and bm−3 = xm−1 xm−3 and bm−4 = xm−2 xm−4
x (x + x m −3 )
= m −1 m +1 · x m = x m +2 x m .
x m −4
| {z }
= x m +2
(by (653))
In other words, (652) holds for n = m. This completes the induction step. Thus,
(652) is proven. In other words, Exercise 4.11.8 (b) is solved.
(a) Let n ∈ N. We must prove that bn is an integer.
Exercise 4.11.8 (b) yields bn = xn+2 xn . However, for each m ∈ N, the number
xm is an integer (by Exercise 4.11.6 (b), applied to m instead of n). In other words,
all entries of the sequence ( x0 , x1 , x2 , x3 , . . .) are integers. Hence, in particular, the
two numbers xn+2 and xn are integers (since these two numbers are entries of the
sequence ( x0 , x1 , x2 , x3 , . . .)). Thus, their product xn+2 xn is an integer as well. In
other words, bn is an integer (since bn = xn+2 xn ). This solves Exercise 4.11.8 (a).
(c) Let ( a0 , a1 , a2 , . . .) be the sequence defined in Exercise 4.11.7. Let n ≥ 1 be an
integer.
Exercise 4.11.8 (b) yields bn = xn+2 xn . Also, we have n − 1 ≥ 0 (since n ≥ 1).
Hence, Exercise 4.11.8 (b) (applied to n − 1 instead of n) yields bn−1 = x(n−1)+2 xn−1 =
xn+1 xn−1 (since (n − 1) + 2 = n + 1). Thus,
bn bn − 1 = x n +2 x n x n +1 x n −1 = x n +2 x n +1 x n x n −1 .
|{z} |{z}
= x n +2 x n = x n +1 x n −1
a n = x n +2 x n +1 x n x n −1 .
Comparing these two equalities, we obtain an = bn bn−1 . This solves Exercise 4.11.8
(c).
gcd (n + 1 − m, n + 1) = gcd n + 1, n 1 − m}
| + {z
=1(n+1)+(−m)
= gcd (n + 1, 1 (n + 1) + (−m))
= gcd (n + 1, −m)
by Proposition 3.4.4 (c),
applied to a = n + 1, b = −m and u = 1
= gcd (n + 1, m)
(by Proposition 3.4.4 (h), applied to a = n + 1 and b = m). Therefore, (655) rewrites
as
n
n + 1 − m | gcd (n + 1, m) · .
m
This proves Proposition A.6.1 (a).
gcd (n + 1, m)
(b) Assume that m 6= n + 1. Thus, n + 1 − m 6= 0. Hence, the fraction
n+1−m
is well-defined.
But n + 1 − m 6= 0. Proposition 3.1.3 (d) (applied to a = n
Hence, +1−m
n n
and b = gcd (n + 1, m) · ) yields that n + 1 − m | gcd (n + 1, m) · if and
m m
n n
gcd (n + 1, m) · gcd (n + 1, m) ·
m m
only if ∈ Z. Therefore, ∈ Z (since
n+1−m n+1−m
n
n + 1 − m | gcd (n + 1, m) · ). Therefore,
m
n
gcd (n + 1, m) ·
gcd (n + 1, m) n m
= ∈ Z.
n+1−m m n+1−m
In view of
and
( a + 1) n + 1 − n = an + 1,
this rewrites as
( a + 1) n
an + 1 | 1 · .
n
( a + 1) n
In other words, an + 1 | . This solves Exercise 5.4.1.
n
A more explicit solution of Exercise 5.4.1 is also possible: Namely, a simple
computation (using Lemma A.4.9 (c)) reveals that
1 ( a + 1) n ( a + 1) n ( a + 1) n + 1
= ( a + 1) −a .
an + 1 n n n
Finite differences can be applied not just to polynomials, but also to any functions,
and in some more general form than in Exercise 5.4.2 (for example, instead of
P ( x ) − P ( x − 1) we can consider P ( x ) − P ( x − r ) for any fixed number r); they
are used a lot in numerical mathematics.
We shall give what is likely the shortest solution to Exercise 5.4.2. Various other
arguments are possible.
m
Solution to Exercise 5.4.2. (a) Write the polynomial P in the form P = ∑ ci xi for
i =0
m
some constants c0 , c1 , . . . , cm . Thus, P ( x ) = P = ∑ ci xi . Substituting x − 1 for x in
i =0
m
this equality, we obtain P ( x − 1) = ∑ ci ( x − 1)i . Now, the definition of ∆P yields
i =0
(∆P) ( x ) = P ( x ) − P ( x − 1)
| {z } | {z }
m m
= ∑ ci x i = ∑ c i ( x −1)i
i =0 i =0
m m
= ∑ c i x i − ∑ c i ( x − 1)i
i =0 i =0
m
= ∑ ci i
x − ( x − 1) i
. (656)
i =0
Now, let us rewrite the differences xi − ( x − 1)i on the right hand side of this
equality. Namely, for each i ∈ {0, 1, . . . , m}, we have
and therefore
i −1 i −1 i
i k
i
x − ( x − 1) = −i
∑ (−1) i −k
k
x = ∑ − (−1) i −k
k
xk
k =0 k =0 | {z }
=(−1)i−k+1
i −1
i k
= ∑ (−1) i − k +1
k
x . (657)
k =0
Now, we notice that the right hand side of (658) is a sum of powers x k of x
(multiplied by constants)380 . Moreover, all powers x k that appear in this sum satisfy
k ≤ m − 1 381 . Thus, the right hand side of (658) is a sum of powers x k (multiplied
by constants) with k ≤ m − 1. In other words, the right hand side of (658) is a
polynomial in x of degree ≤ m − 1. Therefore, so is the left hand side of (658). In
other words, (∆P) ( x ) is a polynomial in x of degree ≤ m − 1. In other words, the
polynomial ∆P has degree ≤ m − 1. This solves Exercise 5.4.2 (a).
(b) This follows by induction on n, using the (already solved) Exercise 5.4.2 (a)
in the induction step. Here are the details:
Forget that we fixed m and P. The following claim follows from Exercise 5.4.2
(a):
380 Notethat a single power x k may appear multiple times in the sum.
381 Indeed,if x k appears in this sum, then k ∈ {0, 1, . . . , i − 1} for some i ∈ {0, 1, . . . , m}; but this
implies
k≤ i
|{z} −1 (since k ∈ {0, 1, . . . , i − 1})
≤m
(since i ∈{0,1,...,m})
≤ m − 1.
The polynomial ∆0 P is just equal to P (by its definition) and therefore has degree ≤ m (by
382 Proof.
Induction step: Let k ∈ N. Assume (as the induction hypothesis) that Claim 2
holds for n = k. We must prove that Claim 2 holds for n = k + 1.
We have assumed that Claim 2 holds for n = k. In other words, the polynomial
∆ P has degree ≤ m − k. The definition of ∆k+1 P yields ∆k+1 P = ∆ ∆k P . But
k
The polynomial ∆k+1 P has degree ≤ m − (k + 1). In other words, Claim 2 holds
for n = k + 1. This completes the induction step. Thus, Claim 2 is proven.]
Having proved Claim 2, we thus have solved Exercise 5.4.2 (b).
(c) This is similar to the standard inductive proof of the Binomial Theorem (as
done, e.g., in [Grinbe15, solution to Exercise 3.6]):
We shall prove Exercise 5.4.2 (c) by induction on n:
Induction base: We have ∆0 P = P (by the definition of ∆0 P) and thus
0
0
∆ P ( x ) = P ( x ) = ∑ (−1)
0 k
P ( x − k)
k =0
k
!
0
k 0 0 0
(since ∑ (−1) P ( x − k ) = (−1) P − 0}
|x {z = P ( x )). In other words,
k =0 k | {z } 0
=1 |{z} =x
=1
Exercise 5.4.2 (c) holds for n = 0.
Induction step: Let i ∈ N. Assume (as the induction hypothesis) that Exercise
5.4.2 (c) holds for n = i. We must prove thatExercise 5.4.2
(c) holds for n = i + 1.
The definition of ∆i+1 P yields ∆i+1 P = ∆ ∆(i+1)−1 P = ∆ ∆i P (since (i + 1) −
1 = i). Thus,
∆ i +1 P ( x ) = ∆ ∆ i P ( x )
i i
= ∆ P ( x ) − ∆ P ( x − 1) (659)
(by the definition of ∆ ∆i P ). We now want to get explicit formulas for the two
We want to subtract the equality (661) from the equality (660). In order for the
result to be simplifiable, it would be good to have the two summations have the
same limits. Fortunately, this is not hard to achieve: We just need to stretch the
summations to range from 0 to i + 1.
i
To wit, we have i + 1 > i and thus = 0 (by Proposition 4.3.4, applied to
i+1
i and i + 1 instead of n and k). Now,
i +1
i
∑ (−1) k P (x − k)
k
k =0
i
i k i
= (−1) i +1
P ( x − (i + 1)) + ∑ (−1) P ( x − k)
i+1 k =0
k
| {z }
=0
i
i
= (−1) i +1
0P ( x − (i + 1)) + ∑ (−1) P ( x − k) k
| {z } k =0 k
=0
i
k i
= ∑ (−1) P ( x − k) .
k =0
k
In other words, Exercise 5.4.2 (c) holds for n = i + 1. This completes the induction
step. Hence, Exercise 5.4.2 (c) is solved.
(d) Let n ∈ N satisfy n > m. Then, Exercise 5.4.2 (b) shows that the poly-
nomial ∆n P has degree ≤ m − n. But m − n < 0 (since n > m); hence, the
only polynomial that has degree ≤ m − n is the zero polynomial 0. Therefore,
the polynomial ∆n P is the zero polynomial 0 (since ∆n P has degree ≤ m − n).
In other words, ∆n P = 0. Thus, (∆n P) ( x ) = 0. But Exercise 5.4.2 (c) yields
n n
(∆n P) ( x ) = ∑ (−1)k P ( x − k). Hence,
k =0 k
n
k n
∑ (−1) k P (x − k) = (∆n P) (x) = 0.
k =0
Hence,
m +1
m+1
0= ∑ (−1) k
k
P (n − k)
k =0
!
m +1
m+1 m+1
= (−1) 0
0
P n − 0}
| {z + ∑ (−1) k
k
P (n − k)
k =1
| {z } | {z }
=n
=1 =−(−1)k−1
| {z }
=1
(by (119),
applied to m+1 instead of n)
m +1 m + 1
= P (n) + ∑ − (−1) k −1
k
P (n − k)
k =1
m +1
m+1
= P (n) − ∑ (−1) k −1
k
P (n − k) ,
k =1
so that
m +1 m +1
m+1
P (n) = ∑ (−1) k −1
k
P (n − k) = ∑ dk P (n − k )
k =1 | {z } k =1
=dk
k −1
m+1
(since dk =(−1)
k
(by the definition of dk ))
= d1 P (n − 1) + d2 P (n − 2) + · · · + dm+1 P (n − (m + 1)) .
for each integer n ≥ m + 1. In other words, the sequence ( P (0) , P (1) , P (2) , . . .)
is (d1 , d2 , . . . , dm+1 )-recurrent (by the definition of “(d1 , d2 , . . . , dm+1 )-recurrent”).
This solves Exercise 5.4.2 (e).
Let us briefly state three more properties of finite differences. We will need
a
notation: If Q is a polynomial in a single variable, and if i ∈ Z, then x ( Q) i
(c) We have
m
m
∑ (−1) k P (x − k) = m! · [xm ] ( P) .
k
k =0
Proposition A.6.2 (a) can be proved by retracing the above solution to Exer-
cise 5.4.2 (a) and analyzing the appearances of x m−1 on the right hand side of
(658) (namely, x m−1 appears
only
once on this right hand side, with coefficient
m
cm (−1)m−(m−1)+1 = [ x m ] ( P) · m = m · [ x m ] ( P)). Proposition A.6.2
|{z} | {z } m−1
=[ x m ]( P) =1 | {z }
=m
(b) can be proved by induction on n using Proposition A.6.2 (a), just as we proved
Exercise 5.4.2 (b) by induction using Exercise 5.4.2 (a). Finally, Proposition A.6.2 (c)
follows by applying both Proposition A.6.2 (b) and Exercise 5.4.2 (c) to n = m (and
recalling that a polynomial having degree ≤ 0 must be a constant polynomial).
n−i n−i
n j n n j n
= 0 with = 0, we obtain = . This
j i i j−i j i i j−i
|{z} | {z }
=0 =0
proves (667).]
Proof of Proposition A.6.3. First, we shall show that certain denominators are nonzero.
Indeed, we have a ≤ b < b + 1 and thus b+ 1 − a > 0, so that b + 1 − a 6= 0. Further-
b
more, each k ∈ {c, c + 1, . . . , b} satisfies 6= 0 383 . Applying this to k = c, we
k
b
obtain 6= 0 (since c ∈ {c, c + 1, . . . , b} (because c ≤ b)). Hence, we have shown
c
b b
that all the three denominators b + 1 − a, and appearing in Proposition
k c
A.6.3 are nonzero. The fractions are therefore well-defined.
Now, let k ∈ {c, c + 1, . . . , b}. Then, c ≤ k ≤ b and thus k ≥ c ≥ 0 (since c ∈ N),
so that k ∈ N. Hence, (667) (applied to n = b, i = k and j = a) yields that
b−k
b a b
= (668)
a k k a−k
(since a ≤ b).
b b
It is easy to see that both numbers and are nonzero384 . Hence, their
a k
b b
product is nonzero. We can therefore divide the equality (668) by this
a k
b b
product . As a result, we obtain
a k
b−k
a
b−k
k a−k 1
= = . (669)
b b b a−k
k a a
Furthermore, b − k ∈ N (since k ≤ b).Thus,
Theorem 4.3.10 (applied to b− k and
b−k b−k b−k
a − k instead of n and k) yields = = (since
a−k (b − k) − ( a − k) b−a
383 Proof. Let k ∈ {c, c + 1, . . . , b}. Then, k ≥ c and k ≤ b. From k ≥ c ≥ 0 (since c ∈ N), we obtain
b b!
k ∈ N. Hence, Theorem 4.3.8 (applied to n = b) yields = 6= 0 (since b! 6= 0
k k! · (b − k )!
(because b! is a positive integer)).
384 Proof. We have a ∈ N and b ∈ N and a ≤ b. Hence, Theorem 4.3.8 (applied to b and a instead of
b b!
n and k) yields = 6= 0 (since b! 6= 0 (because b! is a positive integer)). Also, we
a a! · (b − a)!
b b!
have k ∈ N and k ≤ b. Hence, Theorem 4.3.8 (applied to n = b) yields = 6= 0
k k!· (b− k)!
b b
(since b! 6= 0 (because b! is a positive integer)). Thus, we have now seen that both and
a k
are nonzero.
1 1 1
+ + · · · + . Is there an explicit formula for the harmonic numbers? The
1 2 n
answer depends on how you define “explicit formula”. For some meanings of
this word, it has been proved that an explicit formula does not exist (see, e.g.,
https://math.stackexchange.com/a/52579/ and the references therein). But
if you accept, e.g., floor functions, then you can show that
Gn
Hn = Gn − (n + 1) , where
n+1
n + ( n + 1) !
−1
n
Gn = .
( n + 1) !
This is not hard to prove; but is there any chance for Hn to be easier to
compute using this formula than using the definition?
• For a = b + 2, we have
a b+2
b b b
k k ( b + 1) ( b + 2)
∑ b = ∑ b = ∑ ( b − k + 1) ( b − k + 2)
k=c k=c k=c
k k
b−c
( b + 1 ) ( b + 2 ) b − c +1 ( b + 1 ) ( b + 2 )
= ∑ ( i + 1) ( i + 2)
= ∑
i ( i + 1)
i =0 i =1
b − c +1
1 b−c+1
= ( b + 1) ( b + 2) ∑ i ( i + 1)
= ( b + 1) ( b + 2) ·
b−c+2
.
i =1
| {z }
b−c+1
=
b−c+2
(by (29))
Let us also list formulas for some higher values of a, in the particular case when
c = 0:
b+2
b
k
∑ b = ( b + 1)2 ;
k =0
k
b+3
b
k 1
∑ b =
4
( b + 1)2 ( b + 4) ;
k =0
k
b+4
b
k 1
∑ b =
18
(b + 1)2 b2 + 8b + 18 ;
k =0
k
b+5
b
k 1
∑ b =
96
(b + 1)2 (b + 6) b2 + 7b + 16 ;
k =0
k
b+6
b
k 1
∑ b =
600
(b + 1)2 b4 + 19b3 + 136b2 + 444b + 600 .
k =0
k
Do you see any patterns? (I’m seeing some, but no general rule.)
for each n ∈ N.
Set
1
bn = a n + (677)
q
1 1
for each n ∈ N. Thus, b0 = a0 + = s + . The definition of our sequence
|{z} q q
=s
( a0 , a1 , a2 , . . .) shows that an = an−1 (qan−1 + 2) for each integer n ≥ 1. Thus, for
each integer n ≥ 1, we have
1
bn = a n + (by the definition of bn )
q
1
= an−1 (qan−1 + 2) + (since an = an−1 (qan−1 + 2))
q
1 2
1 2 2 1 2
= q an−1 + 2qan−1 + 1 = (qan−1 + 1) = q · an−1 +
q| {z } q q
=(qan−1 +1)2
= q · bn2 −1 (678)
1
(since the definition of bn−1 yields an−1 + = bn−1 ).
q
From this, we can easily see that
n −1 n
bn = q 2 b02 (679)
2n
(sq + 1) − 1
, if q 6= 0;
an = q
n
2 s, if q = 0
2 n
2n k k −1
= ∑ s q .
k =1
k
(The last equality sign is easy to prove using the binomial theorem.)
[Remark: The above solution is not unmotivated. The reason for defining bn =
1
an + was to complete the square on the right hand side of an = an−1 (qan−1 + 2);
q
1 1
indeed, an−1 (qan−1 + 2) + = (qan−1 + 1)2 ensures that the right hand side
q q
In other words, (679) holds for n = m. This completes the induction step. Thus, (679) is proved.
1 1
becomes a square after addition of , and this reveals that the numbers bn = an +
q q
behave more predictably than the numbers an .]
a2m−1 − a2m−2
am = . (681)
a m −3
However, the definition of the Fibonacci sequence yields that f n = f n−1 + f n−2 for
each n ≥ 2. Thus, f m = f m−1 + f m−2 and f m−1 = f m−2 + f m−3 . The latter equality
entails f m−3 = f m−1 − f m−2 , so that f m−1 − f m−2 = f m−3 ≥ 0 (since all Fibonacci
numbers are nonnegative) and therefore f m−1 ≥ f m−2 , so that 2 f m−1 ≥ 2 f m−2 .
Thus, we can apply Lemma A.6.4 to 2 f m−1 and 2 f m−2 instead of n and m. We thus
obtain
f 2 f m−1 −2 f m−2 f 2 f m−1 +2 f m−2 = f 22f m−1 − (−1)2 f m−1 +2 f m−2 f 22f m−2 = f 22f m−1 − f 22f m−2 .
| {z }
=1
(since 2 f m−1 +2 f m−2
is clearly even)
Therefore,
f 22f m−1 − f 22f m−2 = f 2 f m−1 −2 f m−2 f 2 f m−1 +2 f m−2 = f 2 f m−3 f 2 f m
(since 2 f m−1 + 2 f m−2 = 2 ( f m−1 + f m−2 ) = 2 f m and 2 f m−1 − 2 f m−2 = 2 ( f m−1 − f m−2 ) =
| {z } | {z }
= fm = f m −3
f 22f m−1 − f 22f m−2
2 f m−3 ). Solving this equation for f 2 f m , we obtain f 2 f m = (here, we
f 2 f m −3
are using the fact that f 2 f m−3 6= 0, which follows from 2 f m−3 ≥ 2). Comparing this
| {z }
≥1
with (682), we obtain am = f 2 f m . This completes the induction step. Thus, (680) is
proved.]
The problem is thus solved. We note that the sequence ( a1 , a2 , a3 , . . .) is Sequence
A101361 in the OEIS.
student leaves386 . We claim that these two announcements are sufficient – i.e., each
student hears (at least) one of them.
Indeed, assume the contrary. Thus, there exists a student s who hears neither
the first nor the second announcement. Consider this student s. Let f be the
first student to leave the classroom, and let ` be the first late student to leave the
classroom (we assume that ` exists; the other case is even easier387 ). Now, we shall
prove that no two of the three students s, f and ` are ever together in the room.
Indeed, the student ` is late, and thus does not enter the classroom until after f
has left (by the definition of “late”). Hence, f and ` are never together in the room.
Moreover, the student s cannot have left before f (since f was first to leave), and
thus cannot have entered before f has left (since otherwise, s would have witnessed
the leaving of f , and thus would have heard the first announcement, contradicting
our definition of s). In other words, s is late. Hence, s cannot have left before `
(since ` was the first late student to leave), and thus cannot have entered before `
has left (since otherwise, s would have witnessed the leaving of `, and thus would
have heard the second announcement, contradicting our definition of s). Hence,
s has entered after ` has left. Therefore, s and ` are never together in the room.
Moreover, s and f are never together in the room (since s cannot have entered
before f has left, as we have seen above).
We have now shown that f and ` are never together in the room; that s and `
are never together in the room; and that s and f are never together in the room. In
other words, no two of the three students s, f and ` are ever together in the room.
This contradicts the assumption that among any three (distinct) students, there are
at least two that are together in the room at some moment.388 This contradiction
shows that our assumption was false. Hence, we have shown that each student
hears (at least) one of the two announcements. Thus, we have solved Exercise 5.4.7
(and, with it, solved Exercise 5.2.1 again).
distinct students, there are at least two that are together in the room at
some moment. The lecturer wants to make an announcement that every
student will hear. Prove that the lecturer can pick k − 1 moments at
which to make the announcement so that each student will hear it. (We
assume that the announcement takes no time – i.e., if a student leaves
at the same moment that another student enters, the lecturer can make
the announcement at this moment and both students will hear it.)
We solve this restated exercise using the following method (which generalizes
our above solution to Exercise 5.4.7):
• The lecturer makes the first announcement when the first student leaves. Any
student who, at this moment, has not entered the classroom yet will be called
late.
• The lecturer makes the second announcement when the first late student
leaves390 . Any student who, at this moment, has not entered the classroom
yet will be called doubly late.
• The lecturer makes the second announcement when the first doubly late stu-
dent leaves391 . Any student who, at this moment, has not entered the class-
room yet will be called triply late.
• And so on.
The lecturer stops this process after k − 1 announcements. We claim that each
student will have heard (at least) one of these k − 1 announcements. Indeed, if
there was a student s who hears none of them, then we could show (similarly
to how we did this in the above solution of Exercise 5.4.7) that there would be k
students no two of whom had ever been in the classroom at the same time (namely,
the student s, the first student to leave, the first late student to leave, the first
doubly late student to leave, etc.). To be fully precise, this argument would have
to be tweaked for the case when (e.g.) there are no doubly late students at all; but
this is fairly easy.
A conceptually simpler (but essentially equivalent) way to solve Exercise 5.4.8 is
by induction on k. The idea (again stated in terms of students) is to make the first
announcement when the first student leaves, and then forget about all students
who have heard this announcement. The remaining students have the property
that among any k − 1 of them, there are at least two that are together in the room at
some moment (because the first student that has left has not overlapped with any
of them); thus, by the induction hypothesis, k − 2 announcements will suffice for
them. Altogether, the lecturer will thus make 1 + (k − 2) = k − 1 announcements
and be heard by each student.
390 or,in the case when there are no late students, at the end of class
391 Again, if there are no doubly late students, then this announcement will be made at the end of
class (and likewise for all future announcements).
[Proof of Claim 1: Write each interval Im as [ pm , qm ] for two reals pm and qm . Thus,
each m ∈ {1, 2, . . . , n} satisfies
Im = [ pm , qm ] (683)
and therefore [ pm , qm ] = Im 6= ∅ (since Im is nonempty), so that
pm ≤ qm . (684)
Let
b = min {q1 , q2 , . . . , qn } . (685)
We shall show that each of the intervals I1 , I2 , . . . , In contains b.
Indeed, let j ∈ {1, 2, . . . , n}. We shall show that b ∈ Ij .
We have
b = min {q1 , q2 , . . . , qn } ∈ {q1 , q2 , . . . , qn }
(since the minimum of a set always lies in this set). In other words, there exists
some k ∈ {1, 2, . . . , n} such that b = qk . Consider this k.
Applying (683) to m = k, we obtain Ik = [ pk , qk ]. But applying (684) to m = k, we
obtain pk ≤ qk . Hence, qk ∈ [ pk , qk ] = Ik , so that b = qk ∈ Ik .
Now, our goal is to show that b ∈ Ij . If j = k, then this follows directly from
b ∈ Ik . Thus, for the rest of this proof, we WLOG assume that j 6= k. Thus, j and k
are two distinct elements of {1, 2, . . . , n}.
Recall our assumption that for any 2 distinct elements i1 , i2 ∈ {1, 2, . . . , n}, at
least two of the 2 intervals Ii1 , Ii2 intersect. Applying this to i1 = j and i2 = k, we
conclude that at least two of the 2 intervals Ij , Ik intersect (since j, k are 2 distinct
elements of {1, 2, . . . , n}). In other words, the two intervals Ij and Ik intersect (since
the only way to pick two of the 2 intervals Ij , Ik is to pick Ij and Ik ). In other words,
Ij ∩ Ik 6= ∅.
392 Unfortunately,this is a good example of a proof that heavily increases in length and decreases
in readability when it is formalized. Arguably, it could be that it is just me formalizing it badly
(suggestions for improvement are greatly encouraged!); but it is a sad empirical fact that this
happens to most writers with most proofs in combinatorics.
Recall that Ik = [ pk , qk ]. Also, (683) (applied to m = j) yields Ij = p j , q j . Recall
that Ij ∩ Ik 6= ∅. In other words, there exists some c ∈ Ij ∩ Ik . Consider this c.
From c ∈ Ij ∩ Ik ⊆ Ij = p j , q j , we obtain c ≥ p j . From c ∈ Ij ∩ Ik ⊆ Ik = [ pk , qk ],
we obtain c ≤ qk . Hence, qk ≥ c ≥ p j . Recalling that b = qk , we thus obtain
b = qk ≥ p j .
We have b = min {q1 , q2 , . . . , qn }. In other words, b is the smallest of the n
numbers q1 , q2 , . . . , qn . Hence, b ≤ qi for each i ∈ {1, 2, . . . , n}. Applying this to
i = j, we find b ≤ q j . Combining this with b ≥ p j , we obtain b ∈ p j , q j = Ij .
Forget that we fixed j. We thus have shown that b ∈ Ij for each j ∈ {1, 2, . . . , n}.
In other words, each of the intervals I1 , I2 , . . . , In contains b. Thus, there exists a real
a1 such that each of the intervals I1 , I2 , . . . , In contains at least one of a1 (namely,
a1 = b). In other words, there exist 2 − 1 reals a1 , a2 , . . . , a2−1 such that each of
the intervals I1 , I2 , . . . , In contains at least one of a1 , a2 , . . . , a2−1 (because 2 − 1 reals
a1 , a2 , . . . , a2−1 are the same as a single real a1 ). This proves Claim 1.]
Claim 1 is precisely the claim of Exercise 5.4.8 for k = 2; thus, Exercise 5.4.8 holds
for k = 2 (since we have proved Claim 1). This completes the induction base.
Induction step: Fix an integer ` ≥ 2. Assume (as the induction hypothesis) that
Exercise 5.4.8 holds for k = `. We must prove that Exercise 5.4.8 holds for k = ` + 1.
We have assumed that Exercise 5.4.8 holds for k = `. In other words, the follow-
ing claim holds:
We must prove that Exercise 5.4.8 holds for k = ` + 1. In other words, we must
prove the following claim:
[Proof of Claim 3: Write each interval Im as [ pm , qm ] for two reals pm and qm . Thus,
each m ∈ {1, 2, . . . , n} satisfies
Im = [ pm , qm ] (686)
and therefore [ pm , qm ] = Im 6= ∅ (since Im is nonempty), so that
pm ≤ qm . (687)
Let
b = min {q1 , q2 , . . . , qn } . (688)
[Proof of (691): Let u ∈ {1, 2, . . . , s − 1}. We must show that the intervals Iu and
Ik do not intersect.
Assume the contrary. Thus, the intervals Iu and Ik intersect. In other words,
Iu ∩ Ik 6= ∅. Hence, there exists some c ∈ Iu ∩ Ik . Consider this c. We have
c ∈ Iu ∩ Ik ⊆ Iu = [ pu , qu ] (by (686), applied to m = u). Thus, c ≥ pu , so that
393 Proof. Let j ∈ {s, s + 1, . . . , n}. We shall show that b ∈ Ij .
Indeed, (686) (applied to m = j) yields Ij = p j , q j . Now, j ∈ {s, s + 1, . . . , n}, so that s ≤ j ≤ n.
But (690) shows that pα ≥ p β for any two elements α and β of {1, 2, . . . , n} satisfying α ≤ β.
Applying this to α = s and β = j, we find ps ≥ p j (since s ≤ j), so that p j ≤ ps ≤ b. Hence,
b ≥ p j . But (689) yields b ≤ q j . Combining this with b ≥ p j , we find b ∈ p j , q j = Ij .
Forget that we fixed j. We thus have shown that b ∈ Ij for each j ∈ {s, s + 1, . . . , n}. In other
words, each of the intervals Is , Is+1 , . . . , In contains b.
394 Proof. Assume that s = 1. We have just shown that each of the intervals I , I
s s+1 , . . . , In contains b.
In view of s = 1, we can rewrite this as follows: Each of the intervals I1 , I2 , . . . , In contains b. In
other words, each of the intervals I1 , I2 , . . . , In contains at least one of the ` reals b, b, . . . , b (since
| {z }
` times
` ≥ 2 ≥ 1). Hence, there exist ` reals a1 , a2 , . . . , a` such that each of the intervals I1 , I2 , . . . , In
contains at least one of a1 , a2 , . . . , a` (namely, ai = b for each i ∈ {1, 2, . . . , `}). This proves Claim
3. Thus, Claim 3 is proved under the assumption that s = 1.
iα = i β = i`+1 (since β = ` + 1)
= k,
α, β ∈ {1, 2, . . . , ` + 1} with α < β and with the property that the intervals Iiα and
Ii β intersect. Consider these α and β.
We have α < β ≤ ` + 1 (since β ∈ {1, 2, . . . , ` + 1}), so that α ≤ (` + 1) − 1 (since α
and ` + 1 are integers). Thus, α ≤ (` + 1) − 1 = `, so that α ∈ {1, 2, . . . , `} (since α ∈
{1, 2, . . . , ` + 1} ⊆ {1, 2, 3, . . .}). Therefore, iα is one of the ` elements i1 , i2 , . . . , i` .
Hence, iα ∈ {1, 2, . . . , s − 1} (since i1 , i2 , . . . , i` are elements of {1, 2, . . . , s − 1}).
Hence, (691) (applied to u = iα ) yields that the intervals Iiα and Ik do not inter-
sect.
However, the intervals Iiα and Ii β intersect. If we had i β = k, then this would
entail that the intervals Iiα and Ik intersect; but this would contradict the fact that
the intervals Iiα and Ik do not intersect. Hence, we cannot have i β = k. Thus, we
have i β 6= k.
If we had β = ` + 1, then we would have i β = i`+1 = k, which would con-
tradict i β 6= k. Thus, we cannot have β = ` + 1. Hence, β 6= ` + 1. From
β ∈ {1, 2, . . . , ` + 1} and β 6= ` + 1, we obtain β ∈ {1, 2, . . . , ` + 1} \ {` + 1} =
{1, 2, . . . , `}.
Thus, we know that α and β are two distinct elements of {1, 2, . . . , `} (since α ∈
{1, 2, . . . , `} and β ∈ {1, 2, . . . , `} and α < β). Hence, the intervals Iiα and Iiβ do not
intersect (since no two of the ` intervals Ii1 , Ii2 , . . . , Ii` intersect). This contradicts
the fact that the intervals Iiα and Ii β intersect. This contradiction shows that our
assumption was wrong. Hence, we have shown that at least two of the ` intervals
Ii1 , Ii2 , . . . , Ii` intersect. This proves (693).]
Now, (693) shows that for any ` distinct elements i1 , i2 , . . . , i` ∈ {1, 2, . . . , s − 1},
at least two of the ` intervals Ii1 , Ii2 , . . . , Ii` intersect. Hence, we can apply Claim 2 to
s − 1 instead of n (since s − 1 is a positive integer, and since I1 , I2 , . . . , Is−1 are s − 1
nonempty finite closed intervals on the real axis). As a result, we conclude that
there exist ` − 1 reals a1 , a2 , . . . , a`−1 such that each of the intervals I1 , I2 , . . . , Is−1
contains at least one of a1 , a2 , . . . , a`−1 . Consider these ` − 1 reals a1 , a2 , . . . , a`−1 .
Extend the (` − 1)-tuple ( a1 , a2 , . . . , a`−1 ) to an `-tuple ( a1 , a2 , . . . , a` ) by setting a` =
b.
Now, it is easy to see that for each h ∈ {1, 2, . . . , n},
the interval Ih contains at least one of a1 , a2 , . . . , a` . (694)
[Proof of (694): Let h ∈ {1, 2, . . . , n}. We must prove that the interval Ih contains
at least one of a1 , a2 , . . . , a` . We are in one of the following two cases:
Case 1: We have h < s.
Case 2: We have h ≥ s.
Let us first consider Case 1. In this case, we have h < s. Thus, h ≤ s − 1
(since h and s are integers), so that h ∈ {1, 2, . . . , s − 1} (since h ∈ {1, 2, . . . , n} ⊆
{1, 2, 3, . . .}). Thus, Ih is one of the intervals I1 , I2 , . . . , Is−1 .
Recall that each of the intervals I1 , I2 , . . . , Is−1 contains at least one of a1 , a2 , . . . , a`−1 .
Hence, Ih contains at least one of a1 , a2 , . . . , a`−1 (since Ih is one of the intervals
I1 , I2 , . . . , Is−1 ). Therefore, Ih contains at least one of a1 , a2 , . . . , a` . Thus, (694) is
proved in Case 1.
The following second solution may appear very different from the first, but in
truth is closely related: It simply formalizes and applies the idea of our solution to
Exercise 5.2.4 straight to our sequence ( x0 , x1 , x2 , . . .), without the detour of restat-
ing it in terms of cars and gas stations. The resulting argument is more rigorous
and perhaps also more readable, although less vivid and intuitive.
Second solution to Exercise 5.4.9. For each m ∈ N, we define a real number
s m = x 0 + x 1 + · · · + x m −1 . (696)
si = si +n . (698)
s j+1 = x0 + x1 + · · · + x( j+1)−1
= x0 + x1 + · · · + x j (since ( j + 1) − 1 = j)
= x 0 + x 1 + · · · + x j −1 + xj = s j+n + x j+n . (699)
| {z } |{z}
=s j =s j+n = x j+n
(by (697),
applied to i = j)
s j+n+1 = x0 + x1 + · · · + x( j+n+1)−1
= x0 + x1 + · · · + x j + n (since ( j + n + 1) − 1 = j + n)
= x 0 + x 1 + · · · + x j + n −1 + x j + n = s j + n + x j + n .
| {z }
=s j+n
397 Thisis, again, an application of Theorem 5.1.1: Indeed, the set {su | u ∈ {0, 1, . . . , n − 1}} is
nonempty (since n is positive) and finite; thus, it has a minimum (by Theorem 5.1.1). If we
denote this minimum by g, then g ∈ {su | u ∈ {0, 1, . . . , n − 1}} (since the minimum of a set
always belongs to this set), and thus there exists some u ∈ {0, 1, . . . , n − 1} such that g = su . We
pick such a u.
Claim 1: The golden pairs different from (0, 1) are the pairs ( f n+1 , f n )
for n ∈ N (that is, the pairs ( f 1 , f 0 ), ( f 2 , f 1 ), ( f 3 , f 2 ), . . .).
We shall prove Claim 1 after some preparatory work. First, we prove the easy
direction:
Therefore,
f n +2 f n − f n2+1 = − f n2+1 − f n +1 f n − f n2 = f n2+1 − f n+1 f n − f n2
f n+2 f n − f n2+1 = (−1)n+1 = 1 since (−1)n+1 is either 1 or − 1 ,
| {z }
=(−1)n+1
Observation 3: Every fibonacci pair is a golden pair different from (0, 1).
( x, y) is fibonacci. (702)
y + ( x − y) = x < m.
Now, we know that (y, x − y) is a golden pair different from (0, 1) (since (y, x − y) 6=
(0, 1)) and satisfying y + ( x − y) < m. Hence, we can apply (702) to (y, x − y) in-
stead of ( x, y). As a consequence, we conclude that the pair (y, x − y) is fibonacci.
398 since
(1, 0) = ( f n+1 , f n ) for n = 0
399 Proof.
Assume the contrary. Thus, (y, x − y) = (0, 1). In other words, y = 0 and x − y = 1.
Hence, x = y + x − y = 0 + 1 = 1. Combined with y = 0, this yields ( x, y) = (1, 0); but this
|{z} | {z }
=0 =1
contradicts ( x, y) 6= (1, 0). This contradiction shows that our assumption was false. Qed.
In other words, (y, x − y) has the form ( f n+1 , f n ) for some n ∈ N (by the defi-
nition of “fibonacci”). Consider this n, and denote it by u. Thus, u ∈ N and
(y, x − y) = ( f u+1 , f u ).
From (y, x − y) = ( f u+1 , f u ), we obtain y = f u+1 and x − y = f u . Now, x =
y + x − y = f u +1 + f u .
|{z} | {z }
= f u +1 = fu
But the recursive definition of the Fibonacci sequence yields f p = f p−1 + f p−2 for
each integer p ≥ 2. Applying this to p = u + 2, we obtain f u+2 = f (u+2)−1 + f (u+2)−2 =
| {z } | {z }
= f u +1 = fu
f u+1 + f u . Hence, x = f u+1 + f u = f u+2 = f (u+1)+1 . Combining this with y = f u+1 ,
we obtain ( x, y) = f (u+1)+1 , f u+1 . Hence, the pair ( x, y) has the form ( f n+1 , f n )
for some n ∈ N (namely, for n = u + 1). In other words, the pair ( x, y) is fibonacci
(by the definition of “fibonacci”).
Forget that we fixed ( x, y). We thus have shown that if ( x, y) is a golden pair
different from (0, 1) and satisfying x + y = m, then ( x, y) is fibonacci. In other
words, Observation 4 holds for x + y = m. This completes the induction step.
Thus, Observation 4 is proved.]
Observation 4 can be restated as follows:
Combining this with Observation 3, we conclude that the golden pairs differ-
ent from (0, 1) are precisely the fibonacci pairs. In other words, the golden pairs
different from (0, 1) are precisely the pairs of the form ( f n+1 , f n ) for some n ∈ N
(because this is how the fibonacci pairs are defined). This proves Claim 1. Thus,
Exercise 5.4.10 (d) is solved.
[Remark: Exercise 5.4.10 (d) is a result of Lucas (1876). A proof similar to ours is
given in [Jones75, Lemmas 1, 2, 3].
Note that our proof is an example of an argument by infinite descent, even
though we have formulated it as a strong induction argument. To see this, it
suffices to rewrite Observation 4 above as “there exists no non-fibonacci golden
pair different from (0, 1)”, and reframe our proof of Observation 4 as transforming
an (ostensible) non-fibonacci golden pair ( x, y) different from (0, 1) into a smaller
non-fibonacci golden pair (y, x − y) which is also different from (0, 1). (“Smaller”
here means “smaller sum of entries”.) We chose to instead organize our proof as a
strong induction argument, in order to avoid the detour through the contrapositive;
but it is probably easiest to find this proof by attempting an infinite descent.
We have thus solved the equation x2 − xy − y2 = 1 in nonnegative integers x
and y. This is an example of a quadratic Diophantine equation, closely connected to
the Pell equation x2 − 5y2 = 1 (see [AndAnd14] for the connection). Similar argu-
ments can be used for solving other equations like this; it is not a coincidence that
the solutions in our case were given by the Fibonacci numbers. Usually, solutions
(when they exist) are given by (u, v)-recurrent sequences for some values of u and
However, the players a and b are distinct (since b is different from a), and thus
there must be a match between a and b (since each pair of distinct players play
exactly one match against one another). This match cannot have been won by a
(since a has not won a match against b), and thus must have been won by b (since
no match ends with a draw). Hence, b has won a match against a. In other words,
b has directly owned a (since “directly owning” a means winning a match against
a).
Let Y be the set of all players that b has directly owned. Thus,
(since the score of b is defined as the number of all players that b has directly
owned). Moreover, we recall that b has directly owned a; in other words, a ∈ Y
(since Y is the set of all players that b has directly owned). Hence, |Y \ { a}| =
|Y | − 1.
Let X be the set of all players that a has directly owned. Thus,
Observation 1’: If there exists a non-flat solution, then there exists a non-
negative non-flat solution.
[Proof of Observation 1’: This can be proved in the same way as Observation 1 was
proved in our solution to Exercise 5.3.2.]
Thanks to Observation 1’, we don’t need to bother with negative integers if we
don’t want to. This will come useful later.
so that a1 ≡ t mod 2.
Thus, by removing a1 and applying the weaker splitting property, we have ob-
tained a1 ≡ t mod 2. But we can apply the same argument to any of the 2n integers
a1 , a2 , . . . , a2n in place of a1 . Thus, we find that
ai ≡ t mod 2 (704)
for each i ∈ {1, 2, . . . , 2n}. Using (40), we now have
2n 2n
∑ ai
|{z}
≡ ∑ t = 2nt ≡ 0 mod 2
i =1 i =1
≡t mod 2
(by (704))
Hence, a2n+1 ≡ t mod 2. Thus, the congruence (704) holds not only for each i ∈
{1, 2, . . . , 2n}, but also for i = 2n + 1. Hence, this congruence (704) holds for each
i ∈ {1, 2, . . . , 2n + 1}. As a consequence,
Thus, a1 , a2 , . . . , a2n+1 all have the same parity. This proves Observation 2’.]
Now, Observation 2’ helps us transform non-flat solutions into smaller non-flat
solutions with an appropriate meaning of “smaller”. To be more precise, we con-
sider nonnegative solutions. If ( a1 , a2 , . . . , a2n+1 ) is a nonnegative solution, then the
weight of this solution is defined to be the nonnegative integer a1 + a2 + · · · + a2n+1 .
Now we claim:
[Proof of Observation 3’: This can be proved in the same way as Observation 3
was proved in our solution to Exercise 5.3.2. (Of course, we now need to use
Observation 2’ instead of Observation 2.)]
Now, all we need is to reap our rewards. By the Principle of Infinite Descent,
Observation 3’ entails that there exists no nonnegative non-flat solution. Hence, by
Observation 1’, we conclude that there exists no non-flat solution either. In other
words, any solution is flat. Exercise 6.3.2 is solved.
(by the definition of “a-periodic”). Thus, if u and v are two nonnegative integers
satisfying u ≡ v mod a, then
f i +u ( x ) = f i +v ( x ) (705)
Define an integer s by
s = 1 + ( p − q − i − 1) %a.
s = 1 + ( p − q − i − 1) %a ≡ 1 + ( p − q − i − 1) = p − q − i mod a.
| {z }
≡ p−q−i −1 mod a
Hence,
(i + 2s + q) − (s + p) = s
|{z} +i + q − p ≡ p − q − i + i + q − p ≡ 0 mod a.
≡ p−q−i mod a
i + 2s + q ≡ s + p mod a.
Proof of Theorem 6.2.10. Exercise 6.3.3 (applied to p = 0 and q = 0) yields that there
exists some k ∈ {1, 2, . . . , n} such that f k+0 ( x ) = f 2k+0 ( x ). In other words, there
exists some k ∈ {1, 2, . . . , n} such that f k ( x ) = f 2k ( x ) (since k + 0 = k and 2k + 0 =
2k). This proves Theorem 6.2.10.
f i ( X ) 6 = f i +1 ( X ) . (706)
402 Proof. The set X is nonempty. Hence, there exists some x ∈ X. Consider this x. Thus, f n ( x ) ∈
f n ( X ) (since x ∈ X). Therefore, the set f n ( X ) has an element (namely, f n ( x )), and thus is
nonempty. Qed.
n −1
∑ f i +1 ( X ) − f i ( X ) = f (n−1)+1 ( X ) − f 0 ( X )
i =0
| {z }
n
| {z }
=f =n
!
by Corollary 4.1.17,
applied to u = 0 and v = n − 1 and ai = f i ( X )
= | f n ( X )| −n ≥ 1 − n > −n.
| {z }
≥1
f ( j+1)k = f k+ jk = f k ◦ f jk
(here, we have split off the factor k from the product, because k ∈ {1, 2, . . . , n}).
Set s = ∏ i. Then, s is a positive integer (since s is defined as a product of
i ∈{1,2,...,n};
i 6=k
positive integers). Hence, 2s is a positive integer as well.
The equality (709) rewrites as n! = k · s (since s = ∏ i). Thus, n! = k · s =
i ∈{1,2,...,n};
i 6=k
sk, so that
f n! ( x ) = f sk ( x ) = f k ( x ) (710)
n! = 2sk, so that
(by Exercise 6.3.5 (a), applied to i = s). Also, 2 |{z}
=sk
f 2n! ( x ) = f 2sk ( x ) = f k ( x )
(by Exercise 6.3.5 (a), applied to i = 2s). Comparing this with (710), we obtain
f n! ( x ) = f 2n! ( x ).
Now, forget that we fixed x. We thus have proved that f n! ( x ) = f 2n! ( x ) for each
x ∈ X. In other words, f n! = f 2n! . This solves Exercise 6.3.5 (b).
(c) Assume that f is a permutation of X.
The map f is a permutation, thus bijective (by the definition of a permutation).
Hence, its power f n! = f ◦ f ◦ · · · ◦ f is bijective as well (since a composition of
| {z }
n! times
bijective maps is always bijective). Thus, in particular, this map f n! is injective.
Now, let x ∈ X. Exercise 6.3.5 (b) yields f n! = f 2n! . But 2n! = n! + n! and
thus f 2n! = f n!+n! = f n! ◦f n! . Hence, f n! = f 2n! = f n! ◦ f n! , so that f n! ( x ) =
f n! ◦ f n! ( x ) = f n! f n! ( x ) . Therefore, x = f n! ( x ) (since the map f n! is injective).
Consequently, f n! ( x ) = x = idX ( x ).
Forget that we fixed x. We thus have shown that f n! ( x ) = idX ( x ) for each x ∈ X.
In other words, f n! = idX . This solves Exercise 6.3.5 (c).
[Remark: Our above solution to Exercise 6.3.5 (c) is not how this exercise is usually
solved. A more common approach to Exercise 6.3.5 (c) uses the notion of a group
(in the sense of group theory), and the following facts:
• The group of all permutations of a given n-element set X has size n!.
The first of these two facts is a basic fact in enumerative combinatorics (see, e.g.,
our Theorem 7.4.1, or [Loehr11, Theorem 1.28] or [Grinbe15, Corollary 7.82]); the
second is a known result in elementary group theory (see, e.g., [Loehr11, Theorem
9.119] or [Elman20, Corollary 10.12] or [Goodma15, Corollary 2.5.9] or [Steinb06,
Corollary 3.2.10]). Combining these two facts, we conclude that f n! = idX for each
permutation f of X (since the permutations of X form a finite group with size n!
and identity element idX ). This solves Exercise 6.3.5 (c) again.]
1 = xb + y |{z}
m ≡ xb + y · 0 = xb = bx mod m.
≡0 mod m
In other words,
bx ≡ 1 mod m. (711)
Now, we define a map g : M × M → M × M by
−−−−−−→
g (( p, q)) = x (q − ap), p for each ( p, q) ∈ M × M.
−−−−−−→
This is well-defined, since each ( p, q) ∈ M × M satisfies x (q − ap), p ∈ M × M
−−−−−−→
(because x (q − ap) = ( x (q − ap)) %m ∈ {0, 1, . . . , m − 1} = M and p ∈ M).
−−−−−−→
w = x (q − ap) ≡ x (q − ap) mod m (712)
−−−−−−→
(since x (q − ap) = w). Now,
−−−−→
( f ◦ g) (α) = f g (α) = f ((w, p)) = p, ap + bw (713)
| {z }
=(w,p)
−−−−→
(by the definition of f ). We will now show that ap + bw = q.
Indeed, (270) (applied to z = ap + bw) yields
−−−−→
ap + bw ≡ ap + b w
|{z} ≡ ap + |{z}
bx (q − ap)
≡ x (q− ap) mod m ≡1 mod m
(by (712)) (by (711))
≡ ap + (q − ap) = q mod m.
−−−−→
Moreover, ap + bw ∈ {0, 1, . . . , m − 1} (since every integer z satisfies − →
z = z%m ∈
−−−−→
{0, 1, . . . , m − 1}). Hence, Proposition 3.3.2 (c) (applied to m, q and ap + bw instead
−−−−→ −−−−→
of n, u and c) yields ap + bw = q%m (since ap + bw ≡ q mod m).
But from ( p, q) ∈ M × M, we obtain q ∈ M = {0, 1, . . . , m − 1}. Hence, Propo-
sition 3.3.2 (c) (applied to m, q and q instead of n, u and c) yields q = q%m (since
−−−−→ −−−−→
q ≡ q mod m). Comparing this with ap + bw = q%m, we obtain ap + bw = q. Thus,
(713) becomes
−−−−→
( f ◦ g) (α) = p, ap + bw = ( p, q) = α = id M× M (α) .
| {z }
=q
Forget that we fixed α. Thus we have shown that ( f ◦ g) (α) = id M× M (α) for
each α ∈ M × M. In other words, f ◦ g = id M× M .
We could now prove g ◦ f = id M× M by a similar argument, and then conclude
that the maps f and g are mutually inverse, whence f is bijective. However, let
us instead take a shortcut: The set M × M is finite (since M is finite) and clearly
x i +2 = a x i +1 +b xi ≡ a−
x−→ −
→
i +1 + b xi mod m.
|{z} |{z}
≡−
x− →
i +1 mod m ≡−
→
xi mod m
− −−−−−−−− →
x−→ −−→ −
→ −→ −
→
i +2 = xi +2 %m = a xi +1 + b xi %m = a xi +1 + b xi (714)
−−−−−−− → −−−−−−−− →
(since the definition of a−
x−→ −
→ −→ −
→ −−→ −
→
i +1 + b xi yields a xi +1 + b xi = a xi +1 + b xi %m).
Now, the definition of f yields
−−→ −− −−−−−− →
f −
→ −− →
x i , x i +1 = x , a x− → + b −
→
x = −
x−→, − x−→ .
i + 1 i + 1 i i + 1 i +2
| {z }
−−→
= x i +2
(by (714))
−
→
xj , −
x−→ j j+1 = f ◦ f j , so that
j+1 = f ( ω ). But f
= f −
→ −−→
f j +1 ( ω ) = f ◦ f j ( ω ) = f
j
f (
| {z } ω ) x j , x j +1
=(− →
x j ,−
x− →
j +1 )
= −
x− → −−→
j +1 , x j +2 (by Claim 2, applied to i = j)
= −x−→, − x −−−→
j +1 ( j+1)+1 (since j + 2 = ( j + 1) + 1) .
−−→ −−−− →
In other words, x j+1 , x( j+1)+1 = f j+1 (ω ). This completes the induction step.
Thus, Claim 3 is proven.]
We have now proved Claims 1, 2 and 3; thus, Exercise 6.3.6 is solved.
Proof of Theorem A.7.1. Informally, the idea is the following: If x = p, then this is
clear (just set k = 1). But if x 6= p, then we can “throw away” the element p from
the set X (indeed, f ( p) = p shows that p does not “interfere” with the remaining
elements of X), and obtain an (n − 1)-element set X \ { p}, to which we can apply
Theorem 6.2.8 (a).
Here are the details of this argument: It is easy to see that Theorem A.7.1 holds
if x = p 403 . Hence, for the rest of this proof, we WLOG assume that x 6= p.
The map f is a permutation of X; thus, f is a bijection. Hence, f is bijective, thus
injective.
Set Y = X \ { p}. Thus, |Y | = | X \ { p}| = | X | − 1 (since p ∈ X), so that |Y | =
| X | −1 = n − 1. In particular, the set Y is finite.
|{z}
=n
Combining x ∈ X with x 6= p, we obtain x ∈ X \ { p} = Y (since Y = X \ { p}).
403 Proof.
Assume that x = p. Note that n − 1 > 0 (since n > 1), so that n − 1 is a positive integer.
Hence, 1 ∈ {1, 2, . . . , n − 1}. Furthermore, f 1 ( p) = f ( p) = p. In other words, f 1 ( x ) = x
|{z}
=f
(since x = p). So the element 1 ∈ {1, 2, . . . , n − 1} satisfies f 1 ( x ) = x. Hence, there exists a
k ∈ {1, 2, . . . , n − 1} such that f k ( x ) = x (namely, k = 1). In other words, the claim of Theorem
A.7.1 holds. Thus, Theorem A.7.1 is proved under the assumption that x = p.
For each y ∈ Y, we have f (y) ∈ Y 404 . Thus, we can define the map
g : Y → Y,
y 7→ f (y) .
This map g is “essentially just” the map f , except with the element p removed from
its domain and target.
It is easy to see (by a straightforward induction) that
Induction base: We have g0 = idY and thus g0 ( x ) = idY ( x ) = x. Also, f 0 = idX and thus
f ( x ) = idX ( x ) = x. Hence, g0 ( x ) = x = f 0 ( x ). In other words, (715) holds for k = 0.
0
Induction step: Let ` ∈ N. Assume (as the induction hypothesis) that (715) holds for k = `. We
must prove that (715) holds for k = ` + 1. In other words, we must prove that g`+1 ( x ) = f `+1 ( x ).
We have assumed that (715) holds for k = `. In other words, g` ( x ) = f ` ( x ). Now,
g`+1 ( x ) = g ◦ g` ( x ) = g
`
= g f ` (x)
g ( x
| {z } )
|{z}
= g◦ g` = f ` (x)
= f f ` (x) (by the definition of g)
= f ◦ f ` ( x ) = f `+1 ( x ) .
| {z }
= f `+1
−
→ −
→
The definition of 0 yields 0 = 0%m = 0. Now, the definition of f yields
−−−−−−→ − →
f ((0, 0)) = 0, a · 0 + b · 0 = 0, 0 (since a · 0 + b · 0 = 0)
−
→
= (0, 0) since 0 = 0 .
We also know (from Claim 1 in our solution to Exercise 6.2.3) that the map f is
bijective. Hence, f is a permutation of the set M × M. Moreover, from m > 1,
we obtain m2 > 1. Hence, we can apply Theorem A.7.1 to X = M × M, n = m2 ,
p = (0, 0) and x = ω (since | M × M | = m2 ). This yields that there exists a k ∈
1, 2, . . . , m2 − 1 such that f k (ω ) = ω. Consider this k.
Now, it is easy to see that the sequence ( x0 %m, x1 %m, x2 %m, . . .) is k-periodic (in-
deed, this canbe shown exactly as in the solution to Exercise 6.2.3). Thus, we have
found a k ∈ 1, 2, . . . , m2 − 1 such that the sequence ( x0 %m, x1 %m, x2 %m, . . .) is
k-periodic. This solves Exercise 6.3.7.
bi = a 1 + a 2 + · · · + a i . (716)
• Set
bn = a 2 . (717)
are n + 1 elements of the n-element set {0, 1, . . . , n − 1} (since they are remainders
upon division by n), and thus at least two of them must be equal (by the Pigeonhole
Principle407 ). In other words, there exist two integers u and v with 0 ≤ u < v ≤ n
407 To
be more specific: by Corollary 6.1.4 (applied to n + 1, {0, 1, . . . , n − 1} and bi−1 %n instead of
m, V and ai ).
bv − bu = ( a1 + a2 + · · · + a v ) − ( a1 + a2 + · · · + a u )
|{z} |{z}
= a1 + a2 +···+ av = a1 + a2 +···+ au
= a u +1 + a u +2 + · · · + a v (since u < v)
= ∑ ai ,
i ∈{u+1,u+2,...,v}
n | bv − bu = a 2 − bu | − ( a 2 − bu ) = bu − a 2 .
|{z}
= a2
(here, we have split off the addend for i = 2 from the sum, since 2 ∈ {1, 2, . . . , u}).
Therefore,
bu − a 2 = ∑ ai . (718)
i ∈{1,2,...,u}\{2}
Now, recall that n | bu − a2 . In view of (718), this rewrites as n | ∑ ai .
i ∈{1,2,...,u}\{2}
Since we know that {1, 2, . . . , u} \ {2} is a nonempty subset of {1, 2, . . . , n − 1}, we
can thus conclude that there exists a nonempty subset I of {1, 2, . . . , n − 1} such
that n | ∑ ai (namely, I = {1, 2, . . . , u} \ {2}). Hence, Exercise 6.3.8 is solved in
i∈ I
Subcase 2.2.
We have now solved Exercise 6.3.8 in both Subcases 2.1 and 2.2. Hence, Exercise
6.3.8 holds in Case 2.
We have now solved Exercise 6.3.8 in both Cases 1 and 2. Thus, the solution to
Exercise 6.3.8 is complete.
Proof of Lemma A.7.3. Let p = b ac and q = bbc. Thus, p and q are integers (since the
floor of any real number is an integer). In other words, p ∈ Z and q ∈ Z. Hence,
p − q ∈ Z and p − q − 1 ∈ Z.
The definition of frac a yields frac a = a − b ac = a − p. The definition of frac b
|{z}
=p
yields frac b = b − bbc = b − q.
|{z}
=q
The chain of inequalities (1) (applied to x = a) says that b ac ≤ a < b ac + 1. In
view of p = b ac, this rewrites as p ≤ a < p + 1. The same argument (applied to b
and q instead of a and p) yields q ≤ b < q + 1.
(a) Assume that frac a ≥ frac b. This rewrites as a − p ≥ b − q (since frac a = a − p
and frac b = b − q). In other words, a + q ≥ b + p. In other words, a − b ≥ p − q.
That is, p − q ≤ a − b. Moreover, |{z}
a − |{z} b < p + 1 − q = p − q + 1. Hence,
< p +1 ≥q
(since q≤b)
p − q ≤ a − b < p − q + 1. Therefore, Lemma A.7.2 (applied to x = a − b and
r = p − q) yields that b a − bc = p − q and frac ( a − b) = ( a − b) − ( p − q). Hence,
frac ( a − b) = ( a − b) − ( p − q) = ( a − p) − (b − q) = frac a − frac b.
| {z } | {z }
=frac a =frac b
(since frac a= a− p) (since frac b=b−q)
408 Don’t mistake this for a rigorous statement.
frac ( a − b) = ( a − b) − ( p − q − 1) = ( a − p) − (b − q) +1
| {z } | {z }
=frac a =frac b
(since frac a= a− p) (since frac b=b−q)
= frac a − frac b + 1.
n−1 n
0 1 1 2
I1 = , , I2 = , , ..., In = ,
n n n n n n
k−1 k
(that is, Ik = , for each k ∈ {1, 2, . . . , n}). The union of these n intervals
n n
is I1 ∪ I2 ∪ · · · ∪ In = [0, 1); furthermore, these n intervals I1 , I2 , . . . , In are disjoint.
Hence, each number y ∈ [0, 1) lies in exactly one of these n intervals I1 , I2 , . . . , In .
Now, consider the n + 1 numbers frac (0x ) , frac (1x ) , . . . , frac (nx ). Each of these
n + 1 numbers belongs to [0, 1) (since frac z ∈ [0, 1) for each z ∈ R), and thus must
lie in one of the n intervals I1 , I2 , . . . , In (since we know that each number y ∈ [0, 1)
lies in exactly one of these n intervals I1 , I2 , . . . , In ). Hence, by the Pigeonhole Princi-
ple, we see that at least two of these n + 1 numbers frac (0x ) , frac (1x ) , . . . , frac (nx )
must belong to one and the same of the n intervals I1 , I2 , . . . , In 409 . In other words,
409 Hereis this argument in more detail:
Let i ∈ {0, 1, . . . , n}. Then,
Hence, there exists some k ∈ {1, 2, . . . , n} such that frac (ix ) ∈ Ik . Fix such a k, and denote it by
bi . (Note that this k is unique, since the n intervals I1 , I2 , . . . , In are disjoint; but we will not need
this in our argument.)
Forget that we fixed i. We thus have defined an element bi ∈ {1, 2, . . . , n} for each
i ∈ {0, 1, . . . , n}. In other words, we have defined n + 1 elements b0 , b1 , . . . , bn ∈ {1, 2, . . . , n}.
there exist two elements i and j of {0, 1, . . . , n} such that i < j and such that the
two numbers frac (ix ) and frac ( jx ) belong to one and the same of the n intervals
I1 , I2 , . . . , In . Consider these i and j.
The two numbers frac (ix ) and frac ( jx ) belong to one and the same of the n
intervals I1 , I2 , . . . , In . In other words, there exists some k ∈ {1, 2, . . . , n} such that
frac (ix ) and frac ( jx ) belong to Ik . Consider this k.
k−1 k
We know that frac (ix ) belongs to Ik . Hence, frac (ix ) ∈ Ik = , (by the
n n
k−1 k
definition of Ik ). In other words, frac (ix ) ≥ and frac (ix ) < . The same
n n
k−1 k
argument (applied to j instead of i) shows that frac ( jx ) ≥ and frac ( jx ) < .
n n
Now, j − i is a positive integer (since i and j are integers satisfying i < j). We
now claim that
1 n−1
frac (( j − i ) x ) is either < or > . (719)
n n
[Proof of (719): We are in one of the following two cases:
Case 1: We have frac ( jx ) ≥ frac (ix ).
Case 2: We have frac ( jx ) < frac (ix ).
Let us first consider Case 1. In this case, we have frac ( jx ) ≥ frac (ix ). Hence,
Lemma A.7.3 (a) (applied to a = jx and b = ix) yields
k k−1 1
frac ( jx − ix ) = frac ( jx ) − frac (ix ) < − = .
| {z } | {z } n n n
k k−1
< ≥
n n
1
In view of jx − ix = ( j − i ) x, this rewrites as frac (( j − i ) x ) < . Hence, frac (( j − i ) x )
n
1 n−1
is either < or > . Thus, (719) is proved in Case 1.
n n
Let us now consider Case 2. In this case, we have frac ( jx ) < frac (ix ). Hence,
Hence, Corollary 6.1.4 (applied to {1, 2, . . . , n}, n + 1 and bi−1 instead of V, m and ai ) yields
that at least two of these n + 1 elements b0 , b1 , . . . , bn are equal. In other words, there exist two
numbers i, j ∈ {0, 1, . . . , n} such that i < j and bi = b j . Consider these i, j.
Our definition of bi shows that bi is a k ∈ {1, 2, . . . , n} satisfying frac (ix ) ∈ Ik . Hence,
frac (ix ) ∈ Ibi . The same argument (applied to j instead of i) yields frac ( jx ) ∈ Ibj . In view
of bi = b j , this rewrites as frac ( jx ) ∈ Ibi .
Now, both frac (ix ) and frac ( jx ) belong to Ibi . Hence, frac (ix ) and frac ( jx ) belong to one and
the same of the n intervals I1 , I2 , . . . , In (namely, to Ibi ). Since i < j, this shows that at least two
of these n + 1 numbers frac (0x ) , frac (1x ) , . . . , frac (nx ) must belong to one and the same of the
n intervals I1 , I2 , . . . , In .
Note that we have not used the fact that the intervals I1 , I2 , . . . , In are disjoint.
Now, let us apply Exercise 6.3.9 (a) to px and u instead of x and n. We thus
1
conclude that there exists a positive integer m such that frac (mpx ) is either < or
u
u−1
> . Consider this m, and denote it by r. Thus, r is a positive integer such that
u
1 u−1
frac (rpx ) is either < or > .
u u
The product rp is a positive integer (since r and p are positive integers). We must
1
prove that there exists a positive integer m such that frac (mx ) < . If frac (rpx ) <
n
1
, then this is immediately clear (since we can just take m = rp). Thus, for the
n
1
rest of this proof, we WLOG assume that we don’t have frac (rpx ) < . Hence, we
n
1 1 1 1 1
have frac (rpx ) ≥ > (since < ). Therefore, frac (rpx ) is not < . Hence,
n u u n u
u−1 1 u−1
frac (rpx ) is > (since we know that frac (rpx ) is either < or > ). In
u u u
u−1
other words, frac (rpx ) > .
u
Now,
u−1
1 1
frac (rpx ) > = 1 − > 1 − (1 − frac ( px )) since < 1 − frac ( px )
u u u
= frac ( px ) . (720)
1 1
n= + 1). Consider this n. Note that n > > 0 (since ε is positive); thus, n is
ε ε
1 1
positive. Furthermore, from n > , we obtain < ε (since n and ε are positive).
ε n
Exercise 6.3.9 (b) shows that there exists a positive integer m such that frac (mx ) <
1
. This positive integer m must then also satisfy frac (mx ) < ε (since it satisfies
n
1
frac (mx ) < < ε). Hence, there exists a positive integer m such that frac (mx ) < ε.
n
This solves Exercise 6.3.9 (c).
(d) Here is where we will need a bit of analysis. We will use the following two
well-known facts about the sine function:
Fact 1: If x is a nonnegative real, then sin x ≤ x.
Fact 2: If x ∈ R and j ∈ Z, then sin ( x + 2πj) = sin x.
Note that Fact 2 is a consequence of the fact that the function sin has period 2π.
We can easily use these two facts to derive the following:
z
Fact 3: If z ∈ R, then sin z = sin 2π frac .
2π
j z k
[Proof of Fact 3: Let z ∈ R. Then, is an integer410 . Now, the definition
z z 2π
z j z k z z j z k
of frac yields frac = − . Hence, = frac + .
2π 2π 2π 2π 2π 2π 2π
Multiplying both sides of this equality by 2π, we find
z j z k z j z k
z = 2π frac + = 2π frac + 2π .
2π 2π 2π 2π
Hence,
z j z k z
sin z = sin 2π frac + 2π = sin 2π frac
2π 2π 2π
z j z k j z k
(by Fact 2, applied to x = 2π frac and j = ), since is an integer.
2π 2π 2π
This proves Fact 3.]
Let ε be a positive real. Let z be a real. We must show that there exists a positive
integer m such that 0 ≤ sin (mz) < ε.
Indeed, we WLOG assume that ε ≤ π (since otherwise, we can simply replace ε
by the positive real min {ε, π }, which is no larger than ε).
ε
The real is positive (since ε and 2π are positive). Hence, Exercise 6.3.9 (c)
2π
z ε
(applied to and instead of x and ε) yields that there exists a positive integer
2π 2π
z ε
m such that frac m · < . Consider this m. We have
2π 2π
mz z ε
frac = frac m · < .
2π 2π 2π
410 since a floor of a real number is always an integer
Claim 1: The entire set R can be covered with 5 closed intervals of length
1
each.
10
Claim 2: Let ε be a positive real such that the entire set R can be covered
1
with 5 closed intervals of length ε each. Then, ε ≥ .
10
[Proof of Claim 1: Define five closed intervals A, B, C, D, E by
1 1 1 1 7 1 3 9
A = 0, , B= , , C= , , D= , , E= ,1 .
10 10 5 4 20 2 5 10
1
These five intervals A, B, C, D, E have length each, and together cover the entire
10
1
set R (indeed, the interval A contains all numbers with s ≥ 10; the interval B
s
1 1 1 1 1 1 1
contains the numbers , , , , ; the interval C contains the numbers , ; the
9 8 7 6 5 4 3
1
interval D contains the number ; the interval E contains the number 1). Thus, the
2
1
entire set R can be covered with 5 closed intervals of length each (namely, with
10
the 5 intervals A, B, C, D, E). This proves Claim 1.]
1 1
[Proof of Claim 2: Assume the contrary. Thus, ε < . In other words, − ε > 0.
10 10
1
Hence, is a well-defined positive real. Hence, there exists an integer N such
1
−ε
10
1 1
that N > (for example, N = + 1). Consider this N. We have
1 1
−ε −ε
10 10
1 1 1 1 1
N> > 0 (since − ε > 0). Also, from N > , we obtain < −ε
1 10 1 N 10
−ε −ε
10 10
1 1 1 1 1
(since N and − ε are positive). Hence, ε < − , so that − > ε.
10 10 N 10 N
We have assumed that the entire set R can be covered with 5 closed intervals of
length ε each. In other words, there exist 5 closed intervals A, B, C, D, E of length
ε each such that these 5 intervals cover the entire set R. Consider these 5 intervals
A, B, C, D, E.
Now, consider the 6 numbers
1 1 1 1 1 1
, , , , , .
1 2 3 5 10 N
These 6 numbers all belong to R, and therefore each of them belongs to (at least) one
of the 5 intervals A, B, C, D, E (since these 5 intervals cover the entire set R). Hence,
by the Pigeonhole Principle, we conclude that at least two of these 6 numbers
belong to one and the same of the 5 intervals A, B, C, D, E. These two numbers
therefore belong to a common interval of length ε (since each of the 5 intervals
A, B, C, D, E has length ε), and thus their difference (if we subtract the smaller one
from the larger) must be ≤ ε. But this contradicts the fact that no two of the 6
numbers
1 1 1 1 1 1
, , , , ,
1 2 3 5 10 N
have a difference that is ≤ ε (indeed, the differences between consecutive numbers
in this list are
1 1 1 1
− = > > ε,
1 2 2 10
1 1 1 1
− = > > ε,
2 3 6 10
1 1 2 1
− = > > ε,
3 5 15 10
1 1 1
− = > ε,
5 10 10
1 1
− > ε,
10 N
and therefore the differences between non-consecutive numbers in this list are even
larger, since the list is in decreasing order). This contradiction shows that our
assumption was false. Thus, Claim 2 is proved.]
With Claim 1 and Claim 2 both proved, we thus have solved Exercise 6.3.10.
( g ◦ f ) ( g ( x )) = g f ( g ( x )) = g ( x ) .
| {z }
=x
( ϕ ◦ γ) ( x ) = ϕ (γ ( x )) = f γ ( x ) = f ( g ( x )) = ( f ◦ g) ( x ) = x = id ( x ) .
| {z }
= g( x )
Now, forget that we fixed x. We thus have proven that ( ϕ ◦ γ) ( x ) = id ( x ) for each x ∈
Fix ( f ◦ g). In other words, ϕ ◦ γ = id.
Moreover, there exists an integer c such that n = dc (since d is a divisor of n). Consider this c.
n /2 = dc/2 = (d/2) c. Hence, d/2 | n/2 (since c is an integer). That is, d/2 is a
We have |{z}
=dc
divisor of n/2. Moreover, d/2 is positive (since d is positive). We have thus shown that d/2 is a
positive divisor of n/2. Qed.
414 Proof. Let u be a positive divisor of n/2. Then, u is an integer, so that 2u is an even integer.
Moreover, 2u is positive (since u is positive). Furthermore, there exists some integer c such
that n/2 = uc (since u is a divisor of n/2). Consider this c. From n/2 = uc, we obtain
n = 2uc = (2u) c. Hence, 2u is a divisor of n (since c is an integer). Thus, 2u is an even positive
divisor of n (since 2u is even and positive). Qed.
In other words, the number of even positive divisors of n equals the number of
positive divisors of n/2.
However, n/2 is positive (since n is positive) and is an integer (since n/2 ∈ Z).
Thus, Exercise 3.8.3 (applied to n/2 instead of n) yields that the number of positive
divisors of n/2 is even if and only if n/2 is not a perfect square. Since the number
of even positive divisors of n equals the number of positive divisors of n/2, we can
rewrite this as follows: The number of even positive divisors of n is even if and
only if n/2 is not a perfect square. Thus, Exercise 7.7.2 is solved in Case 1.
Let us now consider Case 2. In this case, the integer n is odd. Thus, 2 - n, so that
n/2 ∈/ Z. In other words, n/2 is not an integer. Hence, n/2 is not a perfect square
(since each perfect square is an integer).
Moreover, the number n has no even positive divisors415 . Thus, the number of
even positive divisors of n is 0. Hence, the number of even positive divisors of n is
even (since 0 is even).
We thus conclude that the number of even positive divisors of n is even if and
only if n/2 is not a perfect square (because we know that the number of even
positive divisors of n is even, and we also know that n/2 is not a perfect square).
Thus, Exercise 7.7.2 is solved in Case 2.
We have now solved Exercise 7.7.2 in both Cases 1 and 2. This completes the
solution to Exercise 7.7.2.
415 Proof.
Let d be an even positive divisor of n. We shall derive a contradiction.
Indeed, 2 | d (since d is even) and d | n (since d is a divisor of n). Hence, 2 | d | n. But this
contradicts 2 - n.
Forget that we fixed d. We thus have found a contradiction for each even positive divisor d of
n. Hence, there exist no even positive divisors of n. In other words, the number n has no even
positive divisors.
∑ min S = ∑ ∑ | {z S} =
min ∑ ∑ k
S⊆[n]; k∈[n] S⊆[n]; =k k∈[n] S⊆[n];
|S|=r |S|=r; |S|=r;
min S=k min S=k
| {z }
=(# of subsets S of [n] satisfying |S|=r and min S=k)·k
= ∑ (# of subsets S of [n] satisfying |S| = r and min S = k) · k.
k∈[n]
Now, let us fix k ∈ [n]. We shall now compute the # of subsets S of [n] satisfying
|S| = r and min S = k.
For the sake of brevity, let us introduce some terminology:
• A red set will mean a subset S of [n] satisfying |S| = r and min S = k.
• A blue set will mean an (r − 1)-element subset of {k + 1, k + 2, . . . , n}.
The blue sets are easy to count (see the next paragraph), whereas the red sets
are what we want to count. We shall soon find a bijection between {red sets} and
{blue sets}, and therefore we will know how many red sets there are.
First, let us count the blue sets. Note that k ∈ [n] entails 1 ≤ k ≤ n; hence, we
have n − k ∈ N, and the set {k + 1, k + 2, . . . , n} is an (n − k)-element set. Theorem
4.3.12 (applied to n − k, {k + 1, k + 2, . . . , n} and r − 1 instead of n, S and k) thus
yields
n−k
= (the number of (r − 1) -element subsets of {k + 1, k + 2, . . . , n})
r−1
= (# of (r − 1) -element subsets of {k + 1, k + 2, . . . , n}) .
However, from the definition of a “blue set”, we see that
(# of blue sets) = (# of (r − 1) -element subsets of {k + 1, k + 2, . . . , n}) .
Comparing these two equalities, we thus find
n−k
(# of blue sets) = . (725)
r−1
Now, let us construct a bijection between {red sets} and {blue sets}. We shall
present the proof in maximum possible detail, in order to show at least once what
one needs to check when claiming the existence of a bijection; in practice, the actual
checking can often be done easily in one’s head (certainly this is true in the case at
hand), and thus the definition of the bijection may well be sufficient.
If U is a red set, then U \ {k} is a blue set416 . Hence, we can define a map
Φ : {red sets} → {blue sets} ,
U 7→ U \ {k} .
416 Proof. Let U be a red set. We must show that U \ {k} is a blue set.
We know that U is a red set. In other words, U is a subset S of [n] satisfying |S| = r and
min S = k (by the definition of a “red set”). In other words, U is a subset of [n] and satisfies
|U | = r and min U = k. Hence, k = min U ∈ U (since the minimum of a set always belongs to
this set) and therefore |U \ {k}| = |U | −1 = r − 1. In other words, U \ {k} is an (r − 1)-element
|{z}
=r
set.
Next, let u ∈ U \ {k}. Thus, u ∈ U and u 6= k. We have u ∈ U ⊆ [n] (since U is a subset of [n]);
that is, u is an integer satisfying 1 ≤ u ≤ n. But k is the minimum of the set U (since k = min U),
and therefore is ≤ to any element of U. In other words, k ≤ v for each v ∈ U. Applying this to
v = u, we obtain k ≤ u. Thus, u ≥ k, so that u > k (since u 6= k) and therefore u ≥ k + 1 (since u
and k are integers). Combining this with u ≤ n, we obtain u ∈ {k + 1, k + 2, . . . , n} (since u is an
integer).
Forget that we fixed u. We thus have shown that u ∈ {k + 1, k + 2, . . . , n} for each u ∈ U \ {k }.
In other words, U \ {k} is a subset of {k + 1, k + 2, . . . , n}. Hence, we have shown that U \ {k}
is an (r − 1)-element subset of {k + 1, k + 2, . . . , n}. In other words, U \ {k} is a blue set (by the
definition of a “blue set”). Qed.
417 Proof. Let V be a blue set. We must show that V ∪ { k } is a red set.
Ψ are mutually inverse. Hence, the map Φ is invertible, i.e., is a bijection. Now,
the bijection principle yields |{red sets}| = |{blue sets}| (since Φ : {red sets} →
{blue sets} is a bijection). Hence,
n−k
(# of red sets) = |{red sets}| = |{blue sets}| = (# of blue sets) =
r−1
we obtain
Now, forget that we fixed k. We thus have proved (726) for each k ∈ [n]. Now,
418 Proof.
Let V ∈ {blue sets}. Thus, V is a blue set. In other words, V is an (r − 1)-element subset of
{k + 1, k + 2, . . . , n} (by the definition of a “blue set”). In other words, V ⊆ {k + 1, k + 2, . . . , n}
and |V | = r − 1.
If we had k ∈ V, then we would have k ∈ V ⊆ {k + 1, k + 2, . . . , n} and thus k ≥ k + 1 > k,
which is absurd. Thus, we cannot have k ∈ V. Hence, k ∈ / V, so that (V ∪ {k}) \ {k } = V. Now,
we have Ψ (V ) = V ∪ {k} (by the definition of Ψ), and furthermore
|S| = r and min S = k (by the definition of a “red set”). In other words, U is a subset of [n] and
satisfies |U | = r and min U = k. Hence, k = min U ∈ U (since the minimum of a set always
belongs to this set). Therefore, (U \ {k }) ∪ {k } = U. Now, we have Φ (U ) = U \ {k} (by the
definition of Φ), and furthermore
recall that
Now, let us compute the sum on the right hand side of this equality.
We have r − 1 ∈ N (since r is a positive integer). Hence, Exercise 7.6.1 (applied
to x = 1 and y = r − 1) yields
n n
n−k n−k
n+1 k
= ∑ = ∑k
1 + (r − 1) + 1 k =0
1 r−1 k =0
r−1
|{z}
=k
(by (120),
applied to k
instead of n)
n n
n−0 n−k n−k
=0 +∑k = ∑ k
r−1 k = 1
r−1 k =1
r−1
| {z } |{z} | {z }
=0 = ∑ n−k
k ∈[n] = ·k
(since {1,2,...,n}=[n]) r−1
n−k
= ∑ r−1
· k.
k∈[n]
= ∑ min S.
S⊆[n];
|S|=r
422 Proof. There are no onefree compositions of 1 (since the only composition of 1 is (1), which
is clearly not onefree). That is, we have (# of onefree compositions of 1) = 0. Compar-
ing this with f 1−1 = f 0 = 0, we obtain (# of onefree compositions of 1) = f 1−1 . Hence,
(# of onefree compositions of m) = f m−1 holds for m = 1.
The only onefree composition of 2 is (2) (since the only compositions of 2 are (1, 1) and
(2), but (1, 1) is not onefree). Thus, we have (# of onefree compositions of 2) = 1. Com-
paring this with f 2−1 = f 1 = 1, we obtain (# of onefree compositions of 2) = f 2−1 . Hence,
(# of onefree compositions of m) = f m−1 holds for m = 2.
We have thus proved that (# of onefree compositions of m) = f m−1 holds for m = 1 and for
m = 2.
so that a2 + a3 + · · · + ak = m − 2.
The positive integers a1 , a2 , . . . , ak are distinct from 1 (since the composition ( a1 , a2 , . . . , ak ) is
onefree, i.e., does not contain 1 as an entry). Thus, in particular, the positive integers a2 , a3 , . . . , ak
are distinct from 1. Now, ( a2 , a3 , . . . , ak ) is a tuple of positive integers whose sum is m − 2 (since
a2 + a3 + · · · + ak = m − 2); in other words, ( a2 , a3 , . . . , ak ) is a composition of m − 2 (by the
definition of a “composition”). This composition ( a2 , a3 , . . . , ak ) doesn’t contain 1 as an entry
(since the positive integers a2 , a3 , . . . , ak are distinct from 1); in other words, it is onefree. Hence,
( a2 , a3 , . . . , ak ) is a onefree composition of m − 2, qed.
It is easy to see that this map Φ is a bijection425 . Hence, the bijection principle
yields
Thus,
425 Indeed,we can easily construct a map inverse to Φ: Namely, if (b1 , b2 , . . . , b` ) is a onefree com-
position of m − 2, then (2, b1 , b2 , . . . , b` ) is a green onefree composition of m (check this!). Thus,
the map
is well-defined. It is straightforward to see that the maps Φ and Ψ are mutually inverse. Thus,
the map Φ is invertible, i.e., is a bijection.
we obtain 1 + ( a1 − 1) + ( a2 + a3 + · · · + ak ) = m. Hence, ( a1 − 1) + ( a2 + a3 + · · · + ak ) = m − 1.
The positive integers a1 , a2 , . . . , ak are distinct from 1 (since the composition ( a1 , a2 , . . . , ak ) is
onefree, i.e., does not contain 1 as an entry). Thus, in particular, the positive integer a1 is distinct
from 1, and the positive integers a2 , a3 , . . . , ak are distinct from 1.
The positive integer a1 is distinct from 1, and thus must be ≥ 2. Hence, a1 − 1 ≥ 1. This shows
that a1 − 1 is a positive integer. Moreover, a1 − 1 6= 1 (since a1 6= 2); thus, the number a1 − 1 is
distinct from 1. Since we also know that the numbers a2 , a3 , . . . , ak are distinct from 1, we thus
conclude that the numbers a1 − 1, a2 , a3 , . . . , ak are distinct from 1.
We now know that a1 − 1 is a positive integer, and that a2 , a3 , . . . , ak are positive integers as
well. Hence, ( a1 − 1, a2 , a3 , . . . , ak ) is a tuple of positive integers. Moreover, ( a1 − 1, a2 , a3 , . . . , ak )
is a tuple of positive integers whose sum is m − 1 (since ( a1 − 1) + ( a2 + a3 + · · · + ak ) = m − 1);
in other words, ( a1 − 1, a2 , a3 , . . . , ak ) is a composition of m − 1 (by the definition of a “composi-
tion”). This composition ( a1 − 1, a2 , a3 , . . . , ak ) doesn’t contain 1 as an entry (since the numbers
a1 − 1, a2 , a3 , . . . , ak are distinct from 1); in other words, it is onefree. Hence, ( a1 − 1, a2 , a3 , . . . , ak )
is a onefree composition of m − 1, qed.
427 Indeed, we can easily construct a map inverse to Φ0 : Namely, if ( b , b , . . . , b ) is a onefree com-
1 2 `
position of m − 1, then the tuple (b1 + 1, b2 , b3 , . . . , b` ) is well-defined (this requires proving that
` ≥ 1; check this!) and is a red onefree composition of m (check this!). Thus, the map
Ψ0 : {onefree compositions of m − 1} → {red onefree compositions of m} ,
(b1 , b2 , . . . , b` ) 7→ (b1 + 1, b2 , b3 , . . . , b` )
is well-defined. It is straightforward to see that the maps Φ0 and Ψ0 are mutually inverse. Thus,
the map Φ0 is invertible, i.e., is a bijection.
(# of onefree compositions of m)
= (# of green onefree compositions of m) + (# of red onefree compositions of m)
| {z } | {z }
= f m −3 = f m −2
(by (735)) (by (736))
= f m −3 + f m −2 = f m −2 + f m −3 = f m −1 (by (731)) .
In other words, Proposition A.8.1 holds for n = m. This completes the induction
step; thus, Proposition A.8.1 is proved.
Second proof of Proposition A.8.1 (sketched). We proceed by strong induction on n:
Induction step: Let m be a positive integer. Assume (as the induction hypothesis)
that Proposition A.8.1 holds for n < m. We must prove that Proposition A.8.1 holds
for n = m. In other words, we must prove that (# of onefree compositions of m) =
f m −1 .
If m = 1 or m = 2, then this is easy to check. Thus, for the rest of this proof, we
WLOG assume that we have neither m = 1 nor m = 2. Hence, m ≥ 3 (since m is a
positive integer), so that m − 3 ≥ 0.
If ( a1 , a2 , . . . , ak ) is a onefree composition of m, then we necessarily have k ≥ 1
428 , and therefore its first entry a is well-defined. This first entry a must be a
1 1
positive integer (since a1 , a2 , . . . , ak are positive integers) and satisfies a1 6= 1 (since
the composition ( a1 , a2 , . . . , ak ) is onefree). Hence, it satisfies a1 ≥ 2 (since any
positive integer that is 6= 1 must be ≥ 2). It furthermore satisfies a1 ≤ m 429 , and
thus a1 ∈ {2, 3, . . . , m} (since a1 ≥ 2 and a1 ≤ m). Hence, the sum rule yields
(# of onefree compositions of m)
= ∑ (# of onefree compositions ( a1 , a2 , . . . , ak ) of m such that a1 = r ) .
r ∈{2,3,...,m}
428 This follows from the positivity of m. See the first proof of Proposition A.8.1 above for the details
of the argument.
429 Proof. The numbers a , a , . . . , a are positive integers; hence, none of them cannot exceed their
1 2 k
sum. In particular, this shows that a1 ≤ a1 + a2 + · · · + ak = m (since ( a1 , a2 , . . . , ak ) is a compo-
sition of m, that is, a tuple of positive integers whose sum is m).
In other words,
Forget that we fixed r. We thus have proved (737) for each r ∈ {2, 3, . . . , m}. Now,
(# of onefree compositions of m)
= ∑ (# of onefree compositions ( a1 , a2 , . . . , ak ) of m such that a1 = r )
r ∈{2,3,...,m}
| {z }
| {z } =(# of onefree compositions of m−r )
m (by (737))
=∑
r =2
m
= ∑ (# of onefree compositions of m − r)
r =2
m −1
= ∑ (# of onefree compositions of m − r )
|r=2 {z }
m −2
= ∑ (# of onefree compositions of n)
n =1
(here, we have substituted n for m−r in the sum)
+ (# of onefree compositions of m − m)
| {z }
=1
(since m−m=0, and thus the only onefree composition of m−m is the empty tuple ())
here, we have split off the addend for r = m from the sum
(this addend was indeed in the sum, because m ≥ 3 ≥ 2)
m −2
= ∑ (# of onefree compositions of n) +1
n =1
| {z }
= f n −1
(by our induction hypothesis, since n≤m−2<m)
m −2
= ∑ f n −1 + 1 = f m −1 − 1 + 1 = f m −1 .
n =1
| {z }
= f 0 + f 1 +···+ f m−3
= f m −1 −1
(by Exercise 2.2.1 (applied to n=m−3),
since m−3≥0)
430 Itsinverse map, of course, sends each onefree composition (b1 , b2 , . . . , b` ) of m − r to the onefree
composition (r, b1 , b2 , . . . , b` ) of m.
This is precisely what we needed to show. Thus, the induction step is complete, so
that Proposition A.8.1 is proved.
Our third proof of Proposition A.8.1 will be bijective (i.e., it will rely on a bi-
jection). Crucial to this proof will be the following combinatorial interpretation of
Fibonacci numbers:
Proposition A.8.2. Let ( f 0 , f 1 , f 2 , . . .) be the Fibonacci sequence. Let n ∈ N and
a ∈ Z. Then,
Hints to the proof of Proposition A.8.2. (See [19fco, proof of Proposition 1.4.18] for de-
tails.) Proposition A.8.2 can easily be derived from Theorem 2.3.4. Indeed, the set
[ a + 1, a + n] (where we are using the notations of Proposition A.8.2) is just the set
[n] shifted to the right by a units (if we visualize these sets on the real axis); in
more formal language, there is a bijection from [n] to [ a + 1, a + n] that sends each
i ∈ [n] to a + i. This bijection gives rise to a bijection from {lacunar subsets of [n]}
to {lacunar subsets of [ a + 1, a + n]} (namely, we apply the same shift to each ele-
ment of our lacunar subset). Thus, the bijection principle yields
defined in the proof of Theorem 7.3.4. We recall (from said proof) that this map C
is a bijection; thus, it has an inverse map C −1 .
Now, the following two claims are crucial:431
[Proof of Claim 1: The composition a is onefree; in other words, it does not contain
1 as an entry (by the definition of “onefree”).
Write the composition a in the form a = ( a1 , a2 , . . . , ak ). Then, ( a1 , a2 , . . . , ak ) is
a composition of n. In other words, ( a1 , a2 , . . . , ak ) is a tuple of positive integers
whose sum is n. Hence, the numbers a1 , a2 , . . . , ak are positive integers and satisfy
a1 + a2 + · · · + ak = n.
The numbers a1 , a2 , . . . , ak are the entries of the composition a (since a = ( a1 , a2 , . . . , ak )),
and therefore are distinct from 1 (since this composition a does not contain 1 as an
entry). Hence, these numbers a1 , a2 , . . . , ak are ≥ 2 (since they are positive integers).
Now, the definition of C ( a) yields
C ( a) = { a1 + a2 + · · · + ai | i ∈ {1, 2, . . . , k − 1}} .
Hence, it is easy to see that C ( a) is a subset of [2, n − 2] 432 . Furthermore, the set
C ( a) is lacunar433 . This completes the proof of Claim 1.]
a 1 + a 2 + · · · + a i ≤ a 1 + a 2 + · · · + a k −1
= ( a1 + a2 + · · · + a k ) − ak
| {z } |{z}
=n ≥2
(since the numbers a1 ,a2 ,...,ak are ≥2)
≤ n − 2.
Hence, p = a1 + a2 + · · · + ai ≤ n − 2.
Combining p ≥ 2 with p ≤ n − 2, we obtain p ∈ [2, n − 2].
Forget that we fixed p. We thus have shown that p ∈ [2, n − 2] for each p ∈ C ( a). Hence, C ( a)
is a subset of [2, n − 2].
433 Proof. Assume the contrary. Thus, the set C ( a ) is not lacunar; in other words, the set C ( a )
contains two consecutive integers (by the definition of “lacunar”). Let p and q be these two
consecutive integers (in some order). Thus, p ∈ C ( a) and q ∈ C ( a).
We have p ∈ C ( a) = { a1 + a2 + · · · + ai | i ∈ {1, 2, . . . , k − 1}}. In other words, there exists
some u ∈ {1, 2, . . . , k − 1} such that p = a1 + a2 + · · · + au . Consider this u.
We have q ∈ C ( a) = { a1 + a2 + · · · + ai | i ∈ {1, 2, . . . , k − 1}}. In other words, there exists
some v ∈ {1, 2, . . . , k − 1} such that q = a1 + a2 + · · · + av . Consider this v.
We WLOG assume that u ≤ v (since otherwise, we can just swap u with v, while simultane-
ously swapping p with q). Note that p 6= q (since p and q are consecutive integers), so that u 6= v
(because if we had u = v, then we would have a1 + a2 + · · · + au = a1 + a2 + · · · + av , which
would contradict a1 + a2 + · · · + au = p 6= q = a1 + a2 + · · · + av ). Combining this with u ≤ v,
[Proof of Claim 2: I shall be somewhat brief and handwavy, but I trust the reader
to be able to formalize this argument by now.
The set U is a subset of [2, n − 2] and thus a subset of [n − 1] (since [2, n − 2] ⊆
[n − 1]). Hence, C −1 (U ) is a well-defined composition of n.
Recall how the inverse map C −1 of C was described in the proof of Theorem
7.3.4: If I is any subset of [n − 1], then the elements of I subdivide the interval
[0, n] into several blocks; the composition C −1 ( I ) is formed by the lengths of these
blocks (from left to right).
Applying this to I = U, we see that the composition C −1 (U ) is formed by the
lengths of the blocks into which the elements of U subdivide the interval [0, n]. 434
We shall show that each of these blocks has length ≥ 2.
Indeed, this is obvious if U = ∅ (because in this case, there is only one block
(namely, [0, n]), and it has length n ≥ 3 ≥ 2). Hence, for the rest of this proof, we
WLOG assume that U 6= ∅; thus, the set U has a smallest element min U and a
largest element max U. Note that min U ∈ U ⊆ [2, n − 2], so that min U ≥ 2. Also,
max U ∈ U ⊆ [2, n − 2] and thus max U ≤ n − 2. Note that the set U is lacunar;
thus, any two distinct elements of U are at least a distance of 2 apart (on the real
axis).
Now, consider the blocks into which the elements of U subdivide the interval
[0, n]. The first of these blocks is [0, min U ], and thus has length min U − 0 =
q = a 1 + a 2 + · · · + a v = ( a 1 + a 2 + · · · + a u ) + ( a u +1 + a u +2 + · · · + a v ) (since u ≤ v)
| {z }
=p
= p + ( a u +1 + a u +2 + · · · + a v ) .
But av is an addend of the sum au+1 + au+2 + · · · + av (since u < v). However, au+1 + au+2 +
· · · + av is a sum of positive integers (since a1 , a2 , . . . , ak are positive integers), and thus is ≥ to
any of its addends. Hence, au+1 + au+2 + · · · + av ≥ av (since av is an addend of this sum). Also,
av ≥ 2 (since the numbers a1 , a2 , . . . , ak are ≥ 2). Now,
q = p + ( au+1 + au+2 + · · · + av ) ≥ p + 2.
| {z }
≥ a v ≥2
That is, the integer q is at least by 2 larger than p. Hence, p and q cannot be consecutive integers.
This contradicts the fact that p and q are consecutive integers. This contradiction shows that our
assumption was false. Qed.
434 Let us again illustrate this on an example, this time making sure to pick a lacunar subset of
[2, n − 2]. Namely, set n = 14 and U = {2, 4, 7, 11}. Then, the elements of U subdivide the
interval [0, n] = [0, 14] into 5 blocks as follows:
2 2 3 4 3
0 2 4 7 11 14 .
The lengths of these blocks are 2, 2, 3, 4, 3 (from left to right). Thus, the composition C −1 (U ) is
(2, 2, 3, 4, 3).
min U ≥ 2. The last of these blocks is [max U, n], and thus has length n − max
| {z U} ≥
≤ n −2
n − (n − 2) = 2. Each of the remaining blocks begins and ends at two (distinct)
elements of U, and thus has length ≥ 2 (since any two distinct elements of U are at
least a distance of 2 apart (on the real axis)). Combining these results, we conclude
that each of our blocks has length ≥ 2. Hence, none of our blocks has length 1.
Now, recall that the composition C −1 (U ) is formed by the lengths of these
blocks. Since none of our blocks has length 1, we thus conclude that the com-
position C −1 (U ) does not contain 1 as an entry. In other words, the composition
C −1 (U ) is onefree. This proves Claim 2.]
Now, Claim 1 shows that we can define a map
These two maps C and D are restrictions of the maps C and C −1 (respectively), and
thus are mutually inverse (since the maps C and C −1 are mutually inverse). Hence,
the map C is invertible, i.e., is a bijection. The bijection principle thus yields
We refer to [19fco, §2.10.1] for two proofs of Theorem A.8.3. Here, we shall just
briefly outline one of the proofs:
Hints to the proof of Theorem A.8.3. The case when n = 0 is straightforward busy-
work (and is not part of Exercise 7.7.5 anyway), so we WLOG assume that n 6= 0.
Thus, n is a positive integer.
Likewise, we leave the case k = 0 to the reader (again, noting that this case is
straightforward), so we WLOG assume that k 6= 0. Hence, k is a positive integer.
Consider the map
defined in the proof of Theorem 7.3.4. We recall (from said proof) that this map C
is a bijection; thus, it has an inverse map C −1 .
Now, the following two claims are crucial:
The reader will have no trouble proving these two claims. Now, Claim 1 shows
that we can define a map
These two maps C and D are restrictions of the maps C and C −1 (respectively), and
thus are mutually inverse. Hence, the map C is invertible, i.e., is a bijection. The
bijection principle thus yields
We refer to [19fco, §2.10.3] for a detailed proof of Theorem A.8.4. Here, let us
just briefly outline it:
It is easy to see that this map is a bijection. The bijection principle therefore shows
that
(where the last equality sign follows from an application of Theorem 4.3.10 in the
case when k > 0, and can be checked by hand in the case when k = 0). Theorem
A.8.4 thus follows.
The equality (740) can also be proved by induction (see [Jarvin20, §19.3] or
[Grinbe15, Exercise 3.15] for such proofs) or by a direct counting argument (see
[AndFen04, proof of Theorem 4.2 (b)] or [Jarvin20, §19.3] for this).
n − 1 k!
bk = n . (742)
k nk
435 because adding 1 to a nonnegative integer yields a positive integer, and because
( a1 + 1) + ( a2 + 1) + · · · + ( a k + 1) = ( a1 + a2 + · · · + a k ) + (1 + 1 + · · · + 1) = n + k
| {z } | {z }
=n k times
| {z }
=k
n − 1 ( k + 1) ! n − 1 (k + 1) · k!
bk +1 = n =n
k+1 n k +1 k+1 nk · n
since (k + 1)! = (k + 1) · k! and nk+1 = nk · n
n−1 n − 1 k!
k!
= ( k + 1) = ((n − 1) − k) .
k+1 nk k nk
| {z }
n−1
=((n−1)−k)
k
(by Lemma A.4.9 (b)
(applied to n−1 instead of n))
n − 1 k! n − 1 k!
bk − bk + 1 = n − ((n − 1) − k)
k nk k nk
n − 1 k! n − 1 k!
= (n − ((n − 1) − k)) = ( k + 1)
| {z } k nk k nk
= k +1
n − 1 (k + 1) · k! n − 1 ( k + 1) !
= =
k nk k nk
n−1
0! 0!
b0 = n 0
= n · 0
= n · |{z} n0 = n.
0! / |{z}
0 n n
| {z } =1 =1
=1
(by (119)
(applied to n−1 instead of n))
n−1
= k! · nn−k . (745)
k−1
• First, we choose the first k entries a1 , a2 , . . . , ak of a, one after the other (keep-
ing in mind that they have to be distinct). This procedure involves k decisions,
and it is easy to count how many options there are in each decision: There are
n options for choosing a1 (since a1 has to be an element of [n]); there are n − 1
options for choosing a2 (since a2 has to be an element of [n] distinct from a1 );
there are n − 2 options for choosing a3 (since a3 has to be an element of [n]
distinct from both the two distinct elements a1 and a2 ); and so on.
After these k decisions, the first k entries a1 , a2 , . . . , ak of our n-tuple a have
been chosen.
• Next, we choose the (k + 1)-st entry ak+1 of a. This entry has to equal one
of the first k entries a1 , a2 , . . . , ak . Since these first k entries a1 , a2 , . . . , ak are
distinct, we thus have k options for choosing ak+1 .
The dependent product rule shows that the total # of possibilities for making these
choices is
n (n − 1) (n − 2) · · · (n − k + 1) · k · nn · · · n}
| {z
n−k−1 times
n − k −1
= n ( n − 1) ( n − 2) · · · ( n − k + 1) · k · n .
Hence,
= n ( n − 1 ) ( n − 2 ) · · · ( n − k + 1 ) · k · n n − k −1 . (746)
437 This is where we need k < n: If we had k = n, then there would be no (k + 1)-st entry ak+1 .
= n ( n − 1 ) ( n − 2 ) · · · ( n − k + 1 ) · k · n n − k −1 .
Comparing this with (746), we find
n−1
n
k! · nn−k .
# of n-tuples a ∈ [n] with wit k =
k−1
This proves (745).]
Now, the wit of an n-tuple a ∈ [n]n is an element of [n]. Hence, the sum rule
yields
# of n-tuples a ∈ [n]n
n
= ∑ # of n-tuples a ∈ [n]n with wit k
k =1 | {z }
n−1
= k!·nn−k
k−1
(by (745))
n n −1
n−1 n−1
= ∑ k−1
k! · n n−k
= ∑
( k + 1 ) − 1
( k + 1) ! · n n−(k+1)
| {z }
k =1 k =0 |
{z } n n −1
n−1 = n n −1− k =
= nk
k
(here, we have substituted k + 1 for k in the sum)
n −1 n −1
n−1 n n −1 n − 1 ( k + 1) !
= ∑ ( k + 1) ! · k = n n −1
·∑ .
k =0
k n k =0
k nk
Thus,
n −1
n − 1 ( k + 1) !
n n −1
· ∑ k n k
= # of n-tuples a ∈ [ n ] n
= [n]n = nn .
k =0
Now,
n
2n − 1 2n − 1
∑ n − k
−
n − ( k + 1)
k =0 | {z }
2n − 1 2n − 1
=− −−
n − ( k + 1) n−k
n
2n − 1 2n − 1
= ∑ − − −
k =0
n − ( k + 1 ) n−k
n
2n − 1 2n − 1
=∑ − − −
i =0
n − ( i + 1) n−i
(here, we have renamed the summation index k as i )
2n − 1 2n − 1
= − − −
n − ( n + 1) n−0
by Corollary 4.1.17
2n − 1
(applied to u = 0 and v = n and ai = − )
n−i
2n − 1 2n − 1 2n − 1 2n − 1
= − = −
n−0 n − ( n + 1) n −1
| {z }
=0
(by (118)
(since −1/∈N))
(since n − 0 = n and n − (n + 1) = −1)
2n − 1
= .
n
Hence, (747) rewrites as
n
2n − 1
2n
∑ k n−k =n
n
.
k =0
( g0 , g1 , g2 , . . .), whereas [Grinbe15, Exercise 3.18 (a)] and [17f-hw4s, Exercise 6] are stated for two
finite sequences (i.e., tuples) ( f 0 , f 1 , . . . , f N ) and ( g0 , g1 , . . . , g N ) (which are called ( a0 , a1 , . . . , a N )
and (b0 , b1 , . . . , b N ) in [17f-hw4s, Exercise 6]). The proofs given in [Grinbe15] and [17f-hw4s]
for [Grinbe15, Exercise 3.18 (a)] and [17f-hw4s, Exercise 6] apply to Exercise 7.7.8 (once some
obvious changes are made).
439 Proof of (751): We are in one of the following two cases:
Case 1: We have i 6= n.
for each n ∈ N.
Case 2: We have i = n.
we have i 6= n. In other words, n 6= i. Hence,
Let us consider Case 1 first. In this case,
n
n − i 6= 0. Thus, [n − i = 0] = 0, so that [n − i = 0] = 0. Comparing this with [i = n] = 0
i | {z }
=0
n
(since i 6= n), we obtain [n − i = 0] = [i = n]. Hence, (751) is proven in Case 1.
i
Now, let us consider Case 2. In this case, we have i = n. In other words, n = i. Thus,
n n
n − i = 0. Thus, [n − i = 0] = 1. Also, from i = n, we obtain = = 1 (by (124)). Hence,
i n
n n
[n − i = 0] = 1. Comparing this with [i = n] = 1 (since i = n), we obtain [ n − i = 0] =
i | {z } i
| {z } =1
=1
[i = n]. Hence, (751) is proven in Case 2.
We thus have proven (751) in each of the two Cases 1 and 2. Thus, (751) always holds.
Hence,
n
2 (n − k)
2k
∑ k n − k
= (−4)n (−1)n = 4n .
k =0
This solves Exercise 7.7.9 (b).
We end this discussion by mentioning two binomial identities similar to Exercise
7.7.9 (b):
Proof of Lemma A.8.6. We have x ≥ 1 (since x is a positive integer) and y > 0 (since
x + y > 1 + 0 = 1. Hence, x + y − 1 > 0, so that
y is a positive integer), thus |{z}
|{z}
≥1 >0
x + y − 1 6= 0.
this with
x − x − y − y = x 2 − y2 − ( x − y ) = ( x + y ) ( x − y ) − ( x − y )
2 2
| {z }
=( x +y)( x −y)
= ( x + y − 1) ( x − y ) ,
we obtain ( x + y − 1) ( x − y) = 0. We can divide this equality by x + y − 1 (since
x + y − 1 6= 0), and thus obtain x − y = 0. In other words, x = y. This proves
Lemma A.8.6.
(An alternative proof of Lemma A.8.6 could be given using Viete’s theorem, as
the x2 − x = y2 − y condition means that x and y are two roots of the polynomial
X 2 − X − c for c = x2 − x = y2 − y. However, this would be overkill compared to
the completely pedestrian proof given above.)
Solution to Exercise 7.7.10. We need to show the following two claims:
[Proof of Claim 1: We shall show that the sequence 20 , 21 , 22 , . . . fits the bill.
each n ∈ N, we have
n n n n
n + r 2n
n + r n −r n+r 1 n+k 1
∑ r 2|{z} = ∑ r 2r = 2 · ∑ r 2r = 2 · ∑ k 2k n n
r =0 r =0 r =0 k =0
2n | {z }
= = 2 n
2 r
(by Exercise 7.5.2)
Thus,
n
n+r
v2n − vn = ∑ r
v n −r . (757)
r =1
The same argument (applied to (w0 , w1 , w2 , . . .) instead of (v0 , v1 , v2 , . . .)) yields
n
n+r
wn − wn = ∑
2
w n −r . (758)
r =1
r
However, our induction hypothesis says that (756) holds for j < n. In other
words, v j = w j holds for each j < n. In other words, v j = w j holds for each j ∈
{0, 1, . . . , n − 1}. Substituting n − r for j in this result, we conclude the following:
v n −r = w n −r holds for each r ∈ {1, 2, . . . , n} .
Hence, the right hand sides of the equalities (757) and (758) are equal. Thus, their
left hand sides are equal as well. In other words, v2n − vn = w2n − wn . Moreover, vn
is a positive integer (since (v0 , v1 , v2 , . . .) is a sequence of positive integers), and wn
is a positive integer (similarly). Thus, Lemma A.8.6 (applied to x = vn and y = wn )
yields that vn = wn . This is precisely what we needed to prove. Thus, the induction
step is complete. Hence, (756) is proved.]
Now, we have proved (756); in other words, we have shown that (v0 , v1 , v2 , . . .) =
( w0 , w1 , w2 , . . . ) .
Forget that we fixed (v0 , v1 , v2 , . . .) and (w0 , w1 , w2 , . . .). We thus have shown that
if (v0 , v1 , v2 , . . .) and (w0 , w1 , w2 , . . .) are two sequences (u0 , u1 , u2 , . . .) of positive
integers satisfying (755), then (v0 , v1 , v2 , . . .) = (w0 , w1 , w2 , . . .). In other words,
there is at most one such sequence (u0 , u1 , u2 , . . .). Thus, Claim 2 is proved.]
Having proved Claim 1 and Claim 2, we have thus solved Exercise 7.7.10.
1 1 1
∑ xy
= ∑ + ∑
xy ( x,y)∈Z xy
. (759)
2 ( x,y)∈W
( x,y)∈[n] ;
x ⊥y
On the other hand, let A be the set of all pairs ( x, y) ∈ [n]2 satisfying x ⊥ y and
x < y. Let B be the set of all pairs ( x, y) ∈ [n]2 satisfying x ⊥ y and x = y. Let C be
the set of all pairs ( x, y) ∈ [n]2 satisfying x ⊥ y and x > y.
Now, any pair ( x, y) ∈ [n]2 satisfying x ⊥ y must satisfy exactly one of the three
relations x < y and x = y and x > y, and thus must belong to exactly one of the
1
three sets A, B and C. Thus, we can split the sum ∑ as follows:
( x,y)∈[n]2 ;
xy
x ⊥y
1 1 1 1
∑ xy
= ∑ + ∑ + ∑
xy ( x,y)∈ B xy ( x,y)∈C xy
. (760)
2 ( x,y)∈ A
( x,y)∈[n] ;
x ⊥y
We shall now study the three sums on the right hand side of this equality. We
begin with the first one: We claim that
1 1
∑ xy
= ∑
x ( x + y )
. (761)
( x,y)∈ A ( x,y)∈W
and
g : A → W,
(u, v) 7→ (u, v − u)
are well-defined440 and mutually inverse441 . Hence, these two maps are bijections.
In particular, this means that f is a bijection. Hence, we can substitute (u, u + v)
1
for ( x, y) in the sum ∑ . We thus obtain
( x,y)∈ A xy
1 1 1
∑ xy
= ∑
u (u + v)
= ∑
x ( x + y)
( x,y)∈ A (u,v)∈W ( x,y)∈W
(here, we have renamed the summation index (u, v) as ( x, y)). This proves (761).]
Next, we claim that
1 1
∑ xy
= ∑
y ( x + y)
. (762)
( x,y)∈C ( x,y)∈W
1 1 1 1
∑ xy
= ∑
(u + v) v
= ∑
v (u + v)
= ∑
y ( x + y)
( x,y)∈C (u,v)∈W | {z } (u,v)∈W ( x,y)∈W
1
=
v (u + v)
440 Proving this is fairly easy: The only part that is not completely trivial is showing that u ⊥ v
implies u ⊥ u + v and u ⊥ v − u. But this can easily be derived from Proposition 3.4.4 (indeed,
Proposition 3.4.4 (b) entails gcd (u, u + v) = gcd (u, v) and gcd (u, v − u) = gcd (u, v)).
441 This is completely straightforward to check.
442 Proving this is fairly easy: The only part that is not completely trivial is showing that u ⊥ v
implies u + v ⊥ v and u − v ⊥ v. But this can easily be derived from Proposition 3.4.4 (indeed,
Proposition 3.4.4 (b) entails gcd (v, u + v) = gcd (v, u) and gcd (v, u − v) = gcd (v, u)).
443 This is completely straightforward to check.
(here, we have renamed the summation index (u, v) as ( x, y)). This proves (762).]
Next, we claim that
1
∑ xy = 1. (763)
( x,y)∈ B
[Proof of (763): The set B consists of all pairs ( x, y) ∈ [n]2 satisfying x ⊥ y and
x = y. In other words, B consists of all pairs ( x, x ) ∈ [n]2 satisfying x ⊥ x (since
the condition x = y allows us to rewrite the pair ( x, y) as ( x, x )). However, the only
such pair is (1, 1) (indeed, a positive integer x always satisfies gcd ( x, x ) = x, and
therefore will satisfy x ⊥ x if and only if x = 1). Hence, B = {(1, 1)}. Consequently,
1 1 1
∑ xy
= ∑ xy
=
1·1
= 1.
( x,y)∈ B ( x,y)∈{(1,1)}
1 1 1 1
∑ xy
= ∑ xy
+ ∑
xy
+ ∑ xy
( x,y)∈[n]2 ; ( x,y)∈ A ( x,y)∈ B ( x,y)∈C
x ⊥y | {z } | {z } | {z }
1 =1 1
= ∑ (by (763)) = ∑
( x,y)∈W x ( x + y ) ( x,y)∈W y ( x + y )
(by (761)) (by (762))
1 1
= ∑ x ( x + y)
+1+ ∑
y ( x + y)
( x,y)∈W ( x,y)∈W
1 1
= ∑ + ∑
x ( x + y) ( x,y)∈W y ( x + y)
+1
( x,y)∈W
| {z }
1 1
!
= ∑ +
( x,y)∈W x ( x + y ) y ( x + y )
1 1 1
= ∑ + +1 = ∑ + 1.
( x,y)∈W |
x ( x + y ) y ( x + y ) ( x,y)∈W
xy
{z }
y+x 1
= =
xy ( x + y) xy
1 1 1
∑ + ∑
xy ( x,y)∈Z xy
= ∑
xy
+1
( x,y)∈W ( x,y)∈W
1 1
Subtracting ∑ from both sides of this equality, we obtain ∑ = 1.
( x,y)∈W xy ( x,y)∈ Z xy
This solves Exercise 8.3.1.
Second solution to Exercise 8.3.1 (sketched). Let us rename the set Z as Zn , to stress its
1
dependence on n. Thus, we must compute ∑ . We claim that
( x,y)∈ Zn xy
1
∑ xy
= 1.
( x,y)∈ Zn
• The set Zm−1 consists of all pairs ( x, y) ∈ [m − 1]2 satisfying x ⊥ y and x + y >
m − 1.
Thus, roughly speaking, the sets Zm and Zm−1 agree in “most” of their elements.
To make this more precise, let us see which elements of Zm fail to belong to Zm−1 :
1 1 1
∑ xy
= ∑ xy
+ ∑ xy
. (764)
( x,y)∈ Zm ( x,y)∈ Zm ; ( x,y)∈ Zm ;
( x,y)∈ Zm−1 one of x and y equals m
1 1
∑ − ∑
xy ( x,y)∈ xy
( x,y)∈ Zm Z m −1
1 1 1 1
∑ ∑ ∑ ∑
= + − +
( x,y)∈ Zm ;
xy ( x,y)∈ Zm ;
xy ( x,y)∈ Z
xy ( x,y)∈ Z
xy
m −1 ; m −1 ;
( x,y)∈ Zm−1 one of x and y equals m ( x,y)∈ Zm x +y=m
1 1 1 1
= ∑ − ∑
xy ( x,y)∈ xy
+ ∑ xy
− ∑ xy
( x,y)∈ Zm ; Z m −1 ; ( x,y)∈ Zm ; ( x,y)∈ Zm−1 ;
( x,y)∈ Zm−1 ( x,y)∈ Zm one of x and y equals m x +y=m
| {z } | {z } | {z }
=0 = ∑ = ∑
(since these two sums are equal) ( x,y)∈[m]2 ; ( x,y)∈[m−1]2 ;
x ⊥y; x ⊥y;
( x =m or y=m) x +y=m
1 1
= ∑ xy
− ∑ xy
. (766)
( x,y)∈[m]2 ; ( x,y)∈[m−1]2 ;
x ⊥y; x ⊥y;
( x =m or y=m) x +y=m
Now, let us simplify the first sum on the right hand side. A pair ( x, y) ∈ [m]2
satisfying x ⊥ y cannot satisfy x = m and y = m simultaneously (because this
would mean that m ⊥ m, but this is impossible because of m > 1). Hence, we can
1
split the sum ∑ as follows:
( x,y)∈[m]2 ;
xy
x ⊥y;
( x =m or y=m)
1 1 1
∑ xy
= ∑ xy
+ ∑ xy
( x,y)∈[m]2 ; ( x,y)∈[m]2 ; ( x,y)∈[m]2 ;
x ⊥y; x ⊥y; x ⊥y;
( x =m or y=m) x =m but not y=m y=m but not x =m
| {z } | {z }
1 1
= ∑ = ∑
y∈[m]; my x ∈[m]; xm
m⊥y; x ⊥m;
not y=m not x =m
1 1
= ∑ = ∑
y∈[m−1]; my x ∈[m−1]; xm
m⊥y x ⊥m
1 1
= ∑ my
+ ∑ xm
y∈[m−1]; x ∈[m−1];
m⊥y x ⊥m
| {z }
1
=∑
x ∈[m−1]; m (m − x )
m⊥m− x
(here, we have substituted m− x for y in the sum)
1 1
= ∑ + ∑
m (m − x ) x∈[m−1]; xm
x ∈[m−1];
m⊥m− x x ⊥m
| {z }
= ∑
x ∈[m−1];
x ⊥m
(since it is not hard
to see that m⊥m− x is
equivalent to x ⊥m)
1 1 1 1
= ∑ + ∑
m (m − x ) x∈[m−1]; xm
= ∑ +
m (m − x ) xm
x ∈[m−1]; x ∈[m−1]; | {z }
x ⊥m x ⊥m x ⊥m
1
=
x (m − x )
1
= ∑ x (m − x )
. (767)
x ∈[m−1];
x ⊥m
Meanwhile, the second sum on the right hand side of (766) rewrites as follows:
1 1
∑ xy
= ∑ x (m − x )
( x,y)∈[m−1]2 ; x ∈[m−1];
x ⊥y; x ⊥m− x
x +y=m
| {z }
= ∑
x ∈[m−1];
x ⊥m
(since it is not hard
to see that x ⊥m− x is
equivalent to x ⊥m)
1 1 1 1
∑ − ∑
xy ( x,y)∈ xy
= ∑ − ∑
x (m − x ) x∈[m−1]; x (m − x )
= 0.
( x,y)∈ Zm Z m −1 x ∈[m−1];
x ⊥m x ⊥m
Hence,
1 1
∑ xy
= ∑ xy
=1 (by the induction hypothesis) .
( x,y)∈ Zm ( x,y)∈ Z m −1
This completes the induction step. Thus, Exercise 8.3.1 is solved again.
Solution to Exercise 8.3.2 (sketched). (a) The two half-circles subdivide the quarter-
circle into four regions. We denote the areas of these four regions by b, r, x, y in the
following way:
C
x r
b y
A B .
444 Thus, the area of the red region is r, whereas the area of the blue region is b.
We claim that r = b.
Indeed, let a = | AB| = | AC |. Thus, the quarter-circle has radius a; hence, its area
1
is πa2 . In other words,
4
1
b + r + x + y = πa2 (769)
4
(since the quarter-circle has been subdivided into four regions with areas b, r, x, y,
and thus its area is b + r + x + y).
1 1
However, the lower semicircle has diameter AB and thus radius | AB| = a.
2 | {z } 2
=a
2
1 1 1
Hence, its area is π a = πa2 . In other words,
2 2 8
1 2
b+y = πa (770)
8
(since the lower semicircle has been subdivided into two regions with areas b and
y, and thus its area is b + y).
A similar argument (using the upper semicircle instead of the lower one) shows
1
that b + x = πa2 . Subtracting this equality from (769), we obtain (b + r + x + y) −
8
444 Here is how to define b, r, x, y without referencing the picture: We shall refer to the semicircle
with diameter AB as the lower semicircle. We shall refer to the semicircle with diameter AC as
the upper semicircle. Let A (U ) denote the area of any shape U. Now, we set
1 1 1
(b + x ) = πa2 − πa2 . This simplifies to r + y = πa2 . Comparing this with
4 8 8
(770), we obtain r + y = b + y. Hence, r = b. This solves Exercise 8.3.2 (a).
(b) Exercise 8.3.2 (b) is [17f-hw8s, Lemma 0.3], where I give three proofs. The
shortest of them is the second proof, which I will now reproduce:
The map σ is a permutation of [n], thus a bijection [n] → [n]. Hence, it has an
inverse map σ−1 . Now, the map
{i ∈ [ n ] | σ (i ) ≥ j } → {i ∈ [ n ] | i ≥ j } ,
i 7 → σ (i )
is clearly well-defined. Furthermore, this map is a bijection (indeed, its inverse
sends each i to σ−1 (i )). Hence, the bijection principle yields
|{i ∈ [n] | σ (i ) ≥ j}| = |{i ∈ [n] | i ≥ j}| .
In other words,
(# of all i ∈ [n] satisfying σ (i ) ≥ j) = (# of all i ∈ [n] satisfying i ≥ j) .
We have
1 3 2 5 4
7 9 6 10 8 12 11
.
Here, we have drawn the j − 1 nodes 1, 2, . . . , j − 1 above the red line, and drawn
the remaining n − j + 1 nodes j, j + 1, . . . , n below the red line. Now,
is the # of all arrows that cross the red line from bottom to top, whereas
is the # of all arrows that cross the red line from top to bottom. (We assume
that no arrow crosses the red line more than once; this can be achieved, e.g., by
making all arrows straight.) Hence, Exercise 8.3.2 (b) says that the # of arrows
crossing the red line from bottom to top equals the # of arrows crossing the
red line from top to bottom. Stated in this way, this feels rather intuitive –
particularly if one remembers that the arrows form several disjoint cycles, and
each cycle must enter the top region as often as it leaves it. It is essentially a
manifestation of the “what goes in must come out” principle. This thinking can
actually be made rigorous, leading to a different solution to Exercise 8.3.2 (b).
(See [17f-hw8s, Third proof of Lemma 0.3] for this solution.)
( x1 , x2 , . . . , xn ) 7→ (σ ( x1 ) , σ ( x2 ) , . . . , σ ( xn )) .
Hence, we can use the bijection principle to see that
h-even n-tuples in [d]n = 1-even n-tuples in [d]n
1 n
d + ( d − 2) n
= (by our solution to Exercise 7.8.1) .
2
1 n
In other words, the # of h-even n-tuples in [d]n is d + (d − 2)n . This proves Proposition
2
A.10.2.
(Alternatively, of course, Proposition A.10.2 can be proved in the same way as we solved
Exercise 7.8.1, just with all “1”s in the appropriate places replaced by “h”s.)
(# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n])
= ∑ (−1)| I | (# of x ∈ U satisfying x ∈ Ai for all i ∈ I ) . (771)
I ⊆[n]
Now, let us compute both the left and the right hand side of this equality, and
see what it then turns into.
The left hand side is an easy counting problem: We have
Indeed, the last equality sign here follows from the dependent product rule, since
the following decision procedure can be used to construct a set J ∈ U such that
each i ∈ [n] satisfies either i ∈ J or −i ∈ J:
• We choose the p elements i ∈ [n] for which J will contain both i and −i.
(Make sure understand why there should be exactly p such elements!)
you
n
There are options for this decision.
p
• For each of the remaining n − p elements i ∈ [n], we decide whether J will
contain i or −i. (Indeed, J will have to contain exactly one of i and −i for each
of these i.) These are n − p decisions, and each of them allows for 2 options;
thus, we have 2n− p options here in total.
The right hand side of (771) is even easier to compute: If I is any subset of [n],
then
(# of x ∈ U satisfying x ∈
/ Ai for all i ∈ [n])
= ∑ (−1)| I | (# of x ∈ U satisfying x ∈ Ai for all i ∈ I )
I ⊆[n]
n
2n − 2k
n
= ∑ (−1) k
(by (774)) .
k =0
k n+p
n−1
/ N and thus
Now, 0 − 1 = −1 ∈ = 0 (by an application of (118)). Now,
0−1
n
n−1
∑ (−1) k − 1 ak
k
k =0
n
0 n−1 k n−1
= (−1) a0 + ∑ (−1) ak
0−1 k =1
k − 1
| {z }
=0
(here, we have split off the addend for k = 0 from the sum)
n
k n−1
= (−1) 0a0 + ∑ (−1)
0
a
| {z } k=1 k−1 k
=0
n n −1
n−1 n−1
= ∑ (−1) k
k − 1 k k∑
a = (−1) k +1
a
| {z } (k + 1) − 1 k+1
k =1 =0
=−(−1)k
| {z }
n−1
=
k
(here, we have substituted k + 1 for k in the sum)
n −1 n − 1 n −1
k n−1
= ∑ − (−1) k
ak+1 = − ∑ (−1) a k +1 . (776)
k =0
k k =0
k
∈ N. Hence,
Also, n ≥ 1 (since n is a positive integer), so that n − 1 Proposition
n−1
4.3.4 (applied to n − 1 and n instead of n and k) yields = 0 (since n >
n
n − 1). Now,
n
k n−1
∑ (−1) k
ak
k =0
n −1
n n−1 k n−1
= (−1) an + ∑ (−1) ak
n k = 0
k
| {z }
=0
(here, we have split off the addend for k = n from the sum)
n −1
k n−1
= (−1) 0an + ∑ (−1)
n
ak
| {z } k=0 k
=0
n −1
n−1
= ∑ (−1) k
k
ak . (777)
k =0
2m − 2k
Now, let p ∈ Z. Then, Lemma A.10.3 (applied to n = m and ak = )
m+p
445 Proof of (778): Let p ∈ Z. We are in one of the following three cases:
Case 1: We have p = 0.
Case 2: We have p > 0.
Case 3: We have p < 0.
Letusfirstconsider
Case 1. In this case, we have p = 0. Thus, 20− p = 20−0 = 20 = 1, so that
0− p 0 0
2|{z} = . Thus, (778) holds. Hence, we have proved (778) in Case 1.
p p
=1
Let us now consider Case 2. In this we have p > 0. Thus, Proposition
case, 4.3.4
(applied to 0
0 0 − p 0
and p instead of n and k) yields that = 0. Comparing this with 2 = 0, we obtain
p p
| {z }
=0
0 0
= 20− p . Hence, we have proved (778) in Case 2.
p p
0
Finally, let us consider Case 3. In this case, we have p < 0. Thus, p ∈ / N, so that =0
p
0 0 0
(by an application of (118)). Comparing this with 20− p = 0, we obtain = 20 − p .
p p p
| {z }
=0
Hence, we have proved (778) in Case 3.
We have now proved (778) in all three Cases 1, 2 and 3. Thus, (778) always holds.
446 Proof. For each p ∈ Z, we have
0
2 · 0 − 2k 2·0−2·0
0 0 0
∑ (−1) k k
0+ p
= (−1)
| {z } 0 0+ p
k =0
=1 |{z} | {z }
=1
0
=
p
(since 2·0−2·0=0 and 0+ p= p)
0 0− p 0
= =2 (by (778)) .
p p
yields
m
2m − 2k
m
∑ (−1) k k
m+p
k =0
m −1
k m−1 2m − 2k 2m − 2 (k + 1)
= ∑ (−1) − . (780)
k =0
k m + p m + p
2m − 2k 2m − 2 (k + 1)
We shall now simplify the difference − on the right
m+p m+p
side of this equality.
Indeed, it is easy to see that every n ∈ R and i ∈ R satisfy
447 Proof of (781): Let n ∈ R and i ∈ R. Then, Theorem 4.3.7 (applied to k = i) yields
n−1 n−1
n
= +
i i−1 i
| {z } | {z }
n−1−1 n−1−1 n−1−1 n−1−1
= + = +
i−1−1 i−1 i−1 i
(by Theorem 4.3.7, (by Theorem 4.3.7,
applied to n−1 and i −1 applied to n−1 and i
instead of n and k) instead of n and k)
n−1−1 n−1−1 n−1−1 n−1−1
= + + +
i−1−1 i−1 i−1 i
n−1−1 n−1−1 n−1−1
= +2 +
i−1−1 i−1 i
n−2 n−2 n−2
= +2 +
i−2 i−1 i
n−2
(since n − 1 − 1 = n − 2 and i − 1 − 1 = i − 2). Subtracting from both sides of this
i
equality, we obtain
n−2 n−2 n−2
n
− = +2 .
i i i−2 i−1
Thus, (781) is proven.
2m − 2k 2m − 2 (k + 1)
−
m+p m+p
2m − 2k 2m − 2k − 2
= − (since 2m − 2 (k + 1) = 2m − 2k − 2)
m+p m+p
2m − 2k − 2 2m − 2k − 2
= +2
m+ p−2 m+ p−1
(by (781) (applied to n = 2m − 2k and i = m + p))
2 (m − 1) − 2k 2 (m − 2) − 2k
= +2 . (782)
( m − 1) + ( p − 1) ( m − 1) + p
m−1 m−1
m− p m m− p
2 =2 + ,
p p−1 p
|{z
}
m−1 m−1
= +
p−1 p
(by Theorem 4.3.7,
applied to n=m and k= p)
we obtain
m
2m − 2k
m m− p m
∑ (−1) k k
m+p
=2
p
.
k =0
Forget that we fixed p. We thus have shown that every p ∈ Z satisfies
m
2m − 2k
k m m− p m
∑ (−1) k m + p
=2
p
.
k =0
In other words, Exercise 8.4.2 holds for n = m. This completes the induction step.
Thus, Exercise 8.4.2 is solved again.
Our third solution to Exercise 8.4.2 is algebraic as well, but unlike our rather
down-to-earth second solution above, it relies on several binomial identities (while
avoiding the use of induction). The first one is the following identity ([19fco-hw3s,
§6.6, Theorem 6.13]):
Lemma A.10.4. Let p ∈ N and q ∈ R. Then,
p
x−i x−p
p
∑ (−1) i i
q
=
q−p
for all x ∈ R.
i =0
References to the proof of Lemma A.10.4. Lemma A.10.4 is proved in [19fco-hw3s, §6.6,
Theorem 6.13]. (The proof proceeds by first reducing it to the case q ∈ N, which
constitutes [19fco-hw3s, Exercise 6], and then solving the latter exercise in four
different ways. The fourth solution is particularly of note, as it involves finite dif-
ferences of integer sequences, which are a variation on the finite differences of
polynomials we have seen in Example 5.4.2. It can easily be rewritten in terms of
the latter.)
Our next binomial identity is a mashup of Corollary 4.3.17 with the trinomial
revision formula:
Lemma A.10.5. Let n ∈ N and p ∈ Z. Then,
n
n k n− p n
∑ k p =2 p
.
k =0
n−i n−k
n n
= .
i k k i
n−i
Multiplying both sides of this equality by , we obtain
k
n−i n−i
n n
=
i k n−i k
n−k
n
= (by (785)) . (786)
k (n − i ) − k
Now, we are in one of the following two cases:
Case 1: We have k ≤ n.
Case 2: We have k > n.
Let us first consider Case 1. In this case, we have k ≤ n. Thus, n − k ∈ N. Hence,
Theorem 4.3.10 (applied to n − k and i instead of n and k) yields
n−i n−k
n n
= = 0.
i k k (n − i ) − k
| {z }
=0
n−k
n
Comparing this with = 0, we obtain
k i
| {z }
=0
n−i n−k
n n
= .
i k k i
Third solution to Exercise 8.4.2 (sketched). It is easy to see that Exercise 8.4.2 holds if
n + p < 0 448 . Thus, we WLOG assume that n + p ≥ 0. Hence, n + p ∈ N (since
n + p is an integer).
2n − 2k
n n n
k n − p
Comparing this with (788), we obtain ∑ (−1) = 2 . Hence, Exercise
k =0 k n + p p
8.4.2 is solved under the assumption that n + p < 0.
Now, we have
n
2n − 2k
n
∑ (−1) k n + p
k
k =0
n
2n − 2i
i n
= ∑ (−1)
i =0
i n+p
| {z }
(n − i ) + (n − i )
=
n+p
n−i n−i
n+ p
=∑
k =0 k n+p−k
(by Proposition 7.5.1,
applied to n−i, n−i and n+ p instead of x, y and n)
n n+ p
n−i n−i
n
= ∑ (−1) i
∑ k
i =0
i k =0
n+p−k
| {z }
n−i n−i
n
=∑
k =0 k n+p−k
(here, we have changed the upper range of the summation;
indeed, it is not hard to see that all addends with k>n
are zero, as are all addends with k>n+ p, so that the value
of the sum is not affected by our change)
n n
n−i n−i
n
= ∑ (−1) i
i k ∑ n+p−k
i =0 k =0
n n
n−i n−i
n
= ∑ ∑ (−1) i
i
k n+p−k
k =0 i =0 | {z }
n n−k
=
k i
(by Lemma A.10.6)
n n
n−k n−i
i n
= ∑ ∑ (−1)
k =0 i =0
k i n+p−k
n n
i n−k n−i
n
= ∑ ∑ (−1)
k =0
k i =0
i n+p−k
| {z }
n−k n−i
n−k
= ∑ (−1)i
i =0 i n+p−k
(here, we removed all addends with i >n−k,
since these addends were 0 anyway)
n n−k
n−k n−i
n
= ∑ ∑ (−1) i
k =0
k i =0
i n+p−k
| {z }
n − (n − k)
=
(n + p − k) − (n − k)
(by Lemma A.10.4,
applied to p=n−k and q=n+ p−k and x =n)
n n
n − (n − k)
n n k n− p n
= ∑ = ∑ =2
k =0
k (n + p − k) − (n − k) k = 0
k p p
| {z }
k
=
p
(by Lemma A.10.5). This solves Exercise 8.4.2 again.
0
Proof of Proposition A.10.7. We have n > 0 (since n ∈ {1, 2, 3, . . .}). Thus, =0
n
(by Proposition 4.3.4, applied to 0 and n instead of n and k).
We have n ∈ {1, 2, 3, . . .} ⊆ {−1, 0, 1, . . .}. Thus, Proposition 4.9.18 yields
n
n − k n−2k k
x n +1 = ∑ a b
k =0
k
n −1
n − k n−2k k n − n n−2n n
= ∑ a b + a b
k =0
k n
| {z }
0
= =0
n
(here, we have split off the addend for k = n from the sum)
n −1
n − k n−2k k
= ∑ a b + 0a n−2n n
{z b}
k =0
k |
=0
n −1
n − k n−2k k
= ∑ a b . (789)
k =0
k
n−k−1 n−k
(n − k) =k . (792)
k−1 k
Now,
1 n−k
Adding to both sides of this equality, we find
n k
Now,
n −1
n−k
1
∑ n − k k
an−2k bk
k =0 | {z }
n−k n−k−1
1
= +
n k k−1
(by (791))
n −1
n−k n−k−1
1
= ∑ + an−2k bk
k =0
n k k−1
1 n −1 n−k n−k−1
= ∑ + an−2k bk
n k =0 k k−1
1 n−1 n − k n−2k k 1 n−1 n − k − 1 n−2k k
= ∑ a b + ∑ a b
n k =0 k n k =0 k−1
| {z } | {z }
= x n +1 =bxn−1
(by (789)) (by (790))
1 1 1
= xn+1 + bxn−1 = ( xn+1 + bxn−1 ) .
n n n
This proves Proposition A.10.7.
Now, solving Exercise 8.4.3 is a matter of finding the right ( a, b)-recurrent se-
quence:
Solution to Exercise 8.4.3 (sketched). Set a = 1 and b = −1. Thus, a = 1 6= 0.
Consider the sequence ( g0 , g1 , g2 , . . .) defined in Example 4.7.7. This sequence
( g0 , g1 , g2 , . . .) is (1, −1)-recurrent. In other words, it is ( a, b)-recurrent (since a = 1
and b = −1). Moreover, it satisfies g0 = 0 and g1 = 1. Thus, Proposition A.10.7
(applied to xi = gi ) yields
n −1
n−k
1 1
( gn+1 + bgn−1 ) = ∑ n−2k
|a {z } bk
n k =0
n − k k |{z}
=1n−2k =(−1)k
(since a=1) (since b=−1)
n −1
n − k n−2k n −1
(−1)k n − k
1
= ∑ 1| {z } (−1) = ∑
k
k =0
n − k k k =0
n−k k
=1
n −1
(−1)i n − i
= ∑ .
i =0
n−i i
Hence,
n −1 i
n−i
(−1) 1 1
∑ n−i i
=
n
b g n −1 = ( g n +1 − g n −1 ) .
gn+1 + |{z}
n
i =0 =−1
But this is entirely straightforward: Both sides of this equality depend only on the
remainder n%6 (not on n itself), because the sequence ( g0 , g1 , g2 , . . .) is 6-periodic
(as we have seen in Example 4.7.7). Thus, in order to prove it for all positive
integers n, it suffices to prove it for all n ∈ {1, 2, 3, 4, 5, 6} only (since these 6 values
of n represent all possible remainders that n%6 can take). But this can be done
mechanically.449 This solves Exercise 8.4.3.
449 Here are a few more details: Let us forget that we fixed n. Thus, we must prove (793) for all
positive integers n. In other words, we must prove that the two sequences
and
(−1)(n+1)//3 (1 + [3 | n])
n∈{1,2,3,...}
2//3
= (−1) (1 + [3 | 1]) , (−1)3//3 (1 + [3 | 2]) , (−1)4//3 (1 + [3 | 3]) , . . .
are identical. But both of these two sequences are 6-periodic (indeed, the sequence
( gn+1 − gn−1 )n∈{1,2,3,...} is 6-periodic because the sequence ( g0 , g1 , g2 , . . .) is 6-periodic; mean-
while, the sequence (−1)(n+1)//3 (1 + [3 | n]) is 6-periodic because it is straightfor-
n∈{1,2,3,...}
ward to see that
(
(n+1)//3 1, if n%6 ∈ {0, 1, 5} ;
(−1) = and
−1, if n%6 ∈ {2, 3, 4}
(
1, if n%6 ∈ {1, 2, 4, 5} ;
1 + [3 | n ] =
2, if n%6 ∈ {0, 3}
for each n ∈ Z). Hence, in order to prove that these two sequences are identical, it suffices to
show that they agree in their first 6 entries. But this is mechanical.
b
a c
f d
e
,
then we define the fingerprint of this state as the number a − b + c − d + e − f .
It is easy to see that each move leaves the fingerprint of the state unchanged
(since, for example,
( a + 1) − ( b + 1) + c − d + e − f = a − b + c − d + e − f
for any numbers a, b, c, d, e, f ). The fingerprint of the initial state (in which the
numbers are 1, 0, 1, 0, 0, 0) is 1 − 0 + 1 − 0 + 0 − 0 = 2; thus, it remains 2 throughout
the process. Hence, it can never become 0. This entails that the numbers can never
all become equal (because if all numbers are equal, then the fingerprint of the state
is a − a + a − a + a − a = 0). In other words, you cannot ensure that all six sectors
have the same number written in them. This solves Exercise 8.4.5.
Exercise 8.4.5 is [Engel98, Chapter 1, Example E3].
a b a b n
ab + + cents. But since ab + + = (check this!), this shows
2 2 2 2 2
n
that you gain cents. This completes the induction step.
2
Second proof: Let me define a dispersed couple to mean a set {u, v} of two chips
that lie in different heaps. Of course, this concept depends on the state. In the
initial state, there are no dispersed couples, since all chips lie in the same heap. In
the end state (whenyou are left with n heaps, each containing exactly one chip),
n
there are precisely dispersed couples (since any two distinct chips form a
2
dispersed couple). Thus, any set {u, v} of two chips becomes a dispersed couple in
one of your moves (and then remains a dispersed couple forever, since there are no
moves that would bring chips from different heaps back together). Furthermore,
the number of cents you gain from a move is precisely the number of dispersed
couples that are created by this move (i.e., the number of sets {u, v} of two chips
that were not a dispersed couple before the move, but are a dispersed couple after
the move). Thus, the total number of cents you gain during the game is the total
number
of dispersed couples created by the end of the game. But this latter number
n
is (since the initial state has no dispersed couples, whereas the end state has
2
n
of them). This, again, proves our claim.
2
of Z × V. Thus, states are finite subsets of Z × V. For example, the state shown in
(400) is the subset
{(3, a) , (3, b) , (4, c) , (5, d) , (5, e)}
of Z × V (assuming that the cells shown in (400) correspond to the rooms 1, 2, . . . , 11).
For another example, the subset {(1, α) , (1, β) , (4, γ)} of Z × V (with α, β, γ being
three distinct violinists) is the state in which the two violinists α and β are staying
in room 1 and the violinist γ is staying in room 4 (and there are no other violinists
in the hotel).
Thus, any move removes two pairs of the form (i, α) and (i, β) from the state and
inserts the two pairs (i − 1, α) and (i + 1, β) into the state. (Here, of course, α is the
violinist that moves to room i − 1, and β is the violinist that moves to room i + 1.)
If S ⊆ Z × V is any state, then Occ S shall denote the set of all occupied rooms
in S. Thus,
Occ S = {i | (i, v) ∈ S} .
This is a finite subset of Z.
We define the entropy of a state S to be the sum ∑ 2i (recalling that S is a finite
(i,v)∈S
subset of Z × V). This is a rational number (since the sum is finite).
It is easy to see that this entropy increases each night. In other words:
Claim 1: Whenever two violinists move apart, the entropy of the state
increases.
[Proof of Claim 1: Similar to the proof of Claim 1 in the solution to Exercise 8.2.7.]
Once again (as in the solution to Exercise 8.2.7), this is useful but not sufficient to
solve the exercise. Again, we need to show that only finitely many possible states
can be reached.
Let us do this. We let N be the # of violinists in the hotel. (Clearly, this # does
not change during the process.) We shall show that the violinists never move “too
far” away from their original rooms; more precisely, they will always stay within
2N rooms of the interval between the leftmost and the rightmost room occupied in
the initial state. We shall now make this precise.
Let S0 be the initial state. Consider a sequence of g (successive) moves, starting
from state S0 and leading to states S1 , S2 , S3 , . . . , Sg in this order (i.e., the first move
transforms state S0 into state S1 ; the next move transforms state S1 into state S2 ;
and so on). As in the solution to Exercise 8.2.7, we have
N = | S0 | = | S1 | = · · · = S g . (794)
We WLOG assume that N > 0. Thus, the sets S0 , S1 , . . . , Sg are nonempty finite
sets (because (794) shows that each of them has N elements); therefore, so are the
sets Occ (S0 ) , Occ (S1 ) , . . . , Occ Sg . Hence,
the minima and maxima of these lat-
ter sets Occ (S0 ) , Occ (S1 ) , . . . , Occ Sg are well-defined. Let α = min (Occ (S0 ))
and ω = max (Occ (S0 )). (Note that the sets Occ (S0 ) , Occ (S1 ) , . . . , Occ Sg are
going to play some of the roles that the sets S0 , S1 , . . . , Sg used to play in our so-
lution to Exercise 8.2.7. In the latter solution, violinists could not be roommates,
which is why we didn’t have to introduce Occ S.)
Now, we shall see that the violinists don’t spread “too fast” through the hotel.
To be more specific, we claim the following:
Claim 2: We have min (Occ (Si+1 )) ≥ min (Occ (Si )) − 1 for each i ∈
{0, 1, . . . , g − 1}.
S0+ = S ∪ {s + 1 | s ∈ S} = {i ∈ Z | i ∈ S or i − 1 ∈ S} .
In other words, S0+ is the set of all integers i that belong to S themselves or have
their left neighbor i − 1 belong to S. Clearly, for any finite subset S of Z, we have
S 0+ ≤ 2 · | S | (795)
S ⊆ S 0+ . (796)
Our next claim shows that if at least one of two consecutive rooms is occupied at
some point, then this property will remain valid in all future states (even though it
will not always be the same room that is occupied, or even the same # of rooms):
Claim 3: We have (Occ (Si ))0+ ⊆ (Occ (Si+1 ))0+ for each i ∈ {0, 1, . . . , g − 1}.
In words, this is saying that if a room or the next room to its right is occupied at
some time, then it will always remain the case that this room or the next room is
occupied.
In the rest of this solution, we shall use the notation [ p, q] for the integer interval
{ p, p + 1, . . . , q}, just as we did in the solution of Exercise 8.2.7.
Our next claim will show that the leftmost occupied room will always remain to
the right of the room α − 2N (so it cannot “wander off” to the left too far):
Claim 4: Let m ∈ {0, 1, . . . , g}. Then, min (Occ (Sm )) > α − 2N.
Claim 5: Let m ∈ {0, 1, . . . , g}. Then, max (Occ (Sm )) < ω + 2N.
[Proof of Claim 5: This is similar to proving Claim 5 in the solution of Exercise
8.2.7.]
Now, Claim 4 and Claim 5 can be combined to the following:
Claim 6: Let m ∈ {0, 1, . . . , g}. Then, Sm ⊆ [α − 2N + 1, ω + 2N − 1] × V.
[Proof of Claim 6: Using Claim 4 and Claim 5, it is easy to see that Occ (Sm ) ⊆
[α − 2N + 1, ω + 2N − 1] (indeed, this can be proved just as we showed Claim 6 in
the solution of Exercise 8.2.7). However, it is easy to see that S ⊆ (Occ S) × V for
any state S ⊆ Z × V (indeed, this follows from the definition of Occ S). Applying
this to S = Sm , we obtain
Sm ⊆ Occ (Sm ) ×V ⊆ [α − 2N + 1, ω + 2N − 1] × V.
| {z }
⊆[α−2N +1,ω +2N −1]
Let me mention a major difference between Exercise 8.4.8 and Exercise 8.2.7: In
Exercise 8.4.8, if we treat the violinists as indistinguishable, then the final state (i.e.,
the set of rooms that are occupied after the moving has stopped) is independent
of the moves! That is, it does not matter which pairs of violinists choose to move
apart first; in all possible scenarios, the rooms that end up occupied at the end
will be the same. This result (which differs dramatically from the behavior of
final states in Exercise 8.2.7) appears, e.g., in [Klivan18, Proposition 5.2.1] (in much
greater generality); it is part of the theory of the chip-firing game (also known
as the abelian sandpile model) on graphs. There are now two books ([CorPer18],
[Klivan18]) out on this theory; in particular, [Klivan18, §5.3] explicitly describes
the final state in Exercise 8.4.8 in the case when all violinists start out in the same
room.
Solution to Exercise A.10.1 (sketched). This is similar to the above solution to Exercise
8.1.8, so we restrict ourselves to an outline.
Again, we begin by playing around with the recursive equation.
Let n be an integer satisfying n ≥ k + 1. Thus, n ≥ n − 1 ≥ k (since n ≥ k + 1);
hence, (799) holds. Multiplying both sides of (799) by an−k , we obtain
Adding qtn−2 tn−3 + t2n−3 + tn−1 tn−4 + qtn−1 tn−3 to both sides of this equality, we
obtain
In other words,
tn−3 (tn + qtn−1 + qtn−2 + tn−3 ) = tn−1 (tn−1 + qtn−2 + qtn−3 + tn−4 ) .
Now, forget that we fixed n. We thus have proved the equality (803) for each
integer n ≥ 4.
Now, let us define a number
tn + qtn−1 + qtn−2 + tn−3
bn =
t n −1 t n −2
bn = bn − 1
for each integer n ≥ 4 (because its left hand side is bn , while its right hand side is
bn−1 ). In other words, b3 = b4 = b5 = · · · . Hence, all entries b3 , b4 , b5 , . . . of the
sequence (b3 , b4 , b5 , . . .) are integers (since b3 is an integer).
From here on, we can conclude our solution to Exercise 8.4.10 similarly to our
above solution to Exercise A.10.1.
Having solved Exercise 8.4.10, let me point out two generalizations (although I
only know how to solve one).
Exercise 8.4.10 is a particular case (for k = 3) of the following more general
exercise:
Exercise A.10.2. Fix a positive integer k ≥ 2 and an integer q ∈ N. Define a
sequence ( a0 , a1 , a2 , . . .) of positive rational numbers recursively by setting
and
a2n−1 + a2n−2 + · · · + a2n−k+1 + q ∑
a n −i a n − j
1≤ i < j ≤ k −1
an = (805)
an−k
for each n ≥ k.
and
a2n−1 + a2n−2 + · · · + a2n−k+1 + qan−1 an−k+1
an = (807)
an−k
for each n ≥ k.
Exercise A.10.2 and Exercise A.10.3 can be solved along the same lines as our
above solution to Exercise 8.4.10. (Alas, Exercise A.10.3 becomes false for k = 5
/ Z); this spoils the pattern somewhat.)
(indeed, for q = 1 and k = 5, we have a11 ∈
a = u + v = u − v + |{z}
2 v ≡ u − v + 0v = u − v = b mod 2.
≡0 mod 2
450 Note the similarity to Lemma A.4.5 (which we will not, however, use here).
With Lemma A.11.1 in hand, we can quickly reduce Exercise 9.1.4 to showing
that n can be written as a product of two integers that have the same parity if and
only if n 6≡ 2 mod 4. But this is easy to check:
n
• If n is divisible by 4, then n = 2 · is a way to write n as a product of two
2
integers that have the same parity.
• On the other hand, if n is neither divisible by 4 nor odd, then we cannot write
n as a product ab of two integers a and b that have the same parity, because
such a product must either be divisible by 4 (if a and b are both even) or be
odd (if a and b are both odd).
(applied to 4, n and 2 instead of n, u and c) yields 2 = n%4 (since 2 ∈ {0, 1, . . . , 4 − 1}). Hence,
n%4 = 2 6= 0. This contradicts n%4 = 0. This contradiction shows that our assumption was
false; qed.
that n 6≡ 2 mod 4). Therefore, these two statements are equivalent. In other words,
n can be represented in the form n = u2 − v2 for some u, v ∈ Z if and only if
n 6≡ 2 mod 4. Thus, Exercise 9.1.4 is solved in Case 1.
Let us next consider Case 2. In this case, we have 2 - n. In other words, n is odd.
Hence, n 6≡ 2 mod 4 453 .
On the other hand, n ≡ 1 mod 2 (since n is odd). Therefore, Lemma A.11.1
(a) (applied to a = n and b = 1) yields that there exist two integers u, v ∈ Z
such that u + v = n and u − v = 1. These two integers u and v must necessarily
satisfy n = u2 − v2 (since u2 − v2 = (u − v) (u + v) = 1 · n = n). Hence, n can be
| {z } | {z }
=1 =n
represented in the form n = u2 for some u, v ∈ Z.
− v2
Thus, we have shown that both statements “n can be represented in the form
n = u2 − v2 for some u, v ∈ Z” and “n 6≡ 2 mod 4” are true (since we have shown
that n 6≡ 2 mod 4). Therefore, these two statements are equivalent. In other words,
n can be represented in the form n = u2 − v2 for some u, v ∈ Z if and only if
n 6≡ 2 mod 4. Thus, Exercise 9.1.4 is solved in Case 2.
Finally, let us consider Case 3. In this case, we have neither 4 | n nor 2 - n. Thus,
4 - n (since we don’t have 4 | n) and 2 | n (since we don’t have 2 - n). From 2 | n, we
n n n
obtain ∈ Z. In other words, is an integer. This integer cannot be even454 ,
2 2 2
and therefore must be odd. Hence, we have n ≡ 2 mod 4 455 . Thus, we don’t have
n 6≡ 2 mod 4. Also, we have n ≡ 0 mod 2 (since 2 | n).
Now, let u, v ∈ Z be integers satisfying n = u2 − v2 . We shall derive a con-
tradiction. Indeed, set a = u + v and b = u − v. Thus, Lemma A.11.1 (b) yields
a ≡ b mod 2 (since u + v = a and u − v = b). Also, n = u2 − v2 = (u + v) (u − v) =
| {z } | {z }
=a =b
ab. If the integer b was odd, then we would have b ≡ 1 mod 2 and therefore
n = |{z}a b
|{z} ≡ 1 · 1 = 1 6≡ 0 mod 2, which would contradict n ≡ 0 mod 2.
≡b≡1 mod 2 ≡1 mod 2
Hence, the integer b cannot be odd. Thus, b must be even. In other words, b = 2q
for some integer q. Consider this q. Also, a ≡ b ≡ 0 mod 2 (since b is even); hence,
the integer a is even. In other words, a = 2p for some integer p. Consider this p.
453 Proof. Assume the contrary. Thus, n ≡ 2 mod 4. Hence, Proposition 3.2.6 (e) (applied to n, 2, 4
and 2 instead of a, b, n and m) yields n ≡ 2 mod 2 (since 2 | 4). Hence, n ≡ 2 ≡ 0 mod 2; in
other words, n is even. That is, 2 | n. This contradicts 2 - n. This contradiction shows that our
assumption was false; qed.
454 Proof. Assume the contrary. Thus, the integer n is even. In other words, 2 | n ; therefore,
n n 2 2
2 ∈ Z. In other words, n ∈ Z (since 2 = n ). Hence, 4 | n. But this contradicts 4 - n.
2 4 2 4
This contradiction shows that our assumption was false; qed.
455 Proof. The integer n is odd. In other words, n = 2u + 1 for some u ∈ Z. Consider this u.
2 2
n
Multiplying the equality = 2u + 1 by 2, we obtain n = 2 (2u + 1) = |{z} 4 u + 2 ≡ 0u + 2 =
2
≡0 mod 4
2 mod 4.
Now, n = |{z} b = (2p) (2q) = 4pq shows that 4 | n; but this contradicts 4 - n.
a |{z}
=2p =2q
Forget that we fixed u, v. We thus have obtained a contradiction for any two
integers u, v ∈ Z satisfying n = u2 − v2 . Hence, no two such integers u, v exist. In
other words, n cannot be represented in the form n = u2 − v2 for some u, v ∈ Z.
Thus, we have shown that both statements “n can be represented in the form
n = u2 − v2 for some u, v ∈ Z” and “n 6≡ 2 mod 4” are false (since we have shown
that we don’t have n 6≡ 2 mod 4). Therefore, these two statements are equivalent.
In other words, n can be represented in the form n = u2 − v2 for some u, v ∈ Z if
and only if n 6≡ 2 mod 4. Thus, Exercise 9.1.4 is solved in Case 3.
We have now solved Exercise 9.1.4 in all three Cases 1, 2 and 3. Thus, our solution
to Exercise 9.1.4 is complete.
Proof of Lemma A.11.2 (sketched). First of all, we recall that n is not a power of 2.
Hence, the number n has at least one odd prime divisor d (since otherwise, the
prime factorization of n would only consist of 2’s, but this would mean that n is
a power of 2). Consider such a d. Thus, n = de for some positive integer e (since
d is a positive divisor of n). Moreover, d ≥ 3 (since d is an odd prime). Note that
n 6= d (since n is not a prime, but d is a prime), and thus e 6= 1 (since otherwise, we
would have e = 1 and thus n = d |{z} e = d, which would contradict n 6= d). Hence,
=1
e ≥ 2 (since e is a positive integer) and thus 2e ≥ 2 · 2 = 4 ≥ 3.
Now, from n = de, we obtain 2n = 2de = d (2e). Moreover, the two integers d
and 2e satisfy d ≥ 3 and 2e ≥ 3 and d 6≡ 2e mod 2 (since d is odd while 2e is even).
Hence, there exist two integers a ≥ 3 and b ≥ 3 satisfying 2n = ab and a 6≡ b mod 2
(namely, a = d and b = 2e). This proves Lemma A.11.2.
We can now solve Exercise 9.1.5:
Solution to Exercise 9.1.5 (sketched). We must prove the following two claims:
u
Claim 1: If n can be represented in the form n = uv − for some
2
u, v ∈ Z satisfying v ≥ u ≥ 3, then n is neither a prime nor a power of
2.
u (2v − u + 1) u ( u − 1)
u
n= = uv − = uv − .
2 | {z2 } 2
u
=
2
Furthermore, u = a ≥ 3. Moreover,
a+b−1 a+a−1
v= ≥ (since b ≥ a)
2 2
1
a −
= |{z} > u−1
2
=u |{z}
<1
p−1 −1
≡ = (−1)k mod p (by (122)) .
k k
p p
But Exercise 9.1.6 (a) (applied to k = m) yields p | . In other words, ≡
m m
0 mod p. In view of
p−1 p−1
p
= + (by Theorem 4.3.7, applied to n = p and k = m) ,
m m−1 m
p−1 p−1
this rewrites as + ≡ 0 mod p. In other words,
m−1 m
p−1 p−1
≡− ≡ − (−1)m−1 = (−1)m mod p.
m m−1
| {z }
≡(−1)m−1 mod p
In other words, Exercise 9.1.6 (b) holds for k = m. This completes the induction
step. Thus, Exercise 9.1.6 (b) is solved (again).
However,
p −1 p −1
p−1
∑ (−1) p −1− i
i
ik ≡ ∑ (−1) p−1−i (−1)i ik
i =0 i =0
| {z }
=(−1)( p−1−i)+i =(−1) p−1
| {z }
i
≡(−1) mod p (since ( p−1−i )+i = p−1)
(by Exercise 9.1.6 (b)
(applied to i instead of k))
p −1 p −1
= ∑ (−1) p−1 ik = (−1) p−1 ∑ ik ,
i =0 i =0
so that
p −1 p −1
p−1 k
(−1) p −1
∑i k
≡ ∑ (−1) p −1− i
i
i = 0 mod p.
i =0 i =0
457 See [Grinbe19a, proof of Lemma 3.8] for a different solution.
In view of
p −1 p −1
(−1) p−1 (−1) p−1 ∑ ik = ∑ ik ,
| {z } i =0 i =0
p −1 2 2( p −1)
=((−1) ) =(−1) =1
(since 2( p−1) is even)
p −1
this rewrites as ∑ ik ≡ 0 mod p. This solves Exercise 9.1.7.
i =0
f : U → V,
( j, k) 7→ n − j.
458 Proof. 1 1 1
Let ( j, k) ∈ U. Thus, ( j, k ) is a pair of positive integers satisfying − = (by the
j k n
1 1 1 1 1 1
definition of U). From − = , we obtain − − = 0. Now,
j k n j k n
1 1 1
(n − j) (n + k) − n2 = kn − jn − jk = njk − − = 0.
j k n
| {z }
=0
n2
n − x, −n ∈U 459 . Hence, we can define a map
x
g : V → U,
n2
x 7→ n − x, −n .
x
n2
f ( g ( x )) = f n − x, −n = n − (n − x ) = x = id ( x ) .
x
Hence, ( f ◦ g) ( x ) = f ( g ( x )) = id ( x ).
Forget that we fixed x. We thus have shown that ( f ◦ g) ( x ) = id ( x ) for each x ∈ V. In other
words, f ◦ g = id.
461 Proof. Let y ∈ U. Then, y is a pair ( j, k ) of positive integers satisfying 1 − 1 = 1 (since U is the
j k n
set of all such pair ( j, k)). Consider this ( j, k). Thus, y = ( j, k).
1 1 1
Solving the equality − = for k, we obtain
j k n
1 jn
k= = . (810)
1 1 n−j
−
j n
mutually inverse. Hence, the map f is invertible, i.e., is bijective. In other words, f
is a bijection from U to V. Hence, the bijection principle yields |U | = |V |.
Now, recall that |U | = u. Hence,
2
u = |U | = |V | = the # of all integers i ∈ [n − 1] satisfying i | n
= ( j, k) = y = id (y) .
Forget that we fixed y. We thus have shown that ( g ◦ f ) (y) = id (y) for each y ∈ U. In other
words, g ◦ f = id.
References
[17f-hw2s] Darij Grinberg, UMN Fall 2017 Math 4707 & Math 4990 homework set #2
with solutions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw2s.
pdf
[17f-hw3s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #3 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw3os.pdf
[17f-hw4s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #4 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw4os.pdf
[17f-hw6s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #6 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw6os.pdf
[17f-hw7s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #7 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw7os.pdf
[17f-hw8s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #8 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw8os.pdf
[18f-hw2s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #2 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw2s.pdf
[18f-hw3s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #3 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw3s.pdf
[18f-hw4s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #4 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw4s.pdf
[18f-mt1s] Darij Grinberg, UMN Fall 2018 Math 5705 midterm #1 with solutions,
http://www.cip.ifi.lmu.de/~grinberg/t/18f/mt1s.pdf
[18s-hw2s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #2 with so-
lutions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw2s.pdf
[18s-hw3s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #3 with so-
lutions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw3s.pdf
[18s-mt1s] Darij Grinberg, UMN Spring 2018 Math 4707 midterm #1 with solutions,
http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt1s.pdf
[18s-mt2s] Darij Grinberg, UMN Spring 2018 Math 4707 midterm #2 with solutions,
http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt2s.pdf
[19s] Darij Grinberg, Introduction to Modern Algebra (UMN Spring 2019 Math
4281 notes), 1 October 2020.
http://www.cip.ifi.lmu.de/~grinberg/t/19s/notes.pdf
[19s-hw0s] Darij Grinberg, UMN Spring 2019 Math 4281 homework set #0 with so-
lutions, http://www.cip.ifi.lmu.de/~grinberg/t/19s/hw0s.pdf
[19s-mt3s] Darij Grinberg, UMN Spring 2019 Math 4281 midterm #3 with solutions,
http://www.cip.ifi.lmu.de/~grinberg/t/19s/mt3s.pdf
[19fco] Darij Grinberg, Enumerative Combinatorics (Drexel Fall 2019 Math 222
notes), 18 September 2020.
http://www.cip.ifi.lmu.de/~grinberg/t/19fco/n/n.pdf
[19fco-hw0s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #0 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw0s.pdf
[19fco-hw2s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #2 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw2s.pdf
[19fco-hw3s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #3 with solu-
tions, http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw3s.pdf
[19fco-mt2s] Darij Grinberg, Drexel Fall 2019 Math 222 midterm #2 with solutions,
http://www.cip.ifi.lmu.de/~grinberg/t/19fco/mt2s.pdf
[AigZie14] Martin Aigner, Günter M. Ziegler, Proofs from the Book, 6th edition,
Springer 2018.
[AndAnd03] Titu Andreescu, Dorin Andrica, 360 Problems for Mathematical Con-
tests, Gil 2003.
[AndDos10] Titu Andreescu, Gabriel Dospinescu, Problems from the Book, 2nd edi-
tion, XYZ Press 2010.
[AndDos12] Titu Andreescu, Gabriel Dospinescu, Straight from the Book, XYZ Press
2012.
[AndEne11] Titu Andreescu, Bogdan Enescu, Mathematical Olympiad Treasures, 2nd
edition, Birkhäuser 2011.
[AndEri04] George E. Andrews, Kimmo Eriksson, Integer Partitions, Cambridge
University Press 2004.
[AndFen04] Titu Andreescu, Zuming Feng, A Path to Combinatorics for Undergrad-
uates: Counting Strategies, Springer 2004.
[AndTet18] Titu Andreescu, Marian Tetiva, Sums and Products, XYZ Press 2018.
[AnDoMu17] Titu Andreescu, Gabriel Dospinescu, Oleg Mushkarov, Number The-
ory: Concepts and Problems, XYZ Press 2017.
[AnFeLe01] Titu Andreescu, Zuming Feng, George Lee, Jr. (eds.), Mathematical
Olympiads 2000–2001: Problems and Solutions From Around the World,
MAA 2002.
[Armstro19] Drew Armstrong, MTH 309: Discrete Mathematics, Summer 2019, 9
August 2019.
https://www.math.miami.edu/~armstrong/309sum19.php
[Bartle15] Padraic Bartlett, various courses, 2015.
[BecGeo10] Matthias Beck, Ross Geoghegan, The Art of Proof: Basic Training for
Deeper Mathematics, Springer 2010.
http://math.sfsu.edu/beck/aop.html
[BeDeQu11] Arthur T. Benjamin, Halcyon Derks, Jennifer J. Quinn, The Combina-
torialization of Linear Recurrences, The Electronic Journal of Combina-
torics 18(2) (2011), #P12.
[BenPlo08] Arthur T. Benjamin and Sean S. Plott, A combinatorial approach to Fi-
bonomial coefficients, Fibonacci Quarterly 46/47, issue 1, pp. 7–9.
[BenQui03] Arthur T. Benjamin and Jennifer J. Quinn, Proofs that Really Count: The
Art of Combinatorial Proof, The Mathematical Association of America,
2003.
[BenQui08] Arthur T. Benjamin and Jennifer J. Quinn, An Alternate Approach to
Alternating Sums: A Method to DIE for, The College Mathematics Jour-
nal, Volume 39, Number 3, May 2008, pp. 191-202(12).
[BiFoFo95] Wang Zheng Bing, Robert Fokkink, Wan Fokkink, A Relation Between
Partitions and the Number of Divisors, The American Mathematical
Monthly 102, No. 4 (Apr., 1995), pp. 345–347.
https://www.cs.vu.nl/~wanf/pubs/partition.pdf
[Bollob10] Béla Bollobás, The Art of Mathematics: Coffee Time in Memphis, Cam-
bridge University Press, 3rd printing 2010.
[BorMea16] Peter Borg, Karen Meagher, The Katona cycle proof of the Erdös–Ko–Rado
theorem and its possibilities, Journal of Algebraic Combinatorics 43(4),
915–939.
[BraTho05] David M. Bradley, Hugh Thomas, Peg Jumping for Fun and Profit,
arXiv:math/0411275v2.
https://arxiv.org/abs/math/0411275v2
[Carl17] Merlin Carl, Wie kommt man drauf? Einführung in das mathematische
Problemlösen, Springer 2017.
See the Springer book page for solutions and additional exercises.
[CarSpe04] Gabriel D. Carroll, David Speyer, The Cube Recurrence, The Electronic
Journal of Combinatorics 11 (2014), #R73.
[ChaSed97] Gengzhe Chang, Thomas W. Sederberg, Over and Over Again, Anneli
Lax New Mathematical Library 39, The Mathematical Association of
America 1997.
[Cirtoa06] Vasile Cirtoaje, Algebraic inequalities: old and new methods, Gil, Zalău
2006.
[CoLiOs15] David A. Cox, John Little, Donal O’Shea, Ideals, Varieties, and Algo-
rithms: An Introduction to Computational Algebraic Geometry and Com-
mutative Algebra, 4th edition, Springer 2015.
[Comtet74] Louis Comtet, Advanced Combinatorics: The Art of Finite and Infinite
Expansions, D. Reidel Publishing Company, 1974.
[DJMP11] Dusan Djukic, Vladimir Jankovic, Ivan Matic, Nikola Petrovic, The
IMO Compendium: A Collection of Problems Suggested for The Interna-
tional Mathematical Olympiads: 1959-2009, 2nd edition, Springer 2011.
See https://www.imomath.com/index.php?options=350&lmm=0 for
errata.
[DLPS16] Birgit van Dalen, Julian Lyczak, Quintijn Puite, Merlijn Staps,
Finaletraining Wiskunde Olympiade, 21 November 2016.
https://www.wiskundeolympiade.nl/phocadownload/
finaletraining/finaletraining_binnenwerk_uitwerkingen.pdf
[Excali97] Anon, A Proof of The Lambek and Moser Theorem, Mathematical Excal-
ibur 4 (1), 1997–1998, p. 2.
[Gale98] David Gale, Tracking the automatic ant and other mathematical explo-
rations, Springer 1998.
[GalQua20] Jean Gallier and Jocelyn Quaintance, Algebra, Topology, Differential Cal-
culus, and Optimization Theory For Computer Science and Engineering, 22
March 2020.
https://www.cis.upenn.edu/~jean/gbooks/geomath.html
[Galvin20] David Galvin, Notre Dame Math 43900: Problem Solving in Math,
lecture notes (work in progress),
https://www3.nd.edu/~dgalvin1/43900/43900_F20/index.html
(follow the overleaf link, once there allow javascript and note the
“Download PDF” button).
[GelAnd17] Răzvan Gelca, Titu Andreescu, Putnam and Beyond, 2nd edition,
Springer 2017.
[Grinbe07] Darij Grinberg, The Vornicu-Schur inequality and its variations, 13 Au-
gust 2007.
http://www.cip.ifi.lmu.de/~grinberg/VornicuS.pdf
[Grinbe16] Darij Grinberg, 18.781 (Spring 2016): Floor and arithmetic functions, 13
April 2019.
[Grinbe19a] Darij Grinberg, The Lucas and Babbage congruences, 10 January 2019.
[Kamp15] Peter H. van der Kamp, Somos-4 and Somos-5 are arithmetic divisibility
sequences, Journal of Difference Equations and Applications 22 (2016),
issue 4. See arXiv:1505.00194v1 for a preprint.
[LeeShi19] Jonghyeon Lee, Heesung Shin, The chromatic polynomial for cy-
cle graphs, Korean J. Math. 27, No 2 (2019) pp. 525–534,
arXiv:1907.04320v1.
[LeLoPo08] Hojoo Lee, Tom Lovering, and Cosmin Pohoata, Infinity, 19 October
2008.
http://prac.im.pwr.wroc.pl/~kwasnicki/pl/o/infinity.pdf
[Melian01] María Victoria Melián, Linear recurrence relations with constant coeffi-
cients, 9 April 2001.
http://matematicas.uam.es/~mavi.melian/CURSO_15_16/web_
Discreta/recurrence.pdf
[Neale17] Vicky Neale, Closing the Gap: The Quest to Understand Prime Numbers,
Oxford University Press 2017.
[Negut05] Andrei Negut, Problems for the Mathematical Olympiads, Gil 2005.
[Newste20] Clive Newstead, An Infinite Descent into Pure Mathematics, version 0.5
preview, 26 September 2020.
https://infinitedescent.xyz
[Pak10] Igor Pak, Lectures on Discrete and Polyhedral Geometry, 20 April 2010.
https://www.math.ucla.edu/~pak/geompol8.pdf
[Parvar11] Amir Hossein Parvardi, Lifting The Exponent Lemma (LTE), version 6,
7 April 2011.
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.
221.5543
[Polya73] George Polya, How to Solve It: A New Aspect of Mathematical Method,
Princeton University Press, 2nd edition 1973.
[Poorte04] Alfred J. van der Poorten, Elliptic curves and continued fractions,
arXiv:math/0403225v3.
[RitHee13] Benoît Rittaud, Albrecht Heeffer, The Pigeonhole Principle, Two Cen-
turies Before Dirichlet, The Mathematical Intelligencer, 36(2), pp. 27–
29.
[Spivey19] Michael Z. Spivey, The Art of Proving Binomial Identities, CRC Press
2019.
[TAoCP4A] Donald A. Knuth, The Art of Computer Programming, volume 4A: Com-
binatorial Algorithms, Part 1, Addison–Wesley 2011.
See https://www-cs-faculty.stanford.edu/~knuth/taocp.html for
errata.
[Wemyss14] Michael Wemyss, A very elementary proof that the Somos 5 sequence is
integer valued, 28 April 2014.
https://www.maths.gla.ac.uk/~mwemyss/Somos5proof.pdf
[Yiu12] Paul Yiu, Problem Solving and Recreational Mathematics, 2 August 2012.
http://math.fau.edu/Yiu/Oldwebsites/PSRM2012/
00PSRM2012Chapters1to44.pdf
[Zeitz17] Paul Zeitz, The Art and Craft of Problem Solving, 3rd edition, Wiley
2017.