6.4: Onto Functions
 Page ID
 8417
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{\!\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
Onetoone functions focus on the elements in the domain. We do not want any two of them sharing a common image. Onto functions focus on the codomain. We want to know if it contains elements not associated with any element in the domain.
Definition: surjection
A function \(f :{A}\to{B}\) is onto if, for every element \(b\in B\), there exists an element \(a\in A\) such that \[f(a) = b.\] An onto function is also called a surjection, and we say it is surjective.
Example \(\PageIndex{1}\label{eg:ontofcn01}\)
The graph of the piecewisedefined functions \(h :{[1,3]}\to{[2,5]}\) defined by
\[h(x) = \cases{ 3x 1 & if $1\leq x\leq 2$, \cr 3x+11 & if $2 < x\leq 3$, \cr} \nonumber\]
is displayed on the left in Figure [fig:ontograph]. It is clearly onto, because, given any \(y\in[2,5]\), we can find at least one \(x\in[1,3]\) such that \(h(x)=y\). Likewise, the function \(k :{[1,3]}\to{[2,5]}\) defined by
\[k(x) = \cases{ 3x 1 & if $1\leq x\leq 2$, \cr 5 & if $2 < x\leq 3$, \cr}\nonumber\]
is also onto. Its graph is displayed on the right of Figure [fig:ontograph].
exercise \(\PageIndex{1}\label{he:ontofcn01}\)
The two functions in Example 6.4.1 are onto but not onetoone. Construct a onetoone and onto function \(f\) from \([1,3]\) to \([2,5]\).
exercise \(\PageIndex{2}\label{he:ontofcn02}\)
Construct a function \(g :{[1,3]}\to{[2,5]}\) that is onetoone but not onto.
exercise \(\PageIndex{3}\label{he:ontofcn03}\)
Find a subset \(B\) of \(\mathbb{R}\) that would make the function \(s :{\mathbb{R}}\to{B}\) defined by \(s(x) = x^2\) an onto function.
Example \(\PageIndex{2}\label{eg:ontofcn02}\)
Construct a function \(g :{(5,8)}\to{\mathbb{R}}\) that is both onetoone and onto
Remark
This is a challenging problem. Since the domain is an open interval, a straight line graph does not work, because it will not cover every number in the codomain.
 Solution

The solution is based on the observation that the function \(h :{(\frac{\pi}\to{2},\frac{\pi}{2})}{\mathbb{R}}\) defined by \(h(x)=\tan x\) is onetoone and onto. For this to work in this problem, we need to shift and scale the interval \((5,8)\) to the same size as \((\frac{\pi}{2},\frac{\pi}{2})\).
First, we have to shift the center of the interval \((5,8)\) to the center of the interval \((\frac{\pi}{2},\frac{\pi}{2})\). The midpoint of the interval \((5,8)\) is \(\frac{5+8}{2}=\frac{13}{2}\), and the midpoint of \((\frac{\pi}{2},\frac{\pi}{2})\) is 0. Hence, we need to shift the interval \((5,8)\) to the left \(\frac{13}{2}\) units. This means we need to use the transformation \(x\frac{13}{2}\). The two endpoints 5 and 8 become \(\frac{3}{2}\) and \(\frac{3}{2}\), respectively:
\[\arraygap{1.25} \begin{array}{cccc} \hline x & 5 & \frac{13}{2} & 8 \\ \hline x\frac{13}{2} &\frac{3}{2} & 0 & \frac{3}{2} \\ [1pt] \hline \end{array}\nonumber\]
After the transformation \(x\frac{13}{2}\), the original interval \((5,8)\) becomes the interval \((\frac{3}{2},\frac{3}{2})\). Next, we want to stretch the interval \((\frac{3}{2},\frac{3}{2})\) into \((\frac{\pi}{2},\frac{\pi}{2})\). This calls for a scaling factor of \(\frac{\pi}{3}\).
\[\arraygap{1.25} \begin{array}{cccc} \hline x & 5 & \frac{13}{2}& 8 \\ \hline \frac{\pi}{3}\left(x\frac{13}{2}\right) &\frac{\pi}{2}& 0 &\frac{\pi}{2}\\ [1pt] \hline \end{array}\nonumber\]
Putting these transformations together, we conclude that \[g(x) = \tan\left[\frac{\pi}{3}\left(x\frac{13}{2}\right)\right]\] gives a onetoone and onto function from \((5,8)\) to \(\mathbb{R}\).
exercise \(\PageIndex{4}\label{he:ontofcn04}\)
Construct a function \(h :{(2,9)}\to{\mathbb{R}}\) that is both onetoone and onto.
In general, how can we tell if a function \(f :{A}\to{B}\) is onto? The key question is: given an element \(y\) in the codomain, is it the image of some element \(x\) in the domain? If it is, we must be able to find an element \(x\) in the domain such that \(f(x)=y\). Mathematically, if the rule of assignment is in the form of a computation, then we need to solve the equation \(y=f(x)\) for \(x\). If we can always express \(x\) in terms of \(y\), and if the resulting \(x\)value is in the domain, the function is onto.
Example \(\PageIndex{3}\label{eg:ontofcn03}\)
Is the function \(p :{\mathbb{R}}\to{\mathbb{R}}\) defined by \(p(x)=3x^24x+5\) onto?
 Solution

Let \(y=3x^24x+5\), we want to know if we can always express \(x\) in terms of \(y\). Rearranging the equation, we find \[3x^24x+(5y) = 0.\] We want this equation to be solvable over \(\mathbb{R}\), that is, we want its solutions to be real. This requires its discriminant to be nonnegative. So we need
\[(4)^24\cdot3\cdot(5y) = 12y44 \geq 0. \nonumber\]
We have real solutions only when \(y\geq\frac{11}{3}\). This means, when \(y<\frac{11}{3}\), we cannot find an \(x\)value such that \(p(x)=y\). Therefore, \(p\) is not onto.
 Solution

By completing the square, we find
\[p(x) = 3x^24x+5 = 3\left(x\frac{2}{3}\right)^2 + \frac{11}{3} \geq \frac{11}{3}. \nonumber\]
Since \(p(x)\not<\frac{11}{3}\), it is clear that \(p\) is not onto.
exercise \(\PageIndex{5}\label{he:ontofcn05}\)
The function \(g :{\mathbb{R}}\to{\mathbb{R}}\) is defined as \(g(x)=3x+11\). Prove that it is onto.
Example \(\PageIndex{4}\label{eg:ontofcn04}\)
Is the function \(p :{\mathbb{R}}\to{\mathbb{R}}\) defined by
\[p(x) = \cases{ 4x+1 & if $x\leq3$ \cr \textstyle\frac{1}{2} \,x & if $x>3$ \cr} \nonumber\]
an onto function?
 Answer

The graphs \(y=4x+1\) and \(y=\frac{1}{2}\,x\) are both increasing. For \(x\leq3\), the \(y\)values cover the range \((\infty,13)\), and for \(x>3\), the \(y\)values cover the range \(\big(\frac{3}{2},\infty\big)\). Since these two \(y\)ranges overlap, all the \(y\)values are being covered by the images. Therefore, \(p\) is onto.
exercise \(\PageIndex{6}\label{he:ontofcn06}\)
Determine whether \[f(x) = \cases{ 3x+1 & if $x\leq2$ \cr 4x & if $x > 2$ \cr}\nonumber\] is an onto function.
Example \(\PageIndex{5}\label{eg:ontofcn05}\)
Consider the function \(g :{\mathbb{Z}_{43}}\to{\mathbb{Z}_{43}}\) defined by
\[g(x) \equiv 11x5 \pmod{43}.\nonumber\]
Let \[y = g(x) \equiv 11x5 \pmod{43},\nonumber\]
then \[x \equiv 11^{1}(y+5) \equiv 4(y+5) \pmod{43}.\nonumber\]
This shows that \(g\) is onto.
exercise \(\PageIndex{7}\label{he:ontofcn07}\)
Show that the function \(h :{\mathbb{Z}_{23}}\to{\mathbb{Z}_{23}}\) defined by \(h(x) \equiv 5x+8\) (mod 23) is onto.
Example \(\PageIndex{6}\label{eg:ontofcn06}\)
Is the function \({u}:{\mathbb{Z}}\to{\mathbb{Z}}\) defined by
\[u(n) = \cases{ 2n & if $n\geq0$ \cr n & if $n < 0$ \cr} \nonumber\]
onetoone? Is it onto?
 Solution

Since \(u(2)=u(1)=2\), the function \(u\) is not onetoone. Since \(u(n)\geq0\) for any \(n\in\mathbb{Z}\), the function \(u\) is not onto.
exercise \(\PageIndex{8}\label{he:ontofcn08}\)
Is the function \(v:{\mathbb{N}}\to{\mathbb{N}}\) defined by \(v(n)=n+1\) onto? Explain.
Example \(\PageIndex{7}\label{eg:oneonefcn07}\)
The function \(s\) in Example 6.4.10 is both onetoone and onto. It provides a onetoone correspondence between the elements of \(A\) by matching a married individual to his/her spouse.
exercise \(\PageIndex{9}\label{he:ontofcn09}\)
Is the function \(h_1\) in Exercises 1.2, Problem 6.4.8, an onto function? Explain.
Summary and Review
 A function \(f :{A}\to{B}\) is onto if, for every element \(b\in B\), there exists an element \(a\in A\) such that \(f(a)=b\).
 To show that \(f\) is an onto function, set \(y=f(x)\), and solve for \(x\), or show that we can always express \(x\) in terms of \(y\) for any \(y\in B\).
 To show that a function is not onto, all we need is to find an element \(y\in B\), and show that no \(x\)value from \(A\) would satisfy \(f(x)=y\).
exercise \(\PageIndex{1}\label{ex:ontofcn01}\)
Which of the following functions are onto? Explain!
 \(f :{\mathbb{R}}\to{\mathbb{R}}\), \(f(x)=x^32x^2+1\).
 \(g :{[\,2,\infty)}\to{\mathbb{R}}\), \(g(x)=x^32x^2+1\).
exercise \(\PageIndex{2}\label{ex:ontofcn02}\)
Which of the following functions are onto? Explain!
 \(p :{\mathbb{R}}\to{\mathbb{R}}\), \(p(x)=e^{12x}\).
 \(q :{\mathbb{R}}\to{\mathbb{R}}\), \(q(x)=13x\).
exercise \(\PageIndex{3}\label{ex:ontofcn03}\)
Construct a onetoone function \(f :{[1,3]}\to{[2,5]}\) that is not onto.
exercise \(\PageIndex{4}\label{ex:ontofcn04}\)
Construct an onto function \(g :{[\,2,5)}\to{(1,4\,]}\) that is not onetoone.
exercise \(\PageIndex{5}\label{ex:ontofcn05}\)
Determine which of the following are onto functions.
 \(f :{\mathbb{Z}}\to{\mathbb{Z}}\); \(f(n)=n^3+1\)
 \(g :{\mathbb{Q}}\to{\mathbb{Q}}\); \(g(x)=n^2\)
 \(h :{\mathbb{R}}\to{\mathbb{R}}\); \(h(x)=x^3x\)
 \(k :{\mathbb{R}}\to{\mathbb{R}}\); \(k(x)=5^x\)
exercise \(\PageIndex{6}\label{ex:ontofcn06}\)
Determine which of the following are onto functions.
 \(p :{\wp(\{1,2,3,\ldots,n\})}\to{\{0,1,2,\ldots,n\}}\); \(p(S)=S\)
 \(q :{\wp(\{1,2,3,\ldots,n\})}\to{\wp(\{1,2,3,\ldots,n\})}\); \(q(S)=\overline{S}\)
exercise \(\PageIndex{7}\label{ex:ontofcn07}\)
Determine which of the following functions are onto.
 \(\{f_1}:{\{1,2,3,4,5\}}\to{\{a,b,c,d\}}\); \(f_1(1)=b\), \(f_1(2)=c\), \(f_1(3)=a\), \(f_1(4)=a\), \(f_1(5)=c\)
 \({f_2}:{\{1,2,3,4\}}\to{\{a,b,c,d,e\}}\); \(f_2(1)=c\), \(f_2(2)=b\), \(f_2(3)=a\), \(f_2(4)=d\)
 \({f_3}:{\mathbb{Z}}\to{\mathbb{Z}}\); \(f_5(n)=n\)
 \({f_4}:{\mathbb{Z}}\to{\mathbb{Z}}\); \(f_4(n) = \cases{\hfill 2n & if\)n < 0\(\cr \hfill 3n & if\)n0\(\cr}\)
exercise \(\PageIndex{8}\label{ex:ontofcn08}\)
Determine which of the following functions are onto.
 \({g_1}:{\{1,2,3,4,5\}}\to{\{a,b,c,d,e\}}\); \(g_1(1)=b\), \(g_1(2)=b\), \(g_1(3)=b\), \(g_1(4)=a\), \(g_1(5)=d\)
 \({g_2}:{\{1,2,3,4,5\}}\to{\{a,b,c,d,e\}}\); \(g_2(1)=d\), \(g_2(2)=b\), \(g_2(3)=e\), \(g_2(4)=a\), \(g_2(5)=c\)
 \({g_3}:{\mathbb{N}}\to{\mathbb{N}}\); \(g_3(n) = \cases{(n+1)/2 & if\)n\(is odd \cr n/2 & if\)n\(is even \cr}\)
 \({g_4}:{\mathbb{N}}\to{\mathbb{N}}\); \(g_4(n) = \cases{n+1 & if\)n\(is odd \cr n1 & if\)n\(is even \cr}\)
exercise \(\PageIndex{9}\label{ex:ontofcn09}\)
Is it possible for a function from \(\{1,2\}\) to \(\{a,b,c,d\}\) to be onto? Explain.
exercise \(\PageIndex{10}\label{ex:ontofcn10}\)
List all the onto functions from \(\{1,2,3,4\}\) to \(\{a,b\}\)?
 Hint

List the images of each function.
exercise \(\PageIndex{11}\label{ex:ontofcn11}\)
Determine which of the following functions are onto.
 \(f :{\mathbb{Z}_{10}}\to{\mathbb{Z}_{10}}\); \(h(n)\equiv 3n\) (mod 10).
 \(g :{\mathbb{Z}_{10}}\to{\mathbb{Z}_{10}}\); \(g(n)\equiv 5n\) (mod 10).
 \(h :{\mathbb{Z}_{36}}\to{\mathbb{Z}_{36}}\); \(h(n)\equiv 3n\) (mod 36).
exercise \(\PageIndex{12}\label{ex:ontofcn12}\)
Determine which of the following functions are onto.
 \(r:{\mathbb{Z}_{36}}\to{\mathbb{Z}_{36}}\); \(r(n)\equiv 5n\) (mod 36).
 \(s :{\mathbb{Z}_{10}}\to{\mathbb{Z}_{10}}\); \(s(n)\equiv n+5\) (mod 10).
 \(t :{\mathbb{Z}_{10}}\to{\mathbb{Z}_{10}}\); \(t(n)\equiv 3n+5\) (mod 10).
exercise \(\PageIndex{13}\label{ex:ontofcn13}\)
Determine which of the following functions are onto.
 \({\alpha}:{\mathbb{Z}_{12}}\to{\mathbb{Z}_{ 7}}\); \(\alpha(n)\equiv 2n\) (mod 7).
 \({\beta} :{\mathbb{Z}_{ 8}}\to{\mathbb{Z}_{12}}\); \(\beta (n)\equiv 3n\) (mod 12).
 \({\gamma}:{\mathbb{Z}_{ 6}}\to{\mathbb{Z}_{12}}\); \(\gamma(n)\equiv 2n\) (mod 12).
 \({\delta}:{\mathbb{Z}_{12}}\to{\mathbb{Z}_{36}}\); \(\delta(n)\equiv 6n\) (mod 36).
exercise \(\PageIndex{14}\label{ex:ontofcn14}\)
Give an example of a function \(f :{\mathbb{N}}{\mathbb{N}}\) that is
 neither onetoone nor onto
 onetoone but not onto
 onto but not onetoone
 both onetoone and onto