Functions
Functions
A B
Domain Co-Domain
A function, f: A B
CSCE 235 Functions 6
More Definitions (1)
• Definition: Let f1 and f2 be two functions from
a set A to R. Then f1+f2 and f1f2 are also
function from A to R defined by:
– (f1+f2)(x) = f1(x) + f2(x)
– f1f2(x)= f1(x)f2(x)
• Example: Let f1(x)=x4+2x2+1 and f2(x)=2-x2
– (f1+f2)(x) = x4+2x2+1+2-x2 = x4+x2+3
– f1f2(x) = (x4+2x2+1)(2-x2)= -x6+3x2+2
CSCE 235 Functions 7
More Definitions (2)
• Definition: Let f: A B and S A. The image
of the set S is the subset of B that consists of
all the images of the elements of S. We
denote the image of S by f(S), so that
f(S)={ f(s) | s S }
• Note there that the image of S is a set and not
an element.
A B
a1 b1
a2 b2
a3 b3
a4 b4
A B
a1 b1
a2 b2
a3 b3
a4 b4
• Is this a function
– One-to-one (injective)? Why? No, b1 has 2 preimages
– Onto (surjective)? Why? No, b4 has no preimage
CSCE 235 Functions 16
Functions: Example 3
A B
a1 b1
a2 b2
a3 b3
b4
• Is this a function
– One-to-one (injective)? Why? Yes, no bi has 2 preimages
– Onto (surjective)? Why? No, b4 has no preimage
CSCE 235 Functions 17
Functions: Example 4
A B
a1 b1
a2 b2
a3 b3
a4
• Is this a function
– One-to-one (injective)? Why? No, b3 has 2 preimages
– Onto (surjective)? Why? Yes, every bi has a preimage
CSCE 235 Functions 18
Functions: Example 5
A B
a1 b1
a2 b2
a3 b3
a4 b4
• Is this a function
– One-to-one (injective)? Thus, it is a bijection or a
– Onto (surjective)? one-to-one correspondence
CSCE 235 Functions 19
Exercice 1
• Let f:ZZ be defined by
f(x)=2x-3
• What is the domain, codomain, range of f?
• Is f one-to-one (injective)?
• Is f onto (surjective)?
• Clearly, dom(f)=Z. To see what the range is, note that:
b rng(f) b=2a-3, with aZ
b=2(a-2)+1
b is odd
CSCE 235 Functions 20
Exercise 1 (cont’d)
• Thus, the range is the set of all odd integers
• Since the range and the codomain are
different (i.e., rng(f) Z), we can conclude
that f is not onto (surjective)
• However, f is one-to-one injective. Using
simple algebra, we have:
f(x1) = f(x2) 2x1-3 = 2x2-3 x1= x2 QED
CSCE 235
thus, f is one-to-one
Functions 28
Exercice 5: f is not onto
• Consider the counter example f(a)=1
• If this were true, we would have
3a3 – a=1 a(3a2 – 1)=1 where a and (3a2 – 1) Z
• The only time we can have the product of two
integers equal to 1 is when they are both equal to 1
or -1
• Neither 1 nor -1 satisfy the above equality
• Thus, we have identified 1Z that does not have
an antecedent and f is not onto (surjective)
f(a)
a b
f -1(b)
A B
Domain Co-Domain
A function and its inverse
CSCE 235 Functions 33
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
(f
g)(a)
rng(g)
g(a) f(g(a))
a f(g(a))
g(a) g(a)
g(a) f(g(a))
a g(a) f(g(a))
A B C
x
-5 -4 -3 -2 -1 1 2 3 4 5
-1
-2
-3
x
-5 -4 -3 -2 -1 1 2 3 4 5
-1
-2
-3