You are on page 1of 10

Discrete Mathematics 1

Exercise 7

Functions

Definition: f is a function (map) from M to N if and only if (xM) (!yN) y=f(x).


The set M is called domain, while the set N codomain of the function f.
Definition: Let f:MN.
1. f is an injection iff (x,yM) (f(x)=f(y) x=y).
2. f is a surjection iff (yN)(xM) y=f(x).
3. f is a bijection iff f is an injection and f is a surjection.
Definition: 1M: MM is called identity function, and it is a bijection determined by
1M(x)=x, for xM.
Definition: Let f: MN be a bijection, then there is an inverse function
f-1:NM determined by f-1(y)=x f(x)=y.
Definition: Let f: XY, AX, BY,
1. f(A)={f(x)|xA}Y an image of the set A
2. f-1(B)={xX|f(x)B}X an inverse image of the set B
Definition: Let f: XY, where X,Y . The function is
1. increasing ( strictly increasing ) x,yX (x y f(x) f(y)
( x,yX (x < y f(x) < f(y) )
2. decreasing ( strictly decreasing ) x,yX (x y f(x) f(y)
( x,yX (x < y f(x) > f(y) )
Definition: Let f and g be two functons f: AB, g: BC. Composition of this two
function is the function gf: AC defined by gf (x)=g(f(x)).
Definition: A graph of the function f: AB is a subset of AB
f ={ (a,b) | aA, b B f(a)=b}.

Exercise 1: Which of the following is a function?


a) f: f(x)=x/2
b) f: f(x)= x/2
x, x Q
c) f: f(x)=
2
x x Q

Solution:

Discrete Mathematics 1

Exercise 7

a) is a function.
b) is not a function, since 1 can not be mapped by the given rule.
c) is not a function, because 2 can be mapped by both of the rules in different
images.

Exercise 2: Let A={1,2,3}, B={a,b,c,d}. Find one injection from A to B and one
surjection from B to A.

1
Solution: f: AB injection f :
c
a
g: BA surjection g :
3

2
a
b
2

d
c d
.
1 3

Exercise 3: Find the properties of the following functions:


a b c d

a) f: {a,b,c,d} {a,b,c} f :
a c c b
b) f: f(x)=2x+1
c) f: f(x)=2x+1
Solution:
a) f is not an injection, because c is an image of 2 elements. But it is a
surjection, because all elements of the codomain are images of some elements of
the domain.
b) Let f(x)=f(y) 2x+1=2y+1 x=y f is an injection.
There is no element of that is mapped to 2 , therefore f is not a surjection.
c) Let f(x)=f(y) 2x+1=2y+1 x=y f is an injection.
Let y , then (y-1)/2 , f((y-1)/2)=y f is a surjection.

Exercise 4: Find the properties and compositions of the given functions. Then find
the compositions properties.
a) f:
b) f:
c) f:
d) f:

f(x)=3x-1
f(x)=x2
f(x)=2x
f(x)=5x

g:
g:
g:
g: +

g(x)=[x]
g(x)=(-1)x x
g(x)=x-1
g(x)= x2

Solution:
a) Let f(x)=f(y) 3x-1=3y-1 x=y f is an injection.
Let y , then (y+1)/3 , and f((y+1)/3)=y f is a surjection.
g(1)=1=g(1.1), so it follows that g is not an injection.
Let y , then [y]=y , and g(y)=y g is a surjection.

Discrete Mathematics 1

Exercise 7

gf:
gf(x)=[3x-1]
gf(1)=[3-1]=2=[3.3-1]=g(1.1), so it follows that gf is not an injection.
Let y , then [y]=y and (y+1)/3 , so gf((y+1)/3)=[y]=y g is a surjection.
The composition f could not be defined because the codomain of g differs from
the domain of f.
b) Let f(x)=f(y) x2=y2 and because x and y are natural numbers it follows
that x=y f is an injection.
2 is not an image of any number f is not a surjection.
Let g(x)=g(y) (-1)x x =(-1)y y=a. a is either positive or negative. If it is
positive, then x and y are even numbers, so (-1)x x =x and (-1)y y=y from which it
follows that x=y.
If is negative, then x and y are odd numbers, so (-1)x x =-x and (-1)yy= -y
from which it follows that x=y. From both arguments it follows that g is an injection.
1 is not an image of any number g is not a surjection.
gf:

gf(x)= (1) x x2
2

Let gf(x)=gf(y) (1) x x2 = (1) y y2=a. a is either positive or negative. If it


2

is positive, then x2 and y2 are even numbers, i.e. x and y are even numbers, so (1) x

