Mathematical Foundations of Computer Science Lecture Outline

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Mathematical Foundations of Computer Science

Lecture Outline
December 6, 2018

Functions
Let A and B be sets. A function from A to B is a relation, f , from A to B such that for all
a ∈ A there is exactly one b ∈ B such that (a, b) ∈ f . If (a, b) ∈ f , then we write b = f (a).
A function from A to B is also called a mapping from A to B and we write it as f : A → B.
The set A is called the domain of f and the set B the codomain. If a ∈ A then the element
b = f (a) is called the image of a under f . The range of f , denoted by Ran(f ) is the set

Ran(f ) = {b ∈ B | ∃a ∈ A such that b = f (a)}

Two functions are equal if they have the same domain, have the same codomain, and
map each element of the domain to the same element in the codomain.

Example. Let A and B be finite sets of size a and b, respectively. How many functions
are there from A to B?

Solution. The procedure of forming a function is as follows: in Step i choose the image
of the ith element in A. There are a steps and there are b ways to perform each step. Thus
the total number of ways to create a function from A to B is ba .

Let f : A → B be a function.

• f is said to be one-to-one or injective, iff for every x, y ∈ A such that x 6= y, f (x) 6=


f (y).

• f is called onto or surjective, iff for every element b ∈ B there is an element a ∈ A


with f (a) = b.

• f is a one-to-one correspondence or bijection, if it is both one-to-one and onto.

Example. Classify the following functions.

• f1 (x) = x2 from the set of integers to the set of integers.

• f2 (x) = x2 from the set of non-negative real numbers to the set of non-negative real
numbers.

• f3 (x) = x + 1 from the set of integers to the set of integers.

• f4 (x) = x from a set A to A. This function is called the identity function.


2 Lecture Outline December 6, 2018

Solution.

injective : f2 , f3 , f4
surjective : f2 , f3 , f4
bijective : f2 , f3 , f4

Inverse and Composition


Let f be a one-to-one correspondence from the set A to the set B. The inverse function
of f is the function that maps an element b ∈ B to the unique element a ∈ A such that
f (a) = b. The inverse function of f is denoted by f −1 . Hence f −1 (b) = a when f (a) = b.
Note that if f is not bijective then its inverse does not exist.
Let f : A → B and g : B → C be functions. The composition of the function g with f
is the function g ◦ f : A → C, defined by

(g ◦ f )(x) = g(f (x)), ∀x ∈ A

Example. Let g be the function from the set {a, b, c} to itself such that g(a) = b, g(b) = c,
and g(c) = a. Let f be the function from the set {a, b, c} to the set {1, 2, 3} such that
f (a) = 3, f (b) = 2, and f (c) = 1. What is the composition of f with g and what is the
composition of g with f ?

Solution. The composition function f ◦ g is as follows: (f ◦ g)(a) = f (g(a)) = f (b) = 2,


(f ◦ g)(b) = f (g(b)) = f (c) = 1, and (f ◦ g)(c) = f (g(c)) = f (a) = 3.
(g ◦ f ) is not defined as the range of f is not a subset of the domain of g.

Example. Let f and g be the functions from the set of integers to the set of integers
defined by f (x) = 2x + 3 and g(x) = 3x + 2. What is the composition of f and g? What
is the composition of g and f ?

Solution. (f ◦ g)(x) = f (g(x)) = 2(3x + 2) + 3 = 6x + 7. Similarly, (g ◦ f )(x) = g(f (x)) =


3(2x + 3) + 2 = 6x + 11. This example shows that commutative law does not apply to the
composition of functions.

Example. Let f : A → B and g : B → C be two functions. Then

i. if f and g are surjective then so is g ◦ f .

ii if f and g are injective then so is g ◦ f .

iii if f and g are bijective then so is g ◦ f .


December 6, 2018 Lecture Outline 3

Solution. Let c ∈ C. Since g is surjective there must be a b ∈ B such that g(b) = c.


Since f is surjective there must be a a ∈ A such that f (a) = b. Thus (g ◦ f )(a) = g(f (a)) =
g(b) = c. This proves that g ◦ f is surjective.
Let a, a0 ∈ A such that (g ◦ f )(a) = (g ◦ f )(a0 ). This means that g(f (a)) = g(f (a0 )).
Since g is injective we have f (a) = f (a0 ). Then since f is injective, we have a = a0 .
The bijectivity of (g ◦ f ) follows from the injectivity and surjectivity of (g ◦ f ).

The Probabilistic Method


The Ramsey number R(k, l) is the smallest number n such that any graph with n vertices
has clique of size k or an independent set of size l. Another way to formulate this is: in
any two-coloring on edges of the complete graph on n vertices, there is a monochromatic
clique of size k or a monochromatic clique of size l. Diagonal Ramsey Number asks for the
value of R(k, k) for any integer k. Finding a diagonal Ramsey number even for k = 6 is
very difficult. We want to find a lower bound on R(k, k).

k k
n
21−(2) < 1, then R(k, k) > n. In particular, R(k, k) > b2 2 c, for k ≥ 3.

Example. If k

Solution. Consider a complete graph G in which each edge is colored red or blue with a
probability of 1/2. Let S be a any subset of k vertices and E(S) be the set of edges with
both endpoints in S.
k
Pr[edges in E(S) are monochromatic] = 2 · 2−(2)
Since there are nk subsets of size k, the probability that some subset of size k is monochro-


matic is at most    
n −(k) n 1−(k)
2 2 2 = 2 2 (1)
k k
Since the last expression is less than 1 (given as a condition in the problem statement), there
is a 2-coloring of edges of a complete graph on n vertices in which there is no monochromatic
clique of size k. Thus R(k, k) > n.
If n = b2k/2 c then
2
! k
n 1−(k) nk 1− k(k−1) 2k /2 21+ 2
 
k2 k
2 2 ≤ ·2 2 ≤ 21− 2 + 2 =
k k! k! k!
Note that the last expression is less than 1, if k ≥ 3.

It can be shown that R(k, k) < 4k . These are the best known bounds on the size of R(k, k),
so a lot of progress is yet to be made. What is known is that R(2, 2) = 2, R(3, 3) = 6, and
R(4, 4) = 18. The values of R(k, k) are not known for k ≥ 5.

A fundamental question in graph coloring is: what is the relation between χ(G) and the
size of the largest clique? We state without proof that simply bounding the size of the
largest clique does not allow us to bound χ(G).
4 Lecture Outline December 6, 2018

Example. For any k ≥ 1, there exist triangle-free graphs (size of the largest clique is at
most 2) with chromatic number greater than k.

The girth of a graph G, g(G), is the length of the smallest cycle in G. In triangle-free
graphs, g(G) > 3. In 1954 B. Descartes constructively showed that triangle-free graphs can
have high chromatic number, but this construction was complicated and contained many
short cycles. In 1959, Paul Erdős used the probabilistic method to prove the existence of
graphs with arbitrarily high girth and chromatic number.

Example (Erdős 1959) For every g, k > 0, there exists a graph G with χ(G) ≥ k and
g(G) ≥ g.

You might also like