\( \newcommand{\mc}{\mathcal} \newcommand{\bb}{\mathbb} \newcommand{\powerset}[1]{\mathbb{P}\left(#1\right)} \newcommand{\set}[2]{\left\{#1:#2\right\}} \newcommand{\genrel}[2]{\left\langle#1:#2\right\rangle} \newcommand{\id}{\operatorname{id}} \newcommand{\dom}{\operatorname{dom}} \newcommand{\cod}{\operatorname{cod}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\N}{\mathbb{N}_0} \newcommand{\Q}{\mathbb{Q}} \newcommand{\R}{\mathbb{R}} \newcommand{\C}{\mathbb{C}} \newcommand{\abs}{\operatorname{abs}} \newcommand{\mat}[3]{\mathbb{M}_{#3}(#1, #2)} \newcommand{\gl}[2]{\operatorname{GL}_{#2}(#1)} \newcommand{\sl}[2]{\operatorname{SL}_{#2}(#1)} \newcommand{\inv}[1]{#1^{-1}} \newcommand{\sgn}{\operatorname{sgn}} \)

Functions and Relations

Last update: Thursday, 6 October 2022.

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.

  1. The preimage of a set \( S \subseteq B \) under \( f \) is the set \( f^{-1}(S) = \set{x \in A}{f(x) \in S} \).
  2. 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.

  1. If \( S \subseteq T \subseteq A \), then \( f(S) \subseteq f(T) \).
  2. If \( S \subseteq T \subseteq B \), then \( f^{-1}(S) \subseteq f^{-1}(T) \).

Let \( f \colon A \to B \) be a function.

  1. For all \( S \subseteq A \) we have \( S \subseteq f^{-1}(f(S)) \).
  2. 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:

  1. \( f(S \cup T) = f(S) \cup f(T) \)
  2. \( f(S \cap T) \subseteq f(S) \cap f(T) \)
  3. \( 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.

  1. \( f^{-1}(S \cup T) = f^{-1}(S) \cup f^{-1}(T) \)
  2. \( f^{-1}(S \cap T) = f^{-1}(S) \cap f^{-1}(T) \)
  3. \( f^{-1}(S \setminus T) = f^{-1}(S) \setminus f^{-1}(T) \)

Let \( f \colon A \to B \) be a function.

  1. Function \( f \) is injective or into when for all \( a, a' \in A \) we have \( f(a) = f(a') \) implies \( a = a' \).
  2. Function \( f \) is surjective or onto when for all \( b \in B \) there exists an \( a \in A \) such that \( f(a) = b \).
  3. 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.

  1. A left inverse of \( f \) is a function \( g \colon B \to A \) such that \( g \circ f = \id_A \).
  2. A right inverse of \( f \) is a function \( g \colon B \to A \) such that \( f \circ g = \id_B \).
  3. 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 \).

  1. Function \( f \) has a left inverse if and only if \( f \) is injective.
  2. Function \( f \) has a right inverse if and only if \( f \) is surjective.
  3. 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.

  1. If \( f \) is injective, then for all \( S \subseteq \dom(f) \) we have \( f^{-1}(f(S)) = S \).
  2. 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).