Functions and Relations
Last update:
.Functions
Functions are the language of higher mathematics!
Let A and B be sets. A function f:A→B is a relation f⊆A×B such that for all a∈A there is a unique b∈B such that (a,b)∈f. The set A is called the source or domain of f, written dom(f)=A. The set B is called the target or codomain of f, written cod(f)=B.
Usually we will write f(a)=b rather than (a,b)∈f or afb.
For every set A there is an identity function idA:A→A having idA(a)=a for all a∈A.
Functions f and g with the same domain and codomain are equal when f(x)=g(x) for all x∈dom(f).
As relations, functions are special; functions take an input and produce a unique output for that input.
Given two compatible functions, we can get another function from them!
Functions f:A→B and g:B→C have composition g∘f:A→C, x↦g(f(x)).
For all f:A→B, g:B→C, and h:C→D we have h∘(g∘f)=(h∘g)∘f.
For all x∈dom(f) we have the following equalities, completing the proof.
(h∘(g∘f))(x)=h((g∘f)(x))=h(g(f(x)))=(h∘g)(f(x))=((h∘g)∘f)(x).Let f:A→B be a function.
- The preimage of a set S⊆B under f is the set f−1(S)={x∈A:f(x)∈S}.
- The image of a set T⊆A under f is the set f(T)={f(x)∈B:x∈T}.
The next several propositions are straightforward applications of the definitions presented here. The proofs are left to you as a method of checking your understanding.
Let f:A→B be a function.
- If S⊆T⊆A, then f(S)⊆f(T).
- If S⊆T⊆B, then f−1(S)⊆f−1(T).
Let f:A→B be a function.
- For all S⊆A we have S⊆f−1(f(S)).
- For all T⊆B we have f(f−1(T))⊆T.
Let f:A→B be a function and S,T⊆A. The following all hold:
- f(S∪T)=f(S)∪f(T)
- f(S∩T)⊆f(S)∩f(T)
- f(S∖T)⊇f(S)∖f(T)
Find examples of functions and subsets for which the above subset relations are strict.
The following proposition makes a nice exercise.
Let f:A→B be a function and S,T⊆B. The following all hold.
- f−1(S∪T)=f−1(S)∪f−1(T)
- f−1(S∩T)=f−1(S)∩f−1(T)
- f−1(S∖T)=f−1(S)∖f−1(T)
Let f:A→B be a function.
- Function f is injective or into when for all a,a′∈A we have f(a)=f(a′) implies a=a′.
- Function f is surjective or onto when for all b∈B there exists an a∈A such that f(a)=b.
- Function f is bijective or a one-to-one correspondence when f is both injective and surjective.
The identity function idA:A→A is bijective.
Write down examples of functions which are injective, surjective, and bijective. Can you write down a function which is injective but not surjective? How about one which is surjective but not injective?
If f is injective, can you strengthen Proposition 1? What if f is surjective?
In Calculus, you may have studied some inverse functions (the Inverse Function Theorem needs them!).
Let f:A→B be a function.
- A left inverse of f is a function g:B→A such that g∘f=idA.
- A right inverse of f is a function g:B→A such that f∘g=idB.
- An inverse of f is a function g:B→A such that g is both a left inverse of f and a right inverse of f.
The function idA is its own inverse.
Find functions that have a left inverse but no right inverse and vice-versa.
The following proposition gives the relationship between invertibility and the properties above.
Let f:A→B be a function with A≠∅.
- Function f has a left inverse if and only if f is injective.
- Function f has a right inverse if and only if f is surjective.
- Function f has an inverse if and only if f is bijective.
Let f:A→B be a function.
Part 1: Supposing f has a left inverse g, then (g∘f)(a)=a for all a∈A. Thus g(f(a))=a for all a∈A. If f(a)=f(a′) for some a,a′∈A, then a=g(f(a))=g(f(a′))=a′; hence f is injective. Supposing f is injective, fix an element a0∈A (this is why we need A≠∅) and define
g(x)={aif x=f(a) for some a∈Aa0otherwisefor all x∈B. If f(a)=f(a′), then a=a′ by injectivity; thus g is well-defined. Moreover (g∘f)(x)=g(f(x))=x for all x∈A; hence g∘f=idA and g is a left inverse of f.
Part 2: Supposing f has a right inverse g, then (f∘g)(b)=b for all b∈B. Thus for all b∈B one has g(b)∈A and f(g(b))=b; hence f is surjective. Supposing f is surjective, we fix for all b∈B an element ab∈A with f(ab)=b.\footnote{This is possible by an abstract axiom of set theory (called the Axiom of Choice). Mathematicians argued for a long time over whether or not this is a good axiom because it has a lot of weird consequences. To learn more, email me…} Now define g:B→A by g(b)=ab; note that this is well-defined by surjectivity of f. Moreover (f∘g)(x)=f(g(x))=f(ax)=x for all x∈B; hence f∘g=idB and g is a right inverse of f.
Part 3: Supposing f has an inverse, f has both a left and right inverse; hence by Part 1 and Part 2, f is both injective and surjective, and thus bijective. If f is bijective, then f is injective and surjective by definition; thus by Part 1 and Part 2 f has a left inverse g and a right inverse g′. Now g=g∘idB=g∘(f∘g′)=(g∘f)∘g′=idA∘g′=g′ and hence g is both a left and right invere for f.
Let f:A→B be a function.
- If f is injective, then for all S⊆dom(f) we have f−1(f(S))=S.
- If f is surjective, then for all T⊆cod(f) we have f(f−1(S))=S.
Exercise (HINT: you can use the preceeding proposition).