In mathematics, the range (or image) of a function are the values it hits. It is not to be confused with the codomain of a function, which is a designated set to which all the values of the function belong.
A function is onto (or surjective) if every value in its codomain is hit by the function, or, equivalently, if its range is equal to its codomain. More formally, a function is onto if for every there exists such that .
Let be the function defined by the equation . By definition, the codomain of is . However, the range of consists of all nonnegative real numbers. Indeed, let be a nonnegative real number. Then , and so is one of the values hit by .
Let be the function defined by the equation . Then, for every real number , we can see that , so every real number is hit by . This means that the codomain and range of are equal, namely . Therefore, is onto.