Given two sets
and
, the "starting" set is called the domain, while the "landing" set is called the codomain.
With that being said, a relation is any way you can associate any number of elements in the domain with every number of elements in the codomain.
A function has more restriction: you can associate one and only one output for every input.
If you visualize this with arrows linking domain and codomain, in order for a relation to be a function, only one arrow can start from each point in the domain.
The domain is thus the set of elements from whence an arrow starts. The range is the subset of the codomain, given by the elements that are reached by at least one arrow.