Lec 10 Discrete Structures

Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

DISCRETE STRUCTURES

Dr. Muhammed Abdel Hameed


Faculty of Computers & Information
Computer Science Dept.
Lecture 10
Lecture Rules
Chapter 5
Functions
Section 5.4
Introduction
 When there is some relation that matches each
item from one set with exactly one item from a
different set. Such a relation is called a function.
Introduction
 To help understand this definition, look at the
function that relates the time of day to the
temperature in Figure.
Introduction
This function can be represented by the ordered pairs:
{(1, 9), (2, 13), (3, 15), (4, 15), (5, 12), (6, 10)}.

 In each ordered pair, the first coordinate (x-value) is the


input and the second coordinate (y-value) is the output.
Introduction
• The set S is called the domain of the function.

• The set T is called the codomain of the function.


Introduction
• The domain elements, x, can be obtained as the
inputs and the range elements, f (x), can be
thought of as the outputs.

Function Input Output

f x f (x)
What is Function?
What is Function?
What is Function?
Function Defined as an Arrow
Diagram
• If X and Y are finite sets, you can define a function f from
X to Y by drawing an arrow diagram. You make a list of
elements in X and a list of elements in Y, and draw an
arrow from each element in X to the corresponding
element in Y. The arrow diagram define a function
1. Every element of X has an arrow coming out of it.
2. No element of X has two arrows coming out of it
that point to two different elements of Y.
Example
• Which of the arrow diagrams in the following Figure
define functions from X = {a, b, c} to Y = {1,2,3,4}?

Note:
1. Every element of X has an arrow coming out of it.
2. No element of X has two arrows coming out of it
that point to two different elements of Y.
Solution
• Which of the arrow diagrams in the following Figure
define functions from X = {a, b, c} to Y = {1,2,3,4}?
Example
Solution
Example
Example
Equality of Functions
Example
Solution
Example
Solution
Properties of Functions
Properties of Functions
Example
• State the following Functions F, G, Either Onto or Not?
Why Not?

(a)
Example
• State the following Functions H, K, Either Onto or Not?
Why Not?
Properties of Functions
Example
Properties of Functions
Example

(A)

(B)
Example

Injective function Bijective Function Surjective Function


Example
Properties of Functions
Example
• Find the inverse function for the given
f (x) = 3x + 2.

y = 3x + 2 Original equation defining f


x = 3y + 2 Switch x and y.
3y + 2 = x Reverse sides of the equation.
( x  2)
y= Solve for y.
3
Graphs of Functions

 The graph of a function y = f (x) is a set of ordered


pairs (x, f (x)), for values of x in the domain of f.

 To graph a function:

1. Make a table of values.

2. Plot the points.

3. Connect them with a curve.


Example
 Graph the function f (x) = x2 – 2x – 2, Where
x= {0,1,2,3,4,-1,-2}.
Summary
Task (15 Min)
(1)

(2)
Solutions
(1)
Solutions
(2)
Text Book
This lecture covered Section 5.4 of Judith Book.
Exercises 5.4.

You might also like