Functions
Tags: discrete math, set theory
Definition1: A function f:A→B from a domain A to a codomain B is a set of pairs (x,y):x∈A,y∈B, each x∈A appears in exactly one pair. e.g.
{(x,x2)∈R2∣x∈R}is a formal description of the square function.
Definition2: A function f:A→B from a domain A to a codomain B is a relation from A to B with the special properties (using the relation notation a f b):
- ∀a∈A ∃b∈B a f b (f is totally defined)
- ∀a∈A ∀b,b′∈B(a f b∧a f b′→b=b′) (f is well defined)
The first property means there’s always a b in B that a can map to. The second property means there’s only one b that a can map to.
How many functions are possible from a set of x elements to set of y elements?
n(f)=y×y×y...×y=yxInjective (one-to-one)
If x1≠x2, then f(x1)≠f(x2),i.e., not two distinct values are mapped to the same function value (there are no “collisions”).
Example: Let f:Z→Q be defined by f(n)=n/1. Then f is one-to-one but not onto.
How many injective functions are possible from a set of x elements to set of y elements?
n(f)=y×(y−1)×(y−2)...(y−(x−1))=ypxIf x=y, then n(f)=n!
Surjective (onto)
Let f:X→Y
f is surjective iff ∀y∈Y,∃x∈X such that f(x)=y (every value in the codomain is taken on for some argument).
Example: Define g:Q→Z by g(p/q)=p where p/q is a rational number expressed in its lowest terms with a positive denominator. The function g is onto but not one-to-one.
Bijective (one-to-one and onto)
If it is both injective and surjective.
Let f:A→B,g:B→C, andh:C→D. Then
- The composition of mapping is associative: that is, (h∘g)∘f=h∘(g∘f);
- If f and g are both one-to-one, then the mapping g∘f is one-to-one;
- If f and g are both onto, then the mapping g∘f is onto;
- If f and g are bijective, then so is g∘f.
Read more: