Week 5 Class 1 - Basic Structures & Functions
Week 5 Class 1 - Basic Structures & Functions
Math 1056
By
Dr. Haider
haider.amir@algomau.ca
and
x, y1 , y2 x, y1 f x, y2 f y1 y2
f x x 1
• A computer program.
• A Java program that when given an integer n, produces
the nth Fibonacci Number.
f S f s | s S
f {a,b,c,} is ? {y,z}
f {c,d} is ? {z}
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
f x x and g x 2 x 1,
2
then
f g x 2 x 1
2
and
g f x 2 x 1
2