In mathematics, a binary relation associates some elements of one set called the domain with some elements of another set (possibly the same) called the codomain. Precisely, a binary relation over sets and is a set of ordered pairs , where is an element of and is an element of . It encodes the common concept of relation: an element is related to an element , if and only if the pair belongs to the set of ordered pairs that defines the binary relation.
An example of a binary relation is the "divides" relation over the set of prime numbers and the set of integers , in which each prime is related to each integer that is a multiple of , but not to an integer that is not a multiple of . In this relation, for instance, the prime number is related to numbers such as , , , , but not to or , just as the prime number is related to , , and , but not to or .