Functions
Functions
What is a function?
𝐴= { 𝑎𝑙𝑖 , 𝑎h𝑚𝑎𝑑 , 𝑢𝑠𝑎𝑚𝑎 ,𝑛𝑜𝑜𝑟 } 𝑎𝑛𝑑 𝐵={𝑥 ∈ 𝑁 : 0 ≤ 𝑥 ≤ 30 }
20
25
30
22
Determine whether the function f from {a, b, c, d} to {1, 2, 3, 4, 5} with f (a) = 4, f (b) = 5, f (c) = 1, and f (d)
= 3 is one-to-one.
Determine whether the function from the set of integers to the set of integers is one-to-one.
Determine whether the function f (x) = x + 1 from the set of real numbers to itself is one-to-one.
Onto Function
• A function f from A to B is called onto, or a surjection, if and only if for every element b ∈ B there
is an element a ∈ A with f (a) = b. A function f is called surjective if it is onto.
Bijective Function
Let f be the function from {a, b, c, d} to {1, 2, 3, 4} with f (a) = 4, f (b) = 2, f (c) = 1, and f (d) = 3. Is f a
bijection?
ASCII Table as function
Array as Function