0% found this document useful (0 votes)
10 views37 pages

Function (Exam)

Uploaded by

Mohmmad Affan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views37 pages

Function (Exam)

Uploaded by

Mohmmad Affan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Lecture # 8

Functions
RELATIONS AND FUNCTIONS:
A function F from a set X to a set Y is a relation from X to Y that satisfies the following two properties

1. For every element x in X, there is an element y in Y such that (x,y) ∈F.


In other words every element of X is the first element of some ordered pair of F.
2. For all elements x in X and y and z in Y, if (x,y) ∈F and (x,z) ∈F, then y = z
In other words no two distinct ordered pairs in F have the same first element.

EXERCISE:
Which of the relations define functions from X = {2,4,5} to Y={1,2,4,6}.
a. R1 = {(2,4), (4,1)}
b. R2 = {(2,4), (4,1), (4,2), (5,6)}
c. R3 = {(2,4), (4,1), (5,6)}

SOLUTION :
a. R1 is not a function, because 5 ∈X does not appear as the first element in any ordered pair in R1.
b. R2 is not a function, because the ordered pairs (4,1) and (4,2) have the same first element but different second elements.
c. R3 defines a function because it satisfy both the conditions of the function that is every element of X is the first element of
some order pair and there is no pair which has the same first order pair but different second order pair.
EXERCISE QUESTION
EXERCISE QUESTION
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 to draw the graph of the function f given by the relation y=x^2 in order to draw the graph of the function we will
first take some elements from the domain will see the image of them and then plot then on the graph as follows Graph of y
= x^2 .
EXERCISE:
Define a binary relation P from R to R as follows: for all real numbers x and y (x, y) ∈ P ⇔ x = y^2
Is P a function? Explain.

SOLUTION:
The graph of the relation x = y^2 is shown below. Since a vertical line intersects the graph at two points; the graph does
not define a function.
X=Y^2 Y
EXERCISE QUESTION
RECURSION:
The process of defining an object in terms of smaller versions of itself is called recursion.
A recursive definition has two parts:
1.BASE:
An initial simple definition which cannot be expressed in terms of smaller versions of itself.

2. RECURSION:
The part of definition which can be expressed in terms of smaller versions of itself.
E:g 7= 5+2

Definition for odd positive integers may be given as:

BASE:
1 is an odd positive integer.

RECURSION:
If k is an odd positive integer, then k + 2 is an odd positive integer.
Now,
1 is an odd positive integer by the definition base.
With k = 1, 1 + 2 = 3, so 3 is an odd positive integer.
With k = 3, 3 + 2 = 5, so 5 is an odd positive integer
and so, 7, 9, 11, … are odd positive integers.
REMARK: Recursive definitions can be used in a “generative” manner.
RECURSIVELY DEFINED FUNCTIONS:

A function is said to be recursively defined if the function refers to itself such that

1. There are certain arguments, called base values, for which the function does not refer to itself.
2. Each time the function does refer to itself, the argument of the function must be closer to a base value.

EXAMPLE:

Suppose that f is defined recursively by


f(0) = 3 base
f(n + 1) = 2 f (n) + 3 recursion

Find f(1), f(2), f(3) and f(4)

SOLUTION:
f(1) = 2 f(0) + 3 = 2(3) + 3 = 6 + 3 = 9 f(0) =3 base value
f(2) = 2 f(1) + 3 = 2(9) + 3 = 18 + 3 = 21
f(3) = 2 f(2) + 3 = 2(21) + 3 = 42 + 3 = 45
f(4) = 2 f(3) + 3 = 2(45) + 3 = 90 + 3 = 93
Total move 3
For 2 disc
Total move 7
For 3 disc

You might also like