Professional Documents
Culture Documents
DisrMathLecture 3
DisrMathLecture 3
Lecture 3 - Functions
Askar Dzhumadil’daev
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then f is a function from A to B.
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then f is a function from A to B.
If g = {(1, x), (3, y)}, then
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then f is a function from A to B.
If g = {(1, x), (3, y)}, then g is not a function from A to B, because g
contains no ordered pair with first coordinate 2.
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then f is a function from A to B.
If g = {(1, x), (3, y)}, then g is not a function from A to B, because g
contains no ordered pair with first coordinate 2.
If h = {(1, x), (2, x), (3, y), (2, y)}, then
Definition(Function)
A function from a set A to a set B is a binary relation from A to B with the
property that, for every a 2 A, there is exactly one b 2 B such that
(a, b) 2 f .
Examples
Let A = {1, 2, 3} and B = {x, y}.
If f = {(1, x), (2, y), (3, x)}, then f is a function from A to B.
If g = {(1, x), (3, y)}, then g is not a function from A to B, because g
contains no ordered pair with first coordinate 2.
If h = {(1, x), (2, x), (3, y), (2, y)}, then h is not a function from A to B,
because 2 is the first coordinate of two ordered pairs.
Definition
Let f : A ! B be a function from A to B.
The domain of f , written D(f ), is the set A and the target of f is B.
The image of f , written Im(f ), is
Im(f ) = {b 2 B | b = f (a) for some a 2 A}.
Askar Dzhumadil’daev (Kazakh-BritishDiscrete
Technical
Mathematics
University) Lecture 3 - Functions July 23, 2020 3 / 31
Im(f ) = B
Definition (Onto)
Let f : A ! B. The function f is said to be onto (surjective) if and only if for
any b 2 B, there exists a 2 A such that f (a) = b.
In other words,
f is onto if and only if Im(f ) = B.
Definition (Onto)
Let f : A ! B. The function f is said to be onto (surjective) if and only if for
any b 2 B, there exists a 2 A such that f (a) = b.
In other words,
f is onto if and only if Im(f ) = B.
Examples
Let A = {1, 2, 3, 4} and B = {x, y, z}.
Suppose f (1) = x, f (2) = y, f (3) = z, f (4) = y.
Since Im(f ) = {x, y, z} = B, f is onto.
Definition (Onto)
Let f : A ! B. The function f is said to be onto (surjective) if and only if for
any b 2 B, there exists a 2 A such that f (a) = b.
In other words,
f is onto if and only if Im(f ) = B.
Examples
Let A = {1, 2, 3, 4} and B = {x, y, z}.
Suppose f (1) = x, f (2) = y, f (3) = z, f (4) = y.
Since Im(f ) = {x, y, z} = B, f is onto.
Suppose g(1) = z, g(2) = y, g(3) = y, g(4) = z.
Since Im(g) = {y, z} is a proper subset of B, g is not onto.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
$ b = 2(a 2) + 1 for some a 2 Z
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
$ b = 2(a 2) + 1 for some a 2 Z
and this occurs if and only if b is odd. Thus, the image of f is the set of
odd integers. Since Im(f ) 6= Z, f is not onto.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
$ b = 2(a 2) + 1 for some a 2 Z
and this occurs if and only if b is odd. Thus, the image of f is the set of
odd integers. Since Im(f ) 6= Z, f is not onto.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f onto?
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
$ b = 2(a 2) + 1 for some a 2 Z
and this occurs if and only if b is odd. Thus, the image of f is the set of
odd integers. Since Im(f ) 6= Z, f is not onto.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f onto? Recalling that the
graph of f (x) = x2 5x + 5, x 2 R, is a parabola with vertex ( 52 , 54 ),
clearly any integer less than 1 is not in the image of f.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
onto or not. To be onto, by the definition there should hold b 2 Im(f ) for
any b 2 Z.
b 2 Im(f ) $ b = 2a 3 for some a 2 Z
$ b = 2(a 2) + 1 for some a 2 Z
and this occurs if and only if b is odd. Thus, the image of f is the set of
odd integers. Since Im(f ) 6= Z, f is not onto.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f onto? Recalling that the
graph of f (x) = x2 5x + 5, x 2 R, is a parabola with vertex ( 52 , 54 ),
clearly any integer less than 1 is not in the image of f. Alternatively, it
is easy to see that 0 is not in the image of f because x2 5x + 5 = 0 has
no integer solutions (Why?). Hence f is not onto.
0
1
2
1 0.5 0 0.5 1
x
0
1
2
1 0.5 0 0.5 1
x
and we immediately see that f is onto.
Examples
Let A = {1, 2, 3} and B = {x, y, z}.
Suppose f (1) = x, f (2) = y, f (3) = z.
This function is 1-1 because f (1), f (2), and f (3) are all di↵erent: if
f (a1 ) = f (a2 ), then a1 = a2
Examples
Let A = {1, 2, 3} and B = {x, y, z}.
Suppose f (1) = x, f (2) = y, f (3) = z.
This function is 1-1 because f (1), f (2), and f (3) are all di↵erent: if
f (a1 ) = f (a2 ), then a1 = a2
Suppose g(1) = z, g(2) = y, g(3) = y.
Since g(2) = g(3) (= y) but 2 6= 3, f is not 1-1.
Askar Dzhumadil’daev (Kazakh-BritishDiscrete
Technical
Mathematics
University) Lecture 3 - Functions July 23, 2020 8 / 31
More examples
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21 5x1 + 5 = x22 5x2 + 5
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21 5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21
5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
$ (x1 x2 )(x1 + x2 ) = 5(x1 x2 )
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21
5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
$ (x1 x2 )(x1 + x2 ) = 5(x1 x2 ) $ (x1 x2 )(x1 + x2 5) = 0
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21
5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
$ (x1 x2 )(x1 + x2 ) = 5(x1 x2 ) $ (x1 x2 )(x1 + x2 5) = 0 $
x1 x2 = 0 or x1 + x2 5 = 0.
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21
5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
$ (x1 x2 )(x1 + x2 ) = 5(x1 x2 ) $ (x1 x2 )(x1 + x2 5) = 0 $
x1 x2 = 0 or x1 + x2 5 = 0.
For instance, x1 = 2, x2 = 3, we have f (2) = f (3).
Examples
Let f : Z ! Z be defined by f (x) = 2x 3. Let us determine whether f is
1-1 or not. To be 1-1, by the definition there should hold
f (x1 ) = f (x2 ) ! x1 = x2 .
f (x1 ) = f (x2 ) $ 2x1 3 = 2x2 3 ! x1 = x2
Hence f is 1-1.
Define f : Z ! Z by f (x) = x2 5x + 5. Is f 1-1?
f (x1 ) = f (x2 ) $ x21
5x1 + 5 = x22 5x2 + 5 $ x21 5x1 = x22 5x2
$ (x1 x2 )(x1 + x2 ) = 5(x1 x2 ) $ (x1 x2 )(x1 + x2 5) = 0 $
x1 x2 = 0 or x1 + x2 5 = 0.
For instance, x1 = 2, x2 = 3, we have f (2) = f (3). Then we conclude that
f is not 1-1.
Definition (bijective)
A function is called bijective if and only if it is both onto and 1-1.
◆A = {(a, a) | a 2 A}.
When there is no possibility of confusion about A, we will often write ◆, rather
than ◆A . (The Greek symbol ◆ is pronounced ”yota”, so that ”◆A ” is read
”yota sub A.”)
Example
The identity function on a set A is onto and 1-1, hence bijective.
Example
Let A = {1, 2, 3, 4} and B = {x, y, z, t}. Suppose
Examples
If f : R ! R is defined by f (x) = 2x 3, then f is 1-1 and onto, so an
inverse function exists. According to the last logical equivalence that was
obtained, if y = f 1 (x), then x = f (y) = 2y 3. Thus,
y = 12 (x + 3) = f 1 (x).
Examples
If f : R ! R is defined by f (x) = 2x 3, then f is 1-1 and onto, so an
inverse function exists. According to the last logical equivalence that was
obtained, if y = f 1 (x), then x = f (y) = 2y 3. Thus,
y = 12 (x + 3) = f 1 (x).
Let A = {x 2 R | x 0} and B = {x 2 R | x 0} and define f : A ! B by
f (x) = x2 . This is just the squaring function with domain restricted so
that it is 1-1 as well as onto. Since f is 1-1 and onto, it has an inverse. To
obtain f 1 (x), let y = f 1 (x), 2
p deduce that f (y) = x and so y = x.
Solvingp for y,1we get yp= ± x. Since x = f (y), y 2 A, so y 0. Thus,
y= x; f (x) = x.
Definition (Composition)
If f : A ! B and g : B ! C are functions, then the composition of f and g is
the function g f : A ! C defined by (g f )(a) = g(f (a)) for all a 2 A.
Examples
If A = {a, b, c}, B = {x, y} and C = {u, v, w}, and if f : A ! B and g : B ! C
are the functions
f = {(a, x), (b, y), (c, x)} and g = {(x, u), (y, w)},
then
f (x) = 2x 3, g(x) = x2 + 1,
then both g f and f g are defined and we have
(g f )(x) = g(f (x)) = g(2x 3) = (2x 3)2 + 1
and
(f g)(x) = f (g(x)) = f (x2 + 1) = 2(x2 + 1) 3.
Thus, even when both f g and g f are defined, it is unlikely that
f g = g f.
In the definition of g f, it is required that Im(f ) ✓ B. If f : R ! R and
g : R\{1} ! R are the functions defined by
x
f (x) = 2x 3 and g(x) = x 1,
Proposition
Composition of functions is an associative operation.
Proposition
Composition of functions is an associative operation.
as desired ⇤
Askar Dzhumadil’daev (Kazakh-BritishDiscrete
Technical
Mathematics
University) Lecture 3 - Functions July 23, 2020 18 / 31
Proposition
Functions f : A ! B and g : B ! A are inverses to each other if and only if
g f = ◆A and f g = ◆B ; that is, if and only if
g(f (a)) = a and f (g(b)) = b for all a 2 A and b 2 B.
Example
Let f : R ! (1, 1) and g : (1, 1) ! R defined
Example
Let f : R ! (1, 1) and g : (1, 1) ! R defined
Example
Let f : R ! (1, 1) and g : (1, 1) ! R defined
Example
Let f : R ! (1, 1) and g : (1, 1) ! R defined
Now we start talking about the size of a set or more correctly, its cardinality.
We will study how to compare sets and figure out whether a set is “smaller”
or “larger” than other set.
Now we start talking about the size of a set or more correctly, its cardinality.
We will study how to compare sets and figure out whether a set is “smaller”
or “larger” than other set.
Examples
|{a, b, x}| = 3
|{x 2 R | x2 + 1 = 0}| = 0
The cardinality of the English alphabet is 26.
How might we determine if two finite sets contain the same number of
elements? We could count the elements in each set, but if the sets were large,
this method would be slowly and highly unreliable.
How might we determine if two finite sets contain the same number of
elements? We could count the elements in each set, but if the sets were large,
this method would be slowly and highly unreliable.
Definition
Sets A and B have same cardinality and we write |A| = |B|, if and only if
there is a one-to-one correspondence between them; that is, if and only if there
exists a one-to-one onto function from A to B (or from B to A)
Examples
|{a, b}| = |{x, y}|.
|N| = |N [ {0}|.
|Z| = |2Z|.
R and the
set R+ of positive reals have
the same cardinality, for
the function R ! R+ defined
by f (x) = 2x establishes
a one-to-one correspondence.
The function
1
(0, 1) ! (1, 1) defined by f (x) = x
shows that (0, 1) and (1, 1)
are in one-to-one correspondence.
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality.
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
We claim that f establishes a one-to-one correspondence between (0, 1) and
(a, 1).
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
We claim that f establishes a one-to-one correspondence between (0, 1) and
(a, 1). This function is one-to-one because
1 1 1 1
f (x1 ) = f (x2 ) ! x1 1+a= x2 1+a! x1 = x2 ! x1 = x2 .
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
We claim that f establishes a one-to-one correspondence between (0, 1) and
(a, 1). This function is one-to-one because
1 1 1 1
f (x1 ) = f (x2 ) ! x1 1+a= x2 1+a! x1 = x2 ! x1 = x2 .
To show f is onto, we have to show that any y > a is f (x) for some x 2 (0, 1).
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
We claim that f establishes a one-to-one correspondence between (0, 1) and
(a, 1). This function is one-to-one because
1 1 1 1
f (x1 ) = f (x2 ) ! x1 1+a= x2 1+a! x1 = x2 ! x1 = x2 .
To show f is onto, we have to show that any y > a is f (x) for some x 2 (0, 1).
Now
1 1
y= x 1+a!x= y+1 a ,
Let a be any real number. We show that two sets (0, 1) and (a, 1) have the
same cardinality. Define f : (0, 1) ! (a, 1) by
1
f (x) = x 1 + a.
We claim that f establishes a one-to-one correspondence between (0, 1) and
(a, 1). This function is one-to-one because
1 1 1 1
f (x1 ) = f (x2 ) ! x1 1+a= x2 1+a! x1 = x2 ! x1 = x2 .
To show f is onto, we have to show that any y > a is f (x) for some x 2 (0, 1).
Now
1 1
y= x 1+a!x= y+1 a ,
5
1 0 2
x
5
1 0 2
x
As we see from the graph that it is a graph of a straight line passing through
the points ( 1, 5) and (2, 4). It is easy to understand that increasing straight
lines are onto and one-to-one. So its equation is f (x) = 3x 2 (Why?). Thus
f is a one-to-one correspondence between ( 1, 2) and ( 5, 4).
Hence |( 1, 2)| = |( 5, 4)|.
Askar Dzhumadil’daev (Kazakh-BritishDiscrete
Technical
Mathematics
University) Lecture 3 - Functions July 23, 2020 26 / 31
@0 “Aleph naught”
Definition (Countable)
A set A is countably infinite if and only if |A| = |N| and countable if and only
if it is either finite or countably infinite. A set that is not countable is
uncountable.
The symbol @0 (pronounced “aleph naught”) has traditionally been used to
denote the cardinality of the natural numbers. Thus, a countably infinite sets
has cardinality @0 . As the name suggests, countably infinte sets are those
whose elements can be listed in a systematic and definite way, because to list
them is to rank them as first, second, third, and so on, and this ranking
establishes the required one-to-one correspondence with N.
f: N ! Z
1 7 ! 0
2 7 ! 1
3 7 ! 1
4 7 ! 2
5 7 ! 2
6 7 ! 3
7 7 ! 3
··· ··· ···
f: N ! Z
1 7 ! 0
2 7 ! 1
3 7 ! 1
4 7 ! 2
5 7 ! 2
6 7 ! 3
7 7 ! 3
··· ··· ···
defined by ⇢ 1
f (n) = 2n if n is even
1
2 (n 1) if n is odd
which is certainly both one-to-one and onto.
f: N ! Z
1 7 ! 0
2 7 ! 1
3 7 ! 1
4 7 ! 2
5 7 ! 2
6 7 ! 3
7 7 ! 3
··· ··· ···
defined by ⇢ 1
f (n) = 2n if n is even
1
2 (n 1) if n is odd
which is certainly both one-to-one and onto.
One can also write it as f (n) = 14 (1 + ( 1)n (2n 1)) (Why?).
Askar Dzhumadil’daev (Kazakh-BritishDiscrete
Technical
Mathematics
University) Lecture 3 - Functions July 23, 2020 28 / 31
|N ⇥ N| = @0
Consider
the set N ⇥ N = {(a, b) | a, b 2 N}.
The elements of N ⇥ N can
be systematically listed by starting
at (1, 1) and following the arrows.