Tải bản đầy đủ (.pdf) (647 trang)

An excursion through elementary mathematics, volume III discrete mathematics and polynomial algebra

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.96 MB, 647 trang )

Problem Books in Mathematics

Antonio Caminha Muniz Neto

An Excursion
through Elementary
Mathematics,
Volume III
Discrete Mathematics and Polynomial
Algebra


Problem Books in Mathematics
Series Editor:
Peter Winkler
Department of Mathematics
Dartmouth College
Hanover, NH
USA


More information about this series at />

Antonio Caminha Muniz Neto

An Excursion through
Elementary Mathematics,
Volume III
Discrete Mathematics and Polynomial
Algebra


123


Antonio Caminha Muniz Neto
Universidade Federal do Ceará
Fortaleza, Ceará, Brazil

ISSN 0941-3502
ISSN 2197-8506 (electronic)
Problem Books in Mathematics
ISBN 978-3-319-77976-8
ISBN 978-3-319-77977-5 (eBook)
/>Library of Congress Control Number: 2017933290
© Springer International Publishing AG, part of Springer Nature 2018
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of
the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology
now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, express or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Printed on acid-free paper
This Springer imprint is published by the registered company Springer International Publishing AG part
of Springer Nature.

The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland


E horas sem conta passo, mudo,
O olhar atento,
A trabalhar, longe de tudo
O pensamento.
Porque o escrever - tanta perícia,
Tanta requer,
Que ofício tal.., nem há notícia
De outro qualquer.
Profissão de Fé (excerto) Olavo Bilac


Preface

This is the final volume of a series of three volumes (the other ones being [9] and
[8]) devoted to the mathematics of mathematical olympiads. Generally speaking,
they are somewhat expanded versions of a collection of six volumes, first published
in Portuguese by the Brazilian Mathematical Society in 2012 and currently in its
second edition.
The material collected here and in the other two volumes is based on course
notes that evolved over the years since 1991, when I first began coaching students
of Fortaleza to the Brazilian Mathematical Olympiad and to the International Mathematical Olympiad. Some ten years ago, preliminary versions of the Portuguese
texts also served as textbooks for several editions of summer courses delivered at
UFC to math teachers of the Cape Verde Republic.
All volumes were carefully planned to be a balanced mixture of a smooth and
self-contained introduction to the fascinating world of mathematical competitions,
as well as to serve as textbooks for students and instructors involved with math clubs
for gifted high school students.

Upon writing the books, I have stuck myself to an invaluable advice of the
eminent Hungarian-American mathematician George Pólya, who used to say that
one cannot learn mathematics without getting one’s hands dirty. That’s why, in
several points throughout the text, I left to the reader the task of checking minor
aspects of more general developments. These appear either as small omitted details
in proofs or as subsidiary extensions of the theory. In this last case, I sometimes
refer the reader to specific problems along the book, which are marked with an *
and whose solutions are considered to be an essential part of the text. In general,
in each section I collect a list of problems, carefully chosen in the direction of
applying the material and ideas presented in the text. Dozens of them are taken from
former editions of mathematical competitions and range from the almost immediate
to real challenging ones. Regardless of their level of difficulty, generous hints, or
even complete solutions, are provided to virtually all of them.
As a quick look through the Contents pages readily shows, this time we concentrate on combinatorics, number theory, and polynomials. Although the chapters’

vii


viii

Preface

names quickly link them to one of these three major themes, whenever possible or
desirable later chapters revisit or complement material covered in earlier ones. We
now describe, a bit more specifically, what is covered within each major topic.
Chapters 1 through 5 are devoted to the study of basic combinatorial techniques
and structures. We start by reviewing the elementary counting strategies, emphasizing the construction of bijections and the use of recursive arguments throughout. We
then go through a bunch of more sophisticated tools, as the inclusion-exclusion principle and double counting, the use of equivalence relations, metrics on finite sets,
and generating functions. Turning our attention to the existence of configurations,
the pigeonhole principle of Dirichlet and invariants associated with algorithmic

problems now play the central role. Our tour through combinatorics finishes by
studying some graph theory, all the way from the basic definitions to the classical
theorems of Euler (on Eulerian paths), Cayley (on the number of labeled trees), and
Turán (on complete subgraphs of a given graph), to name just a few ones.
We then turn to elementary number theory, which is the object of Chaps. 6–12.
We begin, of course, by introducing the basic concepts and properties concerned
with the divisibility relation and exploring the notion of greatest common divisor
and prime numbers. Then we turn to diophantine equations, presenting Fermat’s
descent method and solving the famous Pell’s equation. Before driving through a
systematic study of congruences, we make an interlude to discuss the basics of
multiplicative arithmetic functions and the distribution of primes, these two chapters
being almost entirely independent of the rest of the book. From this point until
Chap. 12, we focus on the congruence relation and its consequences, from the very
beginnings to the finite field Zp , primitive roots, Gauss’ quadratic reciprocity law,
and Fermat’s characterization of integers that can be written as the sum of two
squares. All of the above material is, here more than anywhere else in the book,
illustrated with lots of interesting and challenging examples and problems taken
from several math competitions around the world.
The last nine chapters are devoted to the study of complex numbers and
polynomials. Apart from what is usually present in high school classes—as the
basics of complex numbers and the notion of degree, the division algorithm, and
the concept of root for polynomials—we discuss several nonstandard topics. We
begin by highlighting the use of complex numbers and polynomials as tags in
certain combinatorial problems and presenting a complete proof of the fundamental
theorem of algebra, accompanied with several applications. Then, we study the
famous theorem of Newton on symmetric polynomials and the equally famous
Newton’s inequalities. The next theme concerns interpolation of polynomials, when
particular attention is placed on Lagrange’s interpolation theorem. Such a result
is used to solve linear systems of Vandermonde with no linear algebra, which in
turn allows us to, later, analyze an important particular class of linear recurrence

