A mapping between any two given sets is defined by relations and functions. We can define relation as a set of ordered pairs that shows the relationship between two sets. Function is a subset of relation. Thus, we can say that all functions are relations, however, all relations are not functions. The basic difference between a function and a relation is that a relation may have different outputs for a single input, however, a function only has a single output for a single input.