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 f(x) = y.
Let be the function defined by the equation f(x) = x2. By definition, the codomain of f is . However, the range of f consists of all nonnegative real numbers. Indeed, let y be a nonnegative real number. Then , and so y is one of the values hit by f.
Let be the function defined by the equation g(x) = x + 1. Then, for every real number y, we can see that g(y − 1) = (y − 1) + 1 = y, so every real number is hit by g. This means that the codomain and range of g are equal, namely . Therefore, g is onto.