Inmathematics, anoperation is afunction from aset to itself. For example, an operation onreal numbers will take in real numbers and return a real number. An operation can take zero or more input values (also called "operands" or "arguments") to a well-defined output value. The number of operands is thearity of the operation.
The four classical operations are addition, subtraction, multiplication, and division. These operations form the foundation of arithmetic and are essential for performing calculations and solving problems in various fields.[3]
Generally, the arity is taken to be finite. However,infinitary operations are sometimes considered,[1] in which case the "usual" operations of finite arity are calledfinitary operations.
Apartial operation is defined similarly to an operation, but with apartial function in place of a function.
Operations may not be defined for every possible value of itsdomain. For example, in the real numbers one cannot divide by zero[12] or take square roots of negative numbers. The values for which an operation is defined form a set called itsdomain of definition oractive domain. The set which contains the values produced is called thecodomain, but the set of actual values attained by the operation is its codomain of definition, active codomain,image orrange.[13] For example, in the real numbers, the squaring operation only produces non-negative numbers; the codomain is the set of real numbers, but the range is the non-negative numbers.
The values combined are calledoperands,arguments, orinputs, and the value produced is called thevalue,result, oroutput. Operations can have fewer or more than two inputs (including the case of zero input and infinitely many inputs[1]).
Anoperator is similar to an operation in that it refers to the symbol or the process used to denote the operation. Hence, their point of view is different. For instance, one often speaks of "the operation of addition" or "the addition operation," when focusing on the operands and result, but one switch to "addition operator" (rarely "operator of addition"), when focusing on the process, or from the more symbolic viewpoint, the function+:X ×X →X (where X is a set such as the set of real numbers).
Ann-ary operationω on asetX is afunctionω:Xn →X. The setXn is called thedomain of the operation, the output set is called thecodomain of the operation, and the fixed non-negative integern (the number of operands) is called thearity of the operation. Thus aunary operation has arity one, and abinary operation has arity two. An operation of arity zero, called anullary operation, is simply an element of the codomainY. Ann-ary operation can also be viewed as an(n + 1)-aryrelation that istotal on itsn input domains andunique on its output domain.
Ann-ary partial operationω fromXn toX is apartial functionω:Xn →X. Ann-ary partial operation can also be viewed as an(n + 1)-ary relation that is unique on its output domain.
The above describes what is usually called afinitary operation, referring to the finite number of operands (the valuen). There are obvious extensions where the arity is taken to be an infiniteordinal orcardinal,[1] or even an arbitrary set indexing the operands.
Often, the use of the termoperation implies that the domain of the function includes a power of the codomain (i.e. theCartesian product of one or more copies of the codomain),[17] although this is by no means universal, as in the case ofdot product, where vectors are multiplied and result in a scalar. Ann-ary operationω:Xn →X is called aninternal operation. Ann-ary operationω:Xi ×S ×Xn −i − 1 →X where0 ≤i <n is called anexternal operation by thescalar set oroperator setS. In particular for a binary operation,ω:S ×X →X is called aleft-external operation byS, andω:X ×S →X is called aright-external operation byS. An example of an internal operation isvector addition, where two vectors are added and result in a vector. An example of an external operation isscalar multiplication, where a vector is multiplied by a scalar and result in a vector.
Ann-ary multifunction ormultioperationω is a mapping from a Cartesian power of a set into the set of subsets of that set, formally.[18]