Definition (Mapping, Domain, Range). A mapping or relation between 2 sets, and
is a rule assigning some elements from
(called the domain) to an element in
(called the range).
Example 1. If the set were the set of positive real numbers and the set
were the set of negative real numbers, the rule “take the negative of an element” assigns each positive integer in
to an element in
.
Mathematically, we say that is a relation from a domain
to a range
using the following shorthand.
The rule of the function is often written as where
. An element
in the range can thus be given by
. In the example above,
.
Definition (Function). A mapping is defined as a function if it assigns each element in its domain to exactly one element in its range
. The domain and range of
are sometimes referred to as
and
respectively.
Example 2. The mapping where
(example 1) is a function.
Example 3. (Counter-example) The mapping where
is not a function since
or
.
It is common to write a function in the following manner instead.
,
Example 4. The function in example 1 can be written as ,
We can use a vertical line test on the graph of to determine whether
is the rule of a function or not.
is a function if and only if every vertical line
where
intersects the graph of
exactly once.