You are on page 1of 39

1 — Preliminaries

1.1 Set Notations


The curriculum for math majors emphasizes a lot on logic, concepts, proofs, and abstract ideas.
In this section, let’s first introduce some basic set notations and mathematical languages that you
will encounter very often in math courses.

1.1.1 What is a set?


A set is a collection of objects. These objects can be numbers, animals, fruits, or anything you
can imagine. For example, the following

S = {2, 3, 4}

is a set containing three numbers. The letter S is the symbol of the set, and 2, 3, 4 are said to be
elements of S. We use the symbol 2 and 62 to indicate whether an object is an element of a set
or not. In the above set, we say

2 2 S because 2 is an element of S, whereas


1 62 S because 1 is not an element of S.

We may also use the phrases “2 belongs to S”, “2 is in S”, or “S contains 2” to mean 2 2 S.
A set does not need to have numbers to be its elements. We can have a set containing fruits
as well:
A = {apple, orange, banana, grape}.
A set can even contain objects that are not related to each other, such as:

B = {Hong Kong, Calculus, apple, math, toilet}.

For infinite sets, we may use · · · to list the elements:

S1 = {1, 2, 3, 4, · · · } = set of all positive integers,


S2 = {2, 4, 6, 8, · · · } = set of all positive even numbers,
S3 = {2, 3, 5, 7, 11, 13, · · · } = set of all prime numbers.

We often deal with sets which are impossible to define by listing its elements. It is more
common to define a set in {object : criteria}-form, such as:

p
Q= : p and q are integers and q 6= 0. .
q
2 Preliminaries

The left-hand side of the semi-colon : tells what kind, or what form of elements the set contains.
The right-hand side declares criteria and restrictions. In the above example, the form of
elements are fractions, and the requirements are that the denominator and numerator must be
integers, and the denominator
p cannot be zero. In short, Q is the set of all rational numbers. We
can say 12 2 Q but 2 62 Q.

i Some authors use | instead of semi-colon : when describing a set, such as



p
Q= p and q are integers and q 6= 0. .
q

The sets below have universal notations. We will use them often math courses:

Z = set of all integers


N = set of all positive numbers
Q = set of all rational numbers
R = set of all real numbers
C = {a + bi : a, b 2 R} = set of all complex numbers
(a, b) = {x 2 R : a < x < b}
[a, b) = {x 2 R : a  x < b}
(a, b] = {x 2 R : a < x  b}
[a, b] = {x 2 R : a  x  b}
; = the empty set

1.1.2 Set operations


