3. 3/20
• A function is a special kind of binary
relation.
• A binary relation f ⊆ A × B is a function if
for each a ∈ A there is a unique b ∈ B
Function Definition
1
2
3
α
β
γ
x
y
6. 6/20
An (n+1)-ary relation f ⊆ A1 × A2 × … × An
× B is a function if for each < a1, a2, …,
an> ∈ A1 × A2 × … × An there is a unique
b ∈ B.
Functions
with N-Dimensional Domains
α
β
γ
<1,1>
<1,2>
<1,3>
7. 7/20
• We can use various notation for functions: for
f = {(1, α),(2, β),(3, β)}
Notation for Functions
Notation (x, y) ∈ f f : x→y y = f(x)
Example (2, β) ∈ f f : 2→β β = f(2)
• In the notation, x is the argument or preimage
and y is the image. We can also have the
image of a set of arguments.
• For functions with n-ary domains, use <x0, x1,
…, xn> in place of x.
8. 8/20
Function Domain and Range
• f : A → B
– A is the domain space
• same as the domain (since all elements participate)
• dom f, dom(f), or domain(f)
– B is the range space
• may or may not be the same as the range, which is:
– {y | ∃x(y=f(x))}
– All rhs values in pairs (all that get “hit”)
πBf
• ran f, ran(f), range(f)
• f : D1 × D2 × … × Dn → Z
• f : Dn
→ Z (when all domains are the same)
9. 9/20
Remove the requirement that each a ∈ A must
participate. Retain the uniqueness requirement.
Partial Functions
Partial Function:
α
β
γ
f = {(<1,2>, β),(<1,3>, β),(<1,3>, γ)}
<1,3> not unique
<1,1>
<1,2>
<1,3>
α
β
γ
<1,1>
<1,2>
<1,3>
NOT a Partial Function:
α
β
γ
<1,1>
<1,2>
<1,3>
Partial Function: (A
Total Function is also a
Partial Function.)
10. 10/20
• Identity Function
– IA : A → A
– IA = {(x, x) | x ∈ A}
• Constant Function
– C : A → B
– C = {(x, c) | x ∈ A ∧ c ∈ B }
– Often A and B are the same
• C : A → A
• C= {(x, c) | x ∈ A ∧ c ∈ A}
Special Functions
11. Discussion #29 11/20
Composition of Functions
• Composition is written “°”
• Range space of f =
domain space of g
a
c
1
2
4
f
g
b
α
β
3
f(a) = 2 g(2) = α g(f(a)) = α
g°f(a) = α
f(b) = 2 g(2) = α g(f(b)) = α
g°f(b) = α
f(c) = 4 g(4) = β g(f(c)) = β
g°f(c) = β
12. Discussion #29 12/20
Injection: “one-to-one” or “1-1”
∀x∀y(f(x) = f(y) ⇒ x = y)
– For f : A → B, the elements in B are “hit” at most once
Injection
a
b
d
1
2
3
c
Injective
a
b
d
1
2
3
c
NOT Injective
x
y
x
y
13. 13/20
Surjection: “onto”
∀y∃x(y = f(x))
– For f : A → B, the elements in B are all “hit” at least once
Surjection
1
2
4
a
b
c
3
Surjective NOT Surjective
x
y
x
y
1
2
4
a
b
c
3
{not
“hit”
14. 14/20
Bijection: “one-to-one and onto” or “1-1 correspondence”
∀x∀y(f(x) = f(y) ⇒ x = y) ∧ ∀y∃x(y = f(x))
– For f : A → B, every B element is “hit” once and only once
Bijection
1
2
a
b
c
3
Bijective NOT Bijective
x
y
x
y
1
2
4
a
b
c
3
NOT Surjective
NOT injective
15. 15/20
Notes on Bijection
1. |A| = |B|
– An “extra” B cannot be “hit” (not a surjection)
– An “extra” A requires that at least one B must be
“hit” twice (not an injection)
1. If f is a bijection, swapping the elements of the
ordered pairs is a function
– Called the inverse
– Denoted f-1
– Is also a bijection
– f-1
(f(x)) is the identity function, i.e. f-1
(f(x)) = x.
16. 16/20
Notes on Bijection (continued …)
3. The inverse of an injection is a partial function.
If f : A →B is an injection, then f-1
is a partial function
4. Restricting the range space of an injective
function to the range yields a bijection
Remove b
a
b
d
1
2
3
c
f
a
b
d
1
2
3
c
f-1