Skip to main content

Chapter 2 Functions

Every mathematics, science, and engineering course makes heavy use of functions. Having developed a deep understanding of sets and ordered pairs, we are now in a position to define function in terms of set of ordered pairs.

First, recall from Definition 1.29 that the Cartesian product of \(\X\) and \(\Y\) is \(\X \times \Y = \{(x,y) \mid x \in X \mbox{ and } y\in Y\}\text{.}\)

Definition 2.1.

Let \(\X\) and \(\Y\) be sets. A relation on \(\X \times \Y\) is any subset of \(\X \times \Y\text{.}\) A function on \(\X \times \Y\) is a relation on \(\X \times \Y\) where no two elements have the same first coordinates. The set of all first coordinates of a relation is called the domain and the set of all second coordinates of a relation is called the range.

Example 2.2.

Let \(\A = \{ x \in \R \mid - 3 \leq x \leq 3 \}\text{.}\) The set \(\C = \{ (x,y) \in \R \times \R \mid x^2 + y^2 = 9 \}\) is a relation on \(\A \times \A\) but not a function on \(\A \times \A\text{.}\)

Example 2.3.

The set \(f = \{ (x,y) \mid x \in \R \ \mbox{ and } \ y = 2x-3 \}\) is a function on \(\R \times \R\text{.}\) How do we prove this?

Problem 2.4.

Let \(\A = \{ 1, 2, 3 \}\) and \(\B = \{ \Box, \Diamond, \triangle \}\text{.}\) Which of the following are relations on \(\A \times \B\text{?}\) Which are functions?

  1. \(\displaystyle \{ (1, \Box) , (1, \triangle), (2, \Diamond) \}\)

  2. \(\displaystyle \{ (3, \Box) , (1, \triangle), (2, \triangle) \}\)

  3. \(\displaystyle \{ \big( (1,1) , \Box \big) , \big( (1,2) , \triangle), \big( (2,1) , \Diamond \big), \big( (2,2) , \Diamond \big) \}\)

Problem 2.5.

Consider the function \(f\) defined by

\begin{equation*} f = \{ (x,y) \mid x \in \R \sim \{1\} \ \mbox{ and } \ y = \frac{2x}{x-1} \}\text{.} \end{equation*}

State the domain and the range of this function.

Problem 2.6.

Consider

\(f = \{ (x,y) \mid x \in \R \ \mbox{ and } \ y = \sin(2x) + \sin^2(x) + \cos^2(x) \}\) and

\(g = \{ (x,y) \mid x \in \R \ \mbox{ and } \ y = 2\sin(x)\cos(x) + 1 \}\text{.}\)

Are these the same function?

Since we often think of a function \(f\) on \(\X \times \Y\) as a rule assigning elements of \(\X\) to elements of \(\Y\text{,}\) we often write \(f : \X \to \Y\text{.}\) When \((x,y)\) is an element of \(f\) we write, \(f(x)=y\) and say that \(f\) maps \(x\) to \(y\text{.}\) When we use this notation, it means that \(\X\) is the domain of \(f\) and \(\Y\) contains the range of \(f\text{.}\) In such cases, we call \(\Y\) the codomain of \(f\text{.}\)

Definition 2.7.

If \(f: \X \to \Y\) is a function, then \(f\) is one-to-one if no two elements of \(f\) have the same second coordinate and different first coordinates. Restated, no two elements of \(\X\) can map to the same element of \(\Y\text{.}\) We say that \(f\) is onto the set \(Y\) if for each element \(y \in \Y\) there is some element \(x \in \X\) such that \(f(x) = y\text{.}\) A function \(f:X \to Y\) that is both one-to-one and onto is a bijection.

Example 2.8.

Let \(f = \{(x,y) \mid x\in \R \mbox{ and } y = x^2 + 3\}\text{.}\) We might write the same function as \(f: \R \to \R\) where \(f(x) = x^2+3\text{.}\) Is \(f\) onto \(\R\text{?}\) Is \(f\) onto \(\{ y \mid y \geq 3 \}\text{?}\) We would call \(\R\) a codomain of \(f\text{.}\)

Problem 2.9.

