Skip to main content

Discrete Mathematical Structures

Subsection 2.3.5 Surjective functions

Some functions have a codomain that is larger than it needs to be. Namely, they have a codomain that is larger than the image of the function. For example, consider the absolute value function \(f \colon \RR \to \RR\) given by \(f(x) = \abs{x}\text{.}\) Then the codomain of \(f\) is \(\RR\text{,}\) but the image of \(f\) is just the set of nonnegative real numbers, \(\im(f) = \RR_{\geq 0}\text{.}\)
Negative numbers are in the codomain and have no preimage. Other functions have the property that the codomain is as small as possible. Namely, the codomain is exactly equal to the image. For example, we can modify \(f\) to define a new function \(g \colon \RR \to \RR_{\geq 0}\) given by \(g(x) = \abs{x}\text{.}\) Notice now that the codomain is equal to the image. Another way of saying that is every element of the codomain has at least one preimage. This property is known as surjectivity. Namely, surjective functions codomains equal to their image.

Definition 2.3.5.1.

Let \(f \colon A \to B\) be a function. The function \(f\) is surjective or onto if for each \(b\) in the codomain \(B\text{,}\) there exists an element \(a\) in the domain \(A\) such that \(f(a)= b\text{;}\) equivalently, if \(f(A) = B\text{.}\) A surjective function is called a surjection .

Example 2.3.5.2. Squaring function is not surjective.

The squaring function \(f \colon \RR \to \RR\) defined by \(f(x) = x^2\) is not surjective because \(-2 \in \RR\text{,}\) but there is no \(a \in \RR\) such that \(f(a) = -2\text{.}\)
ExampleΒ 2.3.5.2 shows the general technique for proving a function is not surjective.
We can make a non-surjective function into a surjective one by shrinking the codomain.

Example 2.3.5.4. The squaring function is not surjective.

The squaring function is surjective onto \(\RR_{\geq 0}\text{.}\) Specifically, the function \(g \colon \RR \to \RR_{\geq 0}\) given by \(g(x) = x^2\) is surjective.

Warning 2.3.5.5.

A function is a triple of data \((f, A, B)\text{.}\) In particular, the domain and codomain are part of the function. Because of this, when we change the domain or codomain, we are really creating a new function. For example, the squaring function from \(\RR\) to \(\RR\) is different from the squaring function from \(\RR\) to \(\RR_{\geq 0}\text{.}\)
For a function to be surjective, every element in the codomain must have at least one preimage. For example, the functions in FigureΒ 2.3.5.6 and FigureΒ 2.3.5.7 are surjective.
Two sets A and B are represented each by an oval.  The ovals do not overlap. Inside A are the numbers 1, 2, 3 and 4. Inside B are the numbers 1, 2, 3 and 4. An arrow labeled f goes from 1 in A to to 4 in B. An arrow labeled f goes from 2 in A to to 3 in B. An arrow labeled f goes from 3 in A to to 1 in B. An arrow labeled f goes from 4 in A to to 2 in B.
Figure 2.3.5.6. Graphical representation of a surjective function \(f:A\to B\) where \(A=\set{1,2,3,4}\) and \(B=\set{1,2,3,4}\text{.}\) Each element in the codomain \(B\) has at least one preimage in the domain \(A\text{.}\)
Two sets A and B are represented each by an oval.  The ovals do not overlap. Inside A are the numbers 1, 2, 3 and 4. Inside B are the numbers 1, 2, and 3. An arrow labeled f goes from 1 in A to to 1 in B. An arrow labeled f goes from 2 in A to to 2 in B. An arrow labeled f goes from 3 in A to to 3 in B. An arrow labeled f goes from 4 in A to to 2 in B.
Figure 2.3.5.7. Graphical representation of a surjective function \(f:A\to B\) where \(A=\set{1,2,3,4}\) and \(B=\set{1,2,3}\text{.}\) Each element in the codomain \(B\) has at least one preimage in the domain \(A\text{.}\)
In FigureΒ 2.3.5.8 and FigureΒ 2.3.5.9 we give examples of functions that are not surjective. In each instance, there is an element in the codomain has has no preimage.
Two sets A and B are represented each by an oval.  The ovals do not overlap. Inside A are the numbers 1, 2, and 3. Inside B are the numbers 1, 2, 3 and 4. An arrow labeled f goes from 1 in A to to 2 in B. An arrow labeled f goes from 2 in A to to 3 in B. An arrow labeled f goes from 3 in A to to 1 in B.
Figure 2.3.5.8. Graphical representations of a function \(f:A\to B\) where \(A=\set{1,2,3}\) and \(B=\set{1,2,3,4}\) that is not surjective. There is no element in the domain \(A\) that maps to the element \(4\) of the codomain \(B\text{,}\) so \(4\) has no preimage.
Two sets A and B are represented each by an oval.  The ovals do not overlap. Inside A are the numbers 1, 2, 3, and 4. Inside B are the numbers 1, 2, 3, and 4. An arrow labeled f goes from 1 in A to to 1 in B. An arrow labeled f goes from 2 in A to to 3 in B. An arrow labeled f goes from 3 in A to to 3 in B. An arrow labeled f goes from 4 in A to to 3 in B.
Figure 2.3.5.9. Graphical representations of a function \(f:A\to B\) where \(A=\set{1,2,3,4}\) and \(B=\set{1,2,3,4}\) that is not surjective, because there are no elements that map to \(2\) or \(4\text{,}\) so both \(2\) and \(4\) have no preimages.

Example 2.3.5.10. Prove surjectivity.

Let \(f(x) = 3x - 2\text{.}\) Show that \(f\) is surjective.
Solution.
We prove that \(f\) is surjective as follows.
  1. First we recall the definition of surjective. At the same time,
  2. Now this still does not look like a β€œif \(p\text{,}\) then \(q\)” type of
  3. As before, to prove a statement of the form β€œif \(p\text{,}\) then \(q\)”
  4. Since we want to find \(a\text{,}\) we should write out the conditions
  5. We have found \(a\) as desired. Since \(b\) is
The technique in ExampleΒ 2.3.5.10 an be generalized to prove a function is surjective.