Another problem associated with functions is to show that they are onto. This comes down to showing that for every element in the codomain there exists an element in the domain which maps to it. Again, the method used to establish this property depends on how the function is given and its properties. Typically this property is much harder to establish than showing a function is one-to-one. It is really an existence proof. For functions given by formulas we proceed along the following lines. Let y be any element of the codomain and x an element of the domain. We solve the equation y = f(x) for x. This gives us a possible candidate for a domain element. We prove it is a suitable domain element by substituting this value into the function. As an example, let's prove that defined by f(x) = 5x+2 is onto, where R denotes the real numbers. We let y be a typical element of the codomain and set up the equation y =f(x). then, y = 5x+2 and solving for x we get x =(y-2)/5. Since y is a real number, then (y-2)/5 is a real number and f((y-2)/5) = 5(y-2)/5 +2 = y.
It seems that this was too long winded an argument but care does need to be taken. For example, suppose we tried to show the function defined by is onto, where R denotes the real numbers. Let's go through the same type of proof. We let y be a typical element of the codomain and set up the equation y =f(x). then, and using the quadratic equation we see that is a solution. It is easy to check that f(x) = y. However, x is not a real number for all choices of y - take y to be -2. So -2 is not in the range of the function and hence this is not an onto function. Of course, it is simpler to show f is not onto by a counter example.