relations. The book continues with the study of factorization of polynomials over Q,
Z, and Zp , together with several interesting problems on irreducibility. Algebraic
and transcendental numbers then make their appearance; among other topics, we
present a simple proof of the fact that the set of algebraic numbers forms a field
and discuss the rudiments of cyclotomic polynomials and transcendental numbers.


Preface

ix

The final chapter develops the most basic aspects of complex power series, which
are then used, disguised as complex generating functions, to solve general linear
recurrence relations.
Several people and institutions contributed throughout the years for my efforts
of turning a bunch of handwritten notes into these books. The State of Ceará
Mathematical Olympiad, created by the Mathematics Department of the Federal
University of Ceará (UFC) back in 1980 and now in its 37th edition, has since
then motivated hundreds of youngsters of Fortaleza to deepen their studies of
mathematics. I was one such student in the late 1980s, and my involvement with this
competition and with the Brazilian Mathematical Olympiad a few years later had a
decisive influence on my choice of career. Throughout the 1990s, I had the honor
of coaching several brilliant students of Fortaleza to the Brazilian Mathematical
Olympiad. Some of them entered Brazilian teams to the IMO or other international
competitions, and their doubts, comments, and criticisms were of great help in
shaping my view on mathematical competitions. In this sense, sincere thanks go
to João Luiz de A. A. Falcão, Roney Rodger S. de Castro, Marcelo M. de Oliveira,
Marcondes C. França Jr., Marcelo C. de Souza, Eduardo C. Balreira, Breno de A. A.
Falcão, Fabrício S. Benevides, Rui F. Vigelis, Daniel P. Sobreira, Samuel B. Feitosa,
Davi Máximo A. Nogueira, and Yuri G. Lima.

Professor João Lucas Barbosa, upon inviting me to write the textbooks to the
Amílcar Cabral Educational Cooperation Project with Cape Verde Republic, had
unconsciously provided me with the motivation to complete the Portuguese version
of these books. The continuous support of Professor Hilário Alencar, president of
the Brazilian Mathematical Society when the Portuguese edition was first published,
was also of great importance for me. Special thanks go to my colleagues—
professors Samuel B. Feitosa and Fernanda E. C. Camargo—who read the entire
English version and helped me improve it in a number of ways. If it weren’t for
my editor at Springer-Verlag, Mr. Robinson dos Santos, I almost surely would not
have had the courage to embrace the task of translating more that 1500 pages from
Portuguese into English. I acknowledge all the staff of Springer involved with this
project in his name.
Finally, and mostly, I would like to express my deepest gratitude to my parents
Antonio and Rosemary, my wife Monica, and our kids Gabriel and Isabela. From
early childhood, my parents have always called my attention to the importance of
a solid education, having done all they could for me and my brothers to attend the
best possible schools. My wife and kids fulfilled our home with the harmony and
softness I needed to get to endure on several months of work while translating this
book.
Fortaleza, Brazil
December 2017

Antonio Caminha Muniz Neto


Contents

1

Elementary Counting Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


1

2

More Counting Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

3

Generating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

67

4

Existence of Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

95

5

A Glimpse on Graph Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

6

Divisibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

7


Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

8

Arithmetic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

9

Calculus and Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

10

The Relation of Congruence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

11

Congruence Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

12

Primitive Roots and Quadratic Residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

13

Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

14

Polynomials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347


15

Roots of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

16

Relations Between Roots and Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

17

Polynomials Over R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

18

Interpolation of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

19

On the Factorisation of Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451

xi


xii

Contents

20


Algebraic and Transcendental Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477

21

Linear Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505

22

Hints and Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639


Chapter 1

Elementary Counting Techniques

In this first chapter, we develop the usual elementary tools for counting the number
of distinct configurations corresponding to a certain combinatorial situation, without
needing to list them one by one. As the reader will see, the essential ideas are the
construction of bijections and the use of recursive arguments.
Although we develop all material from scratch, the reader is expected to have
some previous experience with elementary counting techniques, and is warned that
the material collected here can be somewhat terse at places.

1.1 The Bijective Principle
In all that follows, we assume that the reader has a relative acquaintance with sets
and elementary operations on them. Given n ∈ N, we let In denote the set

