Lecture Notes (English)
Lecture Notes (English)
Computer Scientists I
Prof. Dr. Anja Randecker
Dr. Tobias Mai
General Comments
These lecture notes were prepared and typed by Dr. Tobias Mai, following the
German manuscripts of Prof. Dr. Anja Randecker and Prof. Dr. Christian Bender.
There is no doubt that the lecture notes – despite all care – are still containing
several typos. Therefore, we are grateful for hints, which we ask you to send by
mail to the following address:
mai@math.uni-sb.de
The layout used for the lecture notes was designed by Friedrich Günther.
2
Contents
1 Basics: Vocabulary and Methods 5
1.1 Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Proof methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.1 Direct and indirect proof . . . . . . . . . . . . . . . . . . . 9
1.3.2 Proof by contradiction . . . . . . . . . . . . . . . . . . . . . 10
1.3.3 Examples for direct and indirect proofs and proofs by con-
tradiction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.4 Mathematical induction . . . . . . . . . . . . . . . . . . . . 11
1.4 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Functions 67
4.1 Topology on R — Part II . . . . . . . . . . . . . . . . . . . . . . . 67
4.2 Limits of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.3 Continuous functions . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3
1 Basics: Vocabulary and Methods
1.1 Propositional Logic
A statement is a sentence in a human or artificial language to which we can assign
uniquely (now or later) one of the truth values true (T ) or false (F ).
Example 1.1: (i) “2 is an odd number.” is a statement. Its truth value is “true”.
(ii) “Spinach tastes great.” is not a statement.
(iii) “Mensa in Saarbrücken.” is not a statement.
(iv) “There is life outside earth.” is a statement. We do not yet know its truth
value.
Out of given statements, say A and B, we can build further statements by using
logical connectives:
Their truth values are determined by those of A and B according to the following
truth tables:
Using truth tables, we can give proofs and deduce consequences like the following.
Example 1.2 (Truth values of logical connectives): (i) If the premise A is wrong,
then A ⇒ B is always true, independent of the truth value of B.
(ii) The statement “A ∨ ¬A” is always true, independent of the truth value of A.
(This is also known as the “Law of excluded middle”.)
(iii) Contraposition: The statement
(A ⇒ B) ⇔ (¬B) ⇒ (¬A)
5
1 Basics: Vocabulary and Methods
∀ x : P (x)
is the statement “For all x, P (x) holds true.” and ∃ x : P (x) is the statement
“There exists x, such that P (x) holds true.”.
For the purpose of mathematics, we need to specify the values which the variables
may attain. To this end, we need some basics from set theory.
1.2 Sets
It is surprisingly challenging to define sets in a consistent way. We will follow
the so-called “naive set theory” is based on the following definition due to Georg
Cantor (1845-1918):
6
1.2 Sets
If P (•) is a predicate, then we may define the set of all elements for which this
predicate is true; we write {x : P (x)}.
∀ y ∈ Y : y ∈ X.
If X and Y are sets, then the statement “Y is not a subset of X” can be expressed
as
¬ ∀y ∈ Y : y ∈ X .
The latter statement is logically equivalent to
∃y ∈ Y : y ∈
/ X.
Here, we used the second of the following general rules: If P (•) is a predicate,
then
¬ ∃ x : P (x) ⇔ ∀ x : ¬P (x) and ¬ ∀ x : P (x) ⇔ ∃ x : ¬P (x).
Definition 1.5 (Power set): Let X be a set. The power set P(X) of X is the set of
all subsets of X, i. e.,
∀Y : (Y ∈ P(X)) ⇔ (Y ⊆ X).
7
1 Basics: Vocabulary and Methods
Example 1.6: Elements, subsets, power set Let X = {1, 2, 3}. Then 2 ∈ X and
{2} ⊆ X. The difference is that 2 is an element of X, whereas {2} is a subset of X.
We have
P(X) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, X}.
Definition 1.7 (Cardinality): The cardinality |X| of a set X is the number of its
elements.
Example 1.8 (Cardinality of the power set): If X is a finite set with cardinality n,
then P(X) has cardinality 2n .
Example 1.10 (Intersection, union, complement): Let X = {1, 2, 3}, Y = {1, 3, 5, 9},
and Z = {1, 3}. Then
X Y X Y X Y
X ∩Y X ∪Y X \Y
It is possible to define the union and the intersection for more than two sets.
Definition 1.11 (Union and intersection of families of sets): If I is a non-empty set
(possibly with infinitely many elements) and Xi a set for each i ∈ I, then
[ \
Xi := {x : ( ∃ i ∈ I : x ∈ Xi )} and Xi := {x : ( ∀ i ∈ I : x ∈ Xi )}.
i∈I i∈I
1 The symbol “:=” should be read as “is defined as”.
8
1.3 Proof methods
Example 1.13 (Cartesian product): Let X = {1, 2} and Y = {a, b, c}. Then
• X × Y = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)},
• Y × X = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)},
• X 2 = X × X = {(1, 1), (1, 2), (2, 1), (2, 2)}.
A ⇒ C1 , C1 ⇒ C2 , ..., Cn−1 ⇒ Cn , Cn ⇒ B
9
1 Basics: Vocabulary and Methods
∀ n ∈ N : A(n) ⇔ B(n).
Then, it can be helpful to distinguish cases; in the example, we could treat for
instance the cases of even and odd n ∈ N separately. It is important that the proof
covers all cases!
which can easily be checked with the help of a truth table, that “A ⇒ B”
must be true (see assignments).
This is a simple but very instructive example because the statement can be used
to illustrate all of the previously mentioned proof methods.
For the proof, we use the fact that a natural number m ∈ N is
Proof (direct): Let n ∈ N be such that n + 1 is even. Then there exists k ∈ N such
that n + 1 = 2k. It follows that n = 2k − 1, i. e., n is odd. □
10
1.3 Proof methods
n + 1 even ⇒ n odd.
n even ⇒ n + 1 odd.
To verify the latter, let n ∈ N be such that n is even. Then there exists k ∈ N such
that n = 2k. It follows that
n + 1 = 2k + 1 = 2(k + 1) − 1 = 2k ′ − 1 with k ′ := k + 1 ∈ N,
i. e., n + 1 is odd. □
n + 1 = 2k and n = 2k ′ .
It follows that
2k = n + 1 = 2k ′ + 1.
The latter equation, however, has no solutions k, k ′ in N. (In other words, there is
no natural number which is both even and odd.) This is a contradiction. Hence, if
n + 1 is even, then n cannot be even at the same time; thus, it has to be odd, as
we wished to show. □
According to this definition, the set of natural numbers is the “smallest” inductive
set; see Problem 1, Homework Sheet 2. We have N = {1, 2, 3, . . . } and the
cardinality of N is infinite.
The natural numbers and their definition via inductive sets leads us to the proof
method of mathematical induction. It can be used to prove statements for natural
numbers.
Theorem 1.16 (Mathematical induction): Let P (•) be a predicate such that P (n)
is a statement for each n ∈ N. Moreover, we suppose that
11
1 Basics: Vocabulary and Methods
In practice (see the proof of Proposition 1.17, for instance), the following recursions
for n ∈ N turn out to be extremely useful:
n
X n−1
X n
Y n−1
Y
ak = ak + an and ak = ak · an .
k=1 k=1 k=1 k=1
We use the method of mathematical induction to prove that P (n) is true for each
n ∈ N.
12
1.4 Relations
1
X 1 · (1 + 1)
k=1= .
2
k=1
n+1
X n
X
k= k + (n + 1)
k=1 k=1
n(n + 1)
= + (n + 1) (by P (n))
n 2
= + 1 (n + 1)
2
1
= (n + 2)(n + 1)
2
(n + 1) (n + 1) + 1
= ,
2
i. e., P (n + 1) is true.
1.4 Relations
Definition 1.18 (Relation): Let X be a set. A (binary) relation on X is a subset
R ⊆ X × X. For (x, y) ∈ R, we say “x is in relation with y” and write xRy.
• R1 = {(2, 2), (2, 4), (2, 6), (2, 8), (4, 4), (4, 6), (4, 8), (6, 6), (6, 8), (8, 8)}, i. e.,
xR1 y means “x is less or equal y”.
• R2 = {(2, 2), (2, 4), (2, 6), (2, 8), (4, 4), (4, 8), (6, 6), (8, 8)}, i. e., xR2 y means
“x divides y”.
There are several ways to visualize relations. For instance, we may visualize R1 as
a graph
13
1 Basics: Vocabulary and Methods
2 4 6 8
2 2
4 4
6 6
8 8
Definition 1.21 (Partial and total orders): A relation is said to be a partial order
if it is reflexive, antisymmetric, and transitive. If it is moreover total, then it is
called a total order.
Example 1.22 (Relations and their properties): (i) In Example 1.19, we have
that R1 is a total order.
(ii) In Example 1.19, we have that R2 is a partial but not a total order.
14
1.4 Relations
Note: If X contains at least two distinct elements, say x1 and x2 , then “⊆”
is not a total order since neither {x1 } ⊆ {x2 } nor {x2 } ⊆ {x1 }.
(iv) The relation ≤ on the real numbers R is a total order. We do not give a
proof here, but we will come back to this later.
Example 1.24 (Equivalence relations): (i) Let X be the set of all inhabitants of
Germany. Then
X⧸ := {[x] : x ∈ X}
∼
15
1 Basics: Vocabulary and Methods
X2
X1 X3
Example 1.27: The sets of even and odd natural numbers form a partition of N.
Theorem 1.28 (Equivalence classes and partitions): Let X be a set and let ∼ be
an equivalence relation on X. Then the equivalence classes of ∼ form a partition
of X.
Conversely, each partition of X defines an equivalence relation on X.
Proof: To begin with, we give a direct proof for the first statement: Suppose that
∼ is an equivalence relation on X. We want to show that X⧸∼ is a partition of X.
S
• By reflexivity of ∼, we have for all y ∈ X that y ∈ [y] ⊆ [x]∈X⧸ [x];
S ∼
thus X ⊆ [x]∈X⧸ [x], and as the reversed inclusion holds by definition, we
S ∼
conclude X = x∈X⧸ [x].
∼
• Take [x], [y] ∈ X⧸∼. Assume that [x] ∩ [y] ̸= ∅. Choose z ∈ [x] ∩ [y]. Let
a ∈ [x]. We have
– a ∈ [x] ⇒ x ∼ a and
– z ∈ [x] ⇒ x ∼ z ⇒ z ∼ x (by symmetry of ∼),
and thus, by transitivity of ∼, z ∼ a. Further, we have
– z ∈ [y] ⇒ y ∼ z,
and thus, by transitivity of ∼, y ∼ a, which means a ∈ [y]. This proves
[x] ⊆ [y]; by exchanging x and y, we also get [y] ⊆ [x] and thus [x] = [y].
x∼y ⇔ ∃ P ∈ P : x, y ∈ P.
16
1.5 Functions
a∼b ⇔ m divides a − b
It follows that
a − c = (a − b) + (b − c) = m · (k + l)
and hence a ∼ c.
The equivalence classes with respect to ∼ are called congruence classes modulo
m; instead of a ∼ b, we write
a ≡ b mod m.
Congruence classes are interesting because on can define for them an addition
and a multiplication which do not have the same properties as addition and
multiplication on the real numbers. For example, we have 4 · 5 ≡ 0 mod 10, but
neither 4 ≡ 0 mod 10 nor 5 ≡ 0 mod 10.
1.5 Functions
Definition 1.30 (Function): A function (or a map) f from a set X to a set Y is a
subset of X × Y with the property that for each x ∈ X there is exactly one element
y ∈ Y such that (x, y) ∈ f .
We write f (x) = y if (x, y) ∈ f . For the function f , we use the notation
f : X → Y, x 7→ f (x).
17
1 Basics: Vocabulary and Methods
f : X→Y
a 7→ 1, b 7→ 1, c 7→ 4, d 7→ 2
X Y
a 1
b 2
c 3
d 4
We have
f ({a, b}) = {1}, f ({a, c}) = {1, 4}
and
f −1 ({3}) = ∅, f −1 ({2}) = {d}.
f|A : A → Y, a 7→ f (a)
Example: The following picture shows (a piece of) the graph of the function
f : R → R, x 7→ x2 .
18
1.5 Functions
−2 −1 1 2
19
1 Basics: Vocabulary and Methods
Caution: The symbol f −1 is used for the inverse function and the preimage,
even though these are different concepts. The inverse function maps elements to
elements, while the preimage of a set is again a set.
Definition 1.37: Let f : X → Y and g : Y → Z be functions. We call
g ◦ f : X → Z, x 7→ g(f (x))
(f ◦ g) ◦ h = f ◦ (g ◦ h)
Proof:
thus, f is injective.
20
1.5 Functions
21
2 The real numbers
2.1 Natural numbers, integers, and rational numbers
In Section 1.3.4, we have introduced the natural numbers as the intersection of
all inductive sets. This allows us to define1 on natural numbers the operation “+”
(addition). But what actually is meant by an “operation”? The following definition
gives the precise terminology.
Definition 2.1 (Operation): An operation • on a set X is a function • : X ×X → X.
22
2.1 Natural numbers, integers, and rational numbers
really know that such fractions can exist and that the operations · and also + are
well-defined for them? Well, in order to these ideas on a solid base, we have to give
a rigorous meaning to nz . This is done as follows. In Problem 4 on Homework Sheet
2, it is shown that we can define on the set X := Z × N an equivalence relation ∼
by
(z1 , n1 ) ∼ (z2 , n2 ) ⇔ z1 n2 = z2 n1
for (z1 , n1 ), (z2 , n2 ) ∈ X. We call Q := X⧸∼ the set of rational numbers and write
z
n
:= [(z, n)] for the equivalence class [(z, n)] of (z, n) ∈ X with respect to the
equivalence relation ∼. Note that the equivalence relation ∼ was designed in such
a way that it reflects our intuition about equality of two fractions. To complete
our construction, it remains to define an addition and a multiplication on Q. This
is done by
z1 z2 z1 n2 + n1 z2
[(z1 , n1 )] + [(z2 , n2 )] := [(z1 n2 + n1 z2 , n1 n2 )], i. e., + =
n1 n2 n1 n2
and
z1 z2 z1 z2
[(z1 , n1 )] · [(z2 , n2 )] := [(z1 z2 , n1 n2 )], i. e., · = ,
n1 n2 n1 n2
respectively. Though this seems rather obvious in the familiar fraction notation,
we actually have to verify that + and · are well-defined, i. e., that the respective
results
[(z1 n2 + n1 z2 , n1 n2 )] and [(z1 z2 , n1 n2 )]
are independent of the particular choice of representatives (z1 , n1 ) and (z2 , n2 ) of
the two equivalence classes [(z1 , n1 )] and [(z2 , n2 )]. In other words, we must show
that if (z1 , n1 ) ∼ (z1′ , n′1 ) and (z2 , n2 ) ∼ (z2′ , n′2 ), then
(z1 n2 + n1 z2 , n1 n2 ) ∼ (z1′ n′2 + n′1 z2′ , n′1 n′2 ) and (z1 z2 , n1 n2 ) ∼ (z1′ z2′ , n′1 n′2 ).
The former is treated in Problem 4 on Homework Sheet 2; for the latter, the proof
is analogous.2
2With this mindset, the reader might object that not only the construction of Q out of Z, but
also the construction of Z out of N requires more care. That is absolutely true! The elements
−n for n ∈ N, even though their meaning is quite intuitive, must be constructed in the same
way. In fact, one can construct Z as X⧸∼ for the set X := N × N and the equivalence relation
∼ on X which is defined by
(m1 , n1 ) ∼ (m2 , n2 ) ⇔ m1 + n2 = m2 + n1 .
The idea behind is that integers z are “represented” as z = m − n for m, n ∈ N, in the same
way as rational numbers are represented by fractions. Addition on Z = X⧸∼ is then defined by
[(m1 , n1 )] + [(m2 , n2 )] := [(m1 + m2 , n1 + n2 )].
Again, one needs to check that this is well-defined, i. e., that [(m1 +m2 , n1 +n2 )] is independent
of the particular choice of representatives (m1 , n1 ) and (m2 , n2 ). We leave the details to the
readers. Note that the identity element 0 ∈ Z is nothing but [(1, 1)].
23
2 The real numbers
Note that Z can be identified with the subset {[(z, 1)] : z ∈ Z} of Q. Hence, we
may view Z ⊆ Q and all previously introduced operations are compatible with this
identification.
Example 2.3 (Fields): (i) Endowed with the usual addition and multiplication,
Q is a field.
(ii) Z fails to be a field since the only elements of Z which admit an inverse
element with respect to multiplication are −1 and 1.
Proposition 2.4 (Properties of fields): Let F be a field. Then the following state-
ments hold true:
(i) There exists exactly one identity element of addition, i. e., for 0′ ∈ F satisfying
a + 0′ = a for all a ∈ F , it follows that 0′ = 0.
(ii) There exists exactly one identity element of multiplication.
(iii) The inverse element of a with respect to addition is unique, i. e., for any
a′ ∈ F satisfying a + a′ = 0, it follows that a′ = −a.
(iv) The inverse element of a ̸= 0 with respect to multiplication is unique.
(v) ∀ a ∈ F : a · 0 = 0.
(vi) ∀ a, b ∈ F : a · b = 0 ⇒ (a = 0) ∨ (b = 0).
(vii) ∀ a, b, c ∈ F : a + b = a + c ⇒ b = c.
(viii) ∀ a, b, c ∈ F, a ̸= 0 : a · b = a · c ⇒ b = c.
24
2.2 Ordered fields
Proof: Exemplary, we prove (i). Some of the remaining statements appear on the
exercise sheets, the rest is left to the readers for private practicing.
By Definition 2.2, there exists an identity element of addition, namely an element
0 ∈ F which satisfies
a+0=a for all a ∈ F . (∗)
To prove uniqueness of 0, we assume that 0′ ∈ F is any other element which satisfies
the same condition like 0, namely
0′ = 0′ + 0 = 0 + 0′ = 0,
as we wished to show. □
Definition 2.5 (Ordered field): A field F is said to be ordered if there exists a total
order ≤ on F with the following properties:
(i) ∀ a, b, c ∈ F : a ≤ b ⇒ a + c ≤ b + c.
(ii) ∀ a, b ∈ F : (0 ≤ a) ∧ (0 ≤ b) ⇒ 0 ≤ a · b.
Example 2.6 (Ordered fields): The rational numbers Q are an ordered field.
In an ordered field F with the associated total order ≤, we use the following
notation:
x<y :⇔ (x ≤ y) ∧ (x ̸= y)
x≥y :⇔ y≤x
x>y :⇔ y<x
Proposition 2.7 (Properties of ordered fields): Let F be an ordered field. Then the
following statements hold true:
(i) ∀ a, b, c ∈ F : (a ≤ b) ∧ (c ≥ 0) ⇒ a · c ≤ b · c.
25
2 The real numbers
(ii) ∀ a, b, c ∈ F : (a ≤ b) ∧ (c ≤ 0) ⇒ a · c ≥ b · c.
(iii) ∀ a ∈ F : a ≤ 0 ⇒ −a ≥ 0 and ∀ a ∈ F : a < 0 ⇒ −a > 0.
(iv) ∀ a, b ∈ F : 0 < a ≤ b ⇒ 0 < b−1 ≤ a−1 .
(v) ∀ a ∈ F : a2 ≥ 0 and ∀ a ∈ F \ {0} : a2 > 0 (where a2 := a · a);
in particular, we have that 1 > 0.
(vi) ∀ a, b ∈ F : 0 ≤ a ≤ b ⇒ 0 ≤ a2 ≤ b2 .
Proof: Exemplary, we prove (i). Some of the remaining statements appear on the
exercise sheets, the rest is left to the readers for private practicing.
Let a, b, c ∈ F be given such that a ≤ b and c ≥ 0. From a ≤ b, we infer with
the help of Definition 2.5 (i) that
0 = a + (−a) ≤ b + (−a).
Since 0 ≤ b + (−a) and 0 ≤ c, Definition 2.5 (ii) tells us that
0 ≤ (b + (−a)) · c = b · c + (−a) · c = b · c + (−(a · c)).
Using again Definition 2.5 (i), we infer from the latter that
a · c = 0 + a · c ≤ b · c + (−(a · c)) + a · c
= b · c + (−(a · c)) + a · c = b · c + 0 = b · c,
as we wished to show. □
Recall that the need for extending N to Z and Z to Q came from the observation
that certain natural equations failed to have solutions over the respective smaller
set of numbers. Now that we have Q, which even carries the structure of an ordered
field, as we saw above, we should ask ourselves if this is finally “large enough” or if
there are other interesting equations which still fail to have solutions in Q. Well,
the equation x2 = 2 turns out to be problematic, as the next proposition shows (in
anticipation of rules for divisibility and prime numbers which we discuss later).
Proposition 2.8 (Existence of non-rational numbers): There exists no rational so-
lution to the equation x2 = 2, i. e., there is no q ∈ Q such that q 2 = 2.
Proof: We give a proof by contradiction. Assume to the contrary that there exists
q ∈ Q such that q 2 = 2. We write q = ab with a ∈ Z and b ∈ N. Without loss
of generality, we assume that the fraction is reduced, i. e., that a and b have no
common prime factors; this can be achieved by canceling common prime factors
2
of a and b if necessary. Then, we get 2 = q 2 = ab2 and hence 2b2 = a2 . The latter
2
means that 2 divides a . However, since 2 is prime number, this is possible only if
2 divides a; therefore, there is a k ∈ Z such that a = 2k. Inserting this observation
into 2b2 = a2 , we get 2b2 = (2k)2 = 4k 2 and hence b2 = 2k 2 . The latter means
that 2 divides b2 and so b, by the same reasoning as above. Consequently, 2 divides
both a and b. This, however, contradicts the assumption that a and b have no
common prime factor. □
26
2.3 Bounded sets
This observation tells us that Q is still not sufficient for all our purposes. We
know from
√ school that the real numbers R close that gap, since R contains the
number 2, which solves the equation x2 = 2. But do we really know what R
should be? Like Q, also R is an ordered field. So, what is the additional property
which characterizes R?
27
2 The real numbers
28
2.3 Bounded sets
Since r2 > 2 and r2 < 2 have been ruled out, the only remaining option is r2 = 2.
This concludes the proof. □
Note that the particular choice of 2 was not important; the proof works equally
well for each other positive real number.
Example 2.15 (Square roots): From Proposition 2.14, it follows that the function
g : R≥0 → R≥0 , x 7→ x2
is bijective√as asserted in Example 1.35. It inverse function g −1 : R≥0 → R≥0
defines by x := g −1 (x) the (square) root of x.
More generally, one can show that the function
gn : R≥0 → R≥0 , x 7→ xn
√
is bijective for each n ∈ N; we call n x := gn−1 (x) the n-th root of x.
Proposition 2.16 (Inclusions of number sets): We have N ⊆ Z ⊆ Q ⊆ R. More-
over, we have:
(i) For a ∈ R, there exists exactly one k ∈ Z such that k ≤ a < k + 1.
(ii) For a, b ∈ R with a < b, there exists q ∈ Q such that a < q < b.
Proof: The asserted inclusions hold by definition of the respective sets of numbers.
Thus, it suffices to prove the additional statements.
(i) Fix a ∈ R and put M := {z ∈ Z : z ≤ a}. We observe that M ̸= ∅.
Indeed: If we assume to the contrary that M = ∅, then this would tell
us that z > a for all z ∈ Z; in particular, −n > a for all n ∈ N. The latter
implies n < −a for all n ∈ N, i. e., N is bounded from above (namely by a).
This, however, is not true; see Example 2.11 (i).
Since M is non-empty and bounded from above (namely by a), it has
a supremum. Since M ⊆ Z, it follows that the supremum is actually a
maximum (!); thus, k := max M does the job.
(ii) Let a, b ∈ R with a < b be given. Note b − a > 0. Since N is not bounded
1
from above, there exists n ∈ N such that n > b−a > 0. This implies n1 < b − a
and hence a + n1 < b.
By part (i), there exists exactly one m ∈ Z such that m ≤ na < m + 1.
Dividing the latter by n yields mn ≤a< n .
m+1
We infer that
m+1 m 1 1
a< = + ≤ a + < b.
n n n n
This means that q := m+1 n ∈ Q satisfies a < q < b, as desired. □
Now that we have R, we may ask ourselves whether this is the end of the story.
Not at all! There are still interesting equations which do not possess solutions over
R; for instance, x2 = −1. Appetizer: This leads to the field C of complex numbers,
which contains the field R of real numbers; C is not ordered but nonetheless very
natural.
29
2 The real numbers
Proposition 2.18 (Properties of the absolute value): The absolute value has the
following properties:
(i) For all a ∈ R, we have |a| ≥ 0 and
|a| = 0 ⇔ a = 0.
|a − b| ≤ |a| + |b|.
Proof: Exemplary, we prove (i). Some of the remaining statements appear on the
exercise sheets, the rest is left to the readers for private practicing.
Take a ∈ R. We consider the following three cases (other cases cannot occur
since ≤ is a total order so that 0 ≤ a or a ≤ 0 must be satisfied):
Case a > 0: Here, we have |a| = a > 0.
Case a = 0: Here, we have |a| = |0| = 0.
Case a < 0: By Proposition 2.7 (iii), we have −a > 0. Hence, |a| = −a > 0.
Thus, in each case |a| ≥ 0. Moreover, we see that |a| = 0 if and only if a = 0. □
30
2.4 Topology on R — Part I
Moreover, we define
[a, ∞) := {x ∈ R : a ≤ x}
and analogously (a, ∞), (−∞, b], (−∞, b), as well as (−∞, ∞) = R.
Note that the absolute value can be used to measure the distance between two
real numbers x and y; it is given by |x − y|. By an ε-neighborhood of a real number
x, we mean the set (in fact, the interval) of all real numbers y which have a distance
to x which is smaller than the given ε. This is the content of the next definition.
(x − ε, x + ε) = {y ∈ R : |y − x| < ε}
the ε-neighborhood of x.
Definition 2.21 (Open set): A subset U ⊆ R is said to be open if the following con-
dition is satisfied: For each x ∈ U , there exists ε > 0 such that the ε-neighborhood
(x − ε, x + ε) of x is contained in U .
(i) An open interval (see Definition 2.19) is open in the sense of Definition
2.21. Indeed, for an open interval (a, b) and any point x ∈ (a, b), we have
(x − ε, x + ε) ⊆ (a, b) for ε := min{b − x, x − a} > 0.
In contrast, for intervals the form [a, b] or [a, b), there is no ε-neighborhood
of the endpoint a which belongs to that interval. Thus, half-open or closed
intervals, are not open.
(ii) By definition, the empty set ∅ is open. (Why?)
Proof: Take any x ∈ U . By definition of the union, there exists some i ∈ I such that
x ∈ Ui . Since this set Ui is open, there is some ε > 0 such that (x − ε, x + ε) ⊆ Ui .
Since Ui ⊆ U , it follows that (x − ε, x + ε) ⊆ U . This shows that U is open. □
31
2 The real numbers
Note that Proposition 2.24 does not remain true for intersection of infinitely
many sets, as the following example shows.
(i) Closed intervals are closed in the sense of Definition 2.26. Indeed, for the
closed interval [a, b] with a < b, we have
so that R\[a, b] is the union of two open intervals (which are open by Example
2.22) and hence open by Proposition 2.23.
(ii) Finite sets are closed.
(iii) R and ∅ are both open and closed.
(iv) Half-open intervals of the form [a, b) and (b, a] are neither open nor closed.
In contrast, intervals of the form [a, ∞) and (−∞, b] are closed since their
complements R \ [a, ∞) = (−∞, a) and R \ (−∞, b] = (b, ∞) are open.
The following statements are “dual” to those in Proposition 2.23 and Proposition
2.24.
32
2.5 Comparison of cardinalities
Example 2.30 (Boundary points): (i) We have ∂[0, 1] = {0, 1}. Indeed:
• Points x ∈ (0, 1) cannot be boundary points since the ε-neighborhood
(x − ε, x + ε) for ε := min{x, 1 − x} is a subset of (0, 1) and hence cannot
contain elements from R \ [0, 1].
• Points x ∈ R \ [0, 1] = (−∞, 0) ∪ (1, ∞) cannot be boundary points since
the ε-neighborhood (x − ε, x + ε) for
(
−x, if x < 0
ε :=
x − 1, if x > 1
is a subset of R \ [0, 1] and hence cannot contain points from [0, 1].
• The points 0 and 1 are boundary points: For an arbitrary ε > 0, we
have that (0 − ε, 0 + ε) and (1 − ε, 1 + ε) contain points from both [0, 1]
and R \ [0, 1].
(ii) We have ∂Q = R. To see this, we take x ∈ R and ε > 0 and observe the
following:
• By Proposition 2.16 (ii), there exists q ∈ Q such that x − ε < q < x + ε,
i. e., we have q ∈ (x − ε, x + ε).
• By applying Proposition 2.16 (ii) twice, we conclude that there are
q1 , q2 ∈
√ Q such that x − ε < q1 < q2 < x + ε. We consider r :=
q1 + 12 2(q2 − q1 ).
√
From Proposition√2.14 and its proof, we learn that 0 ≤ 2 ≤ 2 or,
equivalently, 0 ≤ 12 2 ≤ 1; thus, we see that q1 < r < q2 and hence
r ∈ (x − ε, x + ε). √
Moreover, Proposition 2.8 tells us that √2 ∈ R \ Q. It follows that
r ∈ R \ Q, because otherwise, we would get 2 = 2 qr−q 1
2 −q1
∈ Q and hence
a contradiction.
In summary, we see that the ε-neighborhood (x − ε, x + ε) of x contains with
q and r elements from both Q and R \ Q; thus, by definition, x ∈ ∂Q. Since
x ∈ R was arbitrary, we get that ∂Q = R.
33
2 The real numbers
f (2)
{1, 2, 3, . . . , n} f (n)
f (3)
f (1)
The sets f −1 ({yj }) for j = 1, . . . , m (some of which might be empty) are pairwise
disjoint; hence (!), we have
m
X
|X| = |f −1 ({yj })|.
j=1
34
2.5 Comparison of cardinalities
m
X m
X
|X| = |f −1 ({yj })| ≥ 1 = m = |Y |.
j=1 j=1
Theorem 2.33 (Pigeonhole principle): Let X and Y be finite sets with |Y | < |X|.
Then there is no injective function f : X → Y .
Proof: The statement is obtained from Theorem 2.33 by contraposition. For the
sake of clarity, we give also a proof by contradiction.
Assume that there exists an injective function f : X → Y . By Lemma 2.32, it
follows that |X| ≤ |Y |, which contradicts the assumption made in the statement of
the theorem. Thus, there cannot exist an injective function f : X → Y . □
is a bijection; indeed, one can write down the inverse function. Hence, Z is
countably infinite.
35
2 The real numbers
1 1 1 1 1 1
1 2 3 4 5 6 ···
2 2 2 2 2 2
1 2 3 4 5 6 ···
3 3 3 3 3 3
1 2 3 4 5 6 ···
4 4 4 4 4 4
1 2 3 4 5 6 ···
5 5 5 5 5 5
1 2 3 4 5 6 ···
6 6 6 6 6 6
1 2 3 4 5 6 ···
.. .. .. .. .. .. ..
. . . . . . .
By going through the list as indicated, we hit eventually all elements in Q>0 and
by removing all repetitions (i. e., those fractions which are not reduced), we obtain
the following enumeration of Q>0 :
1 1 3 2 1 1 5 4 3 2 1
1, 2, , , 3, 4, , , , , 5, 6, , , , , , . . .
2 3 2 3 4 5 2 3 4 5 6
This enumeration induces a bijective function from N to Q>0 ; this shows that Q>0
is countably infinite.
Now, we extend the above enumeration of Q>0 in order to get an enumeration
of Q. We insert 0 in front of 1 and insert after each element in the list the
corresponding negative number:
1 1 1 1 3 3
0, 1, −1, 2, −2, , − , , − , 3, −3, 4, −4, , − , . . .
2 2 3 3 2 2
This is an enumeration of Q, which induces a bijection f : N → Q. □
36
2.5 Comparison of cardinalities
1 8.⃝6
8 2 3 0...
2 3 4. 8⃝7
2 3 4...
0. 0 4⃝2
0 5...
7 3 2. 2 7 6⃝3
4 ...
4. 1 5 5 9⃝
0 ...
⇝r= 0. 0 0 1 0 1 . . .
The arguments in the proofs of Theorem 2.36 and Theorem 2.37 are called
Cantor’s first and second diagonal argument.
Remark: In Example 2.30 (ii), we needed to show that every open interval (x −
ε, x + ε) for x ∈ R and ε > 0 contains an element of R \ Q. The√proof given there
followed the strategy to “scale and shift” the irrational number 2 until it belongs
to (x − ε, x + ε). Now, we can give an abstract argument: From Theorem 2.37, one
can deduce that the set (x − ε, x + ε) is uncountable. The subset (x − ε, x + ε) ∩ Q,
however, is countably infinite since it cannot be finite but must be countable
as a subset of the countable set Q (see Theorem 2.36). Thus, the complement
(x − ε, x + ε) ∩ R \ Q is not only non-empty but must even be uncountable; otherwise,
we could write (x − ε, x + ε) as the union of two countable sets, which would imply
that (x − ε, x + ε) is countable and hence would lead to a contradiction.
37
3 Sequences and series
3.1 Convergent sequences
Definition 3.1 (Sequence): A sequence in a set X means a function a : N → X.
From now on, if nothing else is said, all sequences will be real sequences, i. e.,
sequences in R.
1
Example 3.2 (Sequences): (i) If we define an := n for all n ∈ N, then we get
the sequence a = (1, 12 , 13 , . . .).
(ii) If we define b2n := 0 and b2n−1 := 1 for all n ∈ N, then we get the sequence
b = (1, 0, 1, 0, 1, . . .).
Definition 3.3 (Convergence of sequences): Let (an )n∈N be a sequence of real num-
bers.
(i) Let a ∈ R. We say that (an )n∈N converges to a (or that (an )n∈N is convergent
to a) if
∀ε > 0 ∃N ∈ N ∀n ≥ N : |an − a| < ε.
n→∞
lim an = a, an −−−−→ a, or “an → a as n → ∞”.
n→∞
(ii) If there is no a ∈ R such that (an )n∈N is convergent to a, then (an )n∈N is
called divergent.
In other words: The sequence (an )n∈N converges to a if and only if each ε-
neighborhood (a − ε, a + ε) of a, for ε > 0, contains almost all (i. e., all except at
most finitely many) elements of the sequence (an )n∈N .
The concept of convergence can be visualized as follows:
38
3.1 Convergent sequences
an
a = lim an ⇔ ∀ ε > 0 ∃ N ∈ N ∀ n ≥ N : an ∈ (a − ε, a + ε)
a1 n→∞
a+ε
a
a−ε
n
1 N
Proof: Let a, a′ ∈ R be two limits of the convergent sequence (an )n∈N and assume
′
that a ̸= a′ . Put ε := |a−a
2
|
> 0.
Since (an )n∈N converges to a, there exists N ∈ N such that
on the other hand, since (an )n∈N converges to a′ , there exists N ′ ∈ N such that
(a − ε, a + ε) (a′ − ε, a′ + ε)
( )( )
a a′
Thus, for all n ∈ N with n ≥ max{N, N ′ }, we get by the triangle inequality (2.1)
that
Example 3.5: (i) Let a ∈ R and define the constant sequence (an )n∈N by an := a
for all n ∈ N. Then (an )n∈N is convergent and
lim an = a.
n→∞
39
3 Sequences and series
1 1 1
−0 = ≤ < ε.
n n N
(iii) The sequence (bn )n∈N from Example 3.2 (ii), which was defined by
(
0, if n is even
bn := ,
1, if n is odd
is divergent.
Indeed: Assume to the contrary that there exists b ∈ R such that lim bn =
n→∞
b. We apply the definition of convergence for ε = 12 . Thus, there is N ∈ N
such that
1
|bn − b| < for all n ∈ N with n ≥ N .
2
Clearly, there are natural numbers n, n′ ≥ N such that n is even and n′ is
odd; hence,
1 1
|b| = |bn − b| < and |1 − b| = |bn′ − b| < .
2 2
The triangle inequality (2.1) implies that
1 1
1 = |1| = |(1 − b) + b| ≤ |1 − b| + |b| < + = 1.
2 2
This is a contradiction! Thus our assumption was wrong, i. e., (bn )n∈N is
divergent.
Proposition 3.6 (Rules for limits): Let (an )n∈N and (bn )n∈N be convergent sequences
with limits a and b, respectively. Then the following statements hold true:
Proof: We prove (i). The proof of (ii) will be discussed in Problem 3 on Classroom
Sheet 5; the other properties are left for private practicing.
40
3.2 Convergence criteria
a − ε < an ≤ bn < b + ε = a − ε,
1 2
5(n2 − 1)2 5 1− n2
4
= 8 for all n ∈ N,
7n + 8 7+ n4
5(n2 − 1)2 5
lim 4
= .
n→∞ 7n + 8 7
b := lim an = lim cn ,
n→∞ n→∞
∀ n ≥ Na : an ∈ (b − ε, b + ε) and ∀ n ≥ Nc : cn ∈ (b − ε, b + ε).
b − ε < an ≤ bn ≤ cn < b + ε
1 From 1
Example 3.5 (ii), we know that lim = 0. Hence, Proposition 3.6 (iii) implies that
n→∞ n
1
lim = 0 for all exponents k ∈ N. Indeed, this can be proved using mathematical induction
n→∞ nk
1
with respect to k; in the induction step, we write nk+1 = n1k · n
1
.
41
3 Sequences and series
an ≤ bn ≤ cn for all n ∈ N,
where the sequences (an )n∈N and (cn )n∈N are defined by
1
an := 1 and cn := 1 + for all n ∈ N,
n
respectively. In Example 3.5 (i), we have seen that the constant sequence (an )n∈N
is convergent with limit lim an = 1. In Example 3.5 (ii), we have shown that
n→∞
1
lim = 0, so that Proposition 3.6 (ii) guarantees the convergence of the sequence
n→∞ n
(cn )n∈N with limit
1
lim cn = lim 1 + lim = 1 + 0 = 1.
n→∞ n→∞ n→∞ n
Because lim an = 1 = lim cn , we can apply Theorem 3.8; this implies that
n→∞ n→∞
(bn )n∈N is convergent with lim bn = 1.
n→∞
Notation: A sequence (an )n∈N is said to be bounded (from above/below) if the set
{an : n ∈ N} is bounded (from above/below).
Proof: Let (an )n∈N be convergent sequence, say with limit a ∈ R. By definition of
convergence, applied to ε = 1, there exists some N ∈ N such that |an − a| < 1 for
all n ≥ N . Hence, we get by the triangle inequality (2.1) that
42
3.2 Convergence criteria
“⇒”: If (an )n∈N is convergent, then Proposition 3.10 tells us that (an )n∈N is
bounded.
“⇐”: Let (an )n∈N be bounded. We prove convergence of (an )n∈N in the case that
(an )n∈N is monotonically increasing; the proof for monotonically decreasing
sequences is analogous.
Since (an )n∈N is bounded, the set {an : n ∈ N} is bounded and hence, in
particular, bounded from above. Thus, by the supremum property of R, it
has a supremum; we put
a := sup{an : n ∈ N}.
43
3 Sequences and series
In summary, we get
a − ε < an < a + ε for all n ∈ N with n ≥ N ,
or equivalently,
|an − a| < ε for all n ∈ N with n ≥ N .
Thus, we have lim an = a, as we wished to show. □
n→∞
Remark: The proof of Theorem 3.13 shows that the following is true: A monotoni-
cally increasing sequence (an )n∈N is convergent if and only if is it bounded from
above; in this case, we have
lim an = sup{an : n ∈ N}.
n→∞
44
3.3 Recursively defined sequences
Example 3.14 (Recursion): Let (an )n∈N be the sequence which is defined the re-
cursion √ √
3
a1 := 6 and an+1 := 3 6 + an for all n ∈ N.
Note
√ that this recursion is if the form (∗) with the function f defined by f (x) :=
3
6 + x. More concretely, this means that
r !
√ √ √
q q
3 3 3
3 3 3
(an )n∈N = 6, 6 + 6, 6 + 6 + 6, . . . .
How can we control the behavior of (an )n∈N as n → ∞. Does (an )n∈N have a
limit? If so, what is its value? The problem is the lack of an explicit formula for
an ; we only know how to compute an element of the sequence if the preceding one
has already been computed. Therefore, the rules collected in Proposition 3.6 are
not of any use to us; even if we would expect the (an )n∈N to be convergent, the
definition of convergence given in Definition 3.3 cannot be applied to verify this
claim without having a candidate for the limit. But we are not lost! Fortunately,
there are criteria for convergence of sequences which do not rely on prior knowledge
of the limit. One instance is Theorem 3.13; this criterion, however, imposes quite
restrictive conditions, namely that the sequence is monotonic and bounded. To see
whether there is any chance to apply this criterion in our situation, we compute the
fist elements of the given sequence (an )n∈N and plot them in a coordinate system:
n an
1 1.81712059283214
2 1.98464242367434
3 1.99871938215685
4 1.99989327615152
5 1.99999110630641
6 1.99999925885859
7 1.99999993823821
8 1.99999999485318
9 1.99999999957110
10 1.99999999996426
.. ..
. .
Thus, it seems possible that the sequence (an )n∈N considered here is monotonically
increasing (even strictly) and bounded (from above). We verify these claims as
follows:
The sequence is strictly monotonically increasing: We show that
∀n ∈ N : an+1 > an .
In fact, we give a proof by mathematical induction:
45
3 Sequences and series
√ √
base case n = 1: We have a2 = 3 6 + a1 > 3 6 = a1 because 6 + a1 > 6.
induction step n → n + 1: Assume that the assertion an+1 > an is true
for some n ∈ N. It follows that 6 + an+1 > 6 + an and hence, by the
recursion,
p √
an+2 = 3 6 + an+1 > 3 6 + an = an+1 .
∀n ∈ N : an < 2.
Because we have verified that (an )n∈N is monotonically increasing and bounded
from above, Theorem 3.13 can be applied; this proves convergence of (an )n∈N .
Now that we know that (an )n∈N is convergent, we can compute its limit a :=
lim an . For that purpose, we note the following:
n→∞
• With (an )n∈N , the “shifted” sequence (an+1 )n∈N is also convergent to a.
• Since (an+1 )n∈N converges to a, Proposition 3.6 tells us that (a3n+1 )n∈N
converges to a3 .
• Similarly, since (an )n∈N converges to a, Proposition 3.6 guarantees that
(6 + an )n∈N converges to 6 + a.
√
Now, the recursion an+1 = 3 6 + an implies a3n+1 = 6 + an for all n ∈ N and hence
This means that we have derived an equation for the unknown limit a, namely
a3 = 6 + a. It follows that
0 = a3 − a − 6 = (a − 2)(a2 + 2a + 3) = (a − 2) (a + 1)2 + 2
| {z }
̸=0
and hence a = 2.
46
3.4 The Bolzano-Weierstraß theorem
is divergent. However, the values 0 and 1 seem to play some special role for the
sequence (bn )n∈N and behave very much like limits. In fact, these are the so-called
accumulation points of (bn )n∈N in the sense of the next definition.
Definition 3.15 (Accumulation point): Let (an )n∈N be a sequence in R and let
a ∈ R. We say that a is accumulation point of (an )n∈N if, for each ε > 0, the
ε-neighborhood (a − ε, a + ε) of a contains infinitely many elements of the sequence
(an )n∈N ; in other words, all sets
are infinite.
Example 3.18 (Subsequences): If (an )n∈N is a sequence, then (a2k )k∈N and (ak2 )k∈N
are subsequences of (an )n∈N , for instance, whereas a permutation like
(a1 , a3 , a2 , a4 , a6 , a5 , . . . )
is not.
47
3 Sequences and series
Proof:
(i) “⇒”: Let a ∈ R be an accumulation point of (an )n∈N . By Definition 3.15,
we know that all sets
are all infinite. With the help of this observation, we can now construct
a subsequence (ank )k∈N of (an )n∈N with the property
1
|ank − a| < for all k ∈ N.
k
To this end, we proceed as follows:
• Since the set X1 is infinite, we have in particular that X1 ̸= ∅, i. e.,
there exists n1 ∈ N such that |an1 − a| < 1.
• Let n1 < n2 < · · · < nk with |anj − a| < 1j for j = 1, . . . , k be
constructed. Since the set Xk+1 is infinite, we have in particular
that Xk+1 \ {n ∈ N : n ≤ nk } ≠ ∅; thus, there exists nk+1 ∈ N such
1
that nk < nk+1 and |ank+1 − a| < k+1 .
Since the sequence (nk )k∈N of indices is strictly monotonically increasing,
(ank )k∈N is indeed a subsequence of (an )n∈N . Moreover, we notice that
it converges to a; indeed, we have by construction |ank − a| < k1 and
hence
1 1
a − < ank < a + for all k ∈ N;
k k
because lim a − k1 = a = lim a + k1 , Theorem 3.8 implies that
k→∞ k→∞
(ank )k∈N is convergent with lim ank = a.
k→∞
48
3.4 The Bolzano-Weierstraß theorem
“⇐”: Let (ank )k∈N be a subsequence of (an )n∈N with lim ank = a. Let
k→∞
ε > 0. By definition of convergence, there exists K ∈ N such that
|ank − a| < ε for all k ≥ K; in other words, we have
(iii) Let (an )n∈N be a convergent sequence with lim an = a. Since (an )n∈N is
n→∞
a subsequence of itself, part (i) implies that a is an accumulation point of
(an )n∈N . For any other accumulation point a′ ∈ R of (an )n∈N , we find by
part (i) a convergent subsequence (ank )k∈N of (an )n∈N with lim ank = a′ .
k→∞
However, by part (ii), we have lim ank = a. Thus, a′ = a. This means that
k→∞
a is the only accumulation point of (an )n∈N . □
In Example 3.16, we have seen that there are sequences without accumulation
points. As the following theorem shows, this is only possible for unbounded
sequences.
49
3 Sequences and series
To verify this assertion, we take any sequence (an )n∈N in R. We consider the set
X := {n ∈ N : ( ∀ m ≥ n : an > am )};
Thanks to Theorem 3.19 (i), the statement of Theorem 3.21 can be rephrased
as follows: Every bounded sequence in R has an accumulation point. This will be
used in (the proof of) Theorem 3.22.
Proof: Since (an )n∈N is bounded, there exists C > 0 such that −C ≤ an ≤ C for
all n ∈ N.
Let a ∈ R be any accumulation point of (an )n∈N . By Theorem 3.19 (i), there
exists a subsequence (ank )k∈N of (an )n∈N such that lim ank = a. Since −C ≤
k→∞
ank ≤ C for all k ∈ N, we get from Proposition 3.6 (i) that −C ≤ a ≤ C. This
proves that the set X of all accumulation points of (an )n∈N is bounded.
By the supremum property of R (note that X = ̸ ∅ by Theorem 3.21), the set
X has a supremum; put s := sup X. We claim that s ∈ X, i. e., s = max X. This
claim is verified as follows.
50
3.5 Limes inferior and limes superior
Definition 3.23 (Limes inferior and limes superior): Let (an )n∈N be a bounded se-
quence.
(i) The minimum of the set of all accumulation points of (an )n∈N is called the
limes inferior of (an )n∈N and denoted by lim inf an .
n→∞
(ii) The maximum of the set of all accumulation points of (an )n∈N is called the
limes superior of (an )n∈N and denoted by lim sup an .
n→∞
By definition, we have
lim inf an ≤ lim sup an .
n→∞ n→∞
n
(ii) For the sequence ((−1) )n∈N we have
With arguments similar to those in the proof of Theorem 3.22, we get the
following characterization of the limes inferior and the limes superior:
Proposition 3.25 (Properties of the limes inferior and limes superior): Let (an )n∈N
be a bounded sequence and a ∈ R. Then the following statements hold true:
(i) We have lim inf an = a if and only if the following two conditions are satisfied
n→∞
for each ε > 0:
3 The supremum property of R ensures that every subset of R which is bounded from above has a
supremum. Remarkably, the supremum property of R also ensures that each subset of R which
is bounded from below has an infimum. This is a consequence of Problem 3 on Homework
Sheet 4: If Y ⊆ R is bounded from below, then −Y := {−y : y ∈ Y } is bounded from above.
Hence sup(−Y ) exists and it follows that inf Y exists; in fact, we have inf Y = − sup(−Y ).
51
3 Sequences and series
Proof:
Thus, the assertion in (i) can easily be deduced from (ii); consequently, it
suffices to establish the latter.
(ii) “⇒”: Assume that lim sup an = a. Let ε > 0 be given. We verify the two
n→∞
asserted properties:
• In the proof of Theorem 3.22, we have seen that {n ∈ N : |an − a| <
ε} is an infinite set; in particular, we have a − ε < an for infinitely
many n ∈ N.
• Assume to the contrary that there are infinitely many n ∈ N such
that an ≥ a+ε. Then we can find a strictly monotonically increasing
sequence (nk )k∈N in N such that ank ≥ a + ε for all k ∈ N. Since
(an )n∈N is bounded, its subsequence (ank )k∈N is bounded as well. By
Theorem 3.21, (ank )k∈N has a convergent subsequence; by replacing
(ank )k∈N by this subsequence if necessary, we may assume without
loss of generality (why?) that (ank )k∈N itself is convergent. Since
ank ≥ a + ε for all k ∈ N, it follows from Proposition 3.6 (i) that
lim ank ≥ a + ε. This means that the sequence (an )n∈N has an
k→∞
accumulation point strictly greater than a; this, however, contradicts
the fact that a = lim sup an is the greatest accumulation point of
n→∞
(an )n∈N according to by Definition 3.23.
“⇐”: Assume that (an )n∈N satisfies the two conditions for all ε > 0; we have
to show that lim sup an = a. To this end, we verify for a the defining
n→∞
properties of lim sup an according to Definition 3.23:
n→∞
a is an accumulation point: Combining the two assumed properties of
(an )n∈N , we get that for each ε > 0 there are infinitely many n ∈ N
for which a − ε < an < a + ε and hence |an − a| < ε holds true.
Thus, by Definition 3.15, we get that a is an accumulation point of
(an )n∈N .
52
3.5 Limes inferior and limes superior
Our study of the set of accumulation points of bounded sequences leads to the
following characterization of convergence.
(i) The sequence (an )n∈N has exactly one accumulation point.
(ii) We have lim inf an = lim sup an .
n→∞ n→∞
Proof:
has exactly one accumulation point, namely 0 (why?), but fails to be convergent.
There are rules for the limes superior and limes inferior, but these are more
subtle than the ones for the ordinary limit which we listed in Proposition 3.6. For
53
3 Sequences and series
instance (see Problem 1 on Homework Sheet 7), we have for bounded sequences
(an )n∈N and (bn )n∈N that
Moreover, we have for every bounded sequence (an )n∈N and each c ∈ R that
c · lim sup an , whenever c ≥ 0
lim sup(c · an ) = n→∞ ;
n→∞ c · lim inf an , whenever c ≤ 0
n→∞
the proof of these identities is left for private practicing. Note that the case c = −1
was used in the proof of Proposition 3.25.
Example 3.28 (Cauchy sequences): Let (sn )n∈N be the sequence defined by
n
X 1
sn := for all n ∈ N.
k
k=1
This means that for ε = 12 , we cannot find an N ∈ N such that |sn − sm | < ε for
all n, m ≥ N ; thus, (sn )n∈N is not a Cauchy sequence.
Proof: “⇒”: Assume that (an )n∈N is convergent; put a := lim an . Let ε > 0 be
n→∞
given. Then, there exists N ∈ N such that
ε
|an − a| < for all n ≥ N .
2
54
3.6 Cauchy sequences and Cauchy criterion
The first step is to prove that (an )n∈N is bounded; this is analogous to the
proof of Proposition 3.10. By applying (∗) to ε = 1, we observe that there
exists some N ∈ N such that
In particular, we get with the help of the triangle inequality (2.1) that
am ∈ (a − ε, a + ε) and an ∈ (a − ε, a + ε).
It follows that
which contradicts the choice of N . Thus, our assumption was wrong, i. e., we
have a = a, as we wished to show. □
55
3 Sequences and series
Example 3.30 (Application of the Cauchy criterion): The sequence (sn )n∈N con-
sidered in Example 3.28 is not a Cauchy sequence and hence not convergent.
Example 3.31 (Construction of the real numbers): Using the concept of Cauchy
sequences, we can construct the real numbers R out of the rational numbers Q. Let
C be the set of all Cauchy sequences (an )n∈N in Q. On C, we define an equivalence
relation ∼ by
Accordingly, we define
• lim inf an := −∞ for any sequence (an )n∈N which is not bounded from below;
n→∞
• lim sup an := ∞ for any sequence (an )n∈N which is not bounded from above.
n→∞
56
3.7 Improper convergence and complexity classes
In this extended meaning, the limes inferior and the limes superior exist for any
sequence.
Improper convergence to ∞ occurs, for instance, when considering the running
time of algorithms. If (an )n∈N describes in some sense the cost of an algorithm (e. g.,
n→∞
its running time) depending on the input size n ∈ N, then typically an −−−−→ ∞.
The concept of improper convergence, however, does not specify the speed by which
(an )n∈N converges to ∞ as n → ∞. This is the purpose of the next definition.
Definition 3.33 (Landau’s little o and big O notation): Let A = (an )n∈N and B =
(bn )n∈N be sequences in R. We say that
(i) A is in O(B) (and write A ∈ O(B) or sometimes A = O(B)) if the sequence
an
bn n∈N is bounded.
(ii) A is in o(B) (and write A ∈ o(B) or sometimes A = o(B)) if the sequence
an
bn n∈N is a null sequence.
Example 3.34: The following table collects some sequences B = (bn )n∈N which are
often used to describe the speed of convergence to ∞.
order complexity
O(1) constant
O(log(n)) logarithmic
O(n) linear
O(n log(n)) n log n
O(n2 ) quadratic
O(n3 ) cubic
k
O(n ) for some k ∈ N polynomial
O(an ) for some a > 1 exponential
Example 3.35: Suppose that n integers are given in an arbitrary order. The
purpose of a sorting algorithm is to bring these numbers in an increasing order.
The algorithm “Insertion Sort” works as follows: if the sub-list of the first k numbers
is already in increasing order, we insert the (k + 1)-th number in the sorted list
by moving all larger numbers of the sub-list one position to the right. The total
number of moves is
• in the “worst case” (i. e., the original list was in descending order)
n
X n(n − 1) n2 n
an = (k − 1) = = − ;
2 2 2
k=2
• in the “average case” (i. e., on average, if all numbers in the original list are
“randomly” positioned; see MfCS III)
n(n − 1) n2 n
bn = = − .
4 4 4
Then, we have that (an ), (bn ) ∈ O(n2 ), which means that the cost of the worst
case and the average case are of the same order, namely quadratic.
57
3 Sequences and series
3.8 Series
Definition 3.36: Let (an )n∈N be a sequence in R. We associate to (an )n∈N the
sequence (sn )n∈N which is defined by
n
X
sn := ak for all n ∈ N.
k=1
∞
P
(i) We call (sn )n∈N a series and denote it by an .
n=1
∞
P
(ii) We call sn the n-th partial sum of ak .
k=1
∞
P
(iii) If the sequence (sn )n∈N is convergent, we say that the series an converges;
n=1
∞
P
in this case, we denote also its limit by an , i. e.,
n=1
∞
X
an := lim sn
n→∞
n=1
n
X n+1
X
(1 − x)sn = xk − xk = 1 − xn+1 .
k=0 k=1
Thus, we have
(
n + 1, if x = 1
sn = 1−xn+1
1−x , ̸ 1
if x =
58
3.8 Series
for all n ∈ N0 . Using that (xn )n∈N is convergent if and only if x ∈ (−1, 1]
(see Problem 2 on Classroom Sheet 6), we infer that the geometric series is
1
convergent if and only if |x| < 1; in this case, we have lim sn = 1−x , i. e.,
n→∞
∞
X 1
xn = .
n=0
1−x
∞
P
Theorem 3.38 (Necessary condition for convergence): If the series an is con-
n=1
vergent, then (an )n∈N is a null sequence.
∞
P
Proof: Let an be convergent. By definition, this means that the sequence
n=1
n
P
(sn )n∈N of partial sums sn := ak is convergent. It follows that the “shifted
k=1
sequence” (sn+1 )n∈N is also convergent and has the same limit as the original
sequence (sn )n∈N . Since
n+1
X n
X
sn+1 = ak = ak + an+1 = sn + an+1 ,
k=1 k=0
we have an+1 = sn+1 − sn for all n ∈ N. Therefore, the rules for limits Proposi-
tion 3.6 tell us that (an+1 )n∈N is convergent (as the difference of two convergent
sequences) with the limit
in other words, (an+1 )n∈N is a null sequence. It follows that (an )n∈N is also a null
sequence, as desired. □
Example 3.39 (Divergent series): The sequence ((−1)n )n∈N is not a null sequence
∞
(−1)n
P
(and not even convergent); hence, Theorem 3.38 tells us that the series
n=1
is divergent.
59
3 Sequences and series
More directly, we see this with the help of the sequence (sn )n∈N of partial sums
∞
(−1)n ; note that
P
of the series
n=0
n
(
X
k −1, if n is odd
sn = (−1) = for all n ∈ N.
k=1
0, if n is even
Hence (compare Example 3.5 (iii), where up to the sign the same sequence has
been considered), we observe that (sn )n∈N is divergent.
∞
P
The converse of Theorem 3.38 is not true, meaning that a series an is
n=1
not automatically convergent if (an )n∈N is a null sequence; see Example 3.37 (i).
However, the following theorem shows that this works at least in particular cases.
Theorem 3.40 (Leibniz’s test): If (an )n∈N is a monotonic decreasing null sequence,
∞
(−1)n an is convergent.
P
then the series
n=1
60
3.8 Series
Thus, by the Cauchy criterion (Theorem 3.29), applied to the sequence of partial
∞
P ∞
P
sums of an , it follows that an is convergent. □
n=1 n=1
Note that the criterion for divergence in the root test Theorem 3.44 (iii) uses the
limes superior, whereas the criterion for divergence in the ration test Theorem 3.44
61
3 Sequences and series
(iv) uses the limes inferior. As we will see in the proof, the reason for that is the
characterization of the limes superior and the limes inferior given in Proposition
3.25.
• Suppose that a < 1. We choose any 0 < ε < 1 − a; this ensures that
the condition a + ε < 1 is satisfied. By Proposition 3.25 (ii), we have
an+1
an < a + ε for almost all n ∈ N; this means that there exists N ∈ N
such that aan+1
n
< a + ε or, equivalently, |an+1 | < (a + ε)|an | for all
n ≥ N . With the help of this, one can easily prove by mathematical
induction that
62
3.8 Series
We do not provide a proof here but want to convey some intuition. The underlying
∞
P P ∞
idea is that ak · bℓ is the “sum” of all terms of the form ak · bℓ with
k=0 ℓ=0
integers k, ℓ ∈ N0 , and if we arrange ak · bℓ as an infinite array, then cn corresponds
to the sum of all entries of that array which sit on the n-th diagonal.
63
3 Sequences and series
a0 b0 a0 b1 a0 b2 a0 b3 ...
c0 a1 b0 a1 b1 a1 b2 a1 b3 ...
c1 a2 b0 a2 b1 a2 b2 a2 b3 ...
c2 a3 b0 a3 b1 a3 b2 a3 b3 ...
.. .. .. .. ..
c3 . . . . .
In other words,
n! = 1 · 2 · 3 · . . . · n.
Note that n! is the number of arrangements of a set with n elements. The number
of ways to choose a subset of cardinality k out of a given set of cardinality n is
given by the binomial coefficient nk .
64
3.9 Exponential function
Proof: For x = 0, the series is obviously convergent; thus, we may restrict ourselves
to the case x ∈ R \ {0}. We define the sequence (an )n∈N by
xn
an := for all n ∈ N0 .
n!
Since an ̸= 0 for all n ∈ N0 , we may compute that
therefore, we get
∞ ∞
xn
P P
so that the ratio test (Theorem 3.44 (iv)) implies that the series an = n!
n=0 n=0
is absolutely convergent. □
With the tools which we have developed so far, we could prove that
1 n
lim 1 + = e;
n→∞ n
recall that the existence of this limit was established in Problem 2 on Homework
Sheet 6. Later, we can give a much shorter proof of that fact; we will see that more
generally x n
lim 1 + = exp(x) for all x ∈ R.
n→∞ n
Theorem 3.51 (Properties of the exponential function):
65
3 Sequences and series
Proof:
(i) This uses the Cauchy product from Theorem 3.45 and the binomial formula
from Proposition 3.48. The details will be worked out in Problem 1 on
Classroom Sheet 8.
(ii) This holds by definition; note that x > 0 ensures that the sequence of partial
∞
xn
P
sums of n! is strictly monotonically increasing so that
n=0
∞ 1
X xn X xn
exp(x) = > = 1 + x > 1.
n=0
n! n=0
n!
This proves that exp(x) ̸= 0 and hence exp(x) > 0 (because we already know
1
that exp(x) ≥ 0) as well as exp(x) = exp(−x).
(iv) For all x, y ∈ R with x > y, we have that
(i) (iii)
exp(x) = exp((x − y) + y) = exp(x − y) exp(y) > exp(y),
as asserted. □
Using these properties, we will show that exp : R → R>0 is not only injective
but also surjective and hence bijective. Using its inverse function, we can introduce
powers for arbitrary real exponents. With this notation, we have that exp(x) = ex
for all x ∈ R and the identity stated in Theorem 3.51 (i) can be rewritten in the
more familiar way as
66
4 Functions
4.1 Topology on R — Part II
In this section, we continue our considerations started in Section 2.4 using our new
concepts on convergence.
Definition 4.1 (Accumulation point): Let U ⊆ R and x ∈ R. We call x an ac-
cumulation point of U if there exists a sequence (xn )n∈N in U \ {x} such that
lim xn = x.
n→∞
67
4 Functions
Theorem 4.5 (Characterization of open and closed sets by boundary points): Let
U ⊆ R. Then the following statements hold true:
Proof:
U is closed
⇔ R \ U is open (by Definition 2.26)
⇔ ∂(R \ U ) ∩ (R \ U ) = ∅ (by part (i))
⇔ ∂U ∩ (R \ U ) = ∅ (by the identity (4.1))
⇔ ∂U ⊆ U (by definition of complements)
Compact sets are sets which behave “almost like finite sets”.
68
4.2 Limits of functions
69
4 Functions
(i) There exists an a ∈ R such that lim f (xn ) = a for every sequence (xn )n∈N
n→∞
in D \ {x0 } with lim xn = x0 .
n→∞
(ii) For each sequence (xn )n∈N in D \ {x0 } with lim xn = x0 , the sequence
n→∞
(f (xn ))n∈N is convergent.
(iii) There exists an a ∈ R such that
Proof:
“(i) ⇒ (iii)”: Suppose that the condition in (i) is satisfied for some a ∈ R. We
claim that (iii) is satisfied for the same a ∈ R. To prove this, we proceed as
follows. Let ε > 0 be given. Assume to the contrary that there is no δ > 0
such that |f (x) − a| < ε for all x ∈ D ∩ (x0 − δ, x0 + δ) \ {x0 }, i. e.,
70
4.2 Limits of functions
Remark: In the proof of “(ii) ⇒ (i)”, we have shown that the a ∈ R satisfying (i)
is unique.
It is easy to see that the a ∈ R satisfying (iii) is also unique. Indeed: Let
a′ , a′′ ∈ R be given such that
∀ ε > 0 ∃ δ ′ > 0 ∀ x ∈ D ∩ (x0 − δ ′ , x0 + δ ′ ) \ {x0 } : |f (x) − a′ | < ε and
∀ ε > 0 ∃ δ ′′ > 0 ∀ x ∈ D ∩ (x0 − δ ′′ , x0 + δ ′′ ) \ {x0 } : |f (x) − a′′ | < ε
|a′′ −a′ |
We assume to the contrary that a′ ̸= a′′ . Then, for ε := 2 > 0, we find
δ ′ , δ ′′ > 0 such that
|f (x) − a′ | < ε for all x ∈ D ∩ (x0 − δ ′ , x0 + δ ′ ) \ {x0 } and
′′ ′′ ′′
|f (x) − a | < ε for all x ∈ D ∩ (x0 − δ , x0 + δ ) \ {x0 }.
For δ := min{δ ′ , δ ′′ } > 0 and each x ∈ D ∩ (x0 − δ, x0 + δ) \ {x0 } (such x exist
because x0 is an accumulation point of D), we get by the triangle inequality (2.1)
that
|a′′ −a′ | = |(a′′ −f (x))+(f (x)−a′ )| ≤ |a′′ −f (x)|+|f (x)−a′ | < ε+ε = 2ε = |a′′ −a′ |,
which is a contradiction. Thus, a′ = a′′ , as asserted.
In the proof of “(i) ⇒ (iii)”, we have seen that any a ∈ R for which (i) is satisfied,
condition (iii) is satisfied as well.
Thus, we see that (i) and (iii) uniquely determine the same a ∈ R. We call it
the limit of f at the point x0 ; this is the content of the following definition.
71
4 Functions
Note that even if x0 ∈ D, the value f (x0 ) does not play any role for lim f (x).
x→x0
One can show that lim h(x) = 0 and lim h(x) = 1 ̸= 0 = h(1). In contrast,
x→0 x→1
lim1 h(x) = 0 does not exist.
x→ 2
However, if we consider
• the restriction h− of h to (0, 12 ], then we get lim1 h− (x) = 14 ; we call
x→ 2
1
this the left-sided limit of h at x0 = 2 and denote it by lim
1
h(x);
x→ 2 −
72
4.2 Limits of functions
Remark: Without proof, we point out the following fact: If we define the one-sided
limits like in Example 4.10 (iii), then one can show that the limit exists if and only
if both the left-sided and the right-sided limit exist and are equal.
Theorem 4.11: Let ∅ =
̸ D ⊆ R and let x0 ∈ R be an accumulation point of D.
(i) If f, g : D → R are functions for which lim f (x) and lim g(x) exist, then
x→x0 x→x0
lim (f (x) + g(x)) exists and we have that
x→x0
(ii) If f, g : D → R are functions for which lim f (x) and lim g(x) exist, then
x→x0 x→x0
lim (f (x) · g(x)) exists and we have that
x→x0
(iii) If f : D → R is a function for which lim f (x) exists, then lim |f (x)| exists
x→x0 x→x0
and we have that
lim |f (x)| = lim f (x) .
x→x0 x→x0
(iv) Let f : D → R be a function for which lim f (x) exists and lim f (x) ̸= 0.
x→x0 x→x0
Then there exists some δ > 0 such that
f (x) ̸= 0 for all x ∈ D ∩ (x0 − δ, x0 + δ) \ {x0 }.
Moreover, for the function
1 1
: D ∩ (x0 − δ, x0 + δ) \ {x0 } → R, x 7→ ,
f f (x)
1
the limit lim exists and we have that
x→x0 f (x)
1 1
lim = .
x→x0 f (x) lim f (x)
x→x0
(v) Let f, g : D → R be functions for which there exists δ > 0 such that
f (x) ≤ g(x) for all x ∈ D ∩ (x0 − δ, x0 + δ) \ {x0 }.
If lim f (x) and lim g(x) exist, then
x→x0 x→x0
73
4 Functions
(vi) Let f, g, h : D → R be functions for which there exists δ > 0 such that
lim h(x) = a.
x→x0
Proof: The rules (i), (ii), (iv), and (v) are immediate consequences of Definition
4.9 and the corresponding rules for limits of sequences listed in Proposition 3.6.
The assertion (iii) can be shown by similar considerations based on the reverse
triangle inequality (2.2).
The statement in (vi) is a consequence of the sandwich theorem (Theorem 3.8).□
x→x
0
Like in Definition 3.32, we allow the notation f (x) −−−−→ ±∞. It is straight-
forward to check, in analogy to Proposition 4.8, that the following conditions are
equivalent for a function f : D → R with domain ∅ ̸= D ⊆ R and an accumulation
point x0 ∈ R of D:
(i) For each sequence (xn )n∈N in D \ {x0 } with lim xn = x0 , we have that
n→∞
n→∞
f (xn ) −−−−→ ∞.
(ii) ∀ R > 0 ∃ δ > 0 ∀ x ∈ D ∩ (x0 − δ, x0 + δ) \ {x0 } : f (x) > R
x→x 0
In the case that these two equivalent conditions are satisfied, we write f (x) −−−−→ ∞.
x→x0
The definition of f (x) −−−−→ −∞ is analogous.
Now, we address limits for x → ±∞.
n→∞ n→∞
if we have f (xn ) −−−−→ a for each sequence (xn )n∈N in D with xn −−−−→ ∞.
(ii) If D is not bounded from below, then we write
x→−∞
lim f (x) = a or f (x) −−−−−→ a
x→−∞
n→∞ n→∞
if we have f (xn ) −−−−→ a for each sequence (xn )n∈N in D with xn −−−−→ −∞.
We emphasize that these definitions include the cases a = ±∞; for the sake of
x→±∞
clarity, however, we use in such cases the notation f (x) −−−−−→ a, exclusively.
74
4.3 Continuous functions
1 x→∞ 1 x→−∞
(ii) We have x −
−−−→ 0 and x −
−−−−→ 0.
1 x→0+ 1 x→0−
(iii) We have x −−−−→ ∞ and x −−−−→ −∞.
(i) We say that f is continuous at x0 if lim f (x) exists and is equal to f (x0 ).
x→x0
Notation: For ∅ =
̸ D ⊆ R, we denote the set of all continuous functions f : D → R
by C(D).
75
4 Functions
Since the case x = x0 is trivial, the latter condition is equivalent to (4.4). Hence,
the assertion follows. □
f (x)
f (x0 ) + ε
f (x0 )
f (x0 ) − ε
x
x0 − δ x0 x0 + δ
76
4.3 Continuous functions
In the same way as Proposition 4.8 (iii) leads to the condition for continuity
stated (4.4), Proposition 4.8 (i) tells us that a function f : D → R with domain D
is continuous at an accumulation point x0 ∈ D of D if and only lim f (xn ) = f (x0 )
n→∞
for each sequence (xn )n∈N in D with lim xn = x0 . In other words, the restriction
n→∞
to sequences in D \ {x0 } can be relaxed to arbitrary sequences in D.
For functions f, g : D → R, we define
|f | : D → R, x 7→ |f (x)|,
e := {x ∈ D : f (x) ̸= 0},
and, with D
1 e 1
: D → R, x 7→ .
f f (x)
Since the identity idR and constant functions are continuous on R (see Example
4.16 (i)), Theorem 4.18 tells us that polynomials are continuous on R.
77
4 Functions
Proof: Let (xn )n∈N be a sequence in D with lim xn = x0 . We define (yn )n∈N by
n→∞
yn := f (xn ) for all n ∈ N; moreover, we put y0 := f (x0 ). By continuity of f , we
have
lim yn = lim f (xn ) = f (x0 ) = y0 .
n→∞ n→∞
as we wished to show. □
The following example shows that the statement of the previous proposition does
not remain true if we drop the assumption of continuity.
Example 4.21 (Composition of functions): Consider the functions
(
1, if x ̸= 0
f : R → R, x 7→ 0 and g : R → R, x 7→ .
2, if x = 0
Then, we have lim f (x) = 0 and lim g(x) = 1, but lim (g ◦ f )(x) = 2.
x→0 x→0 x→0
78