Let the function f be a function on the real numbers:
Example
defined by
The codomain of f is R, but clearly f(x) never takes negative values, and thus the range is in fact the set R+ -- non-negative reals, ie the interval [0,∞):
The codomain can affect whether or not the function is a surjection; in our example, g is a surjection while f is not.
See also: Function domain, Function range