In = {j ∈ N; 1 ≤ j ≤ n}
of natural numbers from 1 to n.
A set A is finite if A = ∅ or if there exists a bijection f : In → A, for some
n ∈ N. If A = ∅ is finite and f : In → A is a bijection, then letting aj = f (j ) we
write A = {a1 , . . . , an } and say that n is the number of elements of A (Problem 1
shows that this is a well defined notion). Also in this case, we write
|A| = n or #A = n
to mean that A has n elements. For the sake of completeness, we say that ∅ has 0
elements and write |∅| = 0.

© Springer International Publishing AG, part of Springer Nature 2018
A. Caminha Muniz Neto, An Excursion through Elementary Mathematics, Volume III,
Problem Books in Mathematics, />
1


2

1 Elementary Counting Techniques

The elementary theory of counting (configurations) has its foundations in the
following simple proposition, to which we will systematically refer as the bijective
principle.
Proposition 1.1 If A and B are nonempty finite sets, then |A| = |B| if and only if
there exists a bijection f : A → B.
Proof First of all, assume that there exists a bijection f : A → B. If |A| = n, we
can take a bijection g : In → A, so that f ◦ g : In → B is also a bijection. Hence,
|B| = n.
Conversely, suppose that |A| = |B| = n, with bijections g : In → A and
h : In → B. Then h ◦ g −1 : A → B is a bijection from A to B.

The following consequence of the bijective principle is sometimes referred to as
the additive principle of counting. Before we state it, we recall that two sets A and
B are said to be disjoint if A ∩ B = ∅.
Proposition 1.2 If A and B are finite disjoint sets, then
|A ∪ B| = |A| + |B|.
Proof Exercise (see Problem 2).
A typical application of the former proposition consists in counting the number of
different ways of choosing exactly one object out of two possible distinct kinds, such
that there is a finite number of possibilities for each kind of object. In the statement
of the proposition, the kinds correspond to the disjoint sets A and B, whereas the
possibilities for each kind correspond to the elements of A and B.
An easy induction allows us to generalize the additive principle for n finite
pairwise disjoint sets. This is the content of the coming
Corollary 1.3 If A1 , A2 , . . . , An are finite pairwise disjoint sets, then
n

n

Aj =

#
j =1

|Aj |.
j =1

Proof Exercise (see Problem 3).
For what comes next, given two sets A and B, we let A \ B denote the set
A \ B = {x ∈ A; x ∈
/ B}

and say that A \ B is the difference between A and B, in this order. If B ⊂ A, and if
no danger of confusion arises, we shall sometimes refer to A\B as the complement
of B in A, in which case we denote it as B c , instead of A \ B.
The simple formula of the next corollary, which counts the number of elements
of the complement of a subset of a finite set, is an additional consequence of the
additive principle.


1.1 The Bijective Principle

3

Corollary 1.4 If A is a finite set and B ⊂ A, then
|B| = |A| − |A \ B|.
Proof Since A = B ∪ (A \ B), a disjoint union, the additive principle gives
|A| = |B ∪ (A \ B)| = |B| + |A \ B|.

The general philosophy behind the use of the previous corollary in problems of
counting is this: suppose we wish to count the number of elements of a certain finite
set B, but do not know how to do it directly. An interesting strategy is to search for
a finite set A ⊃ B such that we know how to count both |A| and |A \ B|. Then, we
apply the formula of the corollary to compute the desired number of elements of B.
Some concrete examples of this situation will be found in what is to come.
Our next result generalizes Proposition 1.1 and Corollary 1.4, computing the
number of elements of a union of two finite sets. Formula (1.1) below is known as
the principle of inclusion-exclusion for two finite sets, and will be generalized in
Sect. 2.1 (cf. Theorem 2.1).
Proposition 1.5 If A and B are finite sets, then
|A ∪ B| = |A| + |B| − |A ∩ B|.


(1.1)

Proof Since A and B \ A are finite, disjoint and such that A ∪ B = A ∪ (B \ A), the
additive principle gives
|A ∪ B| = |A ∪ (B \ A)| = |A| + |B \ A|.
On the other hand, we also have the disjoint union
B = (B \ A) ∪ (A ∩ B),
so that, again from the additive principle, |B| = |B \ A| + |A ∩ B|. Then, |B \ A| =
|B| − |A ∩ B|, and once we plug this formula into the above relation for |A ∪ B|
we get
|A ∪ B| = |A| + (|B| − |A ∩ B|).

For what comes next, recall that the cartesian product of sets A and B is the
set A × B whose elements are the ordered pairs (a, b) with a ∈ A and b ∈ B. In
mathematical symbols,
A × B = {(a, b); a ∈ A, b ∈ B}.


4

1 Elementary Counting Techniques

It is also worth recalling that ordered pairs possess the following important property:
if (a, b), (c, d) ∈ A × B, then
(a, b) = (c, d) ⇔ a = c and b = d.
In this respect, see Problem 5.
The coming result, together with its subsequent corollary, are known as the
multiplicative principle or as the fundamental principle of counting.
Proposition 1.6 If A and B are nonempty finite sets, then A × B is also finite, with
|A × B| = |A| · |B|.