x2=x2 and (1) y y2=y2 from which it follows that x2=y2. Since x and y are natural
numbers, it follows that x=y.
2

If is negative, then x2 and y2 are odd numbers, so (1) x x2=-x2 and (1) y
y2=-y2 and because the numbers are natural, it follows that x=y. From both
arguments it follows that gf is an injection.
1 is not an image of any number gf is not a surjection.
2

As it was the case in ), the composition f could not be defined because the
codomain of g differs from the domain of f.
c) Let f(x)=f(y) 2x=2y x=y f is an injection.
Let y , then y/2 , and f(y/2)=y f is a surjection.
Let g(x)=g(y) x-1=y-1 x=y g is an injection.
Let y , then y+1 , and g(y+1)=y g is a surjection.
gf: gf(x)= 2x-1
Let gf(x)=gf(y) 2x-1=2y-1 x=y gf is an injection.
Let y , then (y+1)/2 , and g((y+1)/2)=y gf is a surjection.
The composition f can be defined. ( homework )

Discrete Mathematics 1

Exercise 7

d) Let f(x)=f(y) 5x=5y x=y f is an injection.


Let y , then y/5 , and f(y/5)=y f is a surjection.
Let us assume that g(1)=g(-1) g is not an injection.
Let y +, then y , and g( y )=y g is a surjection.
gf: + gf(x)= 25x2
Let us assume that gf(1)=gf(-1) gf is not an injection.
Let y +, then

y /5 , and g( y /5)=y g is a surjection.

The composition f could not be defined.


Property: Let f: AB and g: BC. Prove that:
) If gf is an injection, then f is an injection.
b) If gf is a surjection, then g is a surjection.

Exercise 5: Let A={1,2,3,4}, B={a,b,c}, C={x,y,z,w,r}.

1 2 3 4

f:AB f :
a b b a
1 2 3 4

h: AC h :
y z w x
If possible, find a function g: BC, such that h=gf.
Solution:
It is not possible, because if there is such g: BC, then f must be an injection (since
h is an injection), but f is not an injection.

a b c
. Find a
Exercise 6: Let A={a,b,c}, B={a,b,c,d} and f:AB is defined by f :
a d b
function g: BA, such that gf=1A.
Solution:

a b c d
. (It is possible because f is an injection).
g: BA , g :
a c c b

Exercise 7: Let f: , defined by f(x)= +1.


2

Find a function g: , such that gf=1R .

Discrete Mathematics 1

Exercise 7

Solution:
g: , g(x)=2(x-1). ( This is possible because f is an injection ).

1 2 3 4
.
Exercise 8: Let A={1, 2, 3, 4}, B={1, 2, 3} and g: AB is defined by g :
1 1 2 3
Find a function f: BA, such that gf=1B.
1 2 3
. ( This is possible because g is a surjection ).
Solution: f: BA , f :
1 3 4
Exercise 9: Let g: + be defined by g(x)=x2. Find a function f: + , such that
gf=1R+.
Solution:
f: + , f(x)= x . ( This is possible because g is a surjection ).

Exercise 10: Let f: be defined by f(x)=x2+3. Find:


f({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) f-1({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).
Solution:
f({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) ={f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), f(9), f(10)}={4, 7,
12, 19, 28, 39, 52, 67, 84, 103}.
0 is mapped to 3, 1 to 4, 2 to 7, and the remaining are mapped in numbers greater
then 10. So, it follows that f-1({1, 2, 3, 4, 5, 6, 7, 8, 9, 10})={0,1,2}.

Exercise 11: Let f:XY be a given function. Prove that:


) AB f(A)f(B), A,BX
b) AB f-1(A)f-1(B), A,BY
Solution:
) Let ABX. Let xf(A). Then (a), x=f(a).
From AB it follows that aB and x=f(a) i.e. xf(B). From this we conclude that
f(A)f(B).
b) Let ABY. Let xf-1(A). So f(x). From AB we have that f(x)B i.e. xf-1(B).
Thus, f-1(A)f-1(B).

Discrete Mathematics 1

Exercise 7

Exercise 12: Give examples for a function f: XY and sets A, BX, such that f(AB)
f(A)f(B).
Solution:

1 2 3
. Then f(AB)={b}, and
Let X={1, 2, 3}, Y={a, b}, A={1, 2}, B={2, 3} f :
a b a
f(A)f(B)={a, b}{a, b}={a, b} and they are different.

