Redirected from Surjective
A function f: X → Y is called surjective or onto or a surjection if for every y in the codomain Y there is at least one x in the domain X with f(x) = y.
Put another way, the range f(X) is equal to the codomain Y.
When X and Y are both the real line R, then a surjective function f: R → R can be visualized as one whose graph will be intersected by any horizontal line.
Consider the function f: R → R defined by f(x) = 2x + 1.
This function is surjective, since given an arbitrary real number y, we can solve y = 2x + 1 for x to get a solution x = (y − 1)/2.
On the other hand, the function g: R → R defined by g(x) = x2 is not surjective, because (for example) there is no real number x such that x2 = -1.
However, if we define the function h: R → R+ by the same formula as g, but with the codomain has been restricted to only the nonnegative real numbers, then the function h is surjective.
This is because, given an arbitrary nonnegative real number y, we can solve y = x2 to get solutions x = √y and x = −√y.
See also: Injective function, Bijection

Surjective, not injective

Injective, not surjective

Bijective

Not surjective, not injective Examples and counterexamples
Properties