Relations and Functions
Relations and Functions
functions
Mathematics is a language. —Josiah
Willard Gibbs (1839–1903)
Relation
Let A and B be sets. A relation R from A to B is a subset
of A X B. Given an ordered pair (x, y) in A X B, x is
related to y by R, written x R y, if, and only if, (x, y) is
in R.
• The set A is called the domain of R and the set B is
called its co-domain.
• The notation for a relation R may be written
symbolically as follows:
x R y means that (x, y) R.
• The notation x R y means that x is not related to y by R:
x R y means that (x, y) R.
A relation as a Subset
1 a
b
2
c
3
d
Let X = {a, b, c} and Y = {1, 2, 3, 4}. Define a function f from X
to Y by the arrow diagram given below.
1. Write the domain and co-domain of f.
2. Find f (a), f (b), and f (c).
3. What is the range of f?
4. Is c an inverse image of 2? Is b an inverse image of 3?
5. Find the inverse images of 2, 4, and 1.
6. Represent f as a set of ordered pairs.
1
a 2
b 3
c 4
Theorem: Test for Function Equality
Does f = g?
x f ( x) ( x 2 x 1) mod 3 g ( x) ( x 2) 2 mod 3
0 1 mod 3=1 4 mod 3 =1
1 3 mod 3=0 9 mod 3 =0
2 7 mod 3=1 16 mod 3 =1
Yes, f=g
The Identity Function on a Set
1 1 1 (1) n
1, , , ,..., ,...
2 3 4 n 1
Send each integer n≥0, to
(1) n
f ( n)
n 1
A Function Defined on a Power Set
0
{}
1
{a}
2
{b}
3
{a, b}
.
.
.
Logarithms and Logarithmic Functions
of strings ( s, t ) S nS n
f : {0,1}n {0,1}
Consider the three-place Boolean function defined from the set of all 3-tuples of 0’s
and 1’s to {0, 1} as follows: For each triple (x1, x2, x3) of 0’s and 1’s,
f ( x1 , x2 , x3 ) ( x1 x2 x 3 ) mod 2
x1 x2 x3 ( x1 x 2 x3 ) mod 2
1 1 1 1
1 1 0 0
1 0 1 0
1 0 0 1
0 1 1 0
0 1 0 1
0 0 1 1
0 0 0 0
Checking Whether a Function Is Well Defined
H
1 a
a 2 b
1 aa
b 3 c
2 d
c
3
d
By definition of f, 4 x11 4 x2 1 .
4 x1 4 x2
x1 x2
If the function g: Z Z is defined by the rule g (n) n 2 , for
all n Z, then g is not one-to-one.
Counter example:
Then by definition of g,
g (n1 ) g (2) 2 2 4
g (n 2 ) g (2) (2) 2 4 and
1
a
2
b
3
c
4
d
5
Proof: Let y R.
[We must show that x in R such that f ( x) y .]
y 1
Let x
4
Then x is a real number since sums and quotients (other than by 0) of real
numbers are real numbers.
It follows that
y 1 y 1
f ( x) f 4 1 y
4 4
If the function h : Z Z is defined by the rule
h(n) = 4n-1 for each integer n, then h is not onto.
Counter example:
The co-domain of h is Z and 0 Z. But h(n) 0 for
any integer n.
For if h(n) = 0, then
4n = 1
n= ¼
¼ is not an integer. Hence there is no integer n for which
f (n) = 0, and thus f is not onto.