# Binary operation

__: Mathematical operation with two operands__

**Short description**

In mathematics, a **binary operation** or **dyadic operation** is a rule for combining two elements (called operands) to produce another element. More formally, a binary operation is an operation of arity two.

More specifically, a **binary operation** *on a set* is a binary operation whose two domains and the codomain are the same set. Examples include the familiar arithmetic operations of addition, subtraction, and multiplication. Other examples are readily found in different areas of mathematics, such as vector addition, matrix multiplication, and conjugation in groups.

An operation of arity two that involves several sets is sometimes also called a *binary operation*. For example, scalar multiplication of vector spaces takes a scalar and a vector to produce a vector, and scalar product takes two vectors to produce a scalar. Such binary operations may also be called binary functions.

Binary operations are the keystone of most structures that are studied in algebra, in particular in semigroups, monoids, groups, rings, fields, and vector spaces.

## Terminology

More precisely, a binary operation on a set [math]\displaystyle{ S }[/math] is a mapping of the elements of the Cartesian product [math]\displaystyle{ S \times S }[/math] to [math]\displaystyle{ S }[/math]:^{[1]}^{[2]}^{[3]}

- [math]\displaystyle{ \,f \colon S \times S \rightarrow S. }[/math]

The closure property of a binary operation expresses the existence of a result for the operation given any pair of operands.^{[4]}

If [math]\displaystyle{ f }[/math] is not a function but a partial function, then [math]\displaystyle{ f }[/math] is called a **partial binary operation**. For instance, division of real numbers is a partial binary operation, because one can't divide by zero: [math]\displaystyle{ \frac{a}{0} }[/math] is undefined for every real number [math]\displaystyle{ a }[/math]. In both model theory and classical universal algebra, binary operations are required to be defined on all elements of [math]\displaystyle{ S \times S }[/math]. However, partial algebras^{[5]} generalize universal algebras to allow partial operations.

Sometimes, especially in computer science, the term binary operation is used for any binary function.

## Properties and examples

Typical examples of binary operations are the addition ([math]\displaystyle{ + }[/math]) and multiplication ([math]\displaystyle{ \times }[/math]) of numbers and matrices as well as composition of functions on a single set. For instance,

- On the set of real numbers [math]\displaystyle{ \mathbb R }[/math], [math]\displaystyle{ f(a,b)=a+b }[/math] is a binary operation since the sum of two real numbers is a real number.
- On the set of natural numbers [math]\displaystyle{ \mathbb N }[/math], [math]\displaystyle{ f(a,b)=a+b }[/math] is a binary operation since the sum of two natural numbers is a natural number. This is a different binary operation than the previous one since the sets are different.
- On the set [math]\displaystyle{ M(2,\mathbb R) }[/math] of [math]\displaystyle{ 2 \times 2 }[/math] matrices with real entries, [math]\displaystyle{ f(A,B)=A+B }[/math] is a binary operation since the sum of two such matrices is a [math]\displaystyle{ 2 \times 2 }[/math] matrix.
- On the set [math]\displaystyle{ M(2,\mathbb R) }[/math] of [math]\displaystyle{ 2 \times 2 }[/math] matrices with real entries, [math]\displaystyle{ f(A,B)=AB }[/math] is a binary operation since the product of two such matrices is a [math]\displaystyle{ 2 \times 2 }[/math] matrix.
- For a given set [math]\displaystyle{ C }[/math], let [math]\displaystyle{ S }[/math] be the set of all functions [math]\displaystyle{ h \colon C \rightarrow C }[/math]. Define [math]\displaystyle{ f \colon S \times S \rightarrow S }[/math] by [math]\displaystyle{ f(h_1,h_2)(c)=(h_1 \circ h_2)(c)=h_1(h_2(c)) }[/math] for all [math]\displaystyle{ c \in C }[/math], the composition of the two functions [math]\displaystyle{ h_1 }[/math] and [math]\displaystyle{ h_2 }[/math] in [math]\displaystyle{ S }[/math]. Then [math]\displaystyle{ f }[/math] is a binary operation since the composition of the two functions is again a function on the set [math]\displaystyle{ C }[/math] (that is, a member of [math]\displaystyle{ S }[/math]).

Many binary operations of interest in both algebra and formal logic are commutative, satisfying [math]\displaystyle{ f(a,b)=f(b,a) }[/math] for all elements [math]\displaystyle{ a }[/math] and [math]\displaystyle{ b }[/math] in [math]\displaystyle{ S }[/math], or associative, satisfying [math]\displaystyle{ f(f(a,b),c)=f(a,f(b,c)) }[/math] for all [math]\displaystyle{ a }[/math], [math]\displaystyle{ b }[/math], and [math]\displaystyle{ c }[/math] in [math]\displaystyle{ S }[/math]. Many also have identity elements and inverse elements.

The first three examples above are commutative and all of the above examples are associative.

On the set of real numbers [math]\displaystyle{ \mathbb R }[/math], subtraction, that is, [math]\displaystyle{ f(a,b)=a-b }[/math], is a binary operation which is not commutative since, in general, [math]\displaystyle{ a-b \neq b-a }[/math]. It is also not associative, since, in general, [math]\displaystyle{ a-(b-c) \neq (a-b)-c }[/math]; for instance, [math]\displaystyle{ 1-(2-3)=2 }[/math] but [math]\displaystyle{ (1-2)-3=-4 }[/math].

