Functions and Relations
Last update:
.Functions
Functions are the language of higher mathematics!
Let \( A \) and \( B \) be sets. A function \( f \colon A \to B \) is a relation \( f \subseteq A \times B \) such that for all \( a \in A \) there is a unique \( b \in B \) such that \( (a, b) \in 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)\in f \) or \( a\, f\, b \).
For every set \( A \) there is an identity function \( \id_A \colon A \to A \) having \( \id_A(a) = a \) for all \( a \in A \).
Functions \( f \) and \( g \) with the same domain and codomain are equal when \( f(x) = g(x) \) for all \( x \in \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 \colon A \to B \) and \( g \colon B \to C \) have composition \( g \circ f \colon A \to C,~~x \mapsto g(f(x)) \).
For all \( f \colon A \to B \), \( g \colon B \to C \), and \( h \colon C \to D \) we have \( h \circ (g \circ f) = (h \circ g) \circ f \).
For all \( x\in\dom(f) \) we have the following equalities, completing the proof.
\begin{align*} (h \circ (g \circ f))(x) &= h((g \circ f)(x)) \\ &= h(g(f(x))) \\ &= (h \circ g)(f(x)) \\ &= ((h \circ g) \circ f)(x) . \end{align*}Let \( f \colon A \to B \) be a function.
- The preimage of a set \( S \subseteq B \) under \( f \) is the set \( f^{-1}(S) = \set{x \in A}{f(x) \in S} \).
- The image of a set \( T \subseteq A \) under \( f \) is the set \( f(T) = \set{f(x) \in B}{x \in 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 \colon A \to B \) be a function.
- If \( S \subseteq T \subseteq A \), then \( f(S) \subseteq f(T) \).
- If \( S \subseteq T \subseteq B \), then \( f^{-1}(S) \subseteq f^{-1}(T) \).
Let \( f \colon A \to B \) be a function.
- For all \( S \subseteq A \) we have \( S \subseteq f^{-1}(f(S)) \).
- For all \( T \subseteq B \) we have \( f(f^{-1}(T)) \subseteq T \).
Let \( f \colon A \to B \) be a function and \( S, T \subseteq A \). The following all hold:
- \( f(S \cup T) = f(S) \cup f(T) \)
- \( f(S \cap T) \subseteq f(S) \cap f(T) \)
- \( f(S \setminus T) \supseteq f(S) \setminus 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 \colon A \to B \) be a function and \( S, T \subseteq B \). The following all hold.
- \( f^{-1}(S \cup T) = f^{-1}(S) \cup f^{-1}(T) \)
- \( f^{-1}(S \cap T) = f^{-1}(S) \cap f^{-1}(T) \)
- \( f^{-1}(S \setminus T) = f^{-1}(S) \setminus f^{-1}(T) \)
Let \( f \colon A \to B \) be a function.
- Function \( f \) is injective or into when for all \( a, a' \in A \) we have \( f(a) = f(a') \) implies \( a = a' \).
- Function \( f \) is surjective or onto when for all \( b \in B \) there exists an \( a \in 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 \( \id_A \colon A \to 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 \colon A \to B \) be a function.
- A left inverse of \( f \) is a function \( g \colon B \to A \) such that \( g \circ f = \id_A \).
- A right inverse of \( f \) is a function \( g \colon B \to A \) such that \( f \circ g = \id_B \).
- An inverse of \( f \) is a function \( g \colon B \to A \) such that \( g \) is both a left inverse of \( f \) and a right inverse of \( f \).
The function \( \id_A \) 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 \colon A \to B \) be a function with \( A \neq \emptyset \).
- 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 \colon A \to B \) be a function.
Part 1: Supposing \( f \) has a left inverse \( g \), then \( (g \circ f)(a) = a \) for all \( a \in A \). Thus \( g(f(a)) = a \) for all \( a \in A \). If \( f(a) = f(a') \) for some \( a,a' \in A \), then \( a = g(f(a)) = g(f(a')) = a' \); hence \( f \) is injective. Supposing \( f \) is injective, fix an element \( a_0\in A \) (this is why we need \( A\neq\emptyset \)) and define
\begin{equation*} g(x)= \begin{cases} a &\text{if } x = f(a) \text{ for some } a \in A \\ a_0 &\text{otherwise} \end{cases} \end{equation*}for all \( x \in B \). If \( f(a) = f(a') \), then \( a = a' \) by injectivity; thus \( g \) is well-defined. Moreover \( (g \circ f)(x) = g(f(x)) = x \) for all \( x \in A \); hence \( g \circ f = \id_A \) and \( g \) is a left inverse of \( f \).
Part 2: Supposing \( f \) has a right inverse \( g \), then \( (f \circ g)(b) = b \) for all \( b \in B \). Thus for all \( b \in B \) one has \( g(b) \in A \) and \( f(g(b)) = b \); hence \( f \) is surjective. Supposing \( f \) is surjective, we fix for all \( b \in B \) an element \( a_b \in A \) with \( f(a_b) = 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 \colon B \to A \) by \( g(b) = a_b \); note that this is well-defined by surjectivity of \( f \). Moreover \( (f \circ g)(x) = f(g(x)) = f(a_x) = x \) for all \( x \in B \); hence \( f \circ g = \id_B \) 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 \circ \id_B = g \circ (f \circ g') = (g \circ f) \circ g' = \id_A \circ g' = g' \] and hence \( g \) is both a left and right invere for \( f \).
Let \( f \colon A \to B \) be a function.
- If \( f \) is injective, then for all \( S \subseteq \dom(f) \) we have \( f^{-1}(f(S)) = S \).
- If \( f \) is surjective, then for all \( T \subseteq \cod(f) \) we have \( f(f^{-1}(S)) = S \).
Exercise (HINT: you can use the preceeding proposition).