Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am interested in generating a finite commutative semigroup which is not a group.

And by generating I mean choosing a number $n$ (number of elements in a semigroup) and then defining a $n \times n$ matrix whose $a_{i,j}$ entry represents a result of my binary operation between $i$-th and $j$-th elements.

So what would be the properties of the matrix in question? Commutativity obviously implies that the matrix is symmetric. What about associativity and it not being a group?

share|cite|improve this question
Write down all possible binary operations on a two-element set. Which are commutative? Which are semigroups? Which are groups? – Chris Eagle Jun 16 '13 at 21:08
($\mathbb{Z}/n,*)$ is an example. – Martin Brandenburg Jun 16 '13 at 21:13
up vote 2 down vote accepted

To test if it's a group, check:

  1. If the values of some row agree with the values of the header; if so you've found the identity, and

  2. Does the identity appear as an entry in each row? If not, some element is missing an inverse.

Testing associativity is harder. Associative relations are rare.

You may be interested in this result, which gives the matrix a type of block structure, for "almost all" semigroups.

On p.9 of this they give a simple construction of nilpotent semigroups of degree 2 or 3, which is also "almost all" semigroups.

share|cite|improve this answer
I appreciate all the information. However, since I'm struggling a little bit with the programming aspect of it, maybe by any chance you could write any particular binary operation which meets the requirements? – Pranasas Jun 21 '13 at 15:33
@Pranasas: did you see Martin Brandenburg's comment? If you just want other examples of commutative semigroups, you could also consult Grillet's book Commutative Semigroups. It's not clear from your question if your goal is to test a random binary operation for being a commutative semigroup or if want generate one that is "random enough" and has the desired properties. – Fizz Apr 16 '15 at 19:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.