Function is a type of relation. But in a function no two ordered pairs have the same first element. For e.g. : R1 and R2 are two relations.
Clearly, R1 is a function, but R2 is not a function because two ordered pairs (1, 2) and (1, 4) have the same first element.
This means every function is a relation but every relation is not a function.