Exercise 13: Let f: XY be a function and A,BX. Prove that:


) If f is an injection, then f(AB) = f(A)f(B),
b) If f is an injection, then AB f(A)f(B).
Solution:
) Let f be an injection. f(AB)f(A)f(B) (* prove) applies to all functions. It remains
to be proved: if f is an injection, then the reverse is true, i.e. f(A)f(B) f(AB).
Let xf(A)f(B). Then xf(A) and xf(B) from which it follows that
(a) x=f(a) (3) (bB) x=f(b) (4)
From (3) and (4) we conclude that f(a)=f(b)=x.
If f is an injection, then a=b. a=bAB and x=f(a) xf(AB), from which we have
f(A)f(B)f(AB) (**).
From (*) and (**) it follows that f(AB) = f(A)f(B).
b) Let f be an injection and let AB. So, it means that AB and (bB) bA. From
AB it follows that f(A)f(B). It remains to prove that f(A)f(B). From bB we
conclude that f(b)f(B). If f(b)f() it would follow that () f(b)=f(a). From the
fact that f is an injection we have b=aA, which is a contradiction to bA. It means
that f(b)f(), i.e. f(A)f(B).

Exercise 14: Prove that for each function f: XY and sets A, BX it holds that f(AB)
= f(A)f(B).
Solution:
Let y f(AB). This means that there is x AB, such that f(x)=y. Hence, there is an
element x, such that xA or xB, and f(x)=y i.e. there is xA, such that f(x)=y or
there is xB, such that f(x)=y xf(A) xf(B) x f(A)f(B).

Exercise 15: Let f: XY be a given function and AX, BY. Prove that:
) Af-1(f(A)),
b) f(f-1(B))B,
c) f(A)B iff Af-1(B).

Discrete Mathematics 1

Exercise 7

Solution:
) Let aA. It is obvious that f(a)f(A), from which it follows that f-1(f(A)), i.e.
Af-1(f(A)).
b) If yf(f-1(B)), then y=f(x), f(x)B i.e. yB. Hence f(f-1(B))B.
c) : Let Af-1(B). Then f(A)f(f-1(B)) and from f(f-1(B))B it follows that f(A)B.
: Let f(A)B. Then f-1(f(A))f-1(B) and from Af-1(f(A)) it follows that Af-1(B).
So f(A)B Af-1(B).
Exercise 16: Find the domain and codomain of the functions () = 2 , () =
( )2 , h(x) = |x| and find their properties. Find their compositions ( if possible ).
Answer:
f: + {0} , is not an injection, it is a surjection.
g: + {0} + {0} , is an injection and surjection ( so it is a bijection ).
h: + {0} is not an injection, it is a surjection.
g : + {0} g () = (()) = ( 2 ) = ( 2 )2 ,
g : + {0} g () = (()) = (||) = (|| )2 = ||

Exercise 17: Prove that: f: X Y is an injection iff for any set A and any functions g1
,g2: AX it is true that fg1=fg2 g1=g2.
Solution:
: Let f: XY be an injection and let be any set such that:
g1,g2: AX, fg1=fg2.
Let x . From fg1=fg2 it follows that fg1(x)=fg2(x) i.e. f(g1(x))=f(g2(x)) so from the
fact that f is an injection it follows that g1(x)=g2(x). Since xA is an arbitrary element,
it follows that g1=g2.
: Let it hold fg1=fg2 g1=g2, for any set A and for any functions g1 ,g2:AX
Let us assume that f is not an injection. This means that (x1,x2 X) i.e. x1 x2, but
f(x1)=f(x2)=y. Let us define =, g1: AX with g1(a)= x1, g2: AX with g2(a)= x2
then:
fg1(a)=f(g1(a))=f(x1)=f(x2)=f(g2(a))=fg2(a),
so fg1= fg2, a g1 g2, which is a contradiction.Thus, f is an injection.

Discrete Mathematics 1

Exercise 7

Exercise 18: Prove that: f: XY is a surjection iff for each set A and functions g1
,g2:YA it is true that g1f=g2f g1=g2.
Solution:
: Let f: XY be a surjection and let be a random set such that:
g1,g2: AX, g1f=g2f.
Let y Y. From the fact that f is a surjection, (xX), such that y=f(x). Then
g1(y)=g1(f(x))= g1f(x)=g2f(x)=g2(f(x))=g2(y).
From the randomness of yY follows that g1=g2.
: For a given set A and functions g1 ,g2: AX let
fg1=fg2 g1=g2.
Let us assume that f is not a surjection. It means that (y Y) such that (xX)
yf(x), i.e. (y Y) yf(X). We define =1, a2
g1: YA with g1(y)= a1 , (yY)
a1 y f ( X )
g2: YA with g 2 ( y )
a 2 y f ( X )
then:
g1f(x)=g1(f(x))=a1=g2(f(x))=g2f(x),
so g1f= g2f, a g1 g2, which is a
contradiction, from which it follows that f is a surjection.

