Call Now: (800) 537-1660  
The Algebra Buster
The Algebra Buster


May 25th









May 25th

Lecture 7: Functions

A function is a mapping from one set , the domain, to another
set, the co-domain.
Each element of the domain must have an image in the codomain.
We write f: X→Y.

Illustrating functions:
1. Arrow diagrams

 

domain:
co-domain:
range of f:
inverse image of 0, 1, 2:

2. Function machine


3. Using functional notation


4. Graphing


5. Listing all sets of ordered pairs


Two functions f and g are equal if they have the same domains and co-domains and for every x
in the domain, f(x) = g(x).
 

Examples of functions:
1. A sequence : 1, 1/2, 1/4, ... is a function from Z+ to R.

2. the cardinality of a subset is a function from P (X) to non- negative integers .
ex. X = { a, b, c } P (X) =

3. a 2-input circuit is a function from {0,1}×{0,1} to {0,1}.

This circuit is equivalent to what statement ?
This is an example of a Boolean function.

4. Hamming distance is a function from Σn × Σn to Znonnegative where Σ = { 0, 1 }
ex: Σ3 = {
One-to-one (Injective)

To show a function is injective, show that if f(x1) = f(x2), then x1 = x2.
To show a function is NOT injective, give a counterexample, i.e., show a case where
f(x1) = f(x2) but x1 ≠ x2.


ex 1. Is the function f: R to R by f(x) = −5x + 1 is one-to-one? Show why.
ex 2. Is the function g: R to R by g(x) = x2 + 2 is one-to-one? Show why.

ex 3. Is the function h: R to R by h(x) = x3 is one-to-one? Show why.
Onto (Surjective) Every element in the co-domain is an image of some element in the domain.

To show a function is surjective, show that for every y ∈ co-domain, x ∈ domain f(x) = y.
To show a function is NOT injective, give a counterexample, i.e. find a y ∈co-domain ∍ there
is no x ∈ domain f(x) = y.

ex. 1: Show whether the function f: R to R by f(x) = x2 + 2 is onto.

ex. 2: Show whether the function g: R to R by g(x) = 3x + 1 is onto.

ex. 3: Show whether the function h: R to R by h(x) = x2 is onto.

One-to-one and onto (Bijective or one-to-one corresponding)

Is the function f: R to R by f(x) = 5x + 1 bijective?

If f is one-to-one and onto, f has an inverse function, f-1.

Hash functions - used to de termine where to store data and where to find data that has been
stored.

“Hash” the data by performing some mathematical operation on the key . The resulting number
tells where to store the data.

ex. Store student records in an array indexed 0..999.
Hash the student ID as follows

H(ID) = ID mod 1000
 
What's the big advantage to a hash function?

Suppose we use the scheme
h(Student) = last 2 digits of the ID
as a hash function to store Student data in an array, i.e,
index = h(Student)

Where are Student records of students with IDs shown be low stored ?

091277817
112376149
116724516
 

Can there be a Problem?


Pigeonhole Principle:
A function from one finite set to a smaller finite set cannot be one-toone.
There must be at least 2 elements in the domain that have the
same image in the co-domain.

ex: In this room, must there be at least 2 people of the same sex?
ex.: How many people would have to use the pigeonhole principle to guarantee that at least 2
people shared the same birth month?

Generalized Pigeonhole Principle:
For function f: X Y where X and Y are finite sets and
N(X) > k * N(Y) for some k ∈Z+,
then at least k + 1 elements of X have the same image under f.


ex: At least _____ people in the room have the same birth month.
Y has cardinality? Largest k = ?
ex. At least _____ people in the room have the same sex.
ex. (As sume there are only 4 hair colors: blond, black, brunette, red hair)
At least _____ people in the room have the same hair color.
ex. (Assume there are only 3 majors: CS, MA, EG)
At least _____ people in the room have the same major.

Composition of Functions: Applying a function to the result of applying a function

Let g: Z Z and f: Z Z
 
ex. Let f(x) = 2x and g(x) = x2 + 3 Let g: Z Z and f: Z Z
Find (f ° g) (5)  
Find (g ° f) (5)  
Is there a function h(x) = (f ° g) (x) ? Is it 1 to 1? Onto?
Is there a function j(x) = (g ° f) (x) ?  

If functions f and g are both one-to-one, f ° g is one-to-one.
If f and g are both onto, f ° g is onto.
If f and g are both one-to-one corresponding, f ° g is one-to-one corresponding.

Prev Next
 
Home    Why Algebra Buster?    Guarantee    Testimonials    Ordering    FAQ    About Us
What's new?    Resources    Animated demo    Algebra lessons    Bibliography of     textbooks
 

Copyright © 2009, algebra-online.com. All rights reserved.