# How to choose a proper binary operation in a semigroup?

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?

-
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

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.

-
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