For any two sets A and B, one can define the intersection A \ B, the union A [ B, and the
complement A\B (alternative notation: A B) as follows:

A \ B = {x : x 2 A and x 2 B}
A [ B = {x : x 2 A or x 2 B}
A\B = {x : x 2 A and x 62 B}

In words, the intersection A \ B is the set of common elements of A and B. The union A [ B is a
new set putting both elements of A and B together. The complement A\B is the set of elements
in A with elements in B removed. For example, if we let

A = {2n : n 2 N}
B = {3n : n 2 N}

then their intersection A \ B is the set of positive integers which are both multiples of 2 and 3.
In other words, A \ B is the set of positive multiples of 6, i.e.

A \ B = {6n : n 2 N}.

For the union A [ B and the complements A\B, B\A, we can describe them by listing some of
their elements:

A [ B = {2, 3, 4, 6, 8, 9, 10, 12, 14, 15, · · · }


A\B = {2, 4, 8, 10, 14, 16, 20, · · · }
B\A = {3, 9, 15, 21, · · · }

Clearly, N\A is the set of all positive odd numbers. A\N is the empty set ;.
1.1 Set Notations 3

Here are more examples of set operations:

R\Q = set of irrational numbers


[0, 3) \ ( 1, 2) = [0, 2)
[0, 3) [ ( 1, 2) = ( 1, 3)
[0, 3)\( 1, 2) = [2, 3)
( 1, 2)\[0, 3) = ( 1, 0)

⌅Exercise 1.1 Suppose U = {1, 2, 3}, S = {1, 3, 5}, and T = {2, 3, 4}. Find U [ S, S [ T , T [ U ,
U \ S, S \ T , and T \ U . How about (U [ S) [ T and U [ (S [ T )? Are they the same?

⌅ Exercise 1.2 Consider the interval sets (a, b) and (c, d), where a < b and c < d. Under what
conditions on a, b, c, d does the set (a, b) \ (c, d) become an empty set?

⌅ Exercise 1.3 Find an example of two sets A and B such that A\B and B\A are not equal.

⌅ Exercise 1.4 Which of the following sets is empty?


1. {x : x is an odd integer and x2 = 4}
2. {x : x is an even integer and x2 = 4}
3. {x : x is a real number and x + 8 = x}
4. {x : x is positive and x < 1}
5. {z : z is a complex number, z 6= 1, and z 3 1 = 0}

To get a better sense of these set operations, we often represent sets using Venn diagrams:

Figure 1.1: Venn diagrams

Given three sets A, B, and C, it is intuitively clear that (A [ B) [ C = A [ (B [ C), and


(A \ B) \ C = A \ (B \ C). Try to draw a Venn diagram to convince yourself on this! Therefore,
we may simply write A [ B [ C and A \ B \ C without the brackets.
4 Preliminaries

⌅ Exercise 1.5 Try to convince yourself using a Venn diagram that the following are true:

(A \ B) [ C = (A [ C) \ (B [ C)
(A [ B) \ C = (A \ C) [ (B \ C)

⌅ Exercise 1.6 Let A = {↵, , , }, B = { , , ✓, ⌘}, C = { , , ", ✓}. Write down:


(a) A \ B, A \ C, B \ C
(b) A [ B, A [ C, B [ C
(c) A \ B, B \ A, B \ C, C \ B, A \ C, C \ A

⌅ Exercise 1.7 Let R be the set of all real numbers. A = [1, 3] and B = [2, 4] be two closed
intervals. Write down:
(a) (R \ A) \ (R \ B)
(b) B [ A \ (R \ B)
(c) (R \ A) \ B [ (R \ B) \ A

Similar to summation signs, if we have sets A1 , A2 , · · · , An , we can denote


n
\
A1 \ A2 \ · · · \ An = Ai
i=1
[n
A1 [ A2 [ · · · [ An = Ai
i=1

For example,

10
[
(0, i) = (0, 1) [ (0, 2) [ · · · [ (0, 10) = (0, 10)
i=1
10
\
(0, i) = (0, 1) \ (0, 2) \ · · · \ (0, 10) = (0, 1)
i=1

We can even take the intersection or union of infinitely many sets. For example:

[1    
1 1 1 1
,1 = , 1 [ , 1 [ , 1 [ · · · = (0, 1].
n=2
n 2 3 4

Think about why 0 is not included?

⌅ Exercise 1.8 What is the following set?


1 ✓
\ ◆
1 1
,
n=1
n n

1.1.3 Subsets
If B contains A, or in other words, A is contained in B, we denote it by:

A⇢B

We say A is a subset of B. Formally speaking A ⇢ B means:

“If x 2 A, then x 2 B.”


1.1 Set Notations 5

For example:

N⇢Z⇢Q⇢R⇢C
(10, 20) ⇢ (9, 21)
{4n : n 2 Z} ⇢ {2n : n 2 Z}

Note that by our convention even if A = B, we can also write A ⇢ B (c.f. if a = b, it is not
wrong to write a  b). In fact, two sets being equal, i.e. A = B, means we have both A ⇢ B and
B ⇢ A.
⌅ Exercise 1.9 Consider A = {pn : n 2 Z} and B = {qn : n 2 Z} where p and q are non-zero
integers. Under what condition on p and q that we have A ⇢ B?

⌅ Exercise 1.10 Consider the interval sets (a, b) and (c, d) where a < b and c < d. Under what
condition on a, b, c, d that we have (a, b) ⇢ (c, d)?

⌅ Exercise 1.11 Let A = {1, 2, 3, 4, 5, 6}, B = {4, 5, 6, 7, 8, 9}, C = {2, 4, 6, 7}, D = {4, 5}, E =
{5, 6}, F = {4, 6}, and X a set which satisfies the following conditions:

X ⇢ A, X ⇢ B and X 6⇢ C.

Which could X possibly equal to among the sets A, B, C, D, E, F ?


6 Preliminaries

1.2 Logic and Proofs


Math is a subject that we need to ask “why”, not just “how”. You can’t study Math well if you just
follow examples or plug-in numbers into formulae blindly without knowing why there are such
formulae in the first place. In this section, we introduce basic logics which is the foundation of
Math.

1.2.1 “If” and “then”


Mathematics is not just about using formulae or applying theorems. Also, a formula or a theorem
may hold only under some conditions. For examples, the Pythagoreas’ Theorem said that if
ABC with a right angle \B, then AC 2 = AB 2 + BC 2 . As a math major, we shouldn’t just
learn the formula part or the result of a theorem, but also keep in mind under what conditions
we can use the theorem. We very often use “if . . . , then . . . ” to express the conditions and
consequences.
We say
“If (A), then (B)”
to mean that whenever (A) is true, (B) will also be true. For example:
• If the person is your mother, then the person is a woman.
• If your status is A0, then you have never dated anyone.
• If a > b and b > c, then a > c.
Symbolically, we write
(A) =) (B)

to mean “If (A), then (B)”. We call also say (A) implies (B).
However, given that “If (A), then (B)” holds, it does not tell whether “If (B), then (A)” holds.
Using the above examples, certainly it is NOT true that “If the person is a woman, the person is
your mother”. However, it is true that “if you have never dated anyone, then your status is A0”.
The phrase “(B) =) (A)” is called the converse of “(A) =) (B)”.
When both “(A) =) (B)” and “(B) =) (A)” hold, we can say

“(A) if and only if (B)”, or symbolically “(A) () (B)”.


The logical order when writing a proof is very crucial. When you want to prove (A) =) (B),
you should start with the given fact (A), derive from there, and finally conclude that (B) holds.
Do not start from (B) at the beginning and derive from there! It is a very common mistake made
by many beginning math majors (unfortunately some very weak Year 4 too).

⌅ Example 1.1 Prove that if x < 3 or x > 0, then (x + 1)2 + (x + 2)2 > 5.

⌅ Solution Here you are given the fact “x < 3 or x > 0”, and you need to show (x + 1)2 +
(x + 2) > 5. Do NOT start your proof by writing (x + 1)2 + (x + 2)2 > 5 and try to show
4

“x < 3 or x > 0”. It is completely illogical! Instead, you should start from:

x< 3 or x > 0.

There are two cases:


Case 1: if x < 3
x< 3 =) x + 1 < 2 =) (x + 1)2 > 4.
Moreover, we have
x< 3 =) x + 2 < 1 =) (x + 2)2 > 1.
These results imply that (x + 1)2 + (x + 2)2 > 4 + 1 = 5.
Case 2: if x > 0
x > 0 =) x + 1 > 1 =) (x + 1)2 > 1.
1.2 Logic and Proofs 7

Also,
x > 0 =) x + 2 > 2 =) (x + 2)2 > 4.
Therefore, in this case, we have (x + 1)2 + (x + 2)2 > 4 + 1 = 5
In both cases, we have (x + 1)2 + (x + 2)2 > 4 + 1 = 5. Therefore, we conclude that

(x < 3 or x > 0) =) (x + 1)2 + (x + 2)2 > 4 + 1 = 5.

⌅ Example 1.2 Prove that if (x + 1)2 + (x + 2)2 > 5, then x < 3 or x > 0.

⌅ Solution Now you are given that (x + 1)2 + (x + 2)2 > 5, and you need to show “x < 3 or
x > 0” holds. Again you should start your proof from the given condition:

(x + 1)2 + (x + 2)2 > 5


=) x2 + 2x + 1 + x2 + 4x + 4 > 5
=) 2x2 + 6x + 5 > 5
=) 2x2 + 6x > 0
=) x(x + 3) > 0.

When the product of two numbers is positive, either both numbers are positive, or both
numbers are negative. Therefore, we can deduce that

(x > 0 and x + 3 > 0) or (x < 0 and x + 3 < 0),

which implies
(x > 0 and x > 3) or (x < 0 and x < 3).
If both x > 0 and x > 3 hold, it simply mean x > 0. Similarly, “x < 0 and x < 3” simply
mean x < 3. Therefore, the above inequalities imply

x > 0 or x < 3,

as desired.

i The difference between the above two examples is that one asks “If (A), then (B)” whereas
the other asks “If (B), then (A)”. You could see that the solutions can be completely different!
The past HKCEE/HKALE curriculum emphasized a lot over these logical issues. If you
attempted to prove “If (A), then (B)” starting from writing down (B), and derive (A) at the
end, you would get zero mark for that question. It seems nowadays HKDSE is more tolerant
on that, and GCEAL/IB/AP are even more lenient.

⌅ Exercise 1.12 Prove each of the following:


(a) If x > 3, then (x 3)(x 2)(x 1) > 0.
(b) If (x 3)(x 2)(x 1) > 0, then x 2 (1, 2) [ (3, +1).

⌅ Exercise 1.13 In each blank below, put in one of the symbols (=, =) or ():
(a) I am a student in the Math department I am a student in the School of Science
(b) x(x + 1) > 0 x>0
(c) x2 > 1 x>1
(d) x3 > 1 x>1
(e) x2Z x2Q
8 Preliminaries

In secondary school, when we are asked to do a question like

“Solve x2 + 5x + 6 = 0.”

Most of us would simply start by writing:

x2 + 5x + 6 = 0
=) (x + 2)(x + 3) = 0
=) x + 2 = 0 or x + 3 = 0
=) x = 2 or x = 3

What have been concluded in the above argument is that “If x2 + 5x + 6 = 0, then x = 2 or
x = 3”. Rigorously speaking, it doesn’t mean “If x = 2 or x = 3, then x2 + 5x + 6 = 0”.
However, in this case every =) can actually be replaced by () as every step can be logically
reversed, so we indeed proved

x2 + 5x + 6 = 0 () x = 2 or x = 3.
p p p
However, if we consider the equation x+6+ x+1= 6x + 7, and we try to solve it as
follows, then some issue may arise:
p p p
x + 6 + x + 1 = 6x + 7
p p 2 p 2
=) x + 6 + x + 1 = 6x + 7
p
=) x + 6 + 2 (x + 6)(x + 1) + x + 1 = 6x + 7
p
=) (x + 6)(x + 1) = 2x

Taking the square on both sides again, we get (x+6)(x+1) = 4x2 . Solving
p the p
quadratic p
equation
we get x = 3 or 23 . However, if we put x = 23 into the equation x + 6 + x + 1 = 6x + 7,
we can easily find that it is not a solution. What was wrong?
The issue is that when we square both sides of the equation, this step cannot be reversed.
While it is true that f (x) = g(x) =) f (x)2 = g(x)2 , but it is NOT true that f (x)2 = g(x)2 =)
f (x) = g(x), as f (x) = g(x) is another possibility. What we can only conclude from the above
is that
p p p
“If x + 6 + x + 1 = 6x + 7, then x = 3 or x = 23 .”

It doesn’t draw any conclusion on whether the following holds:


p p p
“If x = 3 or x = 23 , then x + 6 + x + 1 = 6x + 7.”

Indeed, in the case x = 23 , the LHS is not the same as the RHS.
To summarize, when we solve an equation, it is crucial to check if every step can be reversed.
If not, we may need to verify whether they are solutions at all.

⌅ Exercise 1.14 What’s wrong with the following “proof”?

1=2
=) 1 ⇥ 2 = 2 ⇥ 2
=) 2 = 4
=) 2 3=4 3
=) 1=1
=) ( 1)2 = 12
=) 1 = 1.

Since 1 = 1 is true, so we conclude that 1 = 2.


1.2 Logic and Proofs 9

1.2.2 “For all” and “there exists”


In secondary school you have probably learned about equations versus identities. A equation like
2x + 3 = 1 is true for some specific values of x’s, whereas an identity like (x + y)2 ⌘ x2 + 2xy + y 2
holds for all values of x and y. The key difference between them is for some versus for all.
Mathematically, we may use the symbol 8 to mean “for all”. The synonyms of “for all” include
“for any”, “for each”, “for every”, etc. The following examples all have the same mathematical
meaning:
• For any integers m and n, m + n is also an integer.
• m + n is an integer for all m, n 2 Z.
• 8m, n 2 Z, m + n 2 Z.
For an identity like (x + y)2 ⌘ x2 + 2xy + y 2 can also be stated as

(x + y)2 = x2 + 2xy + y 2 , 8x, y 2 R.

The set R can be replaced by other sets such as Q or C depending on the context it appears.
Statements in the form of “for all x in set, x has certain property” can also be stated using “if
. . . then . . . ” language. Instead of saying “8m, n 2 Z, m + n 2 Z”, one can also say: “If m, n 2 Z,
then m + n 2 Z”.
We use the symbol 9 to mean “there exists”. For example, “9x 2 R such that 2x + 3 = 1”. It is
the same as saying “2x + 3 = 1 for some x 2 R”. In contrast to English grammar, we can still use
“for some x 2 R” even if there is one x 2 R (namely 1) so that 2x + 3 = 1 holds.

i There is a similar difference in the use of word “or” in Mathematics language and English
grammar. When we say “(A) or (B)” in math, it means that at least one of (A) and (B) holds,
and it includes the possibility that both (A) and (B) holds.

⌅ Exercise 1.15 Determine whether each statement below is true or false:


(a) For any x 2 R, we have x 2 Q.
(b) For any x 2 Q, we have x 2 R.
(c) For any x 2 R, there exists y 2 R such that x + y = 3.
(d) For any x 2 N, there exists y 2 N such that x + y = 3.
(e) For any x 2 N, there exists y 2 Z such that x + y = 3.

1.2.3 Negation
One typical logic operation in math is to determine the opposite of a statement. Being a math
major, you need to be logical enough to realize that the opposite of “Every HKUST student is A0”
is NOT “Every HKUST student is not A0”, but it should be “There is at least one HKUST student
who is not A0”. In math, we use the word negation to mean the opposite of a statement. We use
the symbol ⇠(A) to mean the negation of the statement (A).
In general, we have

⇠ (For any x 2 S, x has property (P)) = there exists x 2 S, x does not have property (P)
⇠ (there exists x 2 S, x has property (P)) = for any x 2 S, x does not have property (P)

Here are some examples:


statement negation
8n 2 N, n + 1 2 N. 9n 2 N such that n + 1 62 N.
8n 2 N and n 3, 9n 2 N and n 3, such that
9x, y, z 2 Z such that xn + y n = z n . 8x, y, z 2 Z, xn + y n 6= z n .
8✏ > 0, 9 > 0 9" > 0 such that 8 > 0,
such that 8x with |x a| < , there exists x with |x a| <
we have |f (x) f (a)| < ". such that |f (x) f (a)| ".

Recall that “If (A), then (B)” means whenever (A) holds, then (B) holds. The negation of it
will mean there is some situation that (A) holds, but (B) does not hold. For example:
10 Preliminaries

statement negation
If Person A is a HKUST student, There is at least one HKUST student who is not A0.
then Person A is A0.
If x < 3 then (x + 1)2 > 4 There exists x with x < 3 such that (x + 1)2  4.
If x > 0 and y > 0, then xy > 0 There exist x, y with x > 0 and y > 0
such that xy  0.

⌅ Exercise 1.16 Write down the negation of each statement below:


1. x > 3 or x < 1
2. x > 2 and x < 3
3. 8x 2 R, 9y 2 R such that x + y = 10.
4. If n is an integer with n N , then |an L| < "
5. 8" > 0, 9N > 0 such that if n is an integer with n N , then |an L| < ".
6. 8" > 0, 9N > 0 such that if m, n are integers with m, n N , then |am an | < ".
7. 8k 2 N, 9a, d 2 N such that a + jd is prime for any j 2 {0, 1, 2, · · · , k 1}.

1.2.4 Disproving a statement


When you are asked to disprove a statement, what you need to demonstrate is that the negation
of the statement holds.
For example, let’s say you want to disprove the following statement:

(*): “x3 + 2x 5 > 0 for any real number x.”

what you need to do is to show its negation, namely:

“x3 + 2x 5  0 for some real number x.”

You are NOT going to show that x3 + 2x 5  0 for all real number x, and it is not true either.
Therefore, you need to just tell us one example of real number a such that a3 + 2a 5  0 in
order to disprove (*). We often call this a to be a counter-example. Obviously,

(1)3 + 2(1) 5= 2  0,

so (*) already got disproved. Also you do not need to find ALL a 2 R such that a3 + 2a 5  0.
Just one counter-example is enough to disprove a statement.
Here is another example. We want to disprove:

“If x > y, then sin x > sin y.”

First think about what is the negation of the statement. It should be:

“There exist some x0 , y0 where x0 > y0 , but sin x0  sin y0 .”

One such an example is x0 = ⇡, y0 = 2.



We have ⇡ > 2,

but


| {z⇡}  sin 2 .
sin
=0 | {z }
=1

⌅ Exercise 1.17 Disprove each of the following statement:


• |x + y| = |x| + |y| for any x, y 2 R.
• 2n3 4n + 31 is a prime number for any n 2 N.
• If x > y, then |x| > |y|.
1.2 Logic and Proofs 11

1.2.5 Contrapositive
We have discussed before that “If (A), then (B)” is not the same as “If (B), then (A)”. However, “If
(A), then (B)” is in fact the same as “If ⇠ (B), then ⇠ (A)”. For example, it is true that
“If Typhoon Signal No. 8 is hoisted, then class is cancelled.”

That would be logically the same as saying


If the class is not cancelled, then it infers that Typhoon Signal No. 8 is not hoisted.”
“If not (B), then not (A)” is often called the contrapositive of the statement “If (A), then (B)”.

⌅Exercise 1.18 Each statement below is true. Write down their contrapositives and converses,
and determine whether they are true or false.
(a) If n is even, then n2 is even.
(b) If n is odd, then 2n is even.
(c) If p is an odd prime number, then p + 1 is not a prime number.

1.2.6 Proof by contradiction


The method of proof-by-contradiction is to prove a statement (P) by first assuming that the
statement (P) is false, then derive some absurd conclusions. It would force the statement to be
true.
An easy example is the pigenhole principle:

(P): Suppose there are 10 boxes and 11 balls. We put all these balls into the boxes
(randomly). Then, at least one of the boxes must contain two or more balls.

The statement sounds trivial but it is rather difficult to prove it directly. However, we can
easily prove it by contradiction: Assume the opposite is true: none of the boxes contain two or
more balls. Then, every box contains none or one ball. Since there are 10 boxes, it will conclude
that the number of balls is at most 10. It is a contradiction to the fact that there were 11 balls.
In conclusion, what we assumed is not true, and so at least one of the boxes contain two or more
balls.
Let’s look at a more mathematical example:
p
⌅ Example 1.3 Prove that 2 is irrational.

p
⌅ Solution Method 1 - using unique prime factorization: p
Assume on the contrary that 2 is
rational, then there exist positive integers m, n such that m
2= n , and so 2n2 = m2 . Write m
and n in terms of their unique prime factorizations:

m = 2i1 ⇥ 3i2 ⇥ · · · ⇥ piMM


n = 2j1 ⇥ 3j2 ⇥ · · · ⇥ pjNN

where pM is the largest prime dividing m, and pN is the largest prime dividing n, and
i1 , · · · , iM 0 and j1 , · · · , jN 0 are integers. Then, 2n2 = m2 implies

22j1 +1 ⇥ 32j2 ⇥ · · · ⇥ p2j


N
N
= 22i1 ⇥ 32i2 ⇥ · · · ⇥ p2i
M .
M

The index of 2 in the LHS is odd while that in the RHS is even.
p It is impossible by the unique
prime factorization theorem of integers. It concludes that 2 is irrational.
12 Preliminaries
p
Method 2 - without the use of unique prime factorization:pAssume on the contrary that 2 is
rational, then there exist positive integers m, n such that 2 = m n , and we can pick m and n
such that mn is in the simplest form, i.e. m and n have no common factor.
Then, we have 2n2 = m2 . This shows m2 is divisible by 2, and so is m (for a proof, see
exercise below). Write m = 2k for some integer k, then

2n2 = (2k)2 = 4k 2 =) n2 = 2k 2 .

This shows n2 is divisible by 2, and so is n.


Now both m and n is divisible by p 2, contradicting to our choice of m and n that they have
no common factor. It concludes that 2 is irrational.

⌅ Exercise 1.19 Prove that if m2 is even, then m is also even.

p
⌅ Exercise 1.20 Prove that p is irrational for any prime number p.

p
⌅ Exercise 1.21 Prove that 6 is irrational.

We can give a proof that the empty set ; is a subset of any other set. Recall that A ⇢ B means
for any x 2 A, we have x 2 B. The negation A 6⇢ B means that there exists x 2 A such that
x 62 B.
Now let S be an arbitrary set. We hope to prove by contradiction that ; ⇢ S. Suppose it is not
true, then there exists x 2 ; such that x 62 S. However, it is absurd since ; cannot contain any
element. Therefore, we must have ; ⇢ S.
1.3 Functions 13

1.3 Functions
1.3.1 What is a function?

A function can be regarded as a machine – you give it an input, then after processing it
according to a defined rule, the machine gives you an output. We often denote the input by a
variable x, and the output by f (x). For instance, we can write:

f (x) = x2 + 1

to represent the “machine” that takes the input x and output the value x2 + 1. As such, if we
input the value 2 into this function, it will output the value 22 + 1, or equivalently, 5. In short, we
may simply write:
f (2) = 5.
Likewise, it is easy to verify that f (1) = 2, f (0) = 1, etc.

1.3.2 Some terminology


1. The domain of a function f (x) meanspthe set of allowable inputs. For example, the function
defined by the expression f (x) = x has domain given by the [0, 1). The function
1
g(x) = has domain given by R\{1}.
1 x

i If every real number is an allowable input for a function f (x), then we can denote the
domain of f (x) by ( 1, 1), or simply R.

i Consider the function A(r) = ⇡r2 which is the area of a circle with radius r. Although
it is mathematically legitimate to input a negative r into A(r), a circle with negative
or zero radius is not physically meaningful. Therefore, we can take (0, 1) to be the
domain of A(r), instead of R.

i If D is the domain of a function f (x), then any (non-empty) subset E of D can also
taken to be the domain of f (x). When the domain of a function f (x) is not specified,
the domain is usually taken as the largest set in which f (x) is defined.
p
Take f (x) = x as an example. Since [0, 1) can be taken to be the domain of f (x),
we can also declare that its subset [1, 1)pto be the domain of f (x). However, without
any declaration, the domain of f (x) = x is taken to be [0, 1) by default.

2. The codomain of a function f (x) is the set where the outputs belong to. In this course, the
p 1
output of a function is usually a real number, as in the examples f (x) = x, g(x) =
1 x
and A(r) = ⇡r2 we have seen so far. We may simply say R, or ( 1, 1), is the codomain
of f (x), g(x) and A(r).

i The codomain of a function simply indicates what kind of objects the outputs are, but
it does not mean that everything in the codomain is a possible output.
Take the function h(x) = x2 + 1 as an example. Given any input x, the output x2 + 1
is always positive (in fact at least 1). However, it is perfectly fine to say that the
codomain of h is R.

3. A function f (x) with domain D and codomain C is usually denoted by:

f :D!C
14 Preliminaries

1
For example, we may indicate the domain and codomain of the function g(x) = by
1 x
writing:
g : R\{1} ! R
4. The range of a function f : D ! C is the set of all achievable outputs. It is usually denoted
by f (D) where D is the domain of f . In set notations, the range of f is usually defined by:

f (D) = {f (x) : x 2 D}

For example, the range of h : R ! R defined by h(x) = x2 + 1 is given by h(R) = [1, 1).

i However, if we declare the domain of h to be a smaller set such as [2, 3], then the
range of h will be smaller as it can only output values between 22 + 1 and 32 + 1.
Therefore, the range of h : [2, 3] ! R becomes [5, 10].

i There is no universal way to find the range of a given function, although it is easy
to do so in the above examples. One possible way to find the range is to look at the
graph of the function.

1.3.3 Graph of a function


The graph of a function is a geometric way of representing a function. It is a curve on the
xy-coordinate plane which looks like the one in Figure 1.2.

Figure 1.2: graph of function

To read off the value of f (1) from the graph, simply locate the point on the curve with 1 as
the x-coordinate, then the y-coordinate of that point will be the value f (1). Similar for f (2) and
all other values f (x).

⌅ Example 1.4 Find the (largest possible) domain of the function defined by the expression:
r
x2 x 2
f (x) =
x 3
By plotting the graph of f using computer softwares, estimate the range of f when the domain
is taken to be the largest possible.

⌅ Solution First we observe that x 3 is a divisor so we need to exclude 3 from the domain.
2
Then, in order for the square root to be meaningful, we need to ensure x x x3 2 is non-negative,
1.3 Functions 15

so we solve the inequality:


x2 x 2
0.
x 3
It is standard arithmetics that the quotient of two numbers is non-negative if and only if both
numbers have the same sign (both 0, or both  0). Therefore, we can solve the inequality
by dividing it into two cases:
Case 1: x > 3
In this case the denominator x 3 is positive, so we need to have x2 x 2 0.

x2 x 2 0
(x + 1)(x 2) 0

( (
x+1 0 x+10
or
x 2 0 x 20
( (
x 1 x 1
or
x 2 x2
x 2 or x 1

As x > 3 in this case, and (x > 3) and (x 2 or x  1) simply means x > 3, the solution in
this case is x > 3 .
Case 2: x < 3
In this case we need to have x2 x 2  0:

x2 x 20
(x + 1)(x 2)  0

( (
x+10 x+1 0
or
x 2 0 x 20
( (
x 1 x 1
or
x 2 x2
1x2

Since the interval [ 1, 2] lies within x < 3, the solution in this case is simply 1x2.
Overall, the domain of f is given by inequalities 1  x  2 or x > 3, i.e.

[ 1, 2] [ (3, 1).

-2 2 4 6 8 10
16 Preliminaries

From the graph of f , it suggests that the range of f should be in the form of [0, a] [ [b, 1).
Later in the course, we could use differentiation to determine the exact values of a and b. In
fact, the range of f can be shown to be [0, 1] [ [3, 1).

⌅ Exercise 1.22 In the following real functions, find the domain of each of them (always
referring to largest possible domain if not specified):
(a) f (x) = |x|
1
(b) f (x) =
x
x2 4
(c) f (x) =
r x 2
x2 1
(d) f (x) =
p x 2
(e) f (x) = p2 + x x2
(f) f (x) = sin x
1
(g) f (x) =
sin ⇡x

1.3.4 Well-definedness
When we define a function, it is important to keep in mind that:
Each input in the domain must have exactly one output.

It is the case for all examples we have seen so far. An expression with the property that every
input in the domain has exactly one output is said to be well-defined. The expressions below are
not well-defined and so they cannot be regarded as functions.
1. Let the domain be [0, 1). If we define the output f (x) to be a number y such that y 2 = x,
then such an f (x) is not well-defined. If we let the input to be 1, then f (1) is the number y
such that y 2 = 1. There are two possibilities, namely y = 1 or y = 1. Therefore, there are
two possible values for f (1), and so such an f is not well-defined and cannot be regarded
as a function.
2. Let the domain be Q, the set of all rational numbers. Given any input pq where p and q are
integers, we define ✓ ◆
p
f = p.
q
Given an input 12 , we have f ( 12 ) = 1, it seems that the output is simply 1. However, the
input 12 has many other forms, such as 24 that gives f ( 24 ) = 2 as output. The fractions 12
and 24 are regarded as the same input just expressed in two different ways. Now that this
input has at least two possible outputs, so f is not well-defined and cannot be regarded as
a function.
Given a curve on the xy-plane, one can determine whether or not it is the graph of a function
by so-called the vertical line test, i.e. a curve on the xy-plane is the graph of a function of x if
and only if no vertical line intersects the curve at more than one point (see Figures 1.3 and 1.4).

i Although each input of a function must have exactly one output, it is perfectly fine for a
function to give the same output for two or more different inputs. For instance, consider the
function g : R ! R defined by
g(x) = x2 + 1.
Evidently, we have both g(1) = 2 and g( 1) = 2. It is allowed.
1.3 Functions 17

Figure 1.3: pass the vertical line test, hence a graph of function

Figure 1.4: fail the vertical line test, hence not a graph of function

⌅ Exercise 1.23 Determine if each f (x) below is well-defined:


(a) f : R ! R, f (x) is a number y 2 R such that y 3 = x.
(b) f : {HKUST students} ! N, where f (x) is the student ID of the student x.
(c) f : {0, 1, 2, · · · , 9} ! {Hong Kong residences}, where f (n) is a Hong Kong residences
with HKID ending with number n.
(d) f : {Hong Kong residences} ! {0, 1, 2, · · · , 9, A}, where f (x) is the bracket digit of the
person x’s HKID.

1.3.5 Piecewise Defined Functions


Examples of functions we have seen so far are defined using a simple expression such as
f (x) = x2 + 1. However, in practice we sometimes define a function in a piecewise way, meaning
that the function can have different expressions on different part of the domain, such as
(
x2 + 1 if x < 0
f (x) = p
x if x 0
A classic example of piecewise-defined function is the absolute value function, defined piece-
wise by: (
x if x 0
|x| =
x if x < 0
18 Preliminaries

For example, we can easily see that |1| = 1 and | 3| = ( 3). In short, this function turns
any negative number to its positive counterpart, and preserve all non-negative numbers. The
graph of the absolute value function f (x) = |x| is shown in Figure 1.5.

Figure 1.5: graph of f (x) = |x|.

⌅ Example 1.5 Write down the function below in piecewise form:

f (x) = |x + 1| + |x 2| .

⌅ Solution As |x + 1| and |x 2| change their form near 1 and 2, we divide the real line into
three intervals:
( 1, 1), [ 1, 2), [2, +1).
When x 2 ( 1, 1), we have both x + 1 < 0 and x 2< 3 < 0, hence

|x + 1| + |x 2| = (x + 1) (x 2) = 2x + 1.

Similarly, when x 2 [ 1, 2), we have x + 1 0 and x 2 < 0, so

|x + 1| + |x 2| = x + 1 (x 2) = 3.

When x 2 [2, 1), both x + 1 0 and x 2 0, so

|x + 1| + |x 2| = x + 1 + x 2 = 2x 1.

To summarize, we have
8
>
< 2x + 1 if x 2 ( 1, 1)
f (x) = 3 if x 2 [ 1, 2) .
>
:
2x 1 if x 2 [2, +1)

⌅ Exercise 1.24 Sketch the graph of the piecewise defined function:


8
>
<x + 1 if x < 0
f (x) = x2 + 3 if 0  x < 1 .
>
:
x 1 if x 1

⌅ Exercise 1.25 Write down the following function in piecewise form without using any absolute
value:
2 3
f (x) = |x + 1| 2 |x + 1| 3 |x 2| .
Hence, sketch the graph of the function.
1.3 Functions 19

1.3.6 Various Types of Functions


Definition 1.1 — Odd and Even Functions. Let D be a subset of R which is symmetric about
zero. A function f : D ! R is said to be:
• an even function if f ( x) = f (x) for any x in D.
• an odd function if f ( x) = f (x) for any x in D.

The graph of an even function is reflexively symmetric about the y-axis. Important examples
include:
cos x, x2 , |x| , . . .

Figure 1.6: graph of an even function

The graph of an odd function is 180 -rotationally symmetric about the origin (see Figure
1.7). Important examples include:

sin x, tan x, x3 , ...

Figure 1.7: graph of an odd function

i There are many functions that are neither even nor odd. For example: f (x) = x3 + x2 . We
can check that:
f ( x) = ( x)3 + ( x)2 = x3 + x2
which is not f (x) or f (x).

⌅ Exercise 1.26 Show that if f : R ! R is both an even function and an odd function, then
f (x) = 0 for any x 2 R.
20 Preliminaries

⌅ Example 1.6 — Modified from HKALE Pure Math, Paper 2 Q5. For any function f : R ! R, we
define
1 1
F (x) = f (x) + f ( x) and G(x) = f (x) f ( x) .
2 2
(a) Show that F is an even function, and G is an odd function.
(b) Given that p(x), q(x) are both odd functions, and u(x), v(x) are both even functions such
that
p(x) + u(x) = q(x) + v(x) 8x 2 R.
Show that p(x) = q(x) and u(x) = v(x) for any x 2 R.
(c) Show that if f (x) = M (x) + N (x) for any x 2 R, where M is even and N is odd, then
M (x) = F (x) and N (x) = G(x) for any x 2 R.

⌅ Solution (a) To check that F is an even function, we consider:

1 1
F ( x) = f ( x) + f ( ( x)) = f ( x) + f (x) = F (x) 8x 2 R.
2 2
This shows F is even.
To show that G is an odd function, we consider:
1 1 1
G( x) = f ( x) f ( ( x)) = f ( x) f (x) = f (x) f ( x) = G(x)
2 2 2
for any x 2 R. This shows G is odd.
(b) Given that
p(x) + u(x) = q(x) + v(x) 8x 2 R,
this implies
p(x) q(x) = v(x) u(x) 8x 2 R.
Since p(x) and q(x) are odd functions, p(x) q(x) is an odd function too (proof left as an
exercise). Furthermore, v(x) and u(x) are even functions, so v(x) u(x) is an even function
too.
Now that p(x) q(x) and v(x) u(x) are the same function, and it is both odd and even,
so by Exercise 1.26, we conclude that p(x) q(x) = 0 for any x 2 R. This shows p(x) = q(x)
for any x 2 R. Also, v(x) u(x) = p(x) q(x) = 0 for any x 2 R, so we have u(x) = v(x) for
any x 2 R too.
(c) The key observation here is that:
1 1
F (x) + G(x) = f ( x) + f (x) + f (x) f ( x) = f (x) 8x 2 R.
2 2
Therefore, we have
F (x) + G(x) = M (x) + N (x) 8x 2 R.
From (a) and the given conditions, F and M are even, and G and N are odd. Therefore,
results from (b) show F (x) = M (x) and G(x) = N (x) for any x 2 R.

Definition 1.2 — Increasing and Decreasing Functions. Let I be an interval in the domain D of
a function f : D ! R.
• A function f is said to be strictly increasing on an interval I if

f (x1 ) < f (x2 ) whenever x1 < x2 in I.

• A function f is said to be strictly decreasing on the interval I if

f (x1 ) > f (x2 ) whenever x1 < x2 in I.


1.3 Functions 21

Figure 1.8: a function which is increasing on [a, b] and on [c, d], and is decreasing on [b, c]

i If a function f has a property that: f (x1 )  f (x2 ) whenever x1 < x2 , then we can say f is
monotonically increasing. Similar for the term monotonically decreasing.

It is quite obvious from the graph that f (x) = x2 is strictly increasing on [0, 1). For a formal
proof, we consider x1 , x2 2 [0, 1) and x1 < x2 , then

f (x2 ) f (x1 ) = x22 x21 = (x2 x1 )(x2 + x1 ).

Since x2 x1 > 0 (as x2 > x1 ), and x2 + x1 > 0 as 0  x1 < x2 (note x2 must be positive), we
have f (x2 ) f (x1 ) = (x2 x1 )(x2 + x1 ) > 0. This shows f (x2 ) > f (x1 ).

⌅ Exercise 1.27 Prove that f (x) = x3 is strictly increasing on R.

⌅ Exercise 1.28 Prove that if f : R ! R is an odd function, and f is strictly increasing on [0, 1),
then f is strictly increasing on R.

1.3.7 Function as a Map

A function f : D ! E can be regarded as a “map” that relates each element x in the domain
D with an element f (x) in the codomain E. Let f : D ! E and g : H ! K be two functions,
and assume that f (x) is in H for any x in D, then the expression g(f (x)) can be defined.
Definition 1.3 — Composite Functions. Let f : D ! E and g : H ! K be two functions such
that f (D) ⇢ H, then we denote:

(g f )(x) = g(f (x))

and it is called the composition of g by f , and is often pronounced as “g circle f ”. The


composition can be regarded as a new function g f : D ! K.
22 Preliminaries

⌅ Example 1.7 Let f (x) = x2 and g(x) = x + 1. Find g f and f g. Are they the same?

⌅ Solution

(g f )(x) = g(f (x))


= g(x2 )
= x2 + 1

(f g)(x) = f (g(x))
= f (x + 1)
= (x + 1)2
= x2 + 2x + 1

Clearly, g f 6= f g.

1.3.8 Injectivity
Definition 1.4 — Injective Functions. A function f : D ! C is said to be injective (or one-to-
one) if
a 6= b in D =) f (a) 6= f (b).
Equivalently:
f (a) = f (b) where a, b in D =) a = b

i European textbooks often use the term injective, whereas American textbooks often use
one-to-one.

Figure 1.9: An injective function f maps distinct inputs to distinct outputs, while g is not injective
since g(2) = g(3) = b.

Examples of injective functions:


1. f : R ! R defined by f (x) = 3x
2. f : R ! R defined by f (x) = x3
3. More generally, any function which is strictly increasing or strictly decreasing on its domain.
To prove that f (x) = x3 is injective, we consider let x, y 2 R such that f (x) = f (y). We need
to show x = y:

f (x) = f (y) =) x3 y 3 = 0 =) (x y)(x2 + xy + y 2 ) = 0,

and hence
✓ ◆2 !
1 3
(x y) x+ y + y2 = 0.
2 4
1.3 Functions 23

This shows Case (1): x = y; or Case (2):


✓ ◆2
1 3
x + y + y2 = 0
2 4

which implies x + 12 y = 0 and y = 0. By solving this equation, we get x = y = 0.


In both cases, we have x = y, and so f is injective.

⌅ Exercise 1.29 Prove that f (x) = x2m+1 where m 2 N is injective.

The function g : R ! R defined by g(x) = x2 + 1 is not injective, since 1 6= 1 (two distinct


inputs) but their outputs are the same g(1) = g( 1) = 2. However, it may be possible to make
g(x) = x2 + 1 injective by taking a smaller domain. If we declare the domain of g to be [0, 1),
then g : [0, 1) ! R with the same expression g(x) = x2 + 1 now becomes injective. More
examples are non-injective functions:
1. g : R ! R defined by g(x) = |x|
2. g : R ! R defined by g(x) = x2m , where m 2 N.
3. g : R ! R defined by g(x) = c, where c is a fixed constant.

i To argue that any of the above g’s is not injective, it suffices to find one pair of x, y 2 R
such that x 6= y and g(x) = g(y). For example, to argue that g(x) = |x| is not injective,
just explain it by saying g(1) = g( 1) = 1 but 1 6= 1. There is no need to start with the
equation g(x) = g(y) and find all possible distinct pairs x, y in R.

⌅ Exercise 1.30 “Any even function on R is not injective.” Do you agree with this statement?

Why or why not?

The horizontal line test can determine whether the function is injective: a function is
injective if and only if every horizontal line intersects its graph at no more than one point.

(a) f (x) = x3 is injective (b) a function which is not injective

⌅ Example 1.8 Let f : D ! E and g : H ! K be two functions so that g f : D ! K is


defined. Show that if both f and g are injective, then g f is also injective.

⌅ Solution To show g f is injective, we first suppose there is a pair of a, b in D such that

(g f )(a) = (g f )(b)

Then, we have:

g(f (a)) = g(f (b)) (definition of composition)


f (a) = f (b) (since g is injective)
a=b (since f is injective)
24 Preliminaries

Now we have shown that whenever (g f )(a) = (g f )(b), we must have a = b. Therefore
g f is injective.

1
⌅ Exercise 1.31 Let f (x) = . Find a domain D ⇢ R such that the composition f f is
1 x
defined. Show that f f is injective on D.

⌅ Exercise 1.32 Suppose S ⇢ D and consider the functions f : D ! E and g : S ! E such


that f (x) = g(x) for any x 2 S. Which of the following is/are always true?
1. g is injective =) f is injective.
2. f is injective =) g is injective.
3. g is not injective =) f is not injective.
4. f is not injective =) g is not injective.

1.3.9 Surjectivity
Another important terminology about functions is surjectivity. Recall that given a function
f : D ! C, we just require that each output f (x) is in the codomain C, but we do not require
every value in C is an achievable output. As an example, we consider again the function
g : R ! R defined by g(x) = x2 + 1. We cannot find any real number x such that g(x) = 1. On
the other hand, for the function h : R ! R defined by h(x) = x + 3, we do have the property that
every value in the codomain is attainable (for example, 0 = h( 1), 1 = h( 2), 2 = h( 1), and
generally, for any y 2 R, we have h(y 3) = y). A function whose every value in the codomain is
attainable is called:
Definition 1.5 — Surjective Functions. A function f : D ! C is said to be surjective (or onto) if
for any value y in the codomain C, there is at least one x in the domain D such that y = f (x).

Definition 1.6 — Bijective Functions. A function f : D ! C is said to be bijective if it is both


injective and surjective.

The above-mentioned function g : R ! R where g(x) = x2 + 1 is not surjective, while


h : R ! R where h(x) = x + 3 is surjective.
To prove that a function f : D ! E is surjective, we need to show for any arbitrarily given
y 2 E, there is at least one x 2 D such that f (x) = y. Let’s look at one example:

1
⌅ Example 1.9 Prove that f : R ! (0, 1] defined by f (x) = is surjective.
x2 + 1

1
⌅ Solution Given any y 2 (0, 1], we need to see whether 2+1
= y has a solution x 2 R. By
x
r
1
a simple equation-solving, we can easily see that x = ± 1 are solutions. Note that to
y
prove surjectivity, we only require r for each y 2 (0, 1] there is at least one
r solution x for the
1 1
equation f (x) = y. Let’s take x = 1, we need to verify that (1) 1 2 R; and (2)
✓r ◆ y y
1
f 1 = y.
y
1 1
For (1), we recall that y 2 (0, 1], so 0 < y  1 =) 1  =) 1 0. Therefore, it
y y
1.3 Functions 25
r r
1 1
makes sense to write 1, i.e. 1 2 R. For (2), we check by direct computations that
y y
✓ r ◆
1 1 1 1
f 1 = ✓r ◆2 = 1 = 1 = y.
y 1 y 1+1 y
1 +1
y
r
1
To summarize, we have demonstrated that for any y 2 (0, 1], there exists 1 2 R such
✓r ◆ y
1
that f 1 = y. In other words, f : R ! (0, 1] is surjective.
y

⌅ Example 1.10 — Modified from HKALE Pure Math 1986, Paper 1 Q4. Let X be a non-empty set,
and f : X ! X be a function such that f f = f . Show that if f is injective, then f (x) = x for
any x 2 X.

⌅ Solution Note that we are given that f is injective, but not being asked to show f is injective.
We are given that f f = f . That means f (f (x)) = f (x) for any x 2 X. Since f is injective,
so f (a) = f (b) =) a = b. Hence, for any x 2 X

f (f (x)) = f (x) =) f (x) = x,

as desired.

x
⌅ Exercise 1.33 Prove that f : R\{ 1, 1} defined by f (x) = is surjective.
x2 1

⌅ Exercise 1.34 The following functions are from R to R. Determine whether they are injective,
surjective or bijective.
(a) f (x) = 9x
(b) f (x) = 2x
8 +2 5
<x 1
, x 6= 1
(c) f (x) = x 1
:
1, x=1
(d) f (x) = x(x2 1)
(e) f (x) = x2 sin x
(f) f (x) = x3 + 1

⌅Exercise 1.35 Let X be a non-empty set, and f : X ! X be a function such that f f = f.


Show that if f is surjective, then f (x) = x for any x 2 X.

1.3.10 Inverse Functions


If f : D ! C is injective, it makes sense to talk about its inverse function, denoted by f 1
, that
reverses inputs and outputs of f . For example, if f is a function such that

f (1) = 5, f (3) = 7, f (8) = 10

then f 1
is a function such that:
1 1 1
f (5) = 1, f (7) = 3, f ( 10) = 8.

See Figure 1.11 for the illustration.


Exercise 1 .
33

Proue that f( x) =

,is surjectine f : R { -1 1 }
\ ,

R

tRktDmchthetflx
%
P 然 Kgt _

☆ ,雪 x


1 ± 4
y =

() =f

Considr 4
f
+
y ( 1
)

=

Considw () f

⼾灣 =

州⼚ ⼈繼州州
zylt y(
2
= =
— —

+
— —

H 1
y
2 y (
( 2
= =

)
- )

y Y
= =

灣 R{1
1 ±

ty ε R 雪x }

: =
ε
,
,

such that f(x = )

:
flx ) is
-
=
surjectiue -

x
26 Preliminaries

Figure 1.11: illustration of inverse function

Definition 1.7 — Inverse Function. Let f : D ! C be an injective function, then there exists an
inverse function f 1
: f (D) ! D which is defined by the rule:
1
f (y) = x () y = f (x)

for any y 2 f (D).

i It is crucial for f to be injective in order for f 1 to be well-defined. Otherwise, if a and b are


two distinct numbers in D such that f (a) = f (b) = c, then f 1 (c) would be both a and b
and so f 1 cannot be regarded as a function.

i The domain of f 1 is the range of f and is not necessarily the entire codomain of f . If y is
in the codomain C but not in range of f , then there is no x in D such that y = f (x) and so
f 1 (y) cannot be defined.

i Some textbooks require f to be bijective in order for f 1


to be defined.

Given an injective function f , to find the expression of f 1


, we may simply solve the equation
y = f (x) for x in terms of y. Here is an example:

⌅ Example 1.11 Show that f : ( 1, 1) ! R defined by


x
f (x) =
1+x
is injective. Hence, find the inverse function f 1
.

⌅ Solution Let a and b be two numbers in ( 1, 1) such that f (a) = f (b), then:

a b
=
1+a 1+b
a(1 + b) = b(1 + a) (cross-multiplication)
a + ab = b + ab
a=b (cancellation of ab)

Hence, f is injective.
1.3 Functions 27

To find f 1
, we first write down y = f (x) and then solve for x in terms of y:
x
y=
1+x
y(1 + x) = x
y + xy = x
y=x xy
y = x(1 y)
y
x=
1 y

Therefore,
1 y
f (y) = .
1 y

i After we learn some curve-sketching skills in later chapters, we can find out the range of
f is (1, 1), and hence (1, 1) is the domain of f 1 .

⌅ Exercise 1.36 Show that if f : R ! R is strictly increasing, then f 1


is also strictly increasing.

⌅ Exercise 1.37 The following functions f : R ! R are bijective. Write down the inverse
function f 1 of each of the following:
(a) f (x) = 6x + 4
(b) f (x) = x1013
(c) f (x) = x
8
<1, x 6= 0
(d) f (x) = x
:0, x=0

Composition of f and f 1

If f : D ! C is injective with range denoted by f (D), then f and f 1


have the following
relations:

f 1
(f (x)) = x for any x in D
f (f 1
(y)) = y for any y in f (D)

These relations can be restated using composition notations . First we introduce:


Definition 1.8 — Identity Function. The identity function with domain D is a function idD :
D ! D defined by:
idD (x) = x
for any x in D.

Since:
(f 1
f )(x) = f 1
(f (x)) = x for any x in D
Therefore, f 1
f is a function that maps every number x in D to itself. Therefore,

f 1
f = idD

Likewise, f f 1
= idE .
28 Preliminaries

Graph of f 1

Given the graph of an injective function f , to sketch the graph of f 1


, we may:
First rotate the graph y = f (x) counter-clockwise by 90 about the origin so the the y-axis
becomes horizontal. Then, flip the page so that the y-axis remains horizontal. The graph
x = f 1 (y) will appear on the backside of the page. It will produce a graph of f 1 with y as
the input variable, and x as the output variable, i.e x = f 1 (y).

Figure 1.12: graph of an inverse function

⌅ Example 1.12 — HKALE Pure Math 1992 Paper 1, Q6 (modified). Let f : R ! R be bijective,
and a1 < a2 < · · · < an , where n 2. Suppose f is strictly increasing on R. Show that
n
!
1 1X
a1 < f f (ak ) < an .
n
k=1

⌅ Solution (a) Given that a1 < a2 < · · · < an , and f is strictly increasing, we have

f (a1 ) < f (a2 ) < · · · < f (an ).

Therefore,
n
1X f (a1 ) + f (a2 ) + · · · + f (an ) f (an ) + f (an ) + · · · + f (an )
f (ak ) = < = f (an ).
n n n
k=1

Similarly, we have
n
1X f (a1 ) + f (a2 ) + · · · + f (an ) f (a1 ) + f (a1 ) + · · · + f (a1 )
f (ak ) = > = f (a1 ).
n n n
k=1

To summarize, we have
n
1X
f (a1 ) < f (ak ) < f (an ).
n
k=1
1.3 Functions 29

By Exercise 1.36, we have proved that f 1


: R ! R is also strictly increasing. Therefore,
n
!
1 1 1X
f f (a1 ) < f f (ak ) < f 1 f (an ) .
n
k=1

Note that f 1
(f (x)) = x for any x 2 R, so we conclude that
n
!
1 1X
a1 < f f (ak ) < an .
n
k=1

⌅ Exercise 1.38 Let f : R ! R be bijective, and a1 < a2 < · · · < an , where n 2. Suppose f is
strictly increasing on R.
(a) Define h(x) = 3f (x) + 2. Show that h : R ! R is bijective, and that
✓ ◆
x 2
h 1 (x) = f 1 .
3

(b) Deduce that ! !


n n
1 1X 1 1X
h h(ak ) =f f (ak ) .
n n
k=1 k=1

⌅ Exercise 1.39 Show that for any n 2, we have:


2 n 1
!
1 e1 + e1/2 + e1/2 + · · · e1/2
< ln < 1.
2n 1 n

1.3.11 Absolute-value
Recall that the absolute-value is defined as:
(
x if x 0
|x| = .
x if x < 0

For example, since 6 > 0, we have |6| = 6, whereas 2 < 0, so | 2| = ( 2) = 2. Essentially,


putting an absolute-value sign | | on a number is turning a negative number into its positive
counterpart.

⌅ Exercise 1.40 Let f : R ! [0, 1) be the function defined as

f (x) = |x| .

Is f injective? Is f surjective? Explain.

It is useful to keep in mind that


1. |xy| = |x| |y|;
x |x|
2. = ;
y |y|
3. | x| = |x|;
2
4. |x| = x2 ;
5. |x|  x  |x|;
6. |x + y|  |x| + |y|.
The first five properties can be proved by exhausting all possible cases. Take |xy| = |x| |y| as
an example, we can split into four different cases:
30 Preliminaries

x<0 x 0
y<0 xy > 0, hence |xy| = xy; xy  0, hence |xy| = xy
whereas |x| |y| = ( x)( y) = xy whereas |x| |y| = (x)( y) = xy
y 0 xy  0, hence |xy| = xy xy > 0, hence |xy| = xy
whereas |x| |y| = ( x)(y) = xy whereas |x| |y| = (x)(y) = xy

⌅ Exercise 1.41 Prove the properties (2)-(5).

However, beware that generally we only have |x + y|  |x| + |y|, and equality holds only
when x and y are of the same sign, i.e. when both 0, or both  0. This result is known as
the triangle inequality, as its higher dimensional version means the sum of any two sides of a
triangle is at least greater that length of the remaining side. Here is the proof:

2 2 2 2
|x + y| |x| + |y| = (x + y)2 |x| 2 |x| |y| |y|
= x2 + 2xy + y 2 x2 2 |x| |y| y2
= 2 xy |xy|  0.

Therefore, we get
2 2
|x + y|  (|x| + |y|) .
Since both |x + y| and |x| + |y| are non-negative, we conclude that

|x + y|  |x| + |y| .

Solving equations and inequalities involving absolute values


To solve an equation or an inequality such as |2x 1| = 3, or |4 x| 2, etc., it is useful to keep
in mind the two facts:
If a is non-negative, we have:
• |y| = 1 if and only if y = a or y = a.
• |y|  a if and only if a  y  a.
• |y| a if and only if y  a or y a.
If b is negative, we have:
• |y| = b is always false!
• |y|  b is always false!
• |y| b is always true!

⌅ Example 1.13 Solve 3x2 + 20x + 9 = 16.

⌅ Solution Recall that if |a| = 16, then there are two possibilities: a = 16 or a = 16.
Therefore, 3x2 + 20x + 9 = 16 implies

x2 + 20x + 9 = 16 or 3x2 + 20x + 9 = 16


2
3x + 20x 7=0 or 2
3x + 20x + 25 = 0
(3x 1)(x + 7) = 0 or (3x + 5)(x + 5) = 0
5 1
)x= 7, 5, ,
3 3
1.3 Functions 31

⌅ Example 1.14 Solve |x2 10x| < 24.

⌅ Solution Rewriting the inequality, 24 < x2 10x < 24

) 24 < x2 10x and x2 10x < 24


) x 2
10x + 24 > 0 and x 2
10x 24 < 0
) (x < 4 or x > 6) and ( 2 < x < 12)
) 2 < x < 4 and 6 < x < 12.

⌅ Example 1.15 Solve |2x 11| |x 3| 3.

⌅ Solution Consider 3 cases below:

Case I: If x < 3 ) 2x 11 < 0 < (x 3)


) (2x 11) + (x 3) 3
) x  5 ) all x < 3.
11
Case II: If 3  x < ) 2x 11 < 0  x 3
2
) (2x 11) (x 3) 3
11
)3x .
3
11
Case III: If x ) 2x 11 0, x 3 > 0
2
) (2x 11) (x 3) 3
)x 11.
11
Hence, x  or x 11.
3

