A function is one-one if different inputs always give different outputs, and onto if every element of the codomain is an output. A function that is both is a bijection, and pairs the two sets element for element.
A function f from a set X to a set Y assigns to each element x of X exactly one element f(x) of Y. X is the domain and Y is the codomain. The set of outputs actually produced, { f(x) : x ∈ X }, is the range. The range is a subset of the codomain and may be smaller than it.
A function is a relation from X to Y in which each element of X appears as a first entry in exactly one pair.
Two further questions classify functions: can two different inputs give the same output, and is every element of the codomain an output?
f is one-one, or injective, if different inputs always give different outputs. In symbols: if f(x₁) = f(x₂), then x₁ = x₂.
Assigning roll numbers to the students of a class, with no number repeated, is one-one. f(x) = x² on the real numbers is not one-one: f(2) = f(−2) = 4, although 2 ≠ −2. A function that is not one-one is called many-one.
f is onto, or surjective, if every element of the codomain is the output for at least one input. In symbols: for every y ∈ Y there is an x ∈ X with f(x) = y. Equivalently, the range equals the codomain.
f(x) = 2x from the real numbers to the real numbers is onto: for any real y, the input x = y/2 gives f(x) = y. f(x) = 2x from the natural numbers to the natural numbers is not onto: 2x is always even, so 1 is never an output.
f(x) = x² from the real numbers to the real numbers is neither one-one nor onto. Explain both.
Not one-one: f(2) = 4 and f(−2) = 4. Two different inputs have the same output. In fact every positive output comes from two inputs, a and −a.
Not onto: the square of a real number is never negative. So no input gives −4, or any other negative number. Those elements of the codomain are not outputs.
The range of this function is the set of non-negative real numbers, which is smaller than the codomain.
A function that is both one-one and onto is bijective, or a bijection. Each element of X is paired with exactly one element of Y, and each element of Y is paired with exactly one element of X. If X and Y are finite, a bijection between them exists only if they have the same number of elements.
f(x) = 2x from the real numbers to the real numbers is a bijection. The bijections are exactly the functions that have an inverse, as the next session shows.
Three mappings. Left: no two arrows share a target, but one target is unused (one-one, not onto). Middle: every target is used, but two arrows share a target (onto, not one-one). Right: each element paired with exactly one (bijective).
Keep the rule f(x) = 2x, but change the codomain. Show that whether f is onto changes.
From real numbers to real numbers: for any real y, x = y/2 is a real number with f(x) = y. So f is onto.
From natural numbers to natural numbers: every output is even, so odd numbers are never outputs. f is not onto.
From natural numbers to even natural numbers: every even number 2k is the output for x = k. f is onto again.
Being onto is a property of the rule together with its codomain. A function is fully specified only when its domain and codomain are both stated.
1A function f is one-one if…
2A function f is onto if…
3Why is f(x) = x² from R to R not one-one?
4Why is f(x) = x² from R to R not onto?
5A bijective function is…
6f(x) = 2x is onto with codomain R but not with codomain N. This shows that…
Next: composing functions, and the inverse of a bijection.