Chapter 2 P 3
Chapter 2 P 3
Suppose that f : A → B.
To show that f is injective Show that if f (x) = f (y) for
arbitrary x, y ∈ A, then x = y.
To show that f is not injective Find particular
elements x, y ∈ A such that x ≠ y and f (x) = f (y).
To show that f is surjective Consider an arbitrary
element y ∈ B and find an element x ∈ A such that
f (x) = y.
To show that f is not surjective Find a particular y ∈ B
such that f (x) ≠ y for all x ∈ A.
© 2019 McGraw-Hill Education
Showing that f is one-to-one or onto 2
Example 1: If
2
f (x ) = x and g (x ) = 2 x + 1,
then
2
f (g (x )) = (2 x + 1)
and
2
g ( f (x )) = 2 x + 1
f (x ) = ⎡ x ⎤
is the smallest integer greater than or equal to x
Example: ⎡3.5⎤ = 4 ⎣3.5⎦ = 3
⎡−1.5⎤ = −1 ⎣−1.5⎦ = −2
© 2019 McGraw-Hill Education
Floor and Ceiling Functions 1
(2 ) x − 1 < ⎣ x⎦ ≤ x ≤ ⎡ x⎤ < x + 1
(3a ) ⎣− x ⎦ = − ⎡ x ⎤
(3b ) ⎡− x ⎤ = − ⎣ x ⎦
(4a ) ⎣ x + n⎦ = ⎣ x⎦ + n
(4b ) ⎡ x + n⎤ = ⎡ x⎤ + n
Stirling’s Formula:
n
Examples: n ! ! 2π n (n / e )
f (2 ) = 2! = 1 ⋅ 2 = 2
f (6 ) = 6! = 1 ⋅ 2 ⋅ 3 ⋅ 4 ⋅ 5 ⋅ 6 = 720
f (20 ) = 2, 432,902, 008,176, 640, 000.
© 2019 McGraw-Hill Education
Partial Functions (optional)
Definition: A partial function f from a set A to a set B is an
assignment to each element a in a subset of A, called the
domain of definition of f, of a unique element b in B.
• The sets A and B are called the domain and codomain of f,
respectively.
• We day that f is undefined for elements in A that are not in the
domain of definition of f.
• When the domain of definition of f equals A, we say that f is a total
function.
Example: f: Z → R where f(n) = √n is a partial function from Z
to R where the domain of definition is the set of nonnegative
integers. Note that f is undefined for negative integers.
Sequences.
• Examples: Geometric Progression, Arithmetic
Progression
Recurrence Relations
• Example: Fibonacci Sequence
Summations
1
an = {an } = {a1 , a2 , a3 ...}
n
1 1 1
1, , ,
2 3 4
Answer :
f 2 = f1 + f 0 = 1 + 0 = 1,
f3 = f 2 + f1 = 1 + 1 = 2,
f 4 = f3 + f 2 = 2 + 1 = 3,
f5 = f 4 + f3 = 3 + 2 = 5,
f 6 = f5 + f 4 = 5 + 3 = 8.
© 2019 McGraw-Hill Education
Solving Recurrence Relations
Finding a formula for the nth term of the sequence
generated by a recurrence relation is called solving the
recurrence relation.
Such a formula is called a closed formula.
Various methods for solving recurrence relations will be
covered in Chapter 8 where recurrence relations will be
studied in greater depth.
Here we illustrate by example the method of iteration in
which we need to guess the formula. The guess can be
proved correct by the method of induction (Chapter 5).
© 2019 McGraw-Hill Education