Exercise 19. Let the function f: MN, with M={1,2,3,4,5,6}, N={a,b,c,d,e,g}, be


1 2 3 4 5 6
.
defined by f :
a b b e d c
a) Find whether f is an injection, a surjection, or a bijection;
b) Is there an inverse function f -1?;
c) If A={2,3,4}, B={a,b,g}, find f(A) and f -1(B).
Solution:
a) f is an injection iff (x,yM)(f(x)=f(y)x=y) or the equivalent condition
(x,yM)(xyf(x)f(y)), i.e. there is no two different elements with the same
image. This means that f is an injection iff in the bottom row of the definition of f, all
the elements are different, i.e. there is no element appearing twice or more. But as
we can see b appears twice. So, f(2)=f(3)=b, 23, from which it follows that f is not
an injection.
f is a surjection iff (yN)(xM) f(x)=y. It means that f is a surjection iff each
element of the codomain N appears in the bottom row of the definition of f. We can
see that g does not appear in the bottom row, i.e. (xM) f(x)g.

Discrete Mathematics 1

Exercise 7

f is a bijection iff f is an injection and f is a surjection. So, f is not a bijection.


b) The inverse function f -1:NM exists iff f is a bijection. In that case f -1 is defined
with the following: f -1(y)=xf(x)=y.
c) f(A) contains the images of the elements in A mapped by the function f, i.e.
f(A)={f(x)|xA}={f(2), f(3), f(4)}={b,e}.
f -1 (B) contains the elements of which are mapped with f to an element of B, i.e.
f -1(B)={xM|f(x)B}. f(1)=a, f(2)=f(3)=b and there is no element which is mapped in
g. Therefore, f -1(B)={1,2,3}.
Note: f -1(B) and f -1 are two different things. f -1(B) is an inverse image of the set and
always exists, while f -1 is an inverse function, which exists only if f is a bijection.
Exercise 20. Let f: MN, where M={1,2,3,4,5,6}, N={a,b,c,d,e,g} be given with
1 2 3 4 5 6
. Find f -1, if it exists.
f :
g
a
b
e
d
c

Solution:
According to the explanation in ) in the previous exercise, we conclude that f is an
injection and a surjection, which means that it is a bijection. From this conclusion it
follows that there is an inverse function f -1: NM. Let us find it:
f(1)=gf -1(g)=1
f(4)=ef -1(e)=4

f(2)=af -1(a)=2
f(5)=df -1(d)=5

f(3)=bf -1(b)=3
f(6)=cf -1(c)=6.

a b c d e g
.
So, we get the inverse function f 1 :
2 3 6 5 4 1

Exercise 21: Let f: be a function defined by f(x)=|x|.


) Find whether f is an injection, a surjection or a bijection;
b) Let A={x|x3, B={x |x-4}. Find f(A) and f -1(B).
Solution:
) Because f(1)=f(-1)=1 and 1-1, it follows that f is not an injection. From the fact
that -1R and (yR) f(y)-1, it follows that f is not a surjection. So, f is not a
bijection.
b) ={0,1,2,3}, so f(A)={f(0), f(1), f(2), f(3)}={0,1,2,3}=A.
f- -1(B)=N.

Discrete Mathematics 1

Exercise 7

Note: Which properties will a function have, depends not only on the function's
definition, but also on the domain and codomain. For examples, if the function
f(x)=|x| is considered as f: + , then f is an injection, but not a surjection. If it is
considered as f: + +, then f is an injection and surjection, i.e. it is a bijection.
Exercise 22: Let A={1,2,3,4,6}, B={a,b,c,d,e}, C={x,y}, and the functions f: AB, g:
1 2 3 4 5 6
a b c d e
and g :
. Find the
BC are defined by: f :
d a b a d c
x x y x y
composition gf.
Solution: Since the domain of g is equal to the codomain of f, there is a composition
gf: A C. By definition, gf(x)= g(f(x)), for every xA.
gf(1)= g(f(1))=g(d)= x;
gf(3)= g(f(3))=g(b)= x;
gf(5)= g(f(5))=g(d)= x;

gf(2)= g(f(2))=g(a)= x;
gf(4)= g(f(4))=g(1)= x;
gf(6)= g(f(6))=g(c)= y; so

1 2 3 4 5 6

gf :
x
x
x
x
x
y

You might also like