Say I have the operation table for a magma. I want to know whether or not the operation is associative. However, associativity is defined for an operation on 3 elements, and the operation table deals only with two. So it is not clear to me how to determine whether operation is associative by looking only at the table. Is it possible, or does one just need to try every combination of three elements by brute force?
6 Answers
In the absence of any further information then, yes, you need to check every triple. There is a theorem (due to G. Szasz) which asserts that on any set with at least four elements, there is a binary operation for which there is exactly one non-associative triple. (In fact, there are such operations on three-element sets also; $10$ of them, up to isomorphism.)
A reference for the Szasz theorem is:
@ARTICLE{Szasz1953,
AUTHOR = {G. Szasz},
TITLE = {{D}ie {U}nabh\"{a}ngigkeit der {A}ssoziativit\"{a}tsbedingungen},
JOURNAL = {Acta Sci. Math. Szeged},
VOLUME = {15},
YEAR = {1953},
PAGES = {20--28},
LANGUAGE = {German},
REVIEW = {\MR{56575 (15,95d) 09.1X}},
}
I should add that I've not actually seen this paper. (I've never found it online, and I don't read German anyway.) However, the proof is not difficult. Suppose you have a set $S$ with four distinct elements $a$, $u$, $v$ and $w$. Define the binary operation $\cdot$ on $S$ by putting $a\cdot a = u$, $a\cdot u = v$, and $x\cdot y = w$, for all pairs $(x,y)$ other than $(a,a)$ and $(a,u)$. Then it is easy to see that $(a\cdot a)\cdot a\neq a\cdot(a\cdot a)$. It is then tedious, but completely elementary to check (case by case, as it were) that every other triple does associate.

- 9,272
-
I'd be really interested in a link or other reference. – Eric Stucky Feb 08 '13 at 17:43
-
@EricStucky I've added a reference to the Szasz paper, and the guts of the proof. – James Feb 08 '13 at 18:08
-
If you know $((ab) c) d = (ab)(cd)$, $a((bc)d) = (a(bc))d$, $b(cd) = (bc)d$, and $(ab)c = a(bc)$, then it automatically follows that $a(b(cd)) = (ab)(cd)$. So, in principle, you don't have to check every triple if you can arrange to check equations that imply other equations. – Mar 28 '13 at 08:07
-
@EricStucky There is also a proof in Rajagopalan and Schulman "Verification of Identities" (1997). – MJD Nov 27 '13 at 16:28
-
@Hurkyl The apparent discrepancy to Szasz's result is explained by the fact that he essentially uses only a black box that can check for any triple $(x,y,z)\in S^3$ whether or not $x(yz)=(xy)z$ without looking at the intermediate results. Your remarks goes in the direction of Light's test with a generating set. – Hagen von Eitzen Dec 11 '13 at 16:00
In Rajagopalan and Schulman "Verification of Identities" (1997), an algorithm is given that probabilistically checks whether a given operation $\circ$ on a set $S$ is associative. If the operation is nonassociative, the test detects this fact with with any desired probability $\delta$ in $$O(\kappa n^2\log\delta^{-1})$$ time, where $n=|S|$ and$\kappa$ is the time to calculate $\circ$ for one pair of arguments. A variant of the algorithm will generate a specific triple $\langle a,b,c\rangle$ for which $(a\circ b)\circ c\ne a\circ (b\circ c)$, when one exists, in time $$O(\kappa n^2\log n\log \delta^{-1}).$$
This algorithm works for arbitrary operations. Unlike Light's test, it works even for "noncancellative" operations, where the equations $x\circ a = b$ and $a\circ x = b$ may not have solutions for all given $a,b$.
The paper also shows that if the operation $\circ$ is cancellative, one can compute a small ($O(\log n)$)set that generates it in time $O(n^2)$, and then apply Light's test to deterministically verify associativity in total time $O(\kappa n^2\log n)$.

- 65,394
- 39
- 298
- 580
Generally, checking for associativity can be computationally very difficult. There are no easy visual criteria on the multiplication table to discern associativity.

- 79,840
- 7
- 141
- 236
-
1Thanks. Do you know if there are conditions for non-associativity. Where you can see from the table that it's definitely not associative? – Matthew Matic Feb 08 '13 at 11:45
-
3
-
1@MatthewMatic:If your structure is finite, so maybe there is a way to check the associativity by using GAP. If you'd like, give me that structure. Perhaps, I can make a code to verify it. – Mikasa Feb 08 '13 at 15:14
-
@IttayWeiss, there is a geometric interpretation via commutativity on Stasheff polytopes aka http://en.wikipedia.org/wiki/Associahedron – alancalvitti Dec 06 '14 at 14:19
-
@alancalvitti what does the associahedron have to do with any of this??? – Ittay Weiss Dec 06 '14 at 18:39
-
@IttayWeiss, you wrote "There are no easy visual criteria". How much visual do you want than polytopes, at least in low dimensions. Asssociahedra also bear relation to permutohedra, displaying a geometric link b/w associativity and commutativity. – alancalvitti Dec 08 '14 at 21:32
-
@alancalvitti the associahedra are polytopes that form an operad which describes up-to-homotopy associative structures (aka $A_\infty $-spaces). The associahedra are no help at all (geometric or otherwise) for checking for associativity of a given binary operation. – Ittay Weiss Dec 08 '14 at 22:41
-
@IttayWeiss, on p.11 of Mueller-Hoissen et al "Associahedra, Tamari Lattices..." says: a binary operation on a set is n-associative if any monomial composed of n+1 elements is independent of paraenthesization... For a partial binary op (..partial magma)... – alancalvitti Dec 09 '14 at 12:52
-
@alancalvitti yes, but again, this comment (or the associahedra) do not give criterion for associativity (not even in low dimensions. I explained briefly what the associahedra do. They do not allow one to check visually whether a given binary operation is associative or not. – Ittay Weiss Dec 09 '14 at 18:22
-
@IttayWeiss, The whole purpose of associahedra is to study associativity, just find the right operad > http://en.wikipedia.org/wiki/Operad_theory#Associative_operad – alancalvitti Dec 09 '14 at 18:37
-
the whole purpose of the associhedra, as I explained above, is to define up-to-homotopy associative structures. This has nothing to do with a visual criterion to determine if a given binary operation is associative or not. The associative operad also does not provide a visual criterion. The associative operad is just a fancy way to algebraically describe associativity. – Ittay Weiss Dec 09 '14 at 18:57
A method to structure the checking of associativity is Light's associativity test. It doesn't improve the speed of the algorithm (nor can it, as James' answer shows), but it should make you less cross-eyed.
More on this subject can be found in this answer.

- 1,354
What follows was extracted from a personal manuscript of mine written in July 2004. I’ve changed the reference citation numbers to be consecutive beginning with 1, and I’ve included internet links when I could find them. None of the references are very recent (even in 2004) because they were mostly collected (as photocopies I made from library journal volumes) in the 1980s and 1990s when I came across them while browsing these journals in college/university libraries for various topics of interest to me. Also, nearly all are from expository/elementary journals and thus would likely be of interest to teachers (and some students) of beginning abstract algebra courses. I have not attempted to search for more recent references that would fit with those I've given below—I'll leave that to others who might be interested.
Associativity can sometimes be difficult to verify when the operation is not based on known associative operations in certain ways, such as subgroup or direct product group settings. The following give tips on some efficient ways to prove associativity in finite groups: Abdali [1], Aczel [2], Budden [5] (pp. 36−42, 96), Burn [6], Di Paola [7], Dobyns [8], Ferrero/Ferrero [9], Hammel [10], Parker [11], Rosenberg [12], Siu [13], Spielman [14], Watson [15], and Zassenhaus [16].
Borenson [3] gives a short proof that at most $n^3 – n$ verifications are needed to prove associativity for an arbitrary binary operation defined on a set of $n$ elements. Bruckheimer/Scott [4], by assuming that an identity and inverses exist for the binary operation, manage to slightly improve on this last result. They show that $n^3 – 3n^2 +2n$ verifications are needed to prove associativity. Bruckheimer/Scott’s result winds up being about $27\%$ less than $n^3 – n$ when $n=10$ and about $3\%$ less when $n = 100.$
[1] S. Kamal Abdali, Verification of associativity of a binary operation, Mathematical Gazette 54 #390 (December 1970), pp. 372−374.
[2] János Aczél, Conditions for a loop to be a group and for a groupoid to be a semigroup, American Mathematical Monthly 76 #5 (May 1969), pp. 547−549.
[3] Henry Borenson, Verifying associativity (Solution to Problem 6238), American Mathematical Monthly 87 #5 (May 1980), pp. 409−410
[4] Maxim Bruckheimer and Jean V. Scott, Testing for associativity, Mathematics Teaching 45 (Winter 1968), pp. 44−46.
[5] Francis James Budden, The Fascination of Groups, Cambridge University Press, 1972, xviii + 596 pages.
[6] Robert Pemberton Burn, Cayley tables and associativity, Mathematical Gazette 62 #422 (December 1978), pp. 278−281.
[7] Jane W. Di Paola, When is a totally symmetric loop a group?, American Mathematical Monthly 76 #3 (March 1969), pp. 249−252.
[8] Roy Dobyns, A condition equivalent to associativity for finite groups, Two-Year College Mathematics Journal [after 1983: College Mathematics Journal] 3 #1 (Spring 1972), pp. 10−13.
[9] Giovanni Ferrero and Celestina Cotti Ferrero, Verifying the associative property, Bollettino della Unione Matematica Italiana (4) 11 (1975), pp. 322−329.
[10] Arnold Dean Hammel, Verifying the associative property for finite groups, Mathematics Teacher 61 #2 (February 1968), pp. 136−139.
[11] Francis D. Parker, When is a loop a group?, American Mathematical Monthly 72 #7 (August−September 1965), pp. 765−766.
[12] Edwin A. Rosenberg, A question of associativity, or many are the uses of commutativity, School Science and Mathematics 84 #7 (November 1984), pp. 566−572.
[13] Man-Keung Siu, Which Latin squares are Cayley tables?, American Mathematical Monthly 98 #7 (August−September 1991), pp. 625−627.
[14] Bryan Spielman, A test for associativity, Mathematical Gazette 55 #391 (February 1971), p. 59.
[15] Donald Ross Watson, Condition for a loop to be a group, American Mathematical Monthly 74 #7 (August−September 1967), pp. 843−844.
[16] Hans Zassenhaus, What makes a loop a group?, American Mathematical Monthly 75 #2 (February 1968), pp. 139−142.

- 36,843
-
1This was posted yesterday as an answer to How to prove or disprove associativity for all possible combinations out of cayley table for binary operation on a set? (which at the time I didn't know was a duplicate of this earlier question), and Bill Dubuque suggested in a comment that I should move my answer here and delete my earlier answer. – Dave L. Renfro Jun 29 '21 at 17:28
As somebody already wrote, there are some tests that can be done (this wikipedia page links to the same other one cited by @yatima2975).
Personally, I am interested in these matters but I only know sufficient conditions over the Cayley table, for associativity.
If it may help, this is a simple draft of Matlab script to check associativity by brute force (see @James's answer also):
disp('ASSOCIATIVITY TEST FOR A FINITE MAGMA OF ORDER n, WITH ELEMENTS 1,2,...,n, WHOSE CAYLEY TABLE IS GIVEN.');
n=input('Insert the order of the groupoid, n: ');
A=zeros(n);
for i=1:n
r=zeros(1,n);
r=input('Insert Cayley table line as [a_1,...,a_n]: ');
A(i,:)=r;
end
disp('The Cayley table is:');
disp(A);
B=zeros(n,n,n);
for i=1:n
for j=1:n
for k=1:n
if A(A(i,j),k)==A(i,A(j,k))
B(i,j,k)=1;
end
end
end
end
if B==ones(n,n,n)
disp('*** THIS MAGMA IS A SEMIGROUP ***');
else
disp('*** THIS MAGMA IS NOT A SEMIGROUP ***');
end

- 3,316