On the set of natural numbers [math]\displaystyle{ \mathbb N }[/math], the binary operation exponentiation, [math]\displaystyle{ f(a,b)=a^b }[/math], is not commutative since, [math]\displaystyle{ a^b \neq b^a }[/math] (cf. Equation x^{y} = y^{x}), and is also not associative since [math]\displaystyle{ f(f(a,b),c) \neq f(a,f(b,c)) }[/math]. For instance, with [math]\displaystyle{ a=2 }[/math], [math]\displaystyle{ b=3 }[/math], and [math]\displaystyle{ c=2 }[/math], [math]\displaystyle{ f(2^3,2)=f(8,2)=8^2=64 }[/math], but [math]\displaystyle{ f(2,3^2)=f(2,9)=2^9=512 }[/math]. By changing the set [math]\displaystyle{ \mathbb N }[/math] to the set of integers [math]\displaystyle{ \mathbb Z }[/math], this binary operation becomes a partial binary operation since it is now undefined when [math]\displaystyle{ a=0 }[/math] and [math]\displaystyle{ b }[/math] is any negative integer. For either set, this operation has a *right identity* (which is [math]\displaystyle{ 1 }[/math]) since [math]\displaystyle{ f(a,1)=a }[/math] for all [math]\displaystyle{ a }[/math] in the set, which is not an *identity* (two sided identity) since [math]\displaystyle{ f(1,b) \neq b }[/math] in general.

Division ([math]\displaystyle{ \div }[/math]), a partial binary operation on the set of real or rational numbers, is not commutative or associative. Tetration ([math]\displaystyle{ \uparrow\uparrow }[/math]), as a binary operation on the natural numbers, is not commutative or associative and has no identity element.

## Notation

Binary operations are often written using infix notation such as [math]\displaystyle{ a \ast b }[/math], [math]\displaystyle{ a+b }[/math], [math]\displaystyle{ a \cdot b }[/math] or (by juxtaposition with no symbol) [math]\displaystyle{ ab }[/math] rather than by functional notation of the form [math]\displaystyle{ f(a, b) }[/math]. Powers are usually also written without operator, but with the second argument as superscript.

Binary operations are sometimes written using prefix or (more frequently) postfix notation, both of which dispense with parentheses. They are also called, respectively, Polish notation [math]\displaystyle{ \ast a b }[/math] and reverse Polish notation [math]\displaystyle{ a b \ast }[/math].

## Binary operations as ternary relations

A binary operation [math]\displaystyle{ f }[/math] on a set [math]\displaystyle{ S }[/math] may be viewed as a ternary relation on [math]\displaystyle{ S }[/math], that is, the set of triples [math]\displaystyle{ (a, b, f(a,b)) }[/math] in [math]\displaystyle{ S \times S \times S }[/math] for all [math]\displaystyle{ a }[/math] and [math]\displaystyle{ b }[/math] in [math]\displaystyle{ S }[/math].

## Other binary operations

For example, scalar multiplication in linear algebra. Here [math]\displaystyle{ K }[/math] is a field and [math]\displaystyle{ S }[/math] is a vector space over that field.

Also the dot product of two vectors maps [math]\displaystyle{ S \times S }[/math] to [math]\displaystyle{ K }[/math], where [math]\displaystyle{ K }[/math] is a field and [math]\displaystyle{ S }[/math] is a vector space over [math]\displaystyle{ K }[/math]. It depends on authors whether it is considered as a binary operation.

## See also

- Iterated binary operation – Repeated application of an operation to a sequence
- Magma (algebra) – Algebraic structure with a binary operation
- Ternary operation – Mathematical operation that combines three elements to produce another element
- Truth table § Binary operations
- Unary operation – Mathematical operation with only one operand

## Notes

- ↑ Rotman 1973, pg. 1
- ↑ Hardy & Walker 2002, pg. 176, Definition 67
- ↑ Fraleigh 1976, pg. 10
- ↑ Hall 1959, pg. 1
- ↑ George A. Grätzer (2008).
*Universal Algebra*(2nd ed.). Springer Science & Business Media. Chapter 2. Partial algebras. ISBN 978-0-387-77487-9. https://archive.org/details/isbn_9780387774862.

## References

- Fraleigh, John B. (1976),
*A First Course in Abstract Algebra*(2nd ed.), Reading: Addison-Wesley, ISBN 0-201-01984-1 - Hall, Marshall Jr. (1959),
*The Theory of Groups*, New York: Macmillan - Hardy, Darel W.; Walker, Carol L. (2002),
*Applied Algebra: Codes, Ciphers and Discrete Algorithms*, Upper Saddle River, NJ: Prentice-Hall, ISBN 0-13-067464-8 - Rotman, Joseph J. (1973),
*The Theory of Groups: An Introduction*(2nd ed.), Boston: Allyn and Bacon

## External links

Original source: https://en.wikipedia.org/wiki/Binary operation.
Read more |