5 Functions
5 Functions
Examples:
4 / 64
More examples
5 / 64
What Can Functions Do?
●
A function processes elements of a set and
returns elements in another set
●
Which means a set can be an input and an
output to a function
●
Mapping / Transformation
7 / 64
More examples
●
Given f(x) = -x2 + 4x + 1
f(t) = -t2 + 4t + 1
8 / 64
More examples
●
Given f(x) = -x2 + 4x + 1
f(t) = -t2 + 4t + 1
9 / 64
More examples
●
Given f(x) = -x2 + 4x + 1
f(t) = -t2 + 4t + 1
11 / 64
Domain, Codomain and Range
● Function f(x) = 2x+1
●
Set A is the domain (input)
●
Set B is the codomain
(output)
●
Elements in B that is
selected as actual output is
the range/image
●
Domain = {1,2,3,4}
●
Codomain = {1,2,3, ...,
8,9,10}
●
Range = {3,5,7,9}
12 / 64
Multiple Functions
● Let f1 and f2 be functions from A to B:
► (f1 + f2)(x) = f1(x) + f2(x)
► (f1 f2)(x) = f1(x) f2(x)
► Both map from A to B
13 / 64
Multiple Functions
● Let f1 and f2 be functions from A to B:
► (f1 + f2)(x) = f1(x) + f2(x)
► (f1 f2)(x) = f1(x) f2(x)
► Both map from A to B
● Example: Let f1 and f2 be functions from R to R such
that f1(x) = x2 and f2(x) = x-x2 . Find f1+f2 and f1 f2.
14 / 64
Multiple Functions
● Let f1 and f2 be functions from A to B:
► (f1 + f2)(x) = f1(x) + f2(x)
► (f1 f2)(x) = f1(x) f2(x)
► Both map from A to B
● Example: Let f1 and f2 be functions from R to R such
that f1(x) = x2 and f2(x) = x-x2 . Find f1+f2 and f1 f2.
16 / 64
Inverse Functions
●
Let f be a function from set A to set B. The
inverse function of f is noted as f −1 .
17 / 64
Inverse Functions
●
Let f be a function from set A to set B. The
inverse function of f is noted as f −1 .
18 / 64
Inverse Functions
●
Let f be a function from set A to set B. The
inverse function of f is noted as f −1 .
19 / 64
Finding Inverse Functions
●
We usually solve the inverse function using
algebraic method:
20 / 64
Composition of Functions
●
Function composition is applying one function to the
result of another.
●
The result of f() is sent through g()
●
You can write the composition above as
g( f(x) ) or (g ∘ f)(x)
21 / 64
Examples
22 / 64
Properties of Functions:
Injective, Surjective and Bijective
23 / 64
Injective
●
Injective / One-to-one function
●
A function f from X to Y is said to be one-to-
one if for each y∈Y, there is at most one
x∈X with f(x)=y.
●
Example:
Given X={1,2,3} and Y={a,b,c,d}, and
f : X → Y is defined as
f = {(1,b), (2,c), (3,a)}
The function f is a one-to-one function.
24 / 64
Invertible Functions
●
A one-to-one function is called invertible
function because we can define an inverse of
this function.
●
A function is not invertible if it is not a one-to-
one correspondence, because the inverse of
such a function does not exist.
●
Example:
► f(x) = x2 is not one-to-one, so it is not
invertible.
► f(2) = f(-2) = 4.
► f-1(x) = ± x½ is not a function 25 / 64
Surjective
●
A function f from X to Y is said to be
surjective if the range of f is Y, f is said to be
onto Y.
●
Example:
Given X={1,2,3,4} and Y={a,b,c}, and
f : X → Y is defined as
f = {(1,b), (2,c), (3,a),(4,a)}
The function f is a surjective function.
●
Range = Codomain! 26 / 64
Bijective
●
A function f from X to Y that is both injective
and surjective is called bijective.
●
Example:
Given X={1,2,3} and Y={a,b,c}, and
f: X→Y is defined as
f = {(1,b), (2,c), (3,a)}
●
The function f is a bijective function
●
Injective + surjective → Bijective
27 / 64
Example
28 / 64
Example
29 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example: show that for f:ℝ→ℝ defined as f(x)=5x+9
is an injective function.
30 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example: show that for f:ℝ→ℝ defined as f(x)=5x+9
is an injective function.
Assume a and b are real numbers in the domain.
f(a) = 5a+9 and f(b) = 5b+9
31 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example: show that for f:ℝ→ℝ defined as f(x)=5x+9
is an injective function.
Assume a and b are real numbers in the domain.
f(a) = 5a+9 and f(b) = 5b+9
32 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example: show that for f:ℝ→ℝ defined as f(x)=5x+9
is an injective function.
Assume a and b are real numbers in the domain.
f(a) = 5a+9 and f(b) = 5b+9
33 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example 2: show that for f:ℝ→ℝ defined as
f(x)=x2+9 is not an injective function.
34 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example 2: show that for f:ℝ→ℝ defined as
f(x)=x2+9 is not an injective function.
Assume a and b are real numbers in the domain.
f(a) = a2+9 and f(b) = b2+9
35 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example 2: show that for f:ℝ→ℝ defined as
f(x)=x2+9 is not an injective function.
Assume a and b are real numbers in the domain.
f(a) = a2+9 and f(b) = b2+9
36 / 64
How to determine a function is injective
(method 1: show that f(a) = f(b) iff a=b)
●
Example 2: show that for f:ℝ→ℝ defined as
f(x)=x2+9 is not an injective function.
Assume a and b are real numbers in the domain.
f(a) = a2+9 and f(b) = b2+9
37 / 64
How to determine a function is injective
(method 2: Using graph for a known domain)
38 / 64
How to determine a function is injective
(method 2: Using graph for a known domain)
39 / 64
How to determine a function is injective
(method 2: Using graph for a known domain)
43 / 64
How to determine a function is NOT
injective
(method 3: counterexample)
We can proof a function is NOT injective by providing a
counterexample
Example: Proof that f(x) = x2 + 9 is not injective
44 / 64
How to determine a function is NOT
injective
(method 3: counterexample)
We can proof a function is NOT injective by providing a
counterexample
Example: Proof that f(x) = x2 + 9 is not injective
f(3) = 32 + 9 = 18
f(-3) = (-3)2 + 9 = 18
Both x=3 and x=-3 maps to 18, with this counter example, we
proof that f(x) is not injective
45 / 64
How to determine a function is NOT
injective
(method 3: counterexample)
We can proof a function is NOT injective by providing a
counterexample
Example: Proof that f(x) = x2 + 9 is not injective
f(3) = 32 + 9 = 18
f(-3) = (-3)2 + 9 = 18
Both x=3 and x=-3 maps to 18, with this counter example, we
proof that f(x) is not injective
47 / 64
How to determine a function is
Surjective
Given function f : A→ B. To proof that it is surjective,
we need to show ∀y∃x y=f(x)
Example: Given f:R→R, Proof that f(x) = 5x + 9 is
surjective
48 / 64
How to determine a function is
Surjective
Given function f : A→ B. To proof that it is surjective,
we need to show ∀y∃x y=f(x)
Example: Given f:R→R, Proof that f(x) = 5x + 9 is
surjective
Assume f(x) = y = 5x + 9
x = (y-9)/5
49 / 64
How to determine a function is
Surjective
Given function f : A→ B. To proof that it is surjective,
we need to show ∀y∃x y=f(x)
Example: Given f:R→R, Proof that f(x) = 5x + 9 is
surjective
Assume f(x) = y = 5x + 9
x = (y-9)/5
50 / 64
How to determine a function is
Surjective
51 / 64
How to determine a function is
Surjective
Assume f(x) = y = x2 + 9
x = ±√y-9
52 / 64
How to determine a function is
Surjective
Assume f(x) = y = x2 + 9
x = ±√y-9
53 / 64
How to determine a function is
Surjective
54 / 64
How to determine a function is
Surjective
Using counterexample:
Assume f(x) = 2
2 = 5x + 9
x = -1.4
55 / 64
How to determine a function is
Surjective
Using counterexample:
Assume f(x) = 2
2 = 5x + 9
x = -1.4
From the result, if f(x)=2∈N, x=-1.4 but not a natural
number. Therefore we proof that f(x) is not surjective
56 / 64
How to determine a function is
Surjective
Using counterexample:
Assume f(x) = 2
2 = 5x + 9
x = -1.4
From the result, if f(x)=2∈N, x=-1.4 but not a natural
number. Therefore we proof that f(x) is not surjective
NOTE: never proof a function is
surjective by providing examples 57 / 64
More examples
●
f: R → R where y = x3
●
f: Z → Z where y = 9 − x2
●
f: R+ → R where f(x) = √ x+5
58 / 64
Common Functions
and
Function Types
59 / 64
Floor function
●
The floor function rounds x
down to the closest integer
less than or equal to x.
●
this function has the same
value throughout the interval
[n, n + 1), namely n.
●
Example: The floor of 3.9
and -3.9 are 3 and -4
respectively.
60 / 64
Ceiling function
●
The ceiling function rounds x
up to the closest integer
greater than or equal to x
●
this function has the same
value throughout the interval
(n, n + 1], namely n + 1.
●
Example: The ceiling of 4.1
and -3.1 are 5 and -3
respectively.
61 / 64
Piecewise Functions
Example:
62 / 64
Multivariable Functions
●
Some functions have more than one variables.
f: X x Y → Z
where X and Y are domains and Z is codomain
●
Sometimes, we can consider the variables of these
as vectors.
●
Example:
f(x,y) = x-y
f(4,2) = 2
f(3,-5) = 8
63 / 64
Formula
●
Assume that |X| and |Y| represent the number of
element in X and Y respectively.
●
The number of functions in f : X → Y is given by:
|Y||X|
●
The number of bijective functions in f : X → Y is:
|X|!
provided |X| = |Y|
Or 0 otherwise.
64 / 64