m
j =1 {yj },

Proof Writing B = {y1 , . . . , ym } =

A×B =A×⎝

m

it follows from Problem 6 that



m

{yj }⎠ =

j =1

(A × {yj }),
j =1

a disjoint union. Hence, Corollary 1.3 gives
m

m

(A × {yj }) =

|A × B| =

j =1

|A × {yj }|.

(1.2)

j =1

Now, since f : A → A × {yj } given by f (x) = (x, yj ) is a bijection (with
inverse g : A × {yj } → A given by g(x, yj ) = x), the bijective principle guarantees
that |A| = |A × {yj }| for 1 ≤ j ≤ m. Hence, it follows from (1.2) that
m

|A × B| =

|A| = |A| · m = |A| · |B|.
j =1

In applications, we ought to invoke this version of the fundamental principle of
counting whenever we need to choose two objects simultaneously, such that one
of the objects is of one of two possible kinds and the other object is of the other
kind (and each kind comprises a finite number of possibilities). In the statement of
the proposition, the two possible kinds correspond to the sets A and B, whereas the
possibilities for each kind correspond to the elements of A and B.
It is time we look at a concrete example.
Example 1.7 How many natural numbers have two distinct nonzero algarisms, both
less that or equal to 5? How many of them are such that the first algarism is smaller
that the second one?



1.1 The Bijective Principle

5

Solution Let A = {1, 2, 3, 4, 5}. The first part of the problem is clearly equivalent
to counting how many ordered pairs (a, b) ∈ A × A are such that a = b; the second
part requires that a < b.
Let us start counting the number of ordered pairs (a, b) ∈ A × A, without
additional restrictions. Since this is the same as counting the number of elements of
A × A, the multiplicative principle gives 5 × 5 = 25 possible pairs (a, b). In order
to count how many of them are such that a = b, let us use Corollary 1.4: the number
of such pairs is obtained by discounting, from the total number of pairs, those for
which a = b. Since there are 5 pairs (a, a) with a ∈ A, we conclude that there are
25 − 5 = 20 pairs (a, b) with a = b.
For what is left, note that (a, b) is an ordered pair such that a < b if and only
if (b, a) is an ordered pair for which b > a; in other words, the correspondence
(a, b) → (b, a) is a bijection between the set whose elements are the ordered pairs
(a, b) ∈ A×A such that a < b and that formed by the ordered pairs (a , b ) ∈ A×A
for which a > b . Hence, these sets have the same number of elements (namely,
ordered pairs); since they are disjoint and their union equals the set of pairs (a, b) ∈
A × A such that a = b, it follows from Proposition 1.2 that the desired number of
ordered pairs is 20
2 = 10.
For the subsequent discussion, we need to extend the concept of cartesian product
to an arbitrary finite number of finite nonempty sets. To this end, given finite
nonempty sets A1 , A2 , . . . , An , let’s define their cartesian product A1 × A2 ×
· · · × An as the set of sequences (to which we shall sometimes refer to as n-tuples)
(a1 , a2 , . . . , an ), such that a1 ∈ A1 , a2 ∈ A2 , . . . , an ∈ An .1
Corollary 1.8 If A1 , A2 , . . . , An are finite nonempty sets, then
n


|A1 × A2 × · · · × An | =

|Aj |.
j =1

Proof Exercise (see Problem 7).
The next corollary brings an important elaboration of the multiplicative principle.
Corollary 1.9 Let A1 , A2 , . . . , Ak be finite nonempty sets with |A1 | = n1 , |A2 | =
n2 , . . . , |Ak | = nk . Then, there are exactly n1 n2 . . . nk sequences (a1 , a2 , . . . , ak )
with aj ∈ Aj for 1 ≤ j ≤ k.

1 In view of this definition, in principle we have two distinct definitions for the elements of A × B:
on the one hand, they consist of the ordered pairs (a, b) such that a ∈ A and b ∈ B; on the other,
they are sequences (a, b) for which a ∈ A and b ∈ B. Since the ordered pair (a, b) is defined
by (a, b) = {{a}, {a, b}} (cf. Problem 5) and the sequence (a, b) (with a ∈ A and b ∈ B) is the
function f : {1, 2} → A ∪ B such that f (1) := a ∈ A and f (2) := b ∈ B, we come to the
conclusion that, although we have been using the same notation, they are distinct mathematical
objects. However, for our purposes the identification of the ordered pair (a, b) to the sequence
(a, b) is totally harmless and will be done, from now on, without further comments.


6

1 Elementary Counting Techniques

Proof As we have told above, a sequence (a1 , a2 , . . . , ak ) such that a1 ∈ A1 , a2 ∈
A2 , . . . , ak ∈ Ak is nothing but an element of the cartesian product A1 × A2 × · · · ×
Ak . Hence, the number of such sequences equals the number of elements of A1 ×
A2 × · · · × Ak , which in turn equals, by the previous corollary, |A1 ||A2 | . . . |Ak | =

