0% found this document useful (0 votes)
53 views14 pages

Functions

The document discusses functions and their properties. It defines partial and total functions, injections, surjections, and bijections. It also covers function composition, inverse functions, and proving properties of functions. Closure operators are introduced as functions that satisfy three properties: extensive, monotone, and idempotent. Closure can be defined in terms of operations on a set or by extending a set to satisfy a given property.

Uploaded by

Akash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views14 pages

Functions

The document discusses functions and their properties. It defines partial and total functions, injections, surjections, and bijections. It also covers function composition, inverse functions, and proving properties of functions. Closure operators are introduced as functions that satisfy three properties: extensive, monotone, and idempotent. Closure can be defined in terms of operations on a set or by extending a set to satisfy a given property.

Uploaded by

Akash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Functions as Relations

Definition
Let A, B be nonempty sets. A relation f ⊆ A × B is called a partial
function from A to B iff it satisfies the function condition

(a, b) ∈ f ∧ (a, c) ∈ f → b = c

I.e., f assigns every element a ∈ A at most one element in B.


Partial functions from A to B are denoted as f : A → B, and we write
f (a) = b instead of (a, b) ∈ f .
Functions are also called mappings or transformations.

Definition
A partial function f : A → B is called a total function iff every element
in A is assigned an element in B, i.e., ∀a ∈ A ∃b ∈ B (a, b) ∈ f .

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 37 / 70


Terminology about Functions

Let f : A → B be a function from A to B.


We say that f maps A to B.
A is called the domain of f .
B is called the codomain of f .
If f (a) = b then b is the image of a under f and a is the preimage
of b.
f (A) := {b ∈ B | ∃a ∈ A f (a) = b} is called the range of f .
(Note the difference between the range and the codomain.)
Two functions f : A → B and g : A0 → B 0 are equal iff A = A0 ,
B = B 0 and ∀a ∈ A f (a) = g(a).

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 38 / 70


Representing Functions

Functions can be specified in different ways:


Explicit statement of assignments, e.g., f (2) = 4, f (3) = 1,
f (4) = 17.
A formula, e.g., f (x) = 5x 2 − 3x + 12.
An algorithm/program, e.g., If x is odd and x > 17 then f (x) = 5
else if x is even then f (x) = x/2, otherwise f (x) = 3x.
General conditions on a function that have just one unique
solution.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 39 / 70


Injections, Surjections, Bijections

Definition
A function f : A → B is injective (“one-to-one”) iff f (a) = f (b) → a = b.
Then f is called an injection.

Definition
A function f : A → B is surjective (“onto”) iff ∀b ∈ B ∃a ∈ A f (a) = b.
Then f is called a surjection.

A function f : A → B is surjective iff f (A) = B, i.e., the range is equal to


the codomain.
Definition
A function f : A → B is bijective iff it is injective and surjective. Then f
is called a bijection or one-to-one correspondence.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 40 / 70


Reasoning about Injections, Surjections

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 41 / 70


Inverse Function
Definition
If f : A → B is a bijection then the inverse of f , denoted by f −1 is
defined as the function f −1 : B → A s.t. f −1 (b) = a iff f (a) = b.

If f is not a bijection then the inverse does not exist.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 42 / 70


Examples

Does the inverse of the following functions exist? Why (not)?


f : R → R, f (x) = x + 1
f : R → R, f (x) = x 2
f : N → N, f (x) = 2x
f : R → R, f (x) = 2x

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 43 / 70


Function Composition

Definition
Let f : A → B and g : B → C. The composition function f ◦ g is defined
by f ◦ g : A → C with f ◦ g(a) = f (g(a)).

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 44 / 70


Floor and Ceiling Functions

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 45 / 70


Proving Properties of Functions

Example: Prove that if x is a real number, then b2xc = bxc + bx + 1/2c.


Solution: Let x = n +  , where n is an integer and 0 ≤  < 1.
Case 1:  < 1/2.
2x = 2n + 2 and b2xc = 2n, since 0 ≤ 2 < 1.
bx + 1/2c = n, since x + 1/2 = n + (1/2 + ) and
0 ≤ 1/2 +  < 1. Hence, b2xc = 2n and
bxc + bx + 1/2c = n + n = 2n.
Case 2:  ≥ 1/2
2x = 2n + 2 = (2n + 1) + (2 − 1) and b2xc = 2n + 1,
since 0 ≤ 2 − 1 < 1.
bx + 1/2c = bn + (1/2 + )c = bn + 1 + ( − 1/2)c = n + 1
since 0 ≤  − 1/2 < 1. Hence, b2xc = 2n + 1 and
bxc + bx + 1/2c = n + (n + 1) = 2n + 1.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 46 / 70


Factorial Function
Definition
The factorial function f : N → N, denoted as f (n) = n! assigns to n the
product of the first n positive integers.

f (0) = 0! = 1
and
f (n) = n! = 1 · 2 · · · · · (n − 1) · n

Can be approximated by Stirling’s formula:


√  n n
g(n) = 2πn
e
We have approximately n! ∼ g(n) in the sense that
limn→∞ n!/g(n) = 1 and

2πnn+1/2 e−n ≤ n! ≤ e nn+1/2 e−n

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 47 / 70


Closure
Definition
A closure operator on a set S is a function C : 2S → 2S that satisfies
the following conditions for all X , Y ⊆ S.
Extensive: X ⊆ C(X )
Monotone: X ⊆ Y → C(X ) ⊆ C(Y )
Idempotent: C(C(X )) = C(X )

A set X is called closed under C iff X = C(X ).


Often closure operators are derived from (one or several) operations
on the elements of a set. E.g., the closure under addition is defined as

C(X ) := X ∪ {a1 + · · · + ak | a1 , . . . , ak ∈ X }

N is closed under addition, but not under subtraction. 3 − 7 = −4 ∈


/ N.
R is closed under multiplication, but not under division.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 48 / 70


Closure
Definition
A closure operator on a set S is a function C : 2S → 2S that satisfies
the following conditions for all X , Y ⊆ S.
Extensive: X ⊆ C(X )
Monotone: X ⊆ Y → C(X ) ⊆ C(Y )
Idempotent: C(C(X )) = C(X )

A set X is called closed under C iff X = C(X ).


Often closure operators are derived from (one or several) operations
on the elements of a set. E.g., the closure under addition is defined as

C(X ) := X ∪ {a1 + · · · + ak | a1 , . . . , ak ∈ X }

N is closed under addition, but not under subtraction. 3 − 7 = −4 ∈/ N.


R is closed under multiplication, but not under division. 1/0 ∈
/ R.

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 48 / 70


Closure (cont.)

Closure operators can also be defined by properties of sets.


Let P : 2S → {T, F} a property of sets.
Let C(X ) be the smallest set Y s.t. X ⊆ Y and P(Y ), i.e., the
smallest extension of X that satisfies property P.
This yields a closure operator only if such a smallest Y actually
exists.
Example: Binary relations R ⊆ S × S are subsets of S × S.
Define the transitive closure of relations C : 2S×S → 2S×S by

C(R) := The smallest transitive relation R 0 with R ⊆ R 0

The transitive closure of relations does exist, because the


intersection of T
transitive relations is transitive.
Thus C(R) := R⊆R 0 ,R 0 transitive R 0 .

Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapters 2 and 9 49 / 70

You might also like