⌅ Example 1.16 Determine the (largest possible) domain of the function:


p
f (x) = |3x + 1| 2

⌅ Solution Again, we need to take the square root, and so we need:

|3x + 1| 2 0
|3x + 1| 2

From the rules mentioned above, we get: 3x + 1  2 or 3x + 1 2, and so:


1
x 1 or x .
3
The domain of f is ( 1, 1] [ [ 13 , 1).
32 Preliminaries

⌅ Exercise 1.42 Solve the following equations:


(a) (3x 1)2 + |3x 1| 12 = 0
(b) 2(x + 4)2 3|x + 4| 14 = 0
(c) (7x 2)2 5|7x 2| 6 = 0
(d) |x 3| = |x2 9|

⌅ Exercise 1.43 Solve the following inequalities:


(a) (x + 2)2 8|x + 2| + 15 0
(b) |x(x + 5)| > 6
1.4 Mathematical Inductions 33

1.4 Mathematical Inductions


Remark: This section covers more advanced mathematical inductions than DSE M2. It will not be
covered in lectures. Students may read this chapter to enrich your knowledge about mathematical
inductions, which will be needed in other courses. Students who did DSE M1 should make up the
“M2-type” of mathematical inductions by studying, for instance, DSE M2 textbooks before reading
this section.
Mathematical induction is a technique of proof for statements P (n) with a variable n 2 N. By
showing that
• P (1) is true; and
• If P (n) is true for some n 2 N, then P (n + 1) is true;
we could conclude that P (n) is true for all n 2 N.

⌅ Example 1.17 Show that (cos ✓ + i sin ✓)n = cos(n✓) + i sin(n✓) for any n 2 N and ✓ 2 R.

⌅ Solution Let P (n) be the statement “(cos ✓ + i sin ✓)n = cos(n✓) + i sin(n✓) for any ✓ 2 R”.
Then, P (1) obviously holds.
Assume that P (n) is true for some n 2 N, i.e. for this n, we have:

(cos ✓ + i sin ✓)n = cos(n✓) + i sin(n✓) for any ✓ 2 R.

Now we consider P (n + 1). For any ✓ 2 R, we have:

(cos ✓ + i sin ✓)n+1


= (cos ✓ + i sin ✓)n (cos ✓ + i sin ✓)
= (cos n✓ + i sin n✓)(cos ✓ + i sin ✓) (induction assumption)
= (cos n✓ cos ✓ sin n✓ sin ✓) + i(cos n✓ sin ✓ + sin n✓ cos ✓)
= cos(n✓ + ✓) + i sin(n✓ + ✓) (compound angle formulae)
= cos((n + 1)✓) + i sin((n + 1)✓).

Therefore, P (n + 1) is also true.


By induction, we have proved P (n) is true for all n 2 N.

Mathematical induction can also be used to prove inequalities. Here is an example whose
technique is often used in the next chapter.

⌅ Example 1.18 Consider the sequence {x1 , x2 , · · · , } defined by:

x1 = 1
p
xn+1 = xn + 1 for any n 2 N

Prove that: 1  xn < xn+1 < 2 for any n 2 N.

⌅ Solution Let P (n) be the statement “1  xn < xn+1 < 2”. When n = 1, we compute that
p p
x2 = x1 + 1 = 2.

Obviously, we have
1  x1 < x2 < 2.
|{z} |{z}
p
=1 = 2

Therefore, P (1) is true.


Now suppose P (n) is true for some n 2 N, and consider P (n + 1), which we need to show
1  xn+1 < xn+2 < 2:
34 Preliminaries
p
Recall that xn+1 = xn + 1, and by induction assumption xn 1, this shows
p p
xn+1 = xn + 1 1 + 1 1.

To prove xn+1 < xn+2 , we consider


p p p p
xn+2 xn+1 = xn+1 + 1 xn + 1 > xn + 1 xn + 1 = 0.

Here we have used the assumption that xn+1 > xn . This shows xn+2 > xn+1 .
Finally, we argue using that the assumption xn+1 < 2 that:
p p
xn+2 = xn+1 + 1 < 2 + 1 < 2.

Combining all results proved, we have 1  xn+1 < xn+2 < 2, and so P (n + 1) holds.
By induction, we conclude that P (n) is true for all n 2 N.

⌅ Exercise 1.44 Prove by induction that n3 + 5n is divisible by 6 for any n 2 N.

⌅ Exercise 1.45 — Extracted from HKAL Pure Math 2008 Paper I Q9. Let {x1 , x2 , · · · } and
{y1 , y2 , · · · } be sequences defined by:

x1 = 2 y1 = 8
x2n yn + xn yn2 x2n + yn2
xn+1 = yn+1 = for any n 2 N
x2n + yn2 x n + yn

Prove that xn  yn , xn+1 xn , and yn+1  yn for any n 2 N.

1.4.1 Variances of mathematical inductions


There are some variations on the form of mathematical inductions. For example, if we are able to
prove:
• P (1) and P (2) are true; and
• P (n) is true =) P (n + 2) is true.
Then, we can still conclude P (n) is true for all n 2 N. Here is an example:

⌅ Example 1.19 Prove that for any n 2 N, there exist distinct integers x, y, z such that x2 + y 2 +
z 2 = 14n .

⌅ Solution We let P (n) be the statement “there exist distinct integers x, y, z such that x2 +
y + z 2 = 14n ”. Then P (1) is true because 12 + 22 + 32 = 141 , and P (2) is true because
2

42 + 62 + 122 = 142 .
Assume P (n) holds, then there exist distinct integers x0 , y0 , z0 such that

x20 + y02 + z02 = 14n .

Now consider P (n + 2), by noting that

(14x0 )2 + (14y0 )2 + (14z0 )2 = 142 (x20 + y02 + z02 ) = 142 · 14n = 14n+2 ,

and that {14x0 , 14y0 , 14z0 } are distinct integers too, we conclude that P (n + 2) holds.
By induction, we proved P (n) is true for all n 2 N.
1.4 Mathematical Inductions 35

⌅ Exercise 1.46 Prove that for any n 2 N, we have


p p
(1 + 5)n (1 5)n
p 2 N.
2n 5
[Hint: It may be necessary to think of a variant of the above variant.]

⌅ Exercise 1.47 — HKAL Pure Math 1997. Let {an } be a sequence of real numbers, where

1 1
a0 = 1, a1 = 6, a2 = 45, an an+1 + an+2 an+3 = 0 for all n 2 N [ {0}.
3 27
Prove that an = 3n (n2 + 1) for all n 2 N [ {0}.

Another important variant of mathematical inductions is to assume that P (1), · · · , P (n) are
true to show that P (n + 1) is true.

⌅ Example 1.20 Prove that every integer n 2 is a prime number or a product of prime
numbers.

⌅ Solution Let P (n) be the statement: “n is a prime number or a product of prime numbers”.
Note that we need to show P (n) is true for n 2, so we start with P (2). Obviously, 2 is itself a
prime, so P (2) holds.
Now assume P (2), P (3), · · · , P (n) all hold, and consider P (n + 1). There are two cases: If
n + 1 is itself a prime, then P (n + 1) holds. Otherwise, n + 1 will be a composite number, and
so can be written as n + 1 = km where k, m 2 N\{1}. We must have k, m < n since k, m > 1.
Since P (k) and P (m) are both true by induction assumption, both k and m are products of
prime numbers. This obviously implies n + 1 = km is also a product of prime numbers. Hence
P (n + 1) holds in both cases.
By induction, P (n) is true for any n 2 N\{1}.

⌅ Exercise 1.48 Prove that every integer n 6 can be written as the sum of 2’s and 5’s.

1.4.2 Backward induction


One variant of mathematical inductions is the backward induction (also known as forward-
backward induction). One proves:
1. P (n) is true for infinitely many n’s (such as when n = 2k for any k 2 N); and
2. P (n) is true for some n 2 implies P (n 1) is true
It will show P (n) is true for all n 2 N because for every n 2 N one can find some k 2 N such
that 2k 1 < n  2k . If P (2k ) is true, then by (2) we know P (2k 1) is also true. Similarly
P (2k 2), P (2k 3), · · · , P (2), P (1) (in particular P (n)) will be all true. One example of using
backward induction is the proof of AM-GM’s inequality (AM stands for Arithmetic Means, and
GM stands for Geometric Means):
Proposition 1.1 — AM-GM Inequality. For any finitely many non-negative numbers a1 , · · · , an ,
we have
p a1 + · · · + an
n
a1 · · · an 
| {z } | n
{z }
GM
AM

and equality holds if and only if a1 = · · · = an .

Proof. For any n 2 N, we let P (n) be the statement:


p a1 + · · · + an
“ n a1 · · · an  for any a1 , · · · , an 0, and equality holds if and
n
36 Preliminaries

only if a1 = · · · = an ”.

We first use standard induction to prove that P (2k ) is true for any k 2 N. When k = 1, then
2k = 2 and we consider an arbitrarily pair of numbers a1 , a2 0. By the fact that
✓ ◆2
a1 + a2 1
a1 a2 = (a1 a2 ) 2 0,
2 4

we conclude that
✓ ◆2
a1 + a2 a1 + a2 p
a1 a2 =) a1 a2 .
2 2
We have used the fact that a1 a2 0. Equality holds if and only if 14 (a1 a2 )2 = 0, which is
equivalent to a1 = a2 . This shows P (21 ) is true.
Now assume P (2k ) for some k 2 N, and we want to prove P (2k+1 ) is true. By P (2k ) being
true it means that we can apply AM-GM inequality on any 2k numbers. Now we consider any
arbitrary 2k+1 numbers a1 , · · · , a2k+1 0. The key idea is to group these 2k+1 numbers into two
groups, each of which consists of 2k many numbers:

a1 + · · · + a2k+1 = (a1 + · · · + a2k ) + (a2k +1 + · · · + a2k+1 ).

Since P (2k ) is true, we can apply the AM-GM inequality on these 2k many numbers a1 , · · · , a2k :
p
a 1 + · · · + a 2k 2k · 2k
a 1 · · · a 2k .

Similarly, a2k +1 , · · · , a2k+1 are also 2k many non-negative numbers, so we can apply the AM-GM
inequality on them:
p
a2k +1 + · · · + a2k+1 2k · 2k a2k +1 · · · a2k+1 .
Combining both results, we conclude that

a1 + · · · + a2k+1
2k+1
(a1 + · · · + a2k ) + (a2k +1 + · · · + a2k+1 )
=
2k+1
k p p
2 · 2 k
a1 · · · a2k + 2k · 2k a2k +1 · · · a2k+1
(since P (2k ) is true)
2k+1
p p
2 k a · · · a k + 2k a k
1 2 2 +1 · · · a2k+1
=
q 2
p p
2 k
a1 · · · a2k · 2k a2k +1 · · · a2k+1 (since P (2) is true)
p
= 2k+1 a1 · · · a2k a2k +1 · · · a2k+1 .

Equality holds if and only if the two inequalities above are equalities. This happens if and only if
p p
a1 = · · · = a2k , and a2k +1 = · · · = a2k+1 , and 2k
a 1 · · · a 2k = 2k a2k +1 · · · a2k+1 ,

which are equivalent to a1 = · · · = a2k = a2k +1 = · · · = a2k+1 . This proves P (2k+1 ) is true.
By induction, we conclude that P (2k ) is true for any k 2 N.

i One common confusion is why we can apply the induction assumption P (2k ) on the set
of numbers a2k +1 , · · · , a2k+1 , while the statement of P (2k ) is about a1 , · · · , a2k . Note that
P (2k ) being true as the AM-GM inequality holds for ANY a1 , · · · , a2k 0, not a fixed set of
{a1 , · · · , a2k }. After we assume P (2k ) is true, we can apply the AM-GM inequality on ANY
set of 2k non-negative numbers, not just on a1 , · · · , a2k but also on a2k +1 , · · · , a2k+1 . Try
to think about {a1 , · · · , an } in the statement of P (n) as merely labels of numbers. Compare
with the situation that if we assume f (x) 0 for any x 2 R, then it is still true that
f (x + 1) 0 for any x 2 R.
1.4 Mathematical Inductions 37

Next we assume P (n) is true for some n 2, and we want to prove that P (n 1) is true.
From the above remark, assuming P (n) is true means that the AM-GM inequality holds for ANY
set of n non-negative numbers.
To prove that P (n 1) is true, we take an arbitrary set of n 1 numbers x1 , · · · , xn 1 0.
The key trick here is to apply the AM-GM inequality on n numbers, namely:
x1 + · · · + xn 1
x 1 , · · · , xn 1, and .
n 1
As they are all non-negative, we can apply the AM-GM inequality on them since we assume P (n)
is true: r
x1 + · · · + xn 1 + x1 +···+x
n 1
n 1
n x1 + · · · + xn 1
x1 · · · xn 1 · ,
n n 1
which is equivalent to
✓ ◆ n1
x1 + · · · + xn 1 1 x1 + · · · + xn 1
(x1 · · · xn 1) n ,
n 1 n 1

and by rearrangement we have


x1 + · · · + xn 1 1
(x1 · · · xn 1) n 1 .
n 1
Equality holds if and only if the n numbers are equal:
x1 + · · · + xn 1
x1 = · · · = xn 1 = ,
n 1
which is just equivalent to x1 = · · · = xn 1 . This proves P (n 1) is true.
Now we have proved P (2k ) is true for all k 2 N, and P (n) is true implies P (n 1) is true. By
backward induction, we conclude that P (n) is true for all n 2 N. ⌅

⌅ Exercise 1.49 Given a function f : [a, b] ! R that satisfies:


✓ ◆
f (x1 ) + f (x2 ) x1 + x2
f 8x1 , x2 2 [a, b].
2 2

Show that ✓ ◆
f (x1 ) + · · · + f (xn ) x1 + · · · + xn
f 8x1 , · · · , xn 2 [a, b].
n n

⌅ Exercise 1.50 — Modified from HKAL Pure Math 1996. Prove that
✓ ◆m
a1 + · · · + an am m
1 + · · · + an

n n

for any a1 , · · · , an > 0 and any m 2 N.

You might also like