n1 n2 . . . nk .
In words, the above corollary furnishes a method for counting in how many
(distinct) ways we can choose k objects in order but independently, with the first
object being of type 1, the second being of type 2, . . . , the k-th being of type k and
having at our disposal one or more possibilities for the choice of each type of object.
Here again, the distinct types of objects correspond to the sets A1 , . . . , Ak , whereas
the numbers of possibilities for each type of object correspond to the elements of
the sets under consideration.
As a special case of the situation of Corollary 1.9, we can count in how many
ways it is possible to choose, in order but independently, k elements out of a set
of n elements, with repeated choices being allowed. More precisely, we have the
following
Corollary 1.10 If |A| = n, then there are exactly nk sequences of k terms, all
chosen from the elements of A.
Proof Make A1 = · · · = Ak = A in Corollary 1.9.
In other words, we say that the above corollary counts how many arrangements
with repetition of k objects, chosen out of a set with n objects, there exist.
Yet another way of looking at the result of Corollary 1.10 is to start by recalling
that a sequence of k terms, all belonging to In , is simply a function f : Ik → In ;
hence, what we established in that corollary was the fact that the number of distinct
functions f : Ik → In is exactly nk . Later, we shall compute how many of such
functions are injective and how many are surjective.
The coming example applies the circle of ideas above to a concrete situation. For
its solution, the reader might find it helpful to recall the criterion of divisibility by 3,
which will be derived in Problem 1, page 162: the remainder of a natural number n
upon division by 3 equals that of the sum of its algarisms.
Example 1.11 Compute the quantity of natural numbers n, of ten algarisms and
satisfying the following conditions:
(a) n does not end in 0.
(b) n is divisible by 3.

Solution If n = (a1 a2 . . . a9 a10 ) the decimal representation of n, then m =
(a1 a2 . . . a9 ) is a natural number of nine algarisms and a10 ∈ {1, 2, 3, . . . , 9}.
Now, for a fixed m = (a1 a2 . . . a9 ), the criterion of divisibility by 3 assures
that each of the numbers (a1 a2 . . . a9 1), (a1 a2 . . . a9 4) and (a1 a2 . . . a9 7) leave
the same remainder upon division by 3, the same happening with the numbers
(a1 a2 . . . a9 2), (a1 a2 . . . a9 5) and (a1 a2 . . . a9 8), as well as with the numbers
(a1 a2 . . . a9 3), (a1 a2 . . . a9 6) and (a1 a2 . . . a9 9). Moreover, letting r1 , r2 and r3
denote such common remainders, then r1 , r2 and r3 are pairwise distinct.


1.1 The Bijective Principle

7

Hence, for each natural number m = (a1 a2 . . . a9 ) of nine algarisms, we have
exactly three natural numbers n = (a1 a2 . . . a9 a10 ) which are divisible by 3. Since
a1 ∈ {1, 2, . . . , 9} and a2 , . . . , a9 ∈ {0, 1, 2, . . . , 9}, Corollary 1.9 guarantees that
the total of numbers we want to compute is 9 × 108 × 3 = 27 × 108 .

Problems: Sect. 1.1
1. * Prove that the notion of number of elements of a nonempty finite set is a well
defined concept. More precisely, prove that there exists a bijection f : Im → In
if and only if m = n.
2. * Prove the additive principle of counting from the definition for the number of
elements of a finite set. More precisely, prove that if A and B are nonempty,
finite disjoint sets, with |A| = m and |B| = n, then there exists a bijection
f : Im+n → A ∪ B.
3. * Prove Corollary 1.3.
4. * Let A and B be nonempty finite sets, with |A| = |B|. Prove that a function
f : A → B is injective if and only if it is surjective.

5. * Given sets A and B and elements a ∈ A, b ∈ B, we formally define the
ordered pair (a, b) by letting2
(a, b) = {{a}, {a, b}}.
Use this definition to show that, for a, c ∈ A and b, d ∈ B, one has (a, b) =
(c, d) ⇔ a = c and b = d.
6. * Given nonempty sets A, B1 , . . . , Bn , prove that
n

n

Bj =


j =1

(A × Bj ).
j =1

Moreover, if B1 , . . . , Bn are pairwise disjoint, prove that A × B1 , . . . , A × Bn
are also pairwise disjoint.
7. * Prove Corollary 1.8.
For the next problem, we define an ordered partition of a set A as a
sequence (A1 , . . . , Ak ) of subsets of A satisfying the following conditions: (i)
A = A1 ∪ . . . ∪ Ak ; (ii) A1 , . . . , Ak are pairwise disjoint. In this case, we use
to say that A1 , . . . , Ak (in this order) form an ordered partition of A into k of
its subsets.
8. Let n, k ∈ N and A be a finite set with n elements. Show that there exist exactly
k n ordered partitions of A into k subsets A1 , . . . , Ak .

2 Such


a definition is due to Kazimierz Kuratowski, Polish mathematician of the twentieth century.


8

1 Elementary Counting Techniques

