You are on page 1of 35

FUNCTIONS

Lecture # 11
Recall the Cartesian Product

 All ordered n-tuples (2 tuples in our example)


 Let S = { Ali, Babar, Kashif } and G = { A, B,
C}
 S×G = { (Ali, A), (Ali, B), (Ali, C), (Babar, A),
(Babar, B), (Babar, C), (Kashif , A), (Kashif , B),
(Kashif , C) }
A relation
 The final grades will be a subset of this:
2 { (Ali, C), (Babar, B), (Kashif, A) }
Grade Assignment

Ali A
Babar B
Kashif C

Ali A
Babar B
Kashif C
3
FUNCTIONS
 A function f from a set X to a set Y is a
relationship between elements of X and
elements of Y such that each element of X is
related to a unique element of Y, and is
denoted f : X Y.

 The set X is called the domain of f and Y is


called the co-domain of f.

 Functions are sometimes also called


mappings and transformations.
REMARK
 The unique element y of Y that is related to x
by f is denoted f(x) and is called

the value of f at x,
or
the image of x under f
ARROW DIAGRAM OF A FUNCTION
 The definition of a function implies that the
arrow diagram for a function f has the
following two properties:

1. Every element of X has an arrow coming out


of it
2. No two elements of X has two arrows
coming out of it that point to two different
elements of Y.
EXAMPLE
 Let X = {a, b, c} and Y = {1, 2, 3, 4}.
 Define a function f from X to Y by the arrow
diagram. f

a. . 1
b. . 2
c. . 3
. 4

X Y

f(a) = 2, f(b) = 4,and f(c) = 2 OR


image of a = 2, image of b = 4, image of c =
Definition 2
 If f is a function from A to B, we say that A is
the domain of f and B is the codomain of f.

Domain A B Co-domain
f

f(4.3)
4.3 4

8
Examples
A pre-image The image
Domain Co-domain of 1 of “a”
Ali A “a” 1

Babar B “bb“ 2

Kashif C “cccc” 3

Dawood D “dd” 4

Ammara F “e” 5

A class grade function A string length function

g(Ali) = A f(x) = length


g(Babar) = C x
g(Kashif) = A f(“a”) = 1
… f(“bb”) = 2
NONFUNCTIONS
 X = {2, 4, 5} to Y = {1, 2, 4, 6}

a. b.
.1
2. .1
.2 2.
4. .2
.4 4.
5. .4
.6 5.
.6

X Y X Y
NOT A FUNCTION NOT A FUNCTION
Not a valid function!

“a” 1
“bb“ 2
“cccc” 3
“dd” 4
“e” 5
RANGE OF A FUNCTION
 Let f: XY. The range of f consists of those
elements of Y that are images of elements of
X.

 Symbolically:

Range of f
= {y Y | y = f(x), for some x  X}
Range of a Function
 The range of f is the set of all images of
elements of A.
Range
a 1
e 2
i 3
o 4
u 5

Some function…

13
REMARKS
 The range of a function f is always a subset of
the co-domain of f.

 The range of f: X Y is also called the image of


X under f.

 When y = f(x), then x is called the pre-image of


y.

 The set of all elements of X, that are related to


some y Y is called the inverse image of y.
EXERCISE
 Determine the range of the functions f, g, h from
X = {2, 4, 5} to Y = {1, 2, 4, 6} defined as:
f

1. X Y

2 . . 1
4 . . 2
5 . . 4
. 6

 2. g = { (2, 6), (4, 2), (5,1) }


 3. h(2) = 4, h(4) = 4, h(5) = 1
SOLUTION
1. Range of f = {1, 6}

2. Range of g = {1, 2, 6}

3. Range of h = {1, 4}
GRAPH OF A FUNCTION
 Let f be a real-valued function of a real
variable. i.e. f: R R. The graph of f is
the set of all points (x, y) in the Cartesian
coordinate plane with the property that x is in
the domain of f and y = f(x).
EXAMPLE
 We have the function

y = x2

From set of real numbers to set of


real numbers.
y y = x2

x y=f(x)
-3 9
-2 4 (-3,9) (3,9)
-1 1
0 0 (x , f(x))
+1 1
+2 4 (-2,4) (2,4)
+3 9
(-1,1) (1,1)

