Skip to main content
\( \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section7Functions

There is no doubt that you have heard of the word "function". In fact, you probably know many different kinds of functions, for example, linear functions, polynomial functions, logarithm functions, exponential functions, trignometric functions, etc. But what is the definition of a function? One might say a function is a rule that assigns a number to any chosen number. For example, the function \(y=2x+1\) assigns \(3\) to \(1\), and assigns \(2\pi +1\) to \(\pi\). First of all, what does it mean when we say "assign"? Second, do functions have to do with numbers? Let us consider the following example. Let \(U\) be the set of all members of Utica College and let \(C\) be the set of colors. Let \(f\) be a function from \(U\) to \(C\) that assigns a person their hair color. For example \(f(\text{Xiao Xiao})\) is black. Cleary \(f\) is a function but it has nothing to do with numbers. So what is the definition of a function?

Subsection7.1Basic Definition

Definition7.1

A function from a set \(A\) to a set \(B\) is a relation \(f\) from \(A\) to \(B\) such that the following two conditions hold:

  1. for any \(a \in A\), there exists \(b \in B\) such that \((a,b) \in f\) and
  2. the existence of \(b\) is unique, namely, if there exists \(b' \in B\) such that \((a,b') \in f\), then \(b = b'\).

The set \(A\) is called the domain of the function and the set \(B\) is called the codomain of the function. If \((a,b) \in f\), we denote \(b\) by \(f(a)\). We write \(f: A \to B\) and read "\(f\) is a function from \(A\) to \(B\)".

Definition7.3

Let \(f: A \to B\) be a function. For any element \(a \in A\), the element \(f(a) \in B\) is called the image of \(a\) (in \(B\) under \(f\)). For any \(X \subset A\), the set \begin{equation*}f(X) := \{f(a) \in B \; | \; a \in X\} \subset B\end{equation*} is called the image of \(X\) (in \(B\) under \(f\)). When \(X=A\), we call the set \(f(A)\) the image of the function \(f\).

Definition7.6

Let \(f: A \to B\) be a function. For any element \(b \in B\), the set \begin{equation*}f^{-1}(b) := \{a \in A \; | \; f(a) = b\}\end{equation*} is called the preimage of \(b\). Similarly, for any subset \(Y\) of \(B\), the set \begin{equation*}f^{-1}(Y) := \{a \in A \; | \; f(a) \in Y\}\end{equation*} is called the preimage of \(Y\).

Note that the image of an element in the domain of a function is an element of the codomain but the preimage of an element in codomain is a subset of the domain.

Subsection7.2Injection, Surjection, Bijection and Inverse

Definition7.13

Let \(f: A \to B\) be a function. We say that \(f\) is one-to-one provided that for any \(b \in B\) there exists at most one \(a \in A\) such that \(f(a) = b\). If \(f\) is one-to-one, we also say that \(f\) is an injection.

Definition7.15

Let \(f: A \to B\) be a function. We say that \(f\) is onto provided that for any \(b \in B\) there exists at least one \(a \in A\) such that \(f(a) = b\). If \(f\) is onto, we also say that \(f\) is an surjection.

Definition7.17

We say that a function \(f: A \to B\) is a one-to-one correspondence, or bijection provided that \(f\) is one-to-one and onto.

Before you continue to solve tasks about one-to-one and onto functions, you need to think about what the general strategy should be. If \(f\) is a one-to-one function, then for any element \(b\) in the codomain, that exists at most one element \(a\) in the domain so that \(f(a)=b\). So there are two possibilities, either there is no \(a\) in the domain so that \(f(a) = b\) or there is exactly one element \(a\) in the domain so that \(f(a) = b\). Now let us recall how we show a statement of the form if \(P\), then \(Q\) or \(R\). We show it by assuming \(P \land (\sim Q)\) is true and show that \(R\) is true. Put things in context, we suppose that there is indeed an element \(a\) in the domain so that \(f(a) = b\) (this is the \((\sim Q)\) statement) and show that the choice of \(a\) is unique, namely there is exactly one element \(a\) in the domain so that \(f(a) = b\) (this is the \(R\) statement).

Now how do we show that there is exactly one element \(a\) in the domain so that \(f(a) = b\)? One way of saying the same thing is that it is impossible to have two distinct elements \(a_1\) and \(a_2\) such that \(f(a_1) = f(a_2) = b\), or equivalently, if \(a_1\) and \(a_2\) are two distinct elements in the domain, then \(f(a_1)\) and \(f(a_2)\) are distinct elements in the codomain. Another way of saying the same thing is its contrapositive, namely, if \(f(a_1)\) and \(f(a_2)\) are the same elements in the codomain, then \(a_1\) and \(a_2\) are the same elements in the domain. Now which one do you think is easier to work with. Choose one that you prefer and solve the following tasks.

The strategy of showing a function is onto is much simpler. To show that for every \(b\) in the codomain, there exists an element \(a\) in the domain such that \(f(a)=b\), we just have to find an expression of \(a\) (in terms of \(b\)) such that when we plug in the expression of \(a\) into the formula of \(f\), we are guarantee to get \(b\).

For each of the following three tasks, find out if the function is one-to-one, onto, and/or one-to-one correspondence. Explain your answer.

Definition7.24

For any function \(f: A \to B\), we define its inverse relation \begin{equation*}\text{INV}(f) = \{(b,a) \; | \; (a,b) \in f\}.\end{equation*}

Definition7.27

If \(f: A \to B\) is a one-to-one correspondence, then the function defined by its inverse relation \(\text{INV}(f)\) is called the inverse of \(f\), and is denoted by \(f^{-1}\).

Subsection7.3Composition

Definition7.28

If \(f: A \to B\) and \(g: B \to C\) are two functions, then a new function \(g\circ f : A \to C\) can be defined by \((g \circ f)(a) = g(f(a))\) for all \(a \in A\). The new function \(g \circ f\) is called \(g\) composed with \(f\).

Let us investigate some relationship betweens \(g, f\) and \(g \circ f\).

Task 7.29 says that if only one of \(f\) and \(g\) is one-to-one (respectively onto) then \(g \circ f\) does not have to be one-to-one (respectively onto). The next task says that if both \(f\) and \(g\) are one-to-one (respectively onto) then \(g \circ f\) will be as well.

Now let us consider the converse. Suppose \(g\circ f\) is one-to-one (respectively onto), can we say that \(f\) and/or \(g\) is one-to-one (respectively onto) as well?

Given three functions \(f: A \to B\), \(g: B \to C\) and \(h: C \to D\), there are two ways to compose them. We can first compose \(g\) with \(f\) to get \(g \circ f : A \to C\), then compose \(h\) with \(g \circ f\) to get \(h \circ (g \circ f) : A \to C\). Or we can first compose \(h\) with \(g\) to get \(h \circ g: B \to C\), then compose \(h \circ g\) with \(f\) to get \((h \circ g) \circ f : A \to C\). We know that \(h \circ (g \circ f) : A \to C\) and \((h \circ g) \circ f): A \to C\) have the same domain and codomain but are they the same functions?

Definition7.33

For any set \(A\), there exists a function \(\mathrm{id}_A : A \to A\) defined by \(\mathrm{id}_A(a) = a\) for all \(a \in A\). This function \(\mathrm{id}_A\) is called the identity function on \(A\).

Question: Is \(\mathrm{id}_A\) one-to-one? Is \(\mathrm{id}_A\) onto?