9. In the cartesian plane, a pawn moves according to the following rule: being at
the point (a, b), he can go to one of the points (a + 1, b + 1), (a + 1, b − 1),
(a − 1, b + 1) or (a − 1, b − 1). If the pawn starts at the point (0, 0), how many
distinct positions can he occupy after his first n moves?
10. (AIME—adapted) Given k, n ∈ N, do the following items:
(a) For a given integer 1 ≤ j ≤ n, prove that there are exactly (n − j + 1)k
sequences formed by k elements of In (possibly with repetitions) such that
the smallest term of the sequence is greater than or equal to j .
(b) For a given integer 1 ≤ j ≤ n, prove that there are exactly (n − j + 1)k −
(n − j )k sequences formed by k elements of In (possibly with repetitions),
such that the smallest term of the sequence equals j .
(c) Prove that the sum of the smallest terms of all nk sequences of k elements
of In (possibly with repetitions) equals 1k + 2k + · · · + nk .
11. (France) Let k ∈ N, A = {1, 2, 3, . . . , 2k } and X be a subset of A satisfying
the following condition: if x ∈ X, then 2x ∈
/ X. Find, with proof, the greatest
possible number of elements of X.

1.2 More Bijections
In this section, with the elementary results of the previous section at our disposal, we
present some instances of deeper applications of the bijective principle to establish
the equality of the numbers of elements of two finite sets.

We start by computing, in two different ways, the number of subsets of a finite
set. If A is any set, we let P(A) denote the power set of A, i.e., the family3
P(A) = {B; B ⊂ A}.
Given finite sets A and B, both with n elements, a bijection f : A → B naturally
induces a bijection f˜ : P(A) → P(B), defined for C ⊂ A by
f˜(C) = {f (x); x ∈ C}.
In words, given a subset C of A, we let f˜(C) be the subset of B whose elements are
the images of the elements of C by f . In particular, note that
f˜(∅) = {f (x); x ∈ ∅} = ∅,
since it is impossible to choose x ∈ ∅.

3 In

Set Theory, a family is a set whose elements are also sets.


1.2 More Bijections

9

Hence, as a corollary to the bijective principle, if A and B are nonempty finite
disjoint sets, then
|A| = |B| ⇒ |P(A)| = |P(B)|.

(1.3)

We shall also need another concept, which will be useful in future discussions.
Definition 1.12 Let A be a nonempty set. For B ⊂ A, the characteristic function
of B (with respect to A) is the function χB : A → {0, 1}, defined by
χB (x) =


0, if x ∈
/B
.
1, if x ∈ B

(1.4)

For example, if A = {a, b, c, d, e, f, g} and B = {c, f, g}, then χB is the
function from A to {0, 1} such that
χB (a) = χB (b) = χB (d) = χB (e) = 0 and χB (c) = χB (f ) = χB (g) = 1.
For what follows, if A = {a1 , . . . , an } is a set with n elements, whenever
convenient we can associate to A the sequence (a1 , . . . , an ); whenever we do that,
we shall say that (a1 , . . . , an ) is an ordering of (the elements of) A or, sometimes,
the natural ordering of A.
If B ⊂ A, a (combinatorially) more interesting way of looking at the characteristic function χB of B with respect to A is to consider it as a sequence of
0’s and 1’s, with the positions of the 1’s (with respect to the natural ordering of
A) corresponding to the elements of B. For instance, let A = {a, b, c, d, e, f, g},
furnished with the ordering induced from the lexicographical (i.e., alphabetical)
order; if B = {c, f, g}, then the characteristic function of B corresponds to the
sequence (0, 0, 1, 0, 0, 1, 1).
More generally, let A = {a1 , . . . , an }, furnished with the natural ordering. For
B ⊂ A, the characteristic sequence of B in A is the sequence sB = (α1 , . . . , αn ),
such that
αj =

/B
0, if aj ∈
.
1, if aj ∈ B


(1.5)

We can finally compute the number of subsets of a set with n elements.
Theorem 1.13 A set with n elements has exactly 2n subsets.
Proof Let A = {a1 , . . . , an } be a set with n elements, furnished with its natural
ordering, and let S be the set of sequences of n terms, formed by the elements of the
set {0, 1}. By Corollary 1.10, we have |S| = 2n . We will show that |P(A)| = 2n ,
and to this end it suffices to show that the function
f : P(A) −→ S
B −→ sB


10

1 Elementary Counting Techniques

(i.e., the function which associates to each subset of A its characteristic sequence
with respect to A) is a bijection. For what is left to do, check that the function
g : S → P(A), given by
g(α1 , . . . , αn ) = {aj ∈ A; αj = 1},
is the inverse of f .
It is instructive to note that we can give another proof of the previous result, this
time relying more directly on the bijective principle. Indeed, by (1.3) it suffices to
show that the set A = {0, 1, . . . , n − 1} has precisely 2n subsets. To this end, we let
f : P(A) → {0, 1, 2, . . . , 2n − 1}
be given by f (∅) = 0 and, for ∅ = B = {a1 , . . . , ak } ⊂ A, with 0 ≤ a1 < · · · <
ak ≤ n − 1,
f (B) = 2a1 + · · · + 2ak .
Since

