A relation is a set of ordered pairs

. For example, the set of points at distance 1 from the origin—the unit circle—is a relation. The domain

is the set of first values

. The range

is the set of last values

.

When every element in the domain corresponds to exactly one element in the range, the relation is a function. A function passes the vertical line test—no vertical line passes through more than one point within the relation. The unit circle is thus not a function. The half-circle above the

axis is the function

.

The horizontal line test, which tests if any horizontal line intersects a graph at more than one point, can have three different results when applied to functions:

1. If no horizontal line intersects the function in more than one point, it is one-to-one (or injective).

2. If every horizontal line intersects the function in at least one point, it is onto (or surjective).

3. If every horizontal line intersects the function in exactly one point, it is one-to-one and onto (or bijective).

Suppose

is a function with domain

and range

. The inverse of

is a function

with domain

and range

such that

if and only if

. For the inverse to exist, the original function

must be one-to-one and onto.

Let

be the set of real numbers. The inverse of

with domain and range

is the function

with the same domain and range.

Many functions that come up in practice are either not one-to-one or not onto. For example, because trigonometric functions are periodic they are many-to-one on

. Also, except for the tangent and arctangent functions, the trig functions are not onto. For example, there is no real number

such that

.