A relation is a set of ordered pairs where the domain is the set of all first elements and the range is the set of all second elements. A function is a special type of relation where each element of the domain is mapped to exactly one element of the range. When finding the domain of a function, valid inputs are any values that do not result in division by zero or taking the square root of a negative number.