1 ≤ 2a1 + · · · + 2ak ≤ 20 + 21 + · · · + 2n−1 = 2n − 1,
f is well defined. To conclude that it is a bijection, recall Example 4.12 of [8], which
shows that every integer 1 ≤ m ≤ 2n − 1 can be written, in a unique way up to the
order of the summands, as a sum of distinct powers of 2 (obviously, none of these
can be bigger that 2n−1 ); such a way of writing m is called its binary representation.
Thus, the uniqueness of the binary representation is equivalent to the injectivity of
f , whereas the existence of such a representation is equivalent to the surjectivity of
f.
Notice how the above proof highlights the strength of the bijective principle in
counting problems. Let us see two more examples.
Example 1.14 Let n be a natural number of the form 4k + 1 or 4k + 2, for some
nonnegative integer k. Prove that In contains exactly 2n−1 subsets with even sum of
elements (and under the convention that the sum of the elements of the empty set is
0).
Proof Let F0 and F1 be the families of the subsets of In with sum of elements
respectively even and odd. Since F0 and F1 are disjoint and such that F0 ∪ F1 =
P(A), it follows from the additive principle and Theorem 1.13 that
|F0 | + |F1 | = |P(A)| = 2n .
Thus, if we show that |F0 | = |F1 |, we will get |F0 | = |F1 | = 2n−1 .


1.2 More Bijections

11

To what is left to do, let’s construct a bijection between F0 and F1 . To this end,
consider the function
f : P(A) −→ P(A)
,
B −→ B c

where B c = A \ B denotes the complement of B in A. Since (B c )c = A \ (A \ B) =
B, we have f (f (B)) = B for every B ⊂ A; hence, f ◦ f = IdP (A) , so that f is a
bijection (cf. Example 6.40 of [8]). Now, the idea is to show that, if n = 4k + 1 or
n = 4k + 2, then f induces a bijection between F0 and F1 .
Given B ⊂ A, we have
n

x+
x∈B

x =
x∈B C

x=
x∈A

x=
x=1

n(n + 1)
2

= (4k + 1)(2k + 1) or (2k + 1)(4k + 3),
according to whether n = 4k + 1 or n = 4k + 2. In any case,
x+
x∈B

x
x∈B C


is an odd number, so that the sums of the elements of B and of B c have distinct
parities; in symbols,
B ∈ F 0 ⇔ B c ∈ F1 .
Therefore, the restriction g of f to F0 applies F0 into F1 , whereas the restriction
h of f to F1 applies F1 into F0 . However, since g and h are clearly inverses of
each other (for, f = f −1 ), it follows that g and h are also bijections, so that
|F0 | = |F1 |.
The bijective principle is particularly useful to understand the properties of the
partitions of a natural number n. Here and in all that follows, a partition of the
natural number n is a way of writing n as a sum of (one or more) not necessarily
distinct natural summands. For example, the distinct partitions of 4 are
4 = 1 + 3 = 1 + 1 + 2 = 1 + 1 + 1 + 1 = 2 + 2.
The coming example is due to L. Euler.
Example 1.15 (Euler) Prove that the number of partitions of a natural n in odd
summands equals the number of partitions of n in distinct summands.
Proof Letting In denote the set of partitions of n in odd summands and Dn the set
of partitions of n in distinct summands, it suffices to construct a bijection f : In →


12

1 Elementary Counting Techniques

Dn . To understand how to define f , consider the following partition of 51 in odd
summands:
1 + 1 + 3 + 3 + 3 + 3 + 3 + 3 + 5 + 5 + 7 + 7 + 7.
Then, we can also write
51 = 2 · 1 + 6 · 3 + 2 · 5 + 3 · 7
= 21 · 1 + (22 + 21 ) · 3 + 21 · 5 + (21 + 20 ) · 7
= 21 · 1 + 22 · 3 + 21 · 3 + 21 · 5 + 21 · 7 + 20 · 7

= 2 + 12 + 6 + 10 + 14 + 7,
which is a partition of 51 in distinct summands. In what follows, we shall make the
above particular case into a general argument to get the desired bijection.
A partition P ∈ In is
n = 1 + ··· + 1+3 + ··· + 3+5 + ··· + 5+7 + ··· + 7+··· ,
a1

a3

a5

a7

