Skip to main content
Logo image

Section 7.3 Equality of Functions

Two functions are equal if they have the same domain and codomain and their values are the same for all elements of the domain.

Definition 7.3.1.

Let \(A\) and \(B\) be sets and \(f:A\to B\) and \(g:A\to B\) be functions. We say that \(f\) and \(g\) are equal and write \(f=g\) if \(f(a)=g(a)\) for all \(a\in A\text{.}\) If \(f\) and \(g\) are not equal, we write \(f\ne g\text{.}\)
In our definition of the equality of functions, we have assumed that the two functions have the same domain and codomain. Two functions that do not have the same domain and codomain are not equal.
In the video in Figure 7.3.2 we recall the definition and show how one can decide whether two functions are equal.
Figure 7.3.2. Equality of functions

Example 7.3.3. Equal functions.

Let \(f:\Z_5\to\Z_5\) be given by \(f(a):=(a+1)\bmod 5\) and \(g:\Z_5\to\Z_5\) be given by \(g(a):=(a-4)\bmod 5\text{.}\) First, note that the domains of \(f\) and \(g\) are the same and the codomains of \(f\) and \(g\) are the same. We show that \(f=g\) by evaluating both \(f\) and \(g\) at each element of the common domain \(\Z_5=\{0,1,2,3,4\}\) and then comparing the function values for the same elements.
\(f(0)=(0+1)\bmod 5=1\) \(g(0)=(0-4)\bmod 5=1\)
\(f(1)=(1+1)\bmod 5=2\) \(g(1)=(1-4)\bmod 5=2\)
\(f(2)=(2+1)\bmod 5=3\) \(g(2)=(2-4)\bmod 5=3\)
\(f(3)=(3+1)\bmod 5=4\) \(g(3)=(3-4)\bmod 5=4\)
\(f(4)=(4+1)\bmod5=0\) \(g(4)=(4-4)\bmod 5=0\)
Since \(f(a)=g(a)\) for all \(a\in\Z_5\text{,}\) we have \(f=g\text{.}\)

Problem 7.3.4. Are these functions equal ?

Decide whether the two functions
\begin{align*} f:\Z_3\to \Z_3 \amp \text{ given by } f(x)=(x^2+1)\fmod 3\\ g:\Z_3\to \Z_3 \amp \text{ given by } f(x)=(x-2)\fmod 3 \end{align*}
are equal.
Solution.
We evaluate \(f\) and \(g\) at elements of their domain \(\Z_3=\{0,1,2\}\text{.}\) If \(f(x)=g(x)\) for all \(x\in\Z_3\) then \(f=g\text{.}\)
\(f(0)=(0^2+1)\fmod 3 = 1\) \(g(0)=(0-2) \fmod 3 = 1\)
\(f(1)=(1^2+1)\fmod 3 = 2\) \(g(1)=(1-2) \fmod 3 = 2\)
\(f(2)=(2^2+1)\fmod 3 = 2\) \(g(2)=(2-2) \fmod 3 = 0\)
As \(f(2)\ne g(2)\) the two functions \(f\) and \(g\) are not equal.
In Example 7.3.5 we decide whether a function given by a plot is equal to a function given by an equation.

Example 7.3.5.

Let the graph of the function \(f\) be given by
The plot shows right away that the domain of \(f\) is \(\mathbb{Z}_{9}\) and that the codomain of \(f\) is \(\mathbb{Z}_{10}\text{.}\) We can read the images of the elements in the domain of \(f\text{:}\)
\(f(0)=0\text{,}\) \(f(1)=3\text{,}\) \(f(2)=6\text{,}\) \(f(3)=9\text{,}\) \(f(4)=2\text{,}\) \(f(5)=5\text{,}\) \(f(6)=8\text{,}\) \(f(7)=1\text{,}\) \(f(8)=4\)
Let \(g:\mathbb{Z}_{9}\to\mathbb{Z}_{10}\) be given by \(g(x)=3\cdot x \bmod 10\text{.}\)
Now we decide whether the functions\(f\) and \(g\) are equal. We have already found \(f(x)\) for all \(x\in\mathbb{Z}_{9}\text{.}\) Now we compute \(g(x)\) for all \(x\in\mathbb{Z}_{9}\text{.}\) We get:
\(g(0)=3\cdot 0 \bmod 10=0\text{,}\) \(g(1)=3\cdot 1 \bmod 10=3\text{,}\) \(g(2)=3\cdot 2 \bmod 10=6\text{,}\) \(g(3)=3\cdot 3 \bmod 10=9\text{,}\) \(g(4)=3\cdot 4 \bmod 10=2\text{,}\) \(g(5)=3\cdot 5 \bmod 10=5\text{,}\) \(g(6)=3\cdot 6 \bmod 10=8\text{,}\) \(g(7)=3\cdot 7 \bmod 10=1\text{,}\) \(g(8)=3\cdot 8 \bmod 10=4\)
The functions \(f\) and \(g\) have the same domain and codomain. Also, \(f(x)=g(x)\) for all \(x\in \mathbb{Z}_{9}\text{.}\) So the two functions \(f\) and \(g\) are equal.