A surjective function, also known as an onto function, is a special type of function where every element in the codomain is mapped to by at least one element from the domain. This means that the range of the function equals its codomain. In this diagram, we can see that every element in set B is reached by at least one arrow from set A, making this function surjective.
Here we see an example of a function that is NOT surjective. Notice that the bottom element in set B is colored gray and has no arrows pointing to it. This means there is no element in the domain A that maps to this element in the codomain B. Since not every element in the codomain is reached, this function is not surjective. The range of this function is only a subset of the codomain, not the entire codomain.
Let's look at mathematical examples. Consider the function f of x equals x squared. If we map from all real numbers to all real numbers, this function is NOT surjective because negative numbers are never outputs of x squared. However, if we change the codomain to only non-negative real numbers, then f of x equals x squared becomes surjective because every non-negative number can be reached as an output.
To test if a function is surjective, we can use the horizontal line test. Draw horizontal lines across the entire graph. If every horizontal line intersects the function at least once, then the function is surjective. In this example with f of x equals x squared, we see that some horizontal lines intersect the parabola twice, but the red line below the x-axis doesn't intersect at all. This confirms that x squared is not surjective when mapping to all real numbers.
To summarize what we have learned about surjective functions: A surjective function ensures that every element in the codomain is mapped to by at least one element from the domain. For surjective functions, the range equals the codomain. We can use the horizontal line test to check if a function is surjective. Remember that changing the codomain can make a non-surjective function become surjective. This concept is essential in advanced mathematics and helps us understand the complete mapping behavior of functions.