If you have 2 sets A and B, then a relation R between the 2 sets is a set of oordered pairs (a,b) where a belongs to A and b belongs to B. This set is a subset of the Cartesioan product A X B which consists of all posssible combination of elements from A and B. If element a is related to element b we write aRb. The order of a and b is important. An example of a relation is the relation "greater than". Some members of this relation can be {(4,1),(5,2),(10,3)} etc. where it means the first element is greater than the second element. You can see that if we change the order it means something different.
A function is a relation where given the first element a, there is a unique elenent b determined by the relation aRb. We write the function as f:A ->B. For example, if we have a relation with elements
{(1,2), (1,4)} it is not a function because for the same a we had 2 different b values. For the relation to be a function, for each distinct value of a we should have a unique value of b. Thus the following relation is a function:
{(1,3),(2,4),(3,4),(5,6)}