Suppose \(\dsp f(x) = \frac{x^2-5x+6}{x-3} \mbox{ and } g(x) = x-2\text{.}\) What is the largest subset of \(\R\) that is an allowable domain for \(f\text{?}\) For \(g\text{?}\) Does \(f=g\text{?}\)

Problem 2.10.

Let \(\ps\) denote the set of all subsets of a set \(\U\text{,}\) and choose two particular sets \(\A, \B \in \ps\text{.}\) Let \(f: \ps \to \ps\) and \(g: \ps \to \ps\) be the functions defined by: \(f(\X) = \X \cap (\A \sim \B)\) for every \(X \in \ps\) and \(g(\X) = (\X \cap \A) \sim (\X \cap \B)\) for every \(X \in \ps\text{.}\) What is the domain of \(f\text{?}\) Of \(g\text{?}\) Does \(f=g\text{?}\)

Definition 2.11.

For real valued functions \(f:\mathbb R \to \mathbb R\) and \(g:\mathbb R \to \mathbb R\) define a new function \(f+g:\mathbb R \to \mathbb R\text{,}\) called the sum of \(f\) and \(g\text{,}\) by the rule \((f+g)(x) = f(x) + g(x)\) for \(x\in \mathbb R\text{.}\)

Problem 2.12.

Suppose each of \(f: \R \to \R\) and \(g: \R \to \R\) are functions and prove that \(f+g = g+f\) by showing that \((f+g)(x) = (g+f)(x)\) for all \(x \in \R\text{.}\) This shows that addition of functions is commutative.

Problem 2.13.

Let \(\A = \{1,2,3,4,5,6,7,8,9\}\text{.}\) Table 2.14 defines a function \(f:\A \to \A\text{.}\) For each \(x \in \A\text{,}\) the value of \(f(x)\) is written below \(x\text{.}\) Is \(f\) one-to-one? Is \(f\) onto \(\A\text{?}\) Is \(f\) a bijection?

Table 2.14. A function, \(f\)
x 1 2 3 4 5 6 7 8 9
f(x) 5 7 9 3 1 2 6 4 8
Problem 2.15.

Let \(\dsp f = \{ (x,y) \mid x \in \R \sim \{2\} \ \mbox{ and } \ y = \frac{x}{x-2} \}\text{.}\)

  1. Is \(f\) a one-to-one function?

  2. Is \(f\) onto the set \(\R\text{?}\)

Problem 2.16.

Define \(f : \R \to \R\) by \(f(x) = \sqrt[3]{x-1}\text{.}\)

  1. Is \(f\) a one-to-one function?

  2. Is \(f\) onto \(\R\text{?}\)

By Definition 2.1, every function \(f: \X \to \Y\) is onto its range since the range of \(f\) is the set of all \(y\) such that \((x,y) \in f\) for some \(x \in \X\text{.}\) Restated, the range of \(f\) is \(\{ y \mid (x,y) \in f \} = \{ f(x) \mid x \in \X \}\)

Should you ever board an airplane (a function) that “maps” you from Houston to Chicago, at some point in the future you will definitely want to board another airplane (the inverse function) that “maps” you back home! Countless people have been lost because they built a time travel machine but forgot to build the inverse time machine!

Problem 2.17.

Figure 2.18 shows the relationship between the Fahrenheit and Celsius temperature scales. Write a formula (equation) for a function \(f\) that converts Celsius to Fahrenheit, and a function \(c\) that converts Fahrenheit back to Celsius. Verify that \(f(c(F)) = F\) for every \(F \in \R\) and that \(c(f(C)) = C\) for every \(C \in \R\text{.}\)

Figure 2.18. Thermometer showing Fahrenheit and Celsius temperature scales

Definition 2.19.

Given a function \(f: X \to Y\text{,}\) the relation \(f^{-1}\) is defined by \(f^{-1} = \{ (y,x) \mid (x,y) \in f \}\text{.}\)

The set \(f^{-1}\) might not be a function. The next two problems tell us exactly when \(f^{-1}\) is a function.

Problem 2.20.

Let \(f\) be a function from \(X\) onto \(Y\text{.}\) Show that if \(f\) is one-to-one, then \(f^{-1}\) is a function.

Problem 2.21.

Let \(f\) be a function from \(X\) onto \(Y\text{.}\) Show that if \(f^{-1}\) is a function, then \(f\) is one-to-one.

Together Problems 2.20 and Problem 2.21 show that a function \(f\) is one-to-one if and only if \(f^{-1}\) is a function. Many mathematicians do not define the inverse of a relation and don't define the inverse of a function unless that function is one-to-one. In this case they would say “if \(f\) is a function that is one-to-one, then there is a function \(f^{-1}\) so that \(f(f^{-1}(x))=x=f^{-1}(f(x))\)”.

Problem 2.22.

For each function \(f\) determine if \(f^{-1}\) is a function.

  1. \(\displaystyle f = \{ (x,y) \mid x \in \R \ \mbox{ and } \ y = x(x-1) \}\)

  2. \(f : \R \to \R\) defined by \(f(x) = \sqrt[3]{x-1}\)

Problem 2.23.

Let \(f:\mathbb R \to \mathbb R\) with \(f(x) = 3x - 7\text{.}\)

  1. Prove that \(f\) is onto \(\mathbb R\text{.}\)

  2. Prove that \(f\) is one-to-one.

  3. Find a formula for \(f^{-1}(y)\text{.}\)

  4. Verify that for all \(x \in \R\) we have, \(f^{-1}(f(x)) = x\) and \(f(f^{-1}(x))=x\text{.}\)

Problem 2.24.

Show that every non-constant linear function \(l(x) = mx+b\text{,}\) with \(m\neq 0\text{,}\) is a bijection \(l:\mathbb R \to \mathbb R\text{.}\) Find a formula for \(l^{-1}(y)\text{.}\)

The binary operations of addition and multiplication can be used to combine any two numbers in order to get a new number. The binary operations of intersection, union, difference and symmetric difference can be used to combine two sets in order to form a new set. Addition, subtraction, multiplication and division of real-valued functions are also binary operations. Another binary operation on functions is called composition.

Definition 2.25.

Suppose that \(g:\A \to \B\) and \(f:\B \to \C\text{.}\) We define the composition of \(f\) and \(g\) (denoted by \(f \circ g\)) to be the function from \(\A\) to \(\C\) satisfying

\begin{equation*} (f \circ g)(x) = f(g(x))\text{.} \end{equation*}

In the Table 2.26 below, we have four bijections from \(\{1,2,3,4\}\) onto \(\{1,2,3,4\}\text{.}\) The first bijection, \(i\text{,}\) is the identity map since it maps \(1 \to 1\text{,}\) \(2 \to 2\text{,}\) \(3 \to 3\) and \(4 \to 4\text{.}\)

Table 2.26. Bijections
i p q r
1234 1234 1234 1234
1234 2134 1243 2143

Let's compute \(q \circ r\text{.}\)

  1. \((q\circ r)(1)=q(r(1))=q(2)=2=p(1)\text{,}\)

  2. \((q\circ r)(2)=q(r(2))=q(1)=1=p(2)\text{,}\)

  3. \((q\circ r)(3)=q(r(3))=q(4)=3=p(3)\text{,}\) and

  4. \((q\circ r)(4)=q(r(4))=q(3)=4=p(4)\text{.}\)

Therefore, \(q \circ r = p\text{.}\)

Table 2.28. Composition
\(\circ\)    i      p      q      r  
i  
p  
q      p  
r  
Problem 2.29.

What is this inverse of each of these bijections?

Problem 2.30.

Addition of numbers is commutative because for any two numbers \(a\) and \(b\) we have \(a+b = b+a\text{.}\) If for every set \(\A\text{,}\) every \(f:\A \to \A\) and every \(g:\A \to \A\) it is true that

\begin{equation*} f \circ g = g \circ f\text{,} \end{equation*}

then we would say that composition of functions is also commutative. Either show that composition is commutative or give a counter example by finding two functions for which the statement is not true.

Problem 2.31.

Intersection of sets is associative since for any sets \(A\text{,}\) \(B\text{,}\)and \(C\) we have \(\A \cap (\B \cap \C) = (\A \cap \B) \cap \C\text{.}\) Is composition of functions associative? Restated, is it true that if each of \(f\text{,}\) \(g\) and \(h\) is a function, then \((f \circ g) \circ h = f \circ (g \circ h)\text{?}\)