Relations are sets of ordered pairs that represent connections between elements. A relation is a function if each element in the domain (input) is uniquely mapped to an element in the range (output). This can be tested using the vertical line test - if a vertical line can pass through the graph of a relation more than once, it is not a function. The domain of a relation is the set of all first elements of each ordered pair, while the range is the set of all second elements. A relation is a function if its domain does not contain repeating elements.