A binary operation on a set S is a function that assigns to each ordered pair of elements of S a unique element of S. We often use some special symbol (such as * or +) to represent a binary operation. For example, if we use the symbol '#' to represent some arbitrary binary operation on the set S = {a, b, c}, then a#b equals some element of S (as does b#a, a#a, a#c, and every other possible permutation).
From the above definition, it would follow that the normal definitions for addition, subtraction, and multiplication are all binary operations when defined on the set of all integers. However, division (the mathematical kind - not "integer division") is not a binary operation for the set of integers, since 1=2 = 0.5 which is not an integer.
The use of the word "ordered" in the definition for binary operations is important, for it allows the possibility that the element assigned to a#b may be different from the one assigned to b#a. In the case of integers, this is evident with the binary operation we know as subtraction, since 5 - 3 is not equal to 3 - 5. If in a particular case, x # y = y # x for all elements x and y in the set, we say that the binary operation is commutative. The standard addition operation on the set of integers is commutative.
For the remainder of this problem we will only concern ourselves with small sets (1 to 26 elements). For small sets such as these, the unique assignments that define an operation can be expressed by simply writing down all possible assignments in a "multiplication" table. For instance, the binary operation '#' on the set S = {a, b, c} might be defined by:
# | a b c
---------
a | b c b
b | a c b
c | c b a
The left column of the table represents the first number in an ordered pair, and the top row represents the second. Thus, in this example, a # b = c, b # a = a, and c # c = a. Notice that the body of the table consists solely of elements from the set S, which must be true for any binary operation. Also notice that this operation is not commutative, since b # a is not equal to a # b.
A binary operation, #, on a set S is associative if (x#y)#z = x#(y#z) for all elements x, y, and z in the set X. In the example with the table above, the operation is not associative, since (a#b)#c is not equal to a#(b#c). If a binary operation, #, on a set is associative, then we say that the pair < S,# > forms a semigroup. If the binary operation is commutative as well as associative, then we say that the semigroup is commutative.