Skip to main content
Mathematics LibreTexts

6.5: Onto functions

  • Page ID
    62299
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    In an arrow diagram of a function \(f: A \rightarrow B\), the definition of a function requires that there is exactly one arrow out of each element of \(A\), but it says nothing about the number of arrows into each element of \(B\). There may be elements of \(B\) with lots of arrows into them (unless the function is one-to-one), and there may be other elements of \(B\) that have no arrows into them. The function is called “onto” if all of the elements of \(B\) are hit by arrows; none are missed.

    Example \(6.5.1\).

    Figure \(6B\) shows arrow diagrams of various functions, some onto and some not.

    clipboard_e41c97c83b146a2d0718b7cea90b60ad5.png
    Figure \(6B\). \(f\) is onto, but not one-to-one. \(h\) is neither one-to-one nor onto. \(g\) is both one-to-one and onto. \(i\) is one-to-one, but not onto.

    Example \(6.5.2\).

    Not every woman is a mother. This means that if you draw an arrow from each person to his or her mother, there will be some women who have no arrows into them. So the function \[\text { mother: People } \rightarrow \text { Women }\]
    is not onto.

    The following official definition of “onto” formalizes the ideas described above.

    Definition \(6.5.3\).

    Suppose \(f: A \rightarrow B\). We say \(f\) is onto iff, for all \(b \in B\), there is some \(a \in A\), such that \(f(a) = b\).

    Exercise \(6.5.4\).

    Suppose \(f: A \rightarrow B\) and \(g: X \rightarrow Y\). Translate each of the following assertions into First-Order Logic:

    1. \(f\) is onto.
    2. \(f\) is not onto.
    3. \(g\) is onto.
    4. \(g\) is not onto.

    (Simplify your answers in (3) and (4) so that \(\neg\) is applied only to predicates.)

    Example \(6.5.5\).

    Without giving formal proofs, let us demonstrate that each of the following functions is not onto.

    1. \(f : \mathbb{R} \rightarrow \mathbb{R}\), defined by \(f(x) = |x|\).
    2. \(g:\{1,2,3\} \rightarrow\{\mathrm{a}, \mathrm{b}, \mathrm{c}\}\) defined by \(g=\{(1, b),(2, a),(3, a)\} .\)

    Solution

    1. Recall that the absolute value of a real number can never be negative. In particular, we can never have \(|x| = −1\) for any real number \(x\). Thus, there does not exist \(x \in \mathbb{R}\), such that \(f(x) = −1\). This shows that \(f\) is not onto.
    2. Notice that \(c\) never appears as the second coordinate of an ordered pair in this function. This means there does not exist any \(x\), such that \(g(x) = \text {c}\). This means that \(g\) is not onto.

    Exercise \(6.5.6\).

    Each of the following sets of ordered pairs is a function from \(\{1,2,3,4,5\}\) to {♣, ♦, ♥, ♠}. Which of the functions are onto? Briefly justify your answers.

    1. \(a =\) {(1, ♣),(2, ♦),(3, ♥),(4, ♠),(5, ♣)}
    2. \(b =\) {(1, ♣),(2, ♥),(3, ♣),(4, ♥),(5, ♣)}
    3. \(c =\) {(1, ♥),(2, ♥),(3, ♥),(4, ♥),(5, ♥)}
    4. \(d =\) {(1, ♦),(2, ♠),(3, ♥),(4, ♠),(5, ♣)}
    5. \(e =\) {(1, ♣),(2, ♠),(3, ♥),(4, ♠),(5, ♣)}

    Let us see how to prove that a function \(f: A \rightarrow B\) is onto. By definition, we wish to show: \[\text { for all } b \in B, \text { there is some } a \in A, \text { such that } f(a)=b \text {. }\]
    In other words: “\(\forall b \in B, \exists a \in A,(f(a)=b)\).”

    The first quantifier is \(\forall\); we are required to prove something about every element of \(B\). Hence, we use \(\forall\)-introduction, so our proof should start with the sentence “Let \(b\) be an arbitrary element of \(B\).” (However, this can be abbreviated to: “Given \(b \in B, \ldots\)”) After this, our task will be to prove “\(\exists a \in A,(f(a)=b)\).”

    At this point, the quantifier that concerns us is \(\exists\); we are required to prove that some element of \(A\) has a certain property. The tool to use for this is \(\exists\)-introduction: we find (or “construct”) an appropriate element of \(A\), and then verify that it does what it is supposed to. Thus, the next step in the proof is “Let \(a=? ? ?\)” (where ??? needs to be replaced with an appropriate expression). Then all that remains is to verify that the value we assigned to \(a\) does the job it is required to do: calculate that \(f(a)\) is indeed equal to \(b\).

    So here what a typical “onto” proof looks like: \[\text { Given } b \in B, \text { let } a=\square \text { Then } f(a)=\cdots=b \text {. }\]
    An appropriate value for a needs to be put in the box (perhaps a formula that depends on \(b\)), and the dots need to be filled in with a calculation that shows the value of \(f(a)\) is \(b\). (Also, of course, some of the letters will need to be changed if the name of the function is not \(f\), or if the sets are not called \(A\) and \(B\).)

    Example \(6.5.7\).

    Define \(g: \mathbb{R} \rightarrow \mathbb{R}\) by \(g(x) = 5x − 2\). Show \(g\) is onto.

    Scratchwork. We wish to show \(\forall y \in \mathbb{R}, \exists x \in \mathbb{R}\), (\(g(x) = y\)). By \(\forall\)-introduction, the first words of the proof are easy: “Given \(y \in \mathbb{R}\).” Then we need to find a value of \(x\) that makes \(g(x) = y\). The appropriate value of \(x\) is probably not obvious, so we will do some scratchwork. We postulate the desired equation \(g(x) = y\) and use algebra to solve it: \[\begin{aligned}
    g(x) &=y \\
    5 x-2 &=y \\
    5 x &=y+2 \\
    x &=\frac{y+2}{5} .
    \end{aligned}\]
    Now that we know the correct value of \(x\), it is easy to write the rest of the proof.

    Solution

    Given \(y \in \mathbb{R}\), let \(x = (y + 2)/5 \in \mathbb{R}\). Then \[g(x)=5 x-2=5\left(\frac{y+2}{5}\right)-2=(y+2)-2=y .\]

    Exercise \(6.5.8\).

    Each formula defines a function from \(\mathbb{R}\) to \(\mathbb{R}\). Show the function is onto.

    1. \(f(x) = 2x + 1\).
    2. \(g(x) = 7x − 3\).
    3. \(h(t) = 4t + 9\).
    4. \(i(z) = 6 − 11z\).
    5. \(j(r) = (3r − 4)/5\).

    Remark \(6.5.9\).

    Some “onto” proofs are more complicated than what is described above, because it may not be possible to go directly from “given \(b \in B\)” to “let \(a = \square\).” The problem is that it is sometimes necessary to insert calculations (or other explanations) between “given \(b\)” and “let \(a\).” Some examples of this will be seen in Exercise \(6.8.14\).

    To complete the discussion, let us also see how to prove that a function \(f: A \rightarrow B\) is not onto. By negating the definition of “onto,” we see that we wish to prove “\(\exists b \in B, \forall a \in A,(f(a) \neq b)\).”

    The first quantifier is \(\exists\); we are required to prove that some element of \(B\) has a certain property. The tool to use for this is \(\exists\)-introduction: we find an appropriate element of \(B\), and then we will need to verify that it does what it is supposed to. Thus, the first step in the proof is “Let \(b = ? ? ?\)” (where ??? needs to be replaced with an appropriate expression). After this, our task will be to prove “\(\forall a \in A,(f(a) \neq b)\).”

    At this point, the quantifier that concerns us is \(\forall\); we are required to prove something about every element of \(A\). Hence, we use \(\forall\)-introduction, so the next step in our proof is the sentence “Let \(a\) be an arbitrary element of \(A\)” (or, for short,“Given \(a \in A, \ldots\)”). Then all that remains is to verify that \(f(a) \neq b\).

    So here what a typical “not onto” proof looks like: \[\text { Let } b=\square \in B \text {. Given } a \in A \text {, we have ..., so } f(a) \neq b \text {. }\]
    An appropriate value for \(b\) needs to be put in the box, and the dots need to be filled in with an explanation that leads to the conclusion \(f(a) \neq b\). (Also, as usual, some of the letters will need to be changed if the name of the function is not \(f\), or if the sets are not called \(A\) and \(B\).)

    Example \(6.5.10\).

    Define \(e: \mathbb{R} \rightarrow \mathbb{R}\) by \(e(r) = 1/ ( |r| + 1)\). Show \(e\) is not onto.

    Scratchwork. We wish to prove \(\exists y \in \mathbb{R}, \forall r \in \mathbb{R},(e(r) \neq y)\), so we need to come up with an appropriate value of \(y\). To do this, let’s attempt to prove \(e\) is onto. Hopefully, we will run into trouble, and this difficulty will point us to a good choice for \(y\). Namely, if \(e\) were onto, we would be able to solve the equation \[e(r)=y\]
    Let’s put in the definition of \(e(r)\), and use algebra to try to solve this equation: \[\begin{aligned}
    \frac{1}{|r|+1} &=y \\
    |r|+1 &=\frac{1}{y} \\
    |r| &=\frac{1}{y}-1
    \end{aligned}\]
    Now the absolute value \(|r|\) is never negative, but the right-hand side of the equation could be negative. For example, if \(y = −1\), then \[\frac{1}{-1}-1=-1-1=-2<0 .\]
    This suggests that we should let \(y = −1\). With this in mind, we can write the proof.

    Solution

    PROOF.

    Let \(y = −1\). Given \(r \in \mathbb{R}\), we have \(|r| \geq 0\), so \(|r| + 1 \geq 0 + 1 = 1 > 0\). Therefore \[e(r)=\frac{1}{|r|+1} \geq 0>-1=y ,\]

    so \(e(r) \neq y\). Since \(r\) is an arbitrary element of the domain \(\mathbb{R}\), this implies that \(e\) is not onto.

    And sometimes you will need to decide whether a function is onto or not.

    Example \(6.5.11\).

    Define \(m: \mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R}\) by \(m(x, y) = x + y\). Is \(m\) onto?

    Scratchwork. Let’s try to prove \(m\) is onto. (If we fail, this is evidence that \(m\) is not onto, and we will try to prove that.) Given \(z \in \mathbb{R}\), we try to solve the equation \[m(x, y)=z .\]
    In other words: \[x+y=z .\]
    It is easy to find values of \(x\) and \(y\) that satisfy the equation: perhaps the easiest solution is to let \(y = 0\) and \(x = z\). We can use these values to prove that \(m\) is onto.

    Solution

    \(m\) is onto.

    PROOF. Given \(z \in \mathbb{R}\), let \((x, y) = (z, 0) \in \mathbb{R} \times \mathbb{R}\). Then \(m(x, y) = x + y = z + 0 = z\).

    Exercise \(6.5.12\).

    Each formula defines a function from \(\mathbb{R}\) to \(\mathbb{R}\). Which of the functions are onto? Prove that your answers are correct.

    1. \(f(x) = 1\).
    2. \(a(x) = x\).
    3. \(b(t) = t^{2}\).
    4. \(c(s) = 3s + 2\).
    5. \(d(r)=\sqrt[3]{r+5}-5.\)

    Exercise \(6.5.13\).

    Suppose \(f: A \rightarrow B\). Show that \(f\) is onto if and only if the range of \(f\) is \(B\).

    Remark \(6.5.14\).

    (alternative terminology). Some mathematicians say “surjective,” rather than “onto.” (Like “injective” in place of “one-to-one,” this comes from French.) Also, a function that is onto can be called a surjection.


    This page titled 6.5: Onto functions is shared under a CC BY-NC-SA 2.0 license and was authored, remixed, and/or curated by Dave Witte Morris & Joy Morris.

    • Was this article helpful?