where a1 , a3 , a5 , . . . ≥ 0 and, from some natural number k on, the number a2k+1 of
summands equal to 2k + 1 is 0. Then, we can write
n = a1 · 1 + a3 · 3 + a5 · 5 + a7 · 7 + · · · .
From here, in order to get a partition f (P ) of n into distinct summands, substitute
each positive coefficient a2k+1 by its binary representation (cf. Example 4.12 de [8])
and, if 2l is one of the summands of such a representation, let 2l (2k + 1) be one of
the summands in f (P ) (you can easily notice that this is exactly what we did in the
particular case of the partitions of 51).
By systematically proceeding this way, we claim that we get a partition of n into
distinct summands. Indeed, any two summands of f (P ) can be written as
2l1 (2k1 + 1) and 2l2 (2k2 + 1);
if k1 = k2 , then such summands are clearly different from one another; if k1 =
k2 , then we must have l1 = l2 , for 2l1 and 2l2 are two summands of the binary
representation of a2k1 +1 = a2k2 +1 . In any case, f is well defined.
To prove that f is a bijection, let’s define a function g : Dn → In (which will be
the inverse of f ) in the following way: let Q be the partition
n = (m11 + m12 + · · · + m1t1 ) + (m31 + m32 + · · · + m3t3 )

+ (m51 + m52 + · · · + m5t5 ) + · · ·


1.2 More Bijections

13

of n into distinct summands, where we have grouped, within each pair of
parentheses, all summands with a single odd part. More precisely, what we are
saying is that m2k+1,i = 2li (2k + 1), for some nonnegative integer li . Then,
m2k+1,1 + · · · + m2k+1,tk = 2l1 (2k + 1) + · · · + 2ltk (2k + 1)
= (2l1 + · · · + 2ltk )(2k + 1),
so that, letting a2k+1 = 2l1 + · · · + 2ltk , we get
n = a1 · 1 + a3 · 3 + a5 · 5 + a7 · 7 + · · · .
We thus define g(Q) to be the partition
n = 1 + ··· + 1+3 + ··· + 3+5 + ··· + 5+7 + ··· + 7+··· ,
a1

a3

a5

a7

so that g(Q) ∈ In .
Finally, it is immediate to verify that f and g are inverses of each other.

Problems: Sect. 1.2
1. Compute the number of subsets of the set In which contain n.
2. * (APMO) We are given a natural number n and a finite nonempty set A. Show

that there are exactly (2n − 1)|A| sequences (A1 , A2 , . . . , An ), formed by subsets
of A such that A = A1 ∪ A2 ∪ . . . ∪ An .
3. (Soviet Union) We are given n straight lines in the plane, in general position, i.e.,
such that no two of them are parallel and no three of them pass through the same
point. Compute the number of regions into which these lines divide the plane.
For the next problem, we say that a family F of subsets of In is an intersecting
system if, for every distinct A, B ∈ F, we have A ∩ B = ∅.
4. (Bulgaria—adapted) Let F be an intersecting system in In .
(a) Give an example of such an F in which |F| = 2n−1 .
(b) Prove that |F| ≤ 2n−1 , for any such F.
5. * Given n ∈ N, let In be the family of subsets of In with odd numbers of
elements. If A = {x1 , x2 , . . . , x2k+1 } ∈ In , with x1 < x2 < · · · < x2k+1 ,
we say that xk+1 is the central element of A, and write xk+1 = c(A). In this
respect, do the following items:
(a) For 1 ≤ x1 < x2 < · · · < x2k+1 ≤ n, show that the correspondence
{x1 , x2 , . . . , x2k+1 } → {n + 1 − x2k+1 , . . . , n + 1 − x2 , n + 1 − x1 }


14

1 Elementary Counting Techniques

establishes a bijection between the sets in In having central elements
respectively equal to i and n + 1 − i.
(b) In Problem 5, page 20, we will show that |In | = 2n−1 . Use the result of item
(a), together with this fact, to show that
c(A) = (n + 1) · 2n−2 .
A∈In

6. (TT) Given n ∈ N, we define the diversity of a partition of n as the number of

distinct summands in it. Also, let p(n) stand for the number of distinct partitions
of n and q(n) for the sum of the diversities of all of the p(n) partitions of n.
Prove that:
(a) q(n) = √
1 + p(1) + p(2) + · · · + p(n − 1).
(b) q(n) ≤ 2np(n).

1.3 Recursion
The general philosophy behind recursive counting is the following: we wish to count
the number an of elements of a set An , which is declared by means of some specific
rule(s) concerning the natural number n. We do this in a two-step process: firstly,
we use the declaration of An to get a recurrence relation for the sequence (an )n≥1 ,
i.e., a relation of the form
an = F (a1 , . . . , an−1 , n),

(1.6)

where F is some function of n variables; secondly, we use the recurrence relation,
together with algebraic and/or analytical arguments, to compute or estimate an in
terms of n.
In this section we concentrate our efforts in the first step above, by examining
in detail some specific examples ranging in difficulty from almost trivial to real
challenging. As for the second step, for the time being we assume that the reader is
familiar with the solution of linear recurrence relations of order at most three and
with constant coefficients, as presented in Chapter 3 of [8]. Chapters 3 and 21 will
develop more powerful tools for the treatment of more general recurrence relations.
We start with a recursive counting for the number os subsets of a finite set.
Example 1.16 If A is a set with n elements, then A has exactly 2n subsets.
Proof Let an be the number of subsets of A (here, we are implicitly using (1.3)
when we write |A| as a function of n). For a fixed x ∈ A, there are two kinds of

subsets of A: those which contain x and those which do not.


×