Suppose ‘f’ be the function and R be the relation defined from the set X to set Y.
A domain of a relation R might be a subset of the set X, but the domain of the function f must be equal to X. This is because each element of the domain of a function must have an element associated with it, whereas this is not necessary for a relation.
In the relation, one element of X might be associated with the one or more elements of Y, while it must be associated with the only one element of Y in a function.
Hence, not every relation is a function. However, every function is necessarily a relation.