Section 4.4

advertisement
Section 4.4
Activity 1
• Give me an example of a relation that is:
1. A bijective function.
2. An injective (one-to-one) function only.
3. A surjective (onto) function only.
4. A function, but neither 1-to-1 or onto.
5. Not a function.
Definition
We can symbolically define that a function is
one-to-one (injective) with:
f: XY is one-to-one 
x1x2 f(x1) = f(x2)  x1 = x2
Definition
We can symbolically define that a function is
onto (surjective) with:
f: XY is onto 
yY xX f(x) = y
Image and Inverse Image
• If f(x)=y then we say that
– The image of x is y
– The inverse image (pre-image) of y is x
Activity #2
• What is the image of
Adams?
• What is the image of
Epp?
• What is the inverse
image of B?
• What is the inverse
image of A?
The inverse of a function
• The inverse of function f is noted as f-1
f-1 ={ (b,a) : (a,b)  f }
If f = { (1,square), (2,circle), (3,triangle) }
What is f-1
Activity #3
Let
• f: X → Y as shown by :
• g: RR
• h: RR
g(x) = 2x + 3
h(x) = x2 + 4
Find the inverse of each of these functions.
Is the inverse function really a
function?
• You identified three inverses in Activity #2.
• Which of these were actually inverse
functions?
What kinds of functions produce
inverse functions?
• What is the definition of a function?
• How does this effect whether or not a
function has an inverse?
Functions/Inverse Functions in CS
• Caesar Cypher
c: string  string
c(string,n) :
Consider a=0, b=1, c=2, …. z=25
For each character in the input string replace the
character with the character formed by
En(x) = (x + n) mod 26
For example,
En(“y”) = (24 + 3) % 26 = 1 = “b”
Download