Skip to main content
Logo image

Section 0.2 Functions

Definition 0.2.1. Functions.

Let \(X\) and \(Y\) be two sets. A function from \(X\) to \(Y\), denoted \(f\colon X\rightarrow Y\text{,}\) is a rule which, given any input \(x\in X\text{,}\) returns an output \(y\in Y\text{.}\) In this case we write \(y=f(x)\) and call \(y\) the image of \(x\) under \(f\), or the value of \(f\) at \(x\). Similarly, we say \(f\) maps (or sends) the input \(x\) to the output \(y\text{.}\)
The set \(X\) is called the domain of \(f\text{;}\) the set \(Y\) is called the codomain of \(f\text{.}\)
When we wish to indicate what rule defines the function, we use the elaborated notation
\begin{align*} f\colon X \amp\rightarrow Y\\ x \amp\mapsto f(x)\text{.} \end{align*}
This is read as “The function \(f\) with domain \(X\) and codomain \(Y\) maps an input \(x\) to the output \(f(x)\)”.

Example 0.2.2.

Consider the function
\begin{align*} f\colon \mathbb{Z}\amp \rightarrow \mathbb{Z}\\ x\amp\mapsto x^2 \text{.} \end{align*}
This function has domain and codomain equal to \(\mathbb{Z}\) and maps an integer to its square.

Example 0.2.3. Arithmetic operations as functions.

Our familiar arithmetic operations can be expressed as functions whose inputs are pairs of numbers: addition is the function
\begin{align*} a\colon \R\times \R \amp\rightarrow \R \\ (x,y) \amp\mapsto x+y \end{align*}
and multiplication is the function
\begin{align*} m\colon\mathbb{R}\times \mathbb{R} \amp \rightarrow \mathbb{R}\\ (x,y)\amp\mapsto xy \end{align*}

Remark 0.2.4.

Invoking the notion of a rule in the definition of a function is admittedly somewhat vague. A more precise definition can be given using the Cartesian product. Namely, given sets \(X\) and \(Y\text{,}\) we define a function \(f\colon X\rightarrow Y\) to be a subset \(f\subseteq X\times Y\) satisfying the following property: for all \(x\in X\) there is a unique element \((x,y)\in f\text{.}\) The uniqueness of the pair \((x,y)\) then allows us to define the value \(f(x)\) of \(f\) at \(x\) as \(y\text{,}\) denoted \(f(x)=y\text{.}\)
As with sets and tuples, we are obliged to specify what we mean for two functions to be equal. The definition below makes clear how the the domain and codomain, as well as the rule that takes inputs to outputs, are all essential ingredients of a function.

Definition 0.2.5. Function equality.

Functions \(f\) and \(g\) are equal if
  1. they have the same domain \(X\) and codomain \(Y\text{,}\) and
  2. for all \(x\in X\text{,}\) we have \(f(x)=g(x)\text{.}\)

Definition 0.2.6. Image of a set.

Given a function \(f\colon X\rightarrow Y\) and a subset \(A \subseteq X\text{,}\) the image of \(A\) under \(f\), denoted \(f(A)\text{,}\) is defined as
\begin{equation*} f(A)=\left\{ y \in Y \colon f(a)=y \text{ for some } a \in A \right\}\text{.} \end{equation*}
In other words, \(f(A)\) is the set of all outputs \(f(a)\text{,}\) where \(a\in X\text{.}\)
The image of \(f\), denoted \(\operatorname{im} f\text{,}\) is the set of all outputs of \(f\text{:}\) i.e.,
\begin{equation*} \operatorname{im} f=f(X)=\left\{ y \in Y \colon f(x)=y \text{ for some } x \in X \right\}\text{.} \end{equation*}

Definition 0.2.7. Injective, surjective, bijective.

