This document provides an introduction to functions and their properties. It defines what a function is as a mapping from a domain set to a codomain set, and introduces related concepts like domain, codomain, range, and the notation for functions. It then gives examples of specifying functions explicitly and with formulas. The document discusses properties of functions like injectivity, surjectivity, and being increasing or decreasing. It provides examples of determining if a function has these properties. The document concludes by introducing the concept of the inverse function for bijective functions.
2. Fall 2002 CMSC 203 - Discrete Structures 2
…… and the following mathematicaland the following mathematical
appetizer is about…appetizer is about…
FunctionsFunctions
3. Fall 2002 CMSC 203 - Discrete Structures 3
FunctionsFunctions
AA functionfunction f from a set A to a set B is anf from a set A to a set B is an
assignmentassignment of exactly one element of B to eachof exactly one element of B to each
element of A.element of A.
We writeWe write
f(a) = bf(a) = b
if b is the unique element of B assigned by theif b is the unique element of B assigned by the
function f to the element a of A.function f to the element a of A.
If f is a function from A to B, we writeIf f is a function from A to B, we write
f: Af: A→→BB
(note: Here, “(note: Here, “→→“ has nothing to do with if… then)“ has nothing to do with if… then)
4. Fall 2002 CMSC 203 - Discrete Structures 4
FunctionsFunctions
If f:AIf f:A→→B, we say that A is theB, we say that A is the domaindomain of f and Bof f and B
is theis the codomaincodomain of f.of f.
If f(a) = b, we say that b is theIf f(a) = b, we say that b is the imageimage of a and a isof a and a is
thethe pre-imagepre-image of b.of b.
TheThe rangerange of f:Aof f:A→→B is the set of all images ofB is the set of all images of
elements of A.elements of A.
We say that f:AWe say that f:A→→BB mapsmaps A to B.A to B.
5. Fall 2002 CMSC 203 - Discrete Structures 5
FunctionsFunctions
Let us take a look at the function f:PLet us take a look at the function f:P→→C withC with
P = {Linda, Max, Kathy, Peter}P = {Linda, Max, Kathy, Peter}
C = {Boston, New York, Hong Kong, Moscow}C = {Boston, New York, Hong Kong, Moscow}
f(Linda) = Moscowf(Linda) = Moscow
f(Max) = Bostonf(Max) = Boston
f(Kathy) = Hong Kongf(Kathy) = Hong Kong
f(Peter) = New Yorkf(Peter) = New York
Here, the range of f is C.Here, the range of f is C.
6. Fall 2002 CMSC 203 - Discrete Structures 6
FunctionsFunctions
Let us re-specify f as follows:Let us re-specify f as follows:
f(Linda) = Moscowf(Linda) = Moscow
f(Max) = Bostonf(Max) = Boston
f(Kathy) = Hong Kongf(Kathy) = Hong Kong
f(Peter) = Bostonf(Peter) = Boston
Is f still a function?Is f still a function? yesyes
{Moscow, Boston, Hong Kong}{Moscow, Boston, Hong Kong}What is its range?What is its range?
7. Fall 2002 CMSC 203 - Discrete Structures 7
FunctionsFunctions
Other ways to represent f:Other ways to represent f:
BostonBostonPeterPeter
HongHong
KongKong
KathyKathy
BostonBostonMaxMax
MoscowMoscowLindaLinda
f(x)f(x)xx LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
8. Fall 2002 CMSC 203 - Discrete Structures 8
FunctionsFunctions
If the domain of our function f is large, it isIf the domain of our function f is large, it is
convenient to specify f with aconvenient to specify f with a formulaformula, e.g.:, e.g.:
f:f:RR→→RR
f(x) = 2xf(x) = 2x
This leads to:This leads to:
f(1) = 2f(1) = 2
f(3) = 6f(3) = 6
f(-3) = -6f(-3) = -6
……
9. Fall 2002 CMSC 203 - Discrete Structures 9
FunctionsFunctions
Let fLet f11 and fand f22 be functions from A tobe functions from A to RR..
Then theThen the sumsum and theand the productproduct of fof f11 and fand f22 are alsoare also
functions from A tofunctions from A to RR defined by:defined by:
(f(f11 + f+ f22)(x) = f)(x) = f11(x) + f(x) + f22(x)(x)
(f(f11ff22)(x) = f)(x) = f11(x) f(x) f22(x)(x)
Example:Example:
ff11(x) = 3x, f(x) = 3x, f22(x) = x + 5(x) = x + 5
(f(f11 + f+ f22)(x) = f)(x) = f11(x) + f(x) + f22(x) = 3x + x + 5 = 4x + 5(x) = 3x + x + 5 = 4x + 5
(f(f11ff22)(x) = f)(x) = f11(x) f(x) f22(x) = 3x (x + 5) = 3x(x) = 3x (x + 5) = 3x22
+ 15x+ 15x
10. Fall 2002 CMSC 203 - Discrete Structures 10
FunctionsFunctions
We already know that theWe already know that the rangerange of a functionof a function
f:Af:A→→B is the set of all images of elements aB is the set of all images of elements a∈∈A.A.
If we only regard aIf we only regard a subsetsubset SS⊆⊆A, the set of allA, the set of all
images of elements simages of elements s∈∈S is called theS is called the imageimage of S.of S.
We denote the image of S by f(S):We denote the image of S by f(S):
f(S) = {f(s) | sf(S) = {f(s) | s∈∈S}S}
11. Fall 2002 CMSC 203 - Discrete Structures 11
FunctionsFunctions
Let us look at the following well-known function:Let us look at the following well-known function:
f(Linda) = Moscowf(Linda) = Moscow
f(Max) = Bostonf(Max) = Boston
f(Kathy) = Hong Kongf(Kathy) = Hong Kong
f(Peter) = Bostonf(Peter) = Boston
What is the image of S = {Linda, Max} ?What is the image of S = {Linda, Max} ?
f(S) = {Moscow, Boston}f(S) = {Moscow, Boston}
What is the image of S = {Max, Peter} ?What is the image of S = {Max, Peter} ?
f(S) = {Boston}f(S) = {Boston}
12. Fall 2002 CMSC 203 - Discrete Structures 12
Properties of FunctionsProperties of Functions
A function f:AA function f:A→→B is said to beB is said to be one-to-oneone-to-one (or(or
injectiveinjective), if and only if), if and only if
∀∀x, yx, y∈∈A (f(x) = f(y)A (f(x) = f(y) →→ x = y)x = y)
In other words:In other words: f is one-to-one if and only if itf is one-to-one if and only if it
does not map two distinct elements of A onto thedoes not map two distinct elements of A onto the
same element of B.same element of B.
13. Fall 2002 CMSC 203 - Discrete Structures 13
Properties of FunctionsProperties of Functions
And again…And again…
f(Linda) = Moscowf(Linda) = Moscow
f(Max) = Bostonf(Max) = Boston
f(Kathy) = Hong Kongf(Kathy) = Hong Kong
f(Peter) = Bostonf(Peter) = Boston
Is f one-to-one?Is f one-to-one?
No, Max and Peter areNo, Max and Peter are
mapped onto the samemapped onto the same
element of the image.element of the image.
g(Linda) = Moscowg(Linda) = Moscow
g(Max) = Bostong(Max) = Boston
g(Kathy) = Hong Kongg(Kathy) = Hong Kong
g(Peter) = New Yorkg(Peter) = New York
Is g one-to-one?Is g one-to-one?
Yes, each element isYes, each element is
assigned a uniqueassigned a unique
element of the image.element of the image.
14. Fall 2002 CMSC 203 - Discrete Structures 14
Properties of FunctionsProperties of Functions
How can we prove that a function f is one-to-one?How can we prove that a function f is one-to-one?
Whenever you want to prove something, first takeWhenever you want to prove something, first take
a look at the relevant definition(s):a look at the relevant definition(s):
∀∀x, yx, y∈∈A (f(x) = f(y)A (f(x) = f(y) →→ x = y)x = y)
Example:Example:
f:f:RR→→RR
f(x) = xf(x) = x22
Disproof by counterexample:
f(3) = f(-3), but 3f(3) = f(-3), but 3 ≠≠ -3, so f is not one-to-one.-3, so f is not one-to-one.
15. Fall 2002 CMSC 203 - Discrete Structures 15
Properties of FunctionsProperties of Functions
…… and yet another example:and yet another example:
f:f:RR→→RR
f(x) = 3xf(x) = 3x
One-to-one:One-to-one: ∀∀x, yx, y∈∈A (f(x) = f(y)A (f(x) = f(y) →→ x = y)x = y)
To show:To show: f(x)f(x) ≠≠ f(y) whenever xf(y) whenever x ≠≠ yy
xx ≠≠ yy
⇔ 3x3x ≠≠ 3y3y
⇔ f(x)f(x) ≠≠ f(y),f(y),
so if xso if x ≠≠ y, then f(x)y, then f(x) ≠≠ f(y), that is, f is one-to-one.f(y), that is, f is one-to-one.
16. Fall 2002 CMSC 203 - Discrete Structures 16
Properties of FunctionsProperties of Functions
A function f:AA function f:A→→B with A,BB with A,B ⊆⊆ R is calledR is called strictlystrictly
increasingincreasing, if, if
∀∀x,yx,y∈∈A (x < yA (x < y →→ f(x) < f(y)),f(x) < f(y)),
andand strictly decreasingstrictly decreasing, if, if
∀∀x,yx,y∈∈A (x < yA (x < y →→ f(x) > f(y)).f(x) > f(y)).
Obviously, a function that is either strictlyObviously, a function that is either strictly
increasing or strictly decreasing isincreasing or strictly decreasing is one-to-oneone-to-one..
17. Fall 2002 CMSC 203 - Discrete Structures 17
Properties of FunctionsProperties of Functions
A function f:AA function f:A→→B is calledB is called ontoonto, or, or surjectivesurjective, if, if
and only if for every element band only if for every element b∈∈B there is anB there is an
element aelement a∈∈A with f(a) = b.A with f(a) = b.
In other words, f is onto if and only if itsIn other words, f is onto if and only if its rangerange isis
itsits entire codomainentire codomain..
A function f: AA function f: A→→B is aB is a one-to-one correspondenceone-to-one correspondence,,
or aor a bijectionbijection, if and only if it is both one-to-one, if and only if it is both one-to-one
and onto.and onto.
Obviously, if f is a bijection and A and B are finiteObviously, if f is a bijection and A and B are finite
sets, then |A| = |B|.sets, then |A| = |B|.
18. Fall 2002 CMSC 203 - Discrete Structures 18
Properties of FunctionsProperties of Functions
Examples:Examples:
In the following examples, we use the arrowIn the following examples, we use the arrow
representation to illustrate functions f:Arepresentation to illustrate functions f:A→→B.B.
In each example, the complete sets A and B areIn each example, the complete sets A and B are
shown.shown.
19. Fall 2002 CMSC 203 - Discrete Structures 19
Properties of FunctionsProperties of Functions
Is f injective?Is f injective?
No.No.
Is f surjective?Is f surjective?
No.No.
Is f bijective?Is f bijective?
No.No.
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
20. Fall 2002 CMSC 203 - Discrete Structures 20
Properties of FunctionsProperties of Functions
Is f injective?Is f injective?
No.No.
Is f surjective?Is f surjective?
Yes.Yes.
Is f bijective?Is f bijective?
No.No.
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
PaulPaul
21. Fall 2002 CMSC 203 - Discrete Structures 21
Properties of FunctionsProperties of Functions
Is f injective?Is f injective?
Yes.Yes.
Is f surjective?Is f surjective?
No.No.
Is f bijective?Is f bijective?
No.No.
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
LLüübeckbeck
22. Fall 2002 CMSC 203 - Discrete Structures 22
Properties of FunctionsProperties of Functions
Is f injective?Is f injective?
No! f is not evenNo! f is not even
a function!a function!
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
LLüübeckbeck
23. Fall 2002 CMSC 203 - Discrete Structures 23
Properties of FunctionsProperties of Functions
Is f injective?Is f injective?
Yes.Yes.
Is f surjective?Is f surjective?
Yes.Yes.
Is f bijective?Is f bijective?
Yes.Yes.
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
LLüübeckbeckHelenaHelena
24. Fall 2002 CMSC 203 - Discrete Structures 24
InversionInversion
An interesting property of bijections is thatAn interesting property of bijections is that
they have anthey have an inverse functioninverse function..
TheThe inverse functioninverse function of the bijection f:Aof the bijection f:A→→BB
is the function fis the function f-1-1
:B:B→→A withA with
ff-1-1
(b) = a whenever f(a) = b.(b) = a whenever f(a) = b.
25. Fall 2002 CMSC 203 - Discrete Structures 25
InversionInversion
Example:Example:
f(Linda) = Moscowf(Linda) = Moscow
f(Max) = Bostonf(Max) = Boston
f(Kathy) = Hong Kongf(Kathy) = Hong Kong
f(Peter) = Lf(Peter) = Lüübeckbeck
f(Helena) = New Yorkf(Helena) = New York
Clearly, f is bijective.Clearly, f is bijective.
The inverse functionThe inverse function
ff-1-1
is given by:is given by:
ff-1-1
(Moscow) = Linda(Moscow) = Linda
ff-1-1
(Boston) = Max(Boston) = Max
ff-1-1
(Hong Kong) = Kathy(Hong Kong) = Kathy
ff-1-1
(L(Lüübeck) = Peterbeck) = Peter
ff-1-1
(New York) = Helena(New York) = Helena
Inversion is onlyInversion is only
possible for bijectionspossible for bijections
(= invertible functions)(= invertible functions)
26. Fall 2002 CMSC 203 - Discrete Structures 26
InversionInversion
LindaLinda
MaxMax
KathyKathy
PeterPeter
BostonBoston
New YorkNew York
Hong KongHong Kong
MoscowMoscow
LLüübeckbeckHelenaHelena
ff
ff-1-1
ff-1-1
:C:C→→P is noP is no
function, becausefunction, because
it is not definedit is not defined
for all elements offor all elements of
C and assigns twoC and assigns two
images to the pre-images to the pre-
image New York.image New York.
27. Fall 2002 CMSC 203 - Discrete Structures 27
CompositionComposition
TheThe compositioncomposition of two functions g:Aof two functions g:A→→B andB and
f:Bf:B→→C, denoted by fC, denoted by f°°g, is defined byg, is defined by
(f(f°°g)(a) = f(g(a))g)(a) = f(g(a))
This means thatThis means that
• firstfirst, function g is applied to element a, function g is applied to element a∈∈A,A,
mapping it onto an element of B,mapping it onto an element of B,
• thenthen, function f is applied to this element of, function f is applied to this element of
B, mapping it onto an element of C.B, mapping it onto an element of C.
• ThereforeTherefore, the composite function maps, the composite function maps
from A to C.from A to C.
29. Fall 2002 CMSC 203 - Discrete Structures 29
CompositionComposition
Composition of a function and its inverse:Composition of a function and its inverse:
(f(f-1-1
°°f)(x) = ff)(x) = f-1-1
(f(x)) = x(f(x)) = x
The composition of a function and its inverseThe composition of a function and its inverse
is theis the identity functionidentity function i(x) = x.i(x) = x.
30. Fall 2002 CMSC 203 - Discrete Structures 30
GraphsGraphs
TheThe graphgraph of a functionof a function f:Af:A→→B is the set ofB is the set of
ordered pairs {(a, b) | aordered pairs {(a, b) | a∈∈A and f(a) = b}.A and f(a) = b}.
The graph is a subset of AThe graph is a subset of A××B that can be usedB that can be used
to visualize f in a two-dimensional coordinateto visualize f in a two-dimensional coordinate
system.system.
31. Fall 2002 CMSC 203 - Discrete Structures 31
Floor and Ceiling FunctionsFloor and Ceiling Functions
TheThe floorfloor andand ceilingceiling functions map the realfunctions map the real
numbers onto the integers (numbers onto the integers (RR→→ZZ).).
TheThe floorfloor function assigns to rfunction assigns to r∈∈RR the largestthe largest
zz∈∈ZZ with zwith z ≤≤ r, denoted byr, denoted by rr..
Examples:Examples: 2.32.3 = 2,= 2, 22 = 2,= 2, 0.50.5 = 0,= 0, -3.5-3.5 = -4= -4
TheThe ceilingceiling function assigns to rfunction assigns to r∈∈RR the smallestthe smallest
zz∈∈ZZ with zwith z ≥≥ r, denoted byr, denoted by rr..
Examples:Examples: 2.32.3 = 3,= 3, 22 = 2,= 2, 0.50.5 = 1,= 1, -3.5-3.5 = -3= -3
32. 32
Do you find this slides were useful?Do you find this slides were useful?
One second of your life , can bring a smile in a girl lifeOne second of your life , can bring a smile in a girl life
If Yes ,JoinIf Yes ,Join Dreams SchoolDreams School “Campaign for Female Education”“Campaign for Female Education”
Help us in bringing a change in a girl life, becauseHelp us in bringing a change in a girl life, because
““When someone takes away your pens youWhen someone takes away your pens you
realize quite how important education is”.realize quite how important education is”.
Just Click on any advertisement on the page, yourJust Click on any advertisement on the page, your
one click can make her smileone click can make her smile..
Eliminate InequalityEliminate Inequality ““Not WomenNot Women””
One second of your life , can bring a smile in her life!!One second of your life , can bring a smile in her life!!
Do you find these slides were useful?Do you find these slides were useful?
If Yes ,JoinIf Yes ,Join Dreams SchoolDreams School ““CampaignCampaign
for Female Educationfor Female Education””
Help us in bringing a change in a girl life,Help us in bringing a change in a girl life,
becausebecause ““When someone takes awayWhen someone takes away
your pens you realize quite howyour pens you realize quite how
important education isimportant education is”.”.
Just Click on any advertisement on the page,Just Click on any advertisement on the page,
your one click can make her smileyour one click can make her smile..
We our doing our part & u ?We our doing our part & u ?
Eliminate InequalityEliminate Inequality ““Not WomenNot Women””