You are on page 1of 4

Chapter 2: Basic Structure, Functions

Functions:

1) Define function (Mappings or transforms) with example

Let A and B to be nonempty sets. A function f from A to B is an


assignment of exactly one element of B to each element of A. We write
f(a) = b. If f is a function from A to B, we write f: A → B.

2) Define domain, codomain, and range with example.

If f is a function from A to B, we say that A is the domain of f and B is


the Co domain of f. If f(a) = b, we say that b is the image of a and a is
a pre image of b. The range of f is the set of all images of elements of
A. Also, if f is a function from A to B, we say that f maps A to B.

3) Define one to one function.

A function f is said to be one-to-one, if and only if f(a) = f(b) implies


that a = b for all a and b in the domain of f.

Example: Determine whether the function f from {a,b,c,d} to


{1,2,3,4,5} with f(a) = 4, f(b) = 5, f(c) = 1 and f(d) = 3 is one-to-one.

a 1
b 2
c 3
d 4
5 Solution: Yes

4) Define onto Function


A function f from A to B is called onto, if and only if for every element
b  B there is an element a  A with f(a) = b.

Example; Let f be the function from {a,b,c,d} to {1,2,3} defined by


f(a) = 3, f(b) = 2, f(c) = 1, and f(d) = 3. Is f an onto function?

a 1
b 2
c 3
d
Solution: Yes.

5) Define Bijective function


The function f is a Bijective function if it is both one-to-one and onto.
More Examples:
 Determine whether the function f(x) = x2 from the set of
integers to the set of integers is one-to-one.
 : Is the function f(x) = x2 from the set of integers to the set of
integers onto?
6) Define inverse function
7) Define composition of functions

8) Define “floor” and “ceiling” functions.


Floor:  x  = Largest integer less than or equal to x
Ceiling:  x  = Smallest integer greater than equal to x.
Example:
1. Data stored on a computer disk or transmitted over data network are
usually represented as a string of bytes. Each byte is made up of 8
bits. How many bytes are required to encode 100 bits of data?
2. In asynchronous transfer mode (ATM), data are organized into cells of
53 bytes. How many ATM cells can be transmitted in 1 minute over a
connection that transmits data at the rate of 500 kilobits per second?
Additional Problems:
Exercise Page 146, 147, 148
Problems: 10, 12, 14, 15, 18, 19, 38, 24, 32, 55, 56, 57

Summations:
Note to teach: Explain for … next loop statement
i= 3
1) Find the sum of  (i  1)
i=0
i= 5
2) Find the sum of  (2)
i=0
i

Note to teach: Explain multiple loops


i=2 J=3

3) Find the sum of  i j


i=0 j=1
2 3

i  2 j 3

4) Find the sum of  (i)


i  0 j 1
2
 ( j )3
i  2 j 3

5) Find the sum of  (i) ( j )


i  0 j 1
2 3

Homework:
Exercise Page 162 Problems 17, 18

You might also like