Relations as functions
We can view functions as a special kind of relations because every function from A to B is a special subset of A×B. A function f from the set A to the set B is a subset of A×B that contains exactly one ordered pair (a,b) for each a∈A for some b∈B. We can write such a function in a compact way as f:A→B. This means that a function from A to B relates each element of A to exactly one element of B. However, an element of B can be related to more than one element of A or even none.
Note: Remember that every function is also a relation, but a relation may or may not be a function.
Terminology
A function from A to B is also called a map or a mapping from A to B and can also be referred as a functionfrom A into B.
If a function f:A→B contains an ordered pair (a,b), we write it as f(a)=b. In this function, we can say that the element b∈B is the image of the element a∈A under the function f. Also, the element a∈A can be called a preimage of b∈B under f.
Examples
Let’s take the following two sets: