Functions Updated
Functions Updated
S. Y. B. Tech CSE
Sets
Counting
Relations
Is this a function?
No, because each of a1, a3 has two images
DISCRETE STRUCTURES UNIT-II 8
Functions: Example 2
A B
Domain Co-Domain
A function, f: A B
DISCRETE STRUCTURES UNIT-II 11
Some Function Terminology
If f:AB, and f(a)=b (where aA &
bB), then:
A is the domain of f.
B is the codomain of f.
b is the image of a under f.
a is a pre-image of b under f.
In general, b may have more than one pre-
image.
The range RB of f is {b | a f(a)=b }.
DISCRETE STRUCTURES UNIT-II 12
Range vs. Codomain: Example
Range {..,..}
{Jan, Feb..Dec}
Codomain is __________________.
DISCRETE STRUCTURES UNIT-II 13
Sum and Product
We can add and multiply functions
Let f,g: AR are two functions
Sum:
(f g): A R, where (f g)(x) = f(x) g(x)
Product:
(f × g): A R, where (f × g)(x) = f(x) × g(x)
f1(x)=x2
f2(x)=x-x2
calculate (f1+f2)(x) and f1f2(x)
(f1+f2)(x) = x2+x-x2 = x (SUM)
f1f2(x) = (x2)(x-x2)= x3-x4 (PRODUCT)
DISCRETE STRUCTURES UNIT-II 15
Sum and Product:Example
Example 2:
Let f1 and f2 be functions
f1 , f2 :RR
f1(x)=x4+2x2+1
f2(x)=2-x2
A = {Geeta, Babita, Priyanka, Ritu, Vinesh,Sangita}
B = {Jan, Feb, Mar,Apr, May, Jun, July,Aug,Sep,Oct,Nov,Dec}
f={(Geeta, December), (Babita, November), (Priyanka, May),
(Ritu, May), (Vinesh, August), (Sangita,March)}
Let S={Geeta, Babita, Priyanka, Ritu}
What is f(S)?
DISCRETE STRUCTURES UNIT-II 18
Function Equality
Although it is intuitive, we formally
define what it means for two functions
to be equal
Equality: Two functions f and g are
equal if and only
dom(f) = dom(g)
a dom(f) (f(a) = g(a))
• • • •
• • • • •
• • • •
• • • •
• • •
• • • •
• •
•
Not even a
One-to-one Not one-to-one function!
Is this a function
One-to-one (injective)? Why? No, b3 has 2 preimages
Yes
Is this a function
One-to-one (injective)? Yes
Onto (surjective)? Yes
DISCRETE STRUCTURES UNIT-II 29
Onto Functions: Example 2
f(x)= x3
Whether this function onto?
Is this a function
One-to-one (injective)? Thus, it is a bijection or a
Onto (surjective)? one-to-one
correspondence
DISCRETE STRUCTURES UNIT-II 32
One to one Onto(Bijection)
:Example 2
Let f:ZZ be defined by
f(x)= x+1
Whether this function bijective?
Let f:RR be defined by
f(x)= x2
Whether this function one to one onto?
(f g)(a)
g(a) f(g(a))
a g(a) f(g(a))
A B C
f(g(x)) = f(x2+1)
2(x2+1)-3
2x2 - 1
(g f)(x) =
Conclusion ?
g(2x-3)
(2x-3)2 +1
4x2 - 12x + 10
f○g g○f
DISCRETE STRUCTURES UNIT-II 39
Function Composition: Associativity
f(a)
a b
f -1(b)
A B
Domain Co-Domain
A function and its inverse
DISCRETE STRUCTURES UNIT-II 42
Inverse Functions: Example 1
Let f:RR be defined by
f(x) = 2x – 3
What is f-1?
1. We must verify that f is invertible, that is, is a
bijection. We prove that is one-to-one (injective)
and onto (surjective). It is.
2. To find the inverse, we use the substitution
Let f-1(y)=x
And y=2x-3, which we solve for x. Clearly, x= (y+3)/2
So, f-1(y)= (y+3)/2
•
• • y
• •
• •
• •
0
1 1
2 3
Leonardo Fibonacci
5 8 1170-1250
13 DISCRETE STRUCTURES UNIT-II 51
Important Function: Factorial
Definition: The factorial function, denoted
n, is a function NN+. Its value is the
product of the n positive integers
1 if n = 0
f(n)= (recursive solution)
n*f(n-1) if n > 0