O (o,o) x
VERTICAL LINE TEST FOR THE GRAPH
OF A FUNCTION
 For a graph to be the graph of a function, any
given vertical line in its domain intersects the
graph in at most one point. For y = x2
y

y=x2

O x

So, it’s the graph of a function.


EXERCISE
Define a binary relation P from R to R as
follows:
for all real numbers x and y (x, y)  P  x =
y2
Is P a function?
x Y
4
9 -3
3 (4,2)
4 -2
1 -1 2
0 0 1
1 1 0 -1 12 3 4 5 6 7 8 9 10 x
4 2
-2
9 3
-3 (4,-2)

-4

This is not a graph of a function.


EXERCISE
 Find all functions from X = { a, b } to Y =
{ u, v }
 SOLUTION
1. 2. a u
a u
Y
X b v
b v
3.
4.
a u a u

b v b v

X Y
X Y
EXERCISE
 Find four binary relations from X = { a, b }to Y
= { u, v } that are not functions.
 SOLUTION 1. a. .u
2.
a. .u

b. b. .v
.v

X Y X Y

3. X Y X Y
4.
a. u. a. u.

b. v. b. v.
EXERCISE
 How many functions are there from a set with three
elements to a set with four elements?

 SOLUTION
Let X = {x1, x2, x3} and
Y = {y1, y2, y3, y4}

 x1 may be related to any of the four elements y1, y2, y3,


y4 of Y.
 x1 has four possibilities.
 x2 has four possibilities.
 x3 has four possibilities.
Total number of function = 4 x 4 x 4 = 64
EXERCISE
 Suppose A is a set with m elements and B is
a set with n elements.
 How many functions are there from A to B?

 SOLUTION:
Number of functions from
A to B = n.n.n. … .n (m times)
= nm
FUNCTIONS NOT WELL DEFINED
 Determine whether f is a function from Z to R
if
1
a. f (n) n b. f (n)  2
n 4

c. f (n)  n d. f (n)  n2 1
SOLUTION
a) f is NOT well defined since each integer n
has two images +n and –n.

b) f is NOT well defined since f(2) and f(-2)


are not defined.

c) f is NOT defined for n < 0 since f then


results in imaginary values (not real).

d) f is well defined because each integer has


unique (one and only one) image in R under
f.
EXERCISE
 Student B tries to define a function h : Q  Q
by the rule. 2
m m
h  
n n

 for all integers m and n with n  0

 Students C claims that h is not well defined.


Justify Student C’s claim.
SOLUTION
 The function h is well defined if each rational
number has a unique (one and only one) image.
1
Consider Q
2
 1  12 1 Hence, an
h   
 2  2 2 element of ‘h’ has
more than two
1 2 images so not a
N ow  and
2 4 function.

 2  22 4
h     1
 4  4 4
 Hence an element of Q has more than one
images under h. Accordingly h is not well
defined.
REMARK
 Mathematical Formulation of Function’s
Properties:

 A function f: X  Y is well defined iff

 x1, x2  X,

if x1 = x2 then f(x1) = f(x2)

 Means an element can not have two images.


Rephrase the properties of function.
EXERCISE
 Let g: RR+ be defined by g(x) = x2 +1

1. Determine g is well defined?


2. Determine the domain, co-domain and range
of g.

SOLUTION:

Domain of g = R (set of real numbers)

Co-domain of g = R+ (set of positive real numbers)


Cont…
 The range of g consists of those elements of
R+ that appear as image points.

Sincex2  0  x R
x2 + 1  1  x R
i.e. g(x) = x2 + 1 1  x R

Hence the range of g is all real number


greater than or equal to 1.
i.e [1, )
 SOLUTION: (we take two elements of R, and
suppose these two elements are equal, by the
definition of function we will prove that their images
are also equal.)

Let x1, x2 R and suppose x1 = x2


 x12 = x22(squaring both sides)
 x12 + 1 = x22 + 1(adding 1 on both sides)
 g(x1) = g(x2) (by definition of g)

Thus if x1 = x2 then g (x1) = g(x2).


Accordingly g:R  R+ is well defined.

You might also like