In mathematics, a binary operation on a set S is a rule that assigns to each ordered pair of elements (a, b) in S × S a single element of S. Formally, a binary operation is a function from S × S into S. This requirement that the result lie in the same set is called closure and distinguishes binary operations from more general two-argument processes that may produce values outside the original domain.
Basic properties
Binary operations are categorized by several familiar algebraic properties. Common ones include:
- Closure: For all a, b in S, the value a * b is in S.
- Associativity: (a * b) * c = a * (b * c) for all a, b, c in S.
- Commutativity: a * b = b * a for all a, b in S.
- Identity element: An element e in S with e * a = a * e = a for all a.
- Inverse: For a given element a, an inverse a^{-1} satisfies a * a^{-1} = a^{-1} * a = e.
Different combinations of these properties generate familiar algebraic structures: a set with a single closed binary operation is a magma; if the operation is associative it is a semigroup; adding an identity gives a monoid; and including inverses yields a group.
Common examples
Concrete instances make the notion clear. On the set of natural numbers, ordinary addition and multiplication are binary operations that are closed on that set. On collections of matrices, matrix addition is commutative and associative, while matrix multiplication is associative but generally not commutative. The composition of functions is a binary operation on a set of functions with compatible domains and codomains: composing f and g yields another function in the same family.
Other examples include set union and intersection on a power set, logical connectives such as AND and OR on truth values, string concatenation on an alphabet, and bitwise operations like XOR on binary words.
Distinctions and special cases
Binary operations are often assumed to be total and single-valued; there are also partial binary operations that are undefined for some pairs, and multivalued binary relations that associate several outputs to a pair. Some familiar arithmetic operations—subtraction and division—are binary operations on many number systems but lack properties such as commutativity or a two-sided identity in all contexts. An operation defined on one set that maps into another set is not a binary operation on the first set but can be viewed as a binary mapping or a mixed operation.
Importance and counting
Binary operations are central to algebra, order theory, logic, and computer science: they define the syntax and semantics of operators in programming languages, structure cryptographic schemes, and underlie combinatorial constructions. For a finite set with n elements, one can count the total number of distinct binary operations on it: each of the n^2 input pairs can be assigned any of n outputs, so there are n^{n^2} possible binary operations in total, illustrating the vast diversity of potential algebraic systems even for small n.
Understanding which properties an operation satisfies—associativity, commutativity, the existence of identities or inverses—allows mathematicians to classify systems and apply specialized techniques. The simple concept of combining two elements thus supports a wide array of theories and applications across mathematics and related fields.