Let \(f\colon X\rightarrow Y\) be a function.
  • The function \(f\) is injective (or one-to-one) if for all \(x,x'\in X\text{,}\) if \(f(x)=f(x')\text{,}\) then \(x=x'\text{:}\) equivalently, if \(x\ne x'\text{,}\) then \(f(x)\ne f(x')\text{.}\)
  • The function \(f\) is surjective (or onto) if for all \(y\in Y\text{,}\) there is an \(x\in X\) such that \(f(x)=y\text{:}\) equivalently, \(\im f=Y\text{.}\)
  • The function \(f\) is bijective (or a one-to-one correspondence) if it is injective and surjective.

Example 0.2.8. Role of domain and codomain in injectivity and surjectivity.

Consider the following three functions
\begin{align*} f\colon \R \amp\rightarrow \R \amp g\colon [0,\infty)\amp\rightarrow \R \amp h\colon [0,\infty)\amp \rightarrow [0,\infty) \\ x \amp\mapsto x^2 \amp x \amp\mapsto x^2 \amp x \amp\mapsto x^2 \amp \text{.} \end{align*}
Although all three functions are defined using the same rule (\(x\mapsto x^2\)), they are not equal thanks to their differing domains and/or codomains. The choice of domain and codomain in these examples also plays a crucial role in determining whether the function is injective and/or surjective. The function \(f\) is neither injective (\(f(-2)=f(2)=4\)) nor surjective (\(f(X)=[0,\infty)\ne \R\)); the function \(g\) is injective but not surjective; the function \(h\) is both injective and surjective, hence bijective.

Definition 0.2.9. Function composition.

Suppose \(f\colon Z\rightarrow W\) and \(g\colon X\rightarrow Y\) are functions satisfying \(Y\subseteq Z\text{.}\) The composition of \(f\) and \(g\) is the function \(f\circ g\colon X\rightarrow W\) defined as \(f\circ g\, (x)=f(g(x)) \text{,}\) for all \(x\in X\text{.}\)

Definition 0.2.10. Identity and inverse functions.

For any set \(X\) the identity function on \(X\) is the function \(\id_X\colon X\rightarrow X\) defined as \(\id_X(x)=x\) for all \(x\in X\text{.}\)
A function \(f\colon X\rightarrow Y\) is invertible if there is a function \(g\colon Y\rightarrow X\) satisfying \(g\circ f=\id_X\) and \(f\circ g=\id_Y\text{:}\) i.e.,
\begin{align*} g(f(x))\amp =x \text{ for all } x\in X, \\ f(g(y))\amp=y \text{ for all } y\in Y \text{.} \end{align*}
The function \(g\) in this case is called the inverse of \(f\text{,}\) denoted \(g=f^{-1}\text{.}\)
The proof of this theorem is left as an example of proving “if and only if” statements. See Example 0.5.3.

Exercises Exercises

1.

Let \(f(x) = x^{2}\text{.}\) Find each set.
\(f ([1, 5)) =\)
\(f ((-4, 5)) =\)
Answer 1.
\(\left[1,25\right)\)
Answer 2.
\(\left[0,25\right)\)
Solution.
\(x^{2}\) is not one-to-one, you can not simply plug the endpoints of the interval into the function to get the endpoints of the answer. Instead, try graphing the function and shading on the \(x\)-axis the input set. Then use the graph to see which \(y\)-values you get out when you put those \(x\)’s in. For instance, notice that \(0 \in (-4, 5)\text{.}\) Because \(f(0) = 0\text{,}\) you should have \(0 \in f( (-4, 5))\text{.}\) Do you?

2.

For each of the following functions, \(f:\textbf{R}\longrightarrow\textbf{R}\) state whether they are one-to-one, onto, both or neither. Use the following key:
  1. \(\displaystyle f(x)=e^x\)
  2. \(\displaystyle f(x)=x^3+6\)
  3. \(\displaystyle f(x)=x(x-6)(x+6)\)
  4. \(\displaystyle f(x)=\left|x\right|\)
  5. \(\displaystyle f(x)=\sin(x)\)
  6. \(\displaystyle f(x)=x^2+4\)
  7. \(\displaystyle f(x)=x + 4\left|x\right|\)

3.

Consider the functions \(f(x) = \sqrt[7]{\frac{x}{4}} + 8\text{,}\) \(g(x) = -8 + 4 x^{7}\text{,}\) \(h(x) = \sqrt[7]{\frac{x}{4}} - 8\text{,}\) \(p(x) = \sqrt[7]{\frac{x - 8}{4}}\text{,}\) \(q(x) = 8 + 4 x^{7}\text{,}\) and \(r(x) = \sqrt[7]{\frac{x + 8}{4}}\text{.}\)
Which of these functions are inverses of each other?
  • \(p(x)\) and \(q(x)\)
  • \(g(x)\) and \(p(x)\)
  • \(f(x)\) and \(q(x)\)
  • \(h(x)\) and \(q(x)\)
  • \(g(x)\) and \(h(x)\)
  • \(q(x)\) and \(r(x)\)
  • \(g(x)\) and \(r(x)\)
  • \(f(x)\) and \(g(x)\)
  • No pairs of these functions are inverses of each other.
Solution.
SOLUTION One way we can check which functions are inverses is to make sure they satisfy the identities \(f \left( f^{-1}(x) \right)=x\) and \(f^{-1} \left( f(x) \right)=x\text{.}\) This will show that \(p(x)\) and \(q(x)\) and \(g(x)\) and \(r(x)\) are inverses of each other, while the other pairs of functions are not. Let’s consider \(p(x)\) and \(q(x)\text{.}\) The composition
\begin{equation*} \begin{aligned} p\left(q(x)\right) \amp = 8 + 4 \left(\sqrt[7]{ \frac{x - 8}{4}}\right)^{7} \\ \amp = 8 + 4 \left( \frac{x - 8}{4} \right) \\ \amp = 8 + (x-8) = x. \end{aligned} \end{equation*}
Also,
\begin{equation*} \begin{aligned} q\left(p(x)\right) \amp = \sqrt[7]{\frac{\left( 8+4 x^{7} \right)-8}{4}} \\ \amp = \sqrt[7]{x^{7}} = x. \end{aligned} \end{equation*}
Thus these are inverses of one another. We can similarly show that \(g(x)\) and \(r(x)\) are inverses of each other. However, the remaining pairs are not inverses. For example, if we consider \(q(x)\) and \(r(x)\text{,}\) we have
\begin{equation*} \begin{aligned} q\left(r(x)\right) \amp = 8 + 4 \left( \sqrt[7]{ \frac{x + 8}{4}} \right)^{7}\\ \amp = 8 + (x+8) = x + 16 \ne x. \end{aligned} \end{equation*}
Thus these functions are not inverses of each other.