\documentclass[numbers=enddot,12pt,final,onecolumn,notitlepage]{scrartcl}%
\usepackage[headsepline,footsepline,manualmark]{scrlayer-scrpage}
\usepackage[all,cmtip]{xy}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{framed}
\usepackage{comment}
\usepackage{color}
\usepackage[breaklinks=True]{hyperref}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{needspace}
\usepackage{tabls}
\usepackage{ytableau}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[type={CC}, modifier={zero}, version={1.0},]{doclicense}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Friday, September 25, 2026 20:09:29}
%TCIDATA{SuppressPackageManagement}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Language=American English}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\pgfplotsset{compat=1.13}
\theoremstyle{definition}
\newtheorem{theo}{Theorem}[subsection]
\newtheorem{exer}{Exercise}[subsubsection]
\newenvironment{theorem}[1][]
{\begin{theo}[#1]\begin{leftbar}}
{\end{leftbar}\end{theo}}
\newtheorem{lem}[theo]{Lemma}
\newenvironment{lemma}[1][]
{\begin{lem}[#1]\begin{leftbar}}
{\end{leftbar}\end{lem}}
\newtheorem{prop}[theo]{Proposition}
\newenvironment{proposition}[1][]
{\begin{prop}[#1]\begin{leftbar}}
{\end{leftbar}\end{prop}}
\newtheorem{defi}[theo]{Definition}
\newenvironment{definition}[1][]
{\begin{defi}[#1]\begin{leftbar}}
{\end{leftbar}\end{defi}}
\newtheorem{remk}[theo]{Remark}
\newenvironment{remark}[1][]
{\begin{remk}[#1]\begin{leftbar}}
{\end{leftbar}\end{remk}}
\newtheorem{coro}[theo]{Corollary}
\newenvironment{corollary}[1][]
{\begin{coro}[#1]\begin{leftbar}}
{\end{leftbar}\end{coro}}
\newtheorem{conv}[theo]{Convention}
\newenvironment{convention}[1][]
{\begin{conv}[#1]\begin{leftbar}}
{\end{leftbar}\end{conv}}
\newtheorem{quest}[theo]{Question}
\newenvironment{question}[1][]
{\begin{quest}[#1]\begin{leftbar}}
{\end{leftbar}\end{quest}}
\newtheorem{warn}[theo]{Warning}
\newenvironment{warning}[1][]
{\begin{warn}[#1]\begin{leftbar}}
{\end{leftbar}\end{warn}}
\newtheorem{conj}[theo]{Conjecture}
\newenvironment{conjecture}[1][]
{\begin{conj}[#1]\begin{leftbar}}
{\end{leftbar}\end{conj}}
\newtheorem{exam}[theo]{Example}
\newenvironment{example}[1][]
{\begin{exam}[#1]\begin{leftbar}}
{\end{leftbar}\end{exam}}
\newtheorem{exmp}[exer]{Exercise}
\newenvironment{exercise}[1][]
{\begin{exmp}[#1]\begin{leftbar}}
{\end{leftbar}\end{exmp}}
\newenvironment{statement}{\begin{quote}}{\end{quote}}
\newenvironment{fineprint}{\begin{small}}{\end{small}}
\iffalse
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{convention}[1][Convention]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{question}[1][Question]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\fi
\let\sumnonlimits\sum
\let\prodnonlimits\prod
\let\cupnonlimits\bigcup
\let\capnonlimits\bigcap
\renewcommand{\sum}{\sumnonlimits\limits}
\renewcommand{\prod}{\prodnonlimits\limits}
\renewcommand{\bigcup}{\cupnonlimits\limits}
\renewcommand{\bigcap}{\capnonlimits\limits}
\usetikzlibrary{arrows,arrows.meta,decorations.markings}
\setlength\tablinesep{3pt}
\setlength\arraylinesep{3pt}
\setlength\extrarulesep{3pt}
\setlength\textheight{22.5cm}
\setlength\textwidth{14.8cm}
\newenvironment{verlong}{}{}
\newenvironment{vershort}{}{}
\newenvironment{noncompile}{}{}
\excludecomment{verlong}
\includecomment{vershort}
\excludecomment{noncompile}
\newcommand{\defn}[1]{{\color{darkred}\emph{#1}}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\KK}{\mathbb{K}}
\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\abs}[1]{\left| #1 \right|}
\newcommand{\tup}[1]{\left( #1 \right)}
\newcommand{\ive}[1]{\left[ #1 \right]}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\mono}{\hookrightarrow}
\newcommand{\epi}{\twoheadrightarrow}
\newcommand{\iso}{\overset{\cong}{\to}}
\newcommand{\arinj}{\ar@{_{(}->}}
\newcommand{\arinjrev}{\ar@{^{(}->}}
\newcommand{\arsurj}{\ar@{->>}}
\newcommand{\arelem}{\ar@{|->}}
\newcommand{\arback}{\ar@{<-}}
\newcommand{\Ker}{\operatorname{Ker}}
\newcommand{\Coker}{\operatorname{Coker}}
\newcommand{\incpdftexpic}[1]{{\def\svgwidth{\columnwidth} \input{#1} }}
\definecolor{dbluecolor}{rgb}{0.01,0.02,0.7}
\definecolor{dgreencolor}{rgb}{0.2,0.4,0.0}
\definecolor{darkred}{rgb}{0.7,0,0}
\newtheoremstyle{plainsl}
{8pt plus 2pt minus 4pt}
{8pt plus 2pt minus 4pt}
{\slshape}
{0pt}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}
\theoremstyle{plainsl}
\ihead{Math 331, Fall 2026, Lecture 2 and 3, version \today}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\section*{Math 331 Fall 2026, Lecture 2 and 3: Defining semigroups, monoids
and groups}

\textbf{website:}
\texttt{\href{https://www.cip.ifi.lmu.de/~grinberg/t/26fa}{\texttt{https://www.cip.ifi.lmu.de/\symbol{126}%
grinberg/t/26fa/}}}

(GPT-6 was used to polish the writing that follows.)

\setcounter{section}{0}

\section{Groups}

\subsection{Definition}

\begin{definition}
Let $S$ be a set.

\begin{enumerate}
\renewcommand{\theenumi}{\alph{enumi}} \renewcommand{\labelenumi}{\textbf{(\theenumi)}}

\item A \textbf{binary operation} on $S$ means a function $f$ from $S\times S$
to $S$. That is, it means a function that takes two elements of $S$ as inputs
and returns an element of $S$. We will usually write this function in
\textbf{infix notation}: i.e., instead of writing $f\left(  s,t\right)  $, we
shall write $s\ f\ t$. We will often use symbols like $\cdot$, $+$ and $\ast$
instead of $f$, so our expressions will look like $s\cdot t$, $s+t$ or $s\ast
t$.

For example, $+$ is a binary operation on the set $\mathbb{Z}$.

\item A binary operation $\ast$ on $S$ is said to be \textbf{associative} if
all $a,b,c\in S$ satisfy
\[
\left(  a\ast b\right)  \ast c=a\ast\left(  b\ast c\right)  .
\]


\item If $\ast$ is an associative binary operation on $S$, then the pair
$\left(  S,\ast\right)  $ is called a \textbf{semigroup}. (Alternatively, we
can say that \textquotedblleft$S$ is a semigroup under $\ast$%
\textquotedblright, or just \textquotedblleft$S$ is a
semigroup\textquotedblright\ if the operation $\ast$ is inferrable from the
context; but the operation $\ast$ is still part of the structure even if we
don't explicitly name it.)

\item Given a binary operation $\ast$ on $S$, a \textbf{neutral element} (also
called an \textbf{identity element}) of $\ast$ means an element $e\in S$ such
that every $a\in S$ satisfies
\[
a\ast e=e\ast a=a.
\]
We also call $e$ a neutral element of $S$ with respect to $\ast$, or just a
neutral element of the pair $\left(  S,\ast\right)  $.

\item A \textbf{monoid} means a semigroup $\left(  S,\ast\right)  $ that has a
neutral element (i.e., for which there exists a neutral element $e\in S$ of
$\ast$). We will soon show (Proposition \ref{prop.sg.neutral-unique}) that
this neutral element is unique.

\item Now let $\left(  S,\ast\right)  $ be a monoid with neutral element $e$.
An \textbf{inverse} of an element $a\in S$ (with respect to $\ast$) means an
element $b\in S$ such that
\[
a\ast b=b\ast a=e.
\]


\item A \textbf{group} means a monoid $\left(  S,\ast\right)  $ such that each
element $a\in S$ has an inverse with respect to $\ast$. We will soon show
(Proposition \ref{prop.monoid.inverse-unique}) that this inverse of $a$ is unique.
\end{enumerate}
\end{definition}

\begin{remark}
We will mostly deal with groups in this course. Monoids are no less natural,
but have fewer general properties (since there is \textquotedblleft less to
work with\textquotedblright\ without inverses). Semigroups occur even more
frequently, but many of the useful examples we will encounter are already monoids.
\end{remark}

Let us summarize the above definition as a \textquotedblleft
flowchart\textquotedblright\ for checking whether a given pair $\left(
S,\ast\right)  $ is a semigroup, monoid or group:

Given a pair $\left(  S,\ast\right)  $:

\begin{itemize}
\item[$\bullet$] \textbf{If} $\ast$ is a map from $S\times S$ to $S$, then
$\ast$ is a binary operation on $S$.

\begin{itemize}
\item[$\bullet\bullet$] \textbf{If, in addition}, $\ast$ is associative (that
is, $\left(  a\ast b\right)  \ast c=a\ast\left(  b\ast c\right)  $ for all
$a,b,c\in S$), then $\left(  S,\ast\right)  $ is a semigroup.

\begin{itemize}
\item[$\bullet\bullet\bullet$] \textbf{If, in addition,} $\ast$ has a neutral
element $e$ (that is, an element $e\in S$ such that all $a\in S$ satisfy
$a\ast e=e\ast a=a$), then $\left(  S,\ast\right)  $ is a monoid.

\begin{itemize}
\item[$\bullet\bullet\bullet\bullet$] \textbf{If, in addition,} each $a\in S$
has an inverse (that is, some $b\in S$ such that $a\ast b=b\ast a=e$), then
$\left(  S,\ast\right)  $ is a group.
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}

\subsection{Examples}

Let us scour the mathematics we know for examples of semigroups, monoids and
groups. We begin with the number systems from Lecture 1:

\begin{itemize}
\item The pair $\left(  \mathbb{Z}_{>0},+\right)  $ (that is, the set
$\mathbb{Z}_{>0}$ equipped with the binary operation $+$) is a semigroup,
since $+$ is associative. It is not a monoid: the only possible neutral
element would be $0$, but $0\notin\mathbb{Z}_{>0}$. Thus, it is not a group either.

The same applies to $\left(  \mathbb{Q}_{>0},+\right)  $ and $\left(
\mathbb{R}_{>0},+\right)  $.

\item The pair $\left(  \mathbb{Z},+\right)  $ is a group: addition is
associative, $0$ is a neutral element, and each $a\in\mathbb{Z}$ has the
inverse $-a\in\mathbb{Z}$.

The same applies to $\left(  \mathbb{Q},+\right)  $, $\left(  \mathbb{R}%
,+\right)  $ and $\left(  \mathbb{C},+\right)  $.

\item The pair $\left(  \mathbb{Z}_{>0},\cdot\right)  $ (that is, the set
$\mathbb{Z}_{>0}$ equipped with multiplication) is a monoid, since
multiplication is associative and $1$ is a neutral element. It is not a group,
since $2$ has no inverse in $\mathbb{Z}_{>0}$.

Similarly, the pairs $\left(  \mathbb{Z},\cdot\right)  $, $\left(
\mathbb{Q},\cdot\right)  $, $\left(  \mathbb{R},\cdot\right)  $ and $\left(
\mathbb{C},\cdot\right)  $ are also monoids but not groups. In each case, $0$
has no inverse.

However, $\left(  \mathbb{Q}\setminus\left\{  0\right\}  ,\cdot\right)  $ is a
group, since products of nonzero rational numbers are nonzero and each nonzero
rational number has a nonzero reciprocal. This group is denoted by
$\mathbb{Q}^{\times}$. Similarly, the nonzero real numbers and the nonzero
complex numbers form groups under multiplication, denoted by $\mathbb{R}%
^{\times}$ and $\mathbb{C}^{\times}$, respectively.

The Hamiltonian quaternions $\mathbb{H}$ give a similar example: nonzero
quaternions have nonzero products and have inverses. Thus, $\left(
\mathbb{H}\setminus\left\{  0\right\}  ,\cdot\right)  $ is a group, even
though quaternion multiplication is not commutative.

\item The pair $\left(  \mathbb{Z},-\right)  $ is not a semigroup, since
subtraction is not associative: the equality $\left(  a-b\right)  -c=a-\left(
b-c\right)  $ fails for any three integers $a,b,c$ with $c\neq0$.

The pair $\left(  \mathbb{Q},/\right)  $ is not a semigroup either. In fact,
division is not even a binary operation on $\mathbb{Q}$, because division by
$0$ is undefined. Restricting to $\mathbb{Q}\setminus\left\{  0\right\}  $
does give a binary operation, but it is still not associative. For example,
$\left(  1/2\right)  /3=1/6\neq3/2=1/\left(  2/3\right)  $.

What about exponentiation on $\mathbb{Z}_{>0}$, viewed as the binary operation
that sends $\left(  a,b\right)  $ to $a^{b}$? This does not give a semigroup
either, since associativity fails. For example, $2^{\left(  2^{3}\right)
}=256\neq64=\left(  2^{2}\right)  ^{3}$.

\item What about the pair $\left(  \mathbb{Z}_{<0},+\right)  $, where
$\mathbb{Z}_{<0}=\left\{  -1,-2,-3,\ldots\right\}  $ is the set of all
negative integers? This is again a semigroup but not a monoid, since addition
is associative but its only possible neutral element, $0$, does not belong to
$\mathbb{Z}_{<0}$.

What about $\left(  \mathbb{Z}_{<0},\cdot\right)  $ ? Here, multiplication is
not even a binary operation on $\mathbb{Z}_{<0}$: products of negative
integers are positive, so the output does not belong to the specified set.
Thus, this pair is certainly not a semigroup, a monoid or a group.

\item For any positive integer $n$, consider the set $\mathbb{R}^{n\times n}$
of all $n\times n$-matrices with real entries. It forms a group $\left(
\mathbb{R}^{n\times n},+\right)  $ under addition. Its neutral element is the
zero matrix, and the inverse of a matrix $A$ is $-A$.

Consider furthermore the set $\operatorname*{GL}\nolimits_{n}\left(
\mathbb{R}\right)  $ of all invertible (= nonsingular) $n\times n$-matrices.
This forms a group $\left(  \operatorname{GL}_{n}\left(  \mathbb{R}\right)
,\cdot\right)  $ under multiplication. Its neutral element is $I_{n}$ (the
identity matrix), and its inverses are the usual matrix inverses. The product
of two invertible matrices is again invertible, so multiplication is indeed a
binary operation on this set.

The pair $\left(  \mathbb{R}^{n\times n},\cdot\right)  $ is a monoid but not a
group: the identity matrix is still neutral, but not every matrix is
invertible. For example, the zero matrix has no inverse. On the other hand,
$\left(  \operatorname*{GL}\nolimits_{n}\left(  \mathbb{R}\right)  ,+\right)
$ is not even a semigroup, since sums of invertible matrices don't have to be invertible.

For two distinct positive integers $n$ and $m$, two $n\times m$-matrices
cannot be multiplied using ordinary matrix multiplication. Thus, there is no
semigroup $\left(  \mathbb{R}^{n\times m},\cdot\right)  $ under matrix multiplication.
\end{itemize}

Let us now move on to less familiar operations and less familiar sets.

\begin{itemize}
\item For any set $A$, consider the set $\operatorname{Map}\left(  A,A\right)
=A^{A}$ of all maps from $A$ to $A$.

For any two maps $f,g\in\operatorname{Map}\left(  A,A\right)  $, the
composition $f\circ g$ also belongs to $\operatorname{Map}\left(  A,A\right)
$. Recall that $f\circ g$ sends an element $a$ to $f\left(  g\left(  a\right)
\right)  $: we apply $g$ first and then $f$. Thus, the composition operation
$\circ$ is a binary operation on $\operatorname{Map}\left(  A,A\right)  $. It
is associative, since both $\left(  f\circ g\right)  \circ h$ and
$f\circ\left(  g\circ h\right)  $ send each $a\in A$ to $f\left(  g\left(
h\left(  a\right)  \right)  \right)  $.

Therefore, $\left(  \operatorname{Map}\left(  A,A\right)  ,\circ\right)  $ is
a semigroup. The identity map $\operatorname{id}_{A}:A\rightarrow A$ (which
sends each $a\in A$ to $a$ itself) is a neutral element, so this semigroup is
a monoid.

Is it a group? This is asking whether every map $f:A\rightarrow A$ is
invertible. This is true when $A$ is empty or a $1$-element set (because in
either case, the only map from $A$ to $A$ is its identity map). If $A$ has at
least two elements, however, a constant map from $A$ to $A$ is not invertible.
Thus, in all these other cases, $\left(  \operatorname{Map}\left(  A,A\right)
,\circ\right)  $ is not a group.

To \textquotedblleft fix\textquotedblright\ this, we can restrict ourselves to
the bijective (equivalently, invertible) maps from $A$ to $A$. These are
called the \textbf{permutations} of $A$, and they do form a group under
composition: compositions and inverses of bijections are again bijections, and
the identity map is a bijection. This group is called the \textbf{symmetric
group} of $A$, and we will spend a while studying its properties.

\item Fix a set $A$. Consider the power set of $A$; this is the set
$\mathcal{P}\left(  A\right)  $ of all subsets of $A$. For example, if
$A=\left\{  1,2,3\right\}  $, then
\[
\begin{aligned}
\mathcal{P}\left(A\right)=\bigl\{&\varnothing,\ \left\{1\right\},\
\left\{2\right\},\ \left\{3\right\},\\
&\left\{1,2\right\},\ \left\{2,3\right\},\ \left\{1,3\right\},\
\left\{1,2,3\right\}\bigr\}.
\end{aligned}
\]
We would like to make $\mathcal{P}\left(  A\right)  $ into a semigroup, or
better yet a monoid, or even a group. What operations can we use?

Two well-known operations are $\cup$ and $\cap$.

The pair $\left(  \mathcal{P}\left(  A\right)  ,\cup\right)  $ is a semigroup,
since $\left(  X\cup Y\right)  \cup Z=X\cup\left(  Y\cup Z\right)  $ for all
$X,Y,Z\subseteq A$. It is also a monoid, with neutral element $\varnothing$.
Unless $A=\varnothing$, it is not a group: a nonempty subset $X$ has no
inverse, since $X\cup Y$ can never be empty.

The pair $\left(  \mathcal{P}\left(  A\right)  ,\cap\right)  $ is also a
semigroup, since $\left(  X\cap Y\right)  \cap Z=X\cap\left(  Y\cap Z\right)
$ for all $X,Y,Z\subseteq A$. It is a monoid with neutral element $A$. Unless
$A=\varnothing$, it is not a group: the empty set has no inverse, since
$\varnothing\cap Y=\varnothing\neq A$ for every $Y\subseteq A$. When
$A=\varnothing$, both of these monoids are one-element groups.

Can you think of a binary operation on $\mathcal{P}\left(  A\right)  $ that
does make it into a group for every $A$? Mason suggests the operation
$\bigtriangleup$ defined by
\[
X\bigtriangleup Y=\left(  X\cup Y\right)  \setminus\left(  X\cap Y\right)
=\left(  X\setminus Y\right)  \cup\left(  Y\setminus X\right)  .
\]
This is called the \textbf{symmetric difference} of $X$ and $Y$. Here is the
Venn diagram of $X\bigtriangleup Y$:%
\[
\begin{tikzpicture}
\fill[even odd rule, fill=gray] (0,0) circle (1) (1.2,0) circle (1.3);
\end{tikzpicture}
\]
(where the two circles represent $X$ and $Y$, while the shaded region is
$X\bigtriangleup Y$).

Does this operation give a semigroup? Yes, if we can show that $\bigtriangleup
$ is associative. This can be done using truth tables: for any $X,Y,Z\subseteq
A$, we must show that a given element $p\in A$ lies in $\left(
X\bigtriangleup Y\right)  \bigtriangleup Z$ if and only if it lies in
$X\bigtriangleup\left(  Y\bigtriangleup Z\right)  $. There are $8$ cases to consider:

\begin{itemize}
\item the case $p\in X$, $p\in Y$ and $p\in Z$;

\item the case $p\in X$, $p\in Y$ and $p\notin Z$;

\item and so on ($6$ more cases).
\end{itemize}

You can visualize this proof through a Venn diagram:%
\[
\begin{tikzpicture}
\fill[even odd rule, fill=gray] (0,0) circle (1) (1.2,0) circle (1.3) (0.4,-0.7) circle (1.1);
\end{tikzpicture}
\]
(where the three circles represent $X$, $Y$ and $Z$, while the shaded region
is $\left(  X\bigtriangleup Y\right)  \bigtriangleup Z=X\bigtriangleup\left(
Y\bigtriangleup Z\right)  $). A nicer proof observes that both $\left(
X\bigtriangleup Y\right)  \bigtriangleup Z$ and $X\bigtriangleup\left(
Y\bigtriangleup Z\right)  $ consist of precisely those $p\in A$ that belong to
an \textbf{odd} number of the sets $X,Y,Z$ (that is, either to exactly one or
to all three).

Thus, $\left(  \mathcal{P}\left(  A\right)  ,\bigtriangleup\right)  $ is a
semigroup. It is a monoid with neutral element $\varnothing$. Is it a group?
Yes: the inverse of any $X\in\mathcal{P}\left(  A\right)  $ is $X$ itself,
since
\[
X\bigtriangleup X=\left(  X\cup X\right)  \setminus\left(  X\cap X\right)
=X\setminus X=\varnothing.
\]


\item Consider the set of all Euclidean transformations of the plane (also
called rigid transformations of the plane). These are the invertible maps from
the plane $\mathbb{R}^{2}$ to itself that preserve distances. Examples are
parallel shifts (translations), rotations and reflections, as well as their
compositions. They form a group under composition: the identity map preserves
distances, and so do compositions and inverses of distance-preserving maps.

What happens if we restrict to Euclidean transformations that preserve
orientation? These still form a group under composition.

What about the Euclidean transformations that reverse orientation? They do not
even form a semigroup under composition, since composing two such
transformations gives an orientation-preserving transformation, not an
orientation-reversing one!

\item Consider a weird-looking binary operation $\ast$ on the set $\mathbb{Q}$
defined by
\[
a\ast b=ab+a+b\ \ \ \ \ \ \ \ \ \ \text{for all }a,b\in\mathbb{Q}.
\]
Is $\left(  \mathbb{Q},\ast\right)  $ a semigroup? Is it a monoid? Is it a group?

\begin{itemize}
\item It is a semigroup. Indeed, associativity can be checked directly: for
all $a,b,c\in\mathbb{Q}$, we have
\begin{align*}
\left(  a\ast b\right)  \ast c  &  =\left(  ab+a+b\right)  \ast c\\
&  =\left(  ab+a+b\right)  c+\left(  ab+a+b\right)  +c\\
&  =abc+ab+ac+bc+a+b+c,
\end{align*}
and expanding $a\ast\left(  b\ast c\right)  $ gives the same result.

\item It is a monoid. The element $0$ is neutral, since $0\ast a=0a+0+a=a$ and
likewise $a\ast0=a$ for every $a\in\mathbb{Q}$.

\item It is not a group. The element $-1$ has no inverse, because $\left(
-1\right)  \ast a=-a-1+a=-1$ for every $a\in\mathbb{Q}$, whereas an inverse
would have to satisfy $\left(  -1\right)  \ast a=0$.

All other rational numbers do have inverses: for $a\neq-1$, the inverse is
$\dfrac{-a}{a+1}$. This can be checked directly from the definition of $\ast$.
\end{itemize}

Thus, $\left(  \mathbb{Q},\ast\right)  $ is a monoid. But actually, it is just
the monoid $\left(  \mathbb{Q},\cdot\right)  $ with its elements renamed --
namely, with each rational number $c$ renamed as $c-1$. Indeed, for three
rational numbers $a,b,c$, we have
\[
c-1=\left(  a-1\right)  \ast\left(  b-1\right)  \qquad\text{if and only
if}\qquad c=ab.
\]
Equivalently,
\[
c=a\ast b\qquad\text{if and only if}\qquad c+1=\left(  a+1\right)  \left(
b+1\right)  .
\]
So $\left(  \mathbb{Q},\ast\right)  $ is a monoid but not really a new one: it
is just a version of $\left(  \mathbb{Q},\cdot\right)  $ with its elements
renamed. We say that it is \textbf{isomorphic} to $\left(  \mathbb{Q}%
,\cdot\right)  $. We will give a formal definition of isomorphism later.

\item Consider the set $\left\{  0\right\}  $ with the binary operation $\ast$
defined by $0\ast0=0$. The pair $\left(  \left\{  0\right\}  ,\ast\right)  $
is a group: its neutral element is $0$, which is also its own inverse. More
generally, any one-element set becomes a group when we define its binary
operation in the only possible way. Such a group is called a \textbf{trivial
group}.

\item What would a group $\left(  G,\ast\right)  $ with two elements look
like? It must have a neutral element -- let's call it $e$. Let $f$ be the
other element of $G$. Since $e$ is neutral, we have $e\ast e=e$, $e\ast f=f$
and $f\ast e=f$.

What can $f\ast f$ be? The only possibilities are $e$ and $f$. But $f$ must
have an inverse, and this inverse cannot be $e$, since $f\ast e=f\neq e$.
Therefore, the inverse of $f$ is $f$ itself, and hence $f\ast f=e$. This
uniquely determines the multiplication table (more precisely: the $\ast
$-table) of $G$:
\[%
\begin{tabular}
[c]{|c||c|c|}\hline
$x\ast y$ & $y=e$ & $y=f$\\\hline\hline
$x=e$ & $e$ & $f$\\\hline
$x=f$ & $f$ & $e$\\\hline
\end{tabular}
\ \quad.
\]
Conversely, if we start with a two-element set $\left\{  e,f\right\}  $ and
define a binary operation $\ast$ by this table, then we do get a group. We can
verify the axioms directly (start by showing that $e$ is a neutral element),
but a shortcut makes the associativity check especially quick: Whenever a
binary operation has a neutral element $e$, the equality $\left(  x\ast
y\right)  \ast z=x\ast\left(  y\ast z\right)  $ holds immediately if
\textbf{any} of $x,y,z$ equals $e$. Thus, in our case, the only remaining
check is
\[
\left(  f\ast f\right)  \ast f=e\ast f=f=f\ast e=f\ast\left(  f\ast f\right)
.
\]
The table also shows that $e$ is neutral and that both elements are their own
inverses, so all the group axioms hold.

Alternatively (thanks to Nico Ghiron), we can recall that the two numbers $1$
and $-1$ multiply by the same rule as the elements $e$ and $f$ above:
\[%
\begin{tabular}
[c]{|c||c|c|}\hline
$xy$ & $y=1$ & $y=-1$\\\hline\hline
$x=1$ & $1$ & $-1$\\\hline
$x=-1$ & $-1$ & $1$\\\hline
\end{tabular}
\ \quad.
\]
Thus, we already have a group $\left(  \left\{  1,-1\right\}  ,\cdot\right)  $
with two elements! The group $\left(  \left\{  e,f\right\}  ,\ast\right)  $ we
are constructing is just an isomorphic copy of this group: it is the same
group with $1$ and $-1$ renamed as $e$ and $f$, and with the operation $\cdot$
renamed as $\ast$.
\end{itemize}

\subsection{Some first general properties of semigroups, monoids and groups}

So we have defined three rather general classes of objects (semigroups,
monoids and groups) and given some examples and non-examples for each. Let us
now prove a few things about these objects in general, just using their definitions.

First of all, neutral elements -- when they exist -- are unique:

\begin{proposition}
\label{prop.sg.neutral-unique}Let $\ast$ be a binary operation on a set $S$.
Then, $\ast$ has \textbf{at most one} neutral element. In other words, if a
neutral element exists, then it is unique.
\end{proposition}

\begin{proof}
We must show that any two neutral elements of $\ast$ are equal.

Let $e$ and $f$ be two neutral elements of $\ast$. We want to prove that
$e=f$. Luke suggests the following argument: Since $f$ is neutral, $e\ast
f=e$; since $e$ is neutral, $e\ast f=f$. Comparing these equalities, we get
$e=f$.

Thus, any two neutral elements of $\ast$ are equal, so there is at most one.
\end{proof}

\begin{definition}
Let $\left(  S,\ast\right)  $ be a monoid. Proposition
\ref{prop.sg.neutral-unique} allows us to speak of \textbf{the neutral
element} of $\left(  S,\ast\right)  $ without having to worry about
potentially confusing several different neutral elements. We shall do so, and
we will usually denote this neutral element by $e$.

In some of the later lectures, we will rename the operation $\ast$ as $\cdot$
(and simply write $st$ for $s\ast t$), and correspondingly rename the neutral
element $e$ as $1$, thus pretending that the operation $\ast$ is some kind of
multiplication. Of course, this notation should not be used when the set $S$
already has a different multiplication defined on it (or contains the number
$1$ but this number is not its neutral element); but it works well when we are
dealing with a generic monoid $\left(  S,\ast\right)  $ that we know nothing about.
\end{definition}

The same applies to inverses in a monoid:

\begin{proposition}
\label{prop.monoid.inverse-unique}Let $\left(  S,\ast\right)  $ be a monoid,
and let $a\in S$ be an element that has an inverse. Then, this inverse is unique.
\end{proposition}

\begin{proof}
We must show that any two inverses of $a$ are equal. Let $x$ and $y$ be two
such inverses. Then, $x\ast a=e$ and $a\ast y=e$ (where $e$ is the neutral
element of $\left(  S,\ast\right)  $). But associativity yields $\left(  x\ast
a\right)  \ast y=x\ast\left(  a\ast y\right)  $. In view of $x\ast
\underbrace{\left(  a\ast y\right)  }_{=e}=x\ast e=x$ (since $e$ is neutral)
and $\underbrace{\left(  x\ast a\right)  }_{=e}\ast\,y=e\ast y=y$ (again since
$e$ is neutral), we can rewrite this as $x=y$. Thus, we have shown that any
two inverses of $a$ are equal. Since an inverse exists by assumption, it is unique.
\end{proof}

\begin{definition}
\label{def.monoid.inverse}Let $\left(  S,\ast\right)  $ be a monoid. Let $a\in
S$. Proposition \ref{prop.monoid.inverse-unique} tells us that if $a$ has an
inverse, then we can call it \textbf{the inverse} of $a$ without worrying that
this might be ambiguous. We shall do so, and we will denote this inverse by
$a^{-1}$.
\end{definition}

The following properties of inverses are crucial for any work with them. You
might have already encountered them when dealing with inverses of matrices and
maps; here we state them in an arbitrary monoid (thus generalizing the matrix
case and partly generalizing the case of maps\footnote{Only partly, because
maps between different sets do not live in a monoid.}).

\begin{theorem}
[rules for inverses]\label{thm.monoid.inverse-rules}Let $\left(
S,\ast\right)  $ be a monoid with neutral element $e$.

\begin{enumerate}
\renewcommand{\theenumi}{\alph{enumi}} \renewcommand{\labelenumi}{\textbf{(\theenumi)}}

\item If $a\in S$ has an inverse $a^{-1}$, then this inverse $a^{-1}$ itself
has an inverse, namely
\[
\left(  a^{-1}\right)  ^{-1}=a.
\]


\item If $a,b\in S$ both have inverses, then $a\ast b$ also has an inverse,
namely
\[
\left(  a\ast b\right)  ^{-1}=b^{-1}\ast a^{-1}.
\]
This is known as the \textbf{socks-and-shoes rule}. It is analogous to the
rule $\left(  f\circ g\right)  ^{-1}=g^{-1}\circ f^{-1}$ for invertible maps
and the rule $\left(  AB\right)  ^{-1}=B^{-1}A^{-1}$ for invertible square
matrices of the same size.
\end{enumerate}
\end{theorem}

\begin{proof}
\leavevmode


\begin{enumerate}
\renewcommand{\theenumi}{\alph{enumi}} \renewcommand{\labelenumi}{\textbf{(\theenumi)}}

\item Since $a^{-1}$ is an inverse of $a$, we have $a\ast a^{-1}=a^{-1}\ast
a=e$. The same equalities show that $a$ is an inverse of $a^{-1}$. Thus,
$\left(  a^{-1}\right)  ^{-1}=a$.

\item We have to show that $b^{-1}\ast a^{-1}$ is an inverse of $a\ast b$. For
this, we must prove that
\begin{align*}
\left(  b^{-1}\ast a^{-1}\right)  \ast\left(  a\ast b\right)   &
=e\ \ \ \ \ \ \ \ \ \ \text{and}\\
\left(  a\ast b\right)  \ast\left(  b^{-1}\ast a^{-1}\right)   &  =e.
\end{align*}
We check both of these equalities now. Using associativity in the first two
steps of each calculation, we obtain
\begin{align*}
\left(  b^{-1}\ast a^{-1}\right)  \ast\left(  a\ast b\right)   &  =b^{-1}%
\ast\left(  a^{-1}\ast\left(  a\ast b\right)  \right) \\
&  =b^{-1}\ast\left(  \underbrace{\left(  a^{-1}\ast a\right)  }_{=e}%
\ast\,b\right) \\
&  =b^{-1}\ast\underbrace{\left(  e\ast b\right)  }_{=b}=b^{-1}\ast b=e
\end{align*}
and
\begin{align*}
\left(  a\ast b\right)  \ast\left(  b^{-1}\ast a^{-1}\right)   &
=a\ast\left(  b\ast\left(  b^{-1}\ast a^{-1}\right)  \right) \\
&  =a\ast\left(  \underbrace{\left(  b\ast b^{-1}\right)  }_{=e}\ast
\,a^{-1}\right) \\
&  =a\ast\underbrace{\left(  e\ast a^{-1}\right)  }_{=a^{-1}}=a\ast a^{-1}=e.
\end{align*}
Thus, $b^{-1}\ast a^{-1}$ is the inverse of $a\ast b$. \qedhere

\end{enumerate}
\end{proof}

In this proof, we had to deal with the annoyance of regrouping products using
associativity. It would have been much nicer if we had been able to write
products like
\[
a\ast b\ast b^{-1}\ast a^{-1}%
\]
without parentheses. But $\ast$ is a binary operation: it has only two inputs.
Thus, it is not a-priori clear that we can make sense of \textquotedblleft
products\textquotedblright\ of several elements, such as $a\ast b\ast c\ast
d\ast e$, without parentheses.

For example, the \textquotedblleft product\textquotedblright\ $a\ast b\ast
c\ast d$ in a semigroup can be fully parenthesized in $5$ ways:
\begin{align*}
&  \left(  \left(  a\ast b\right)  \ast c\right)  \ast d,\\
&  \left(  a\ast\left(  b\ast c\right)  \right)  \ast d,\\
&  a\ast\left(  b\ast\left(  c\ast d\right)  \right)  ,\\
&  a\ast\left(  \left(  b\ast c\right)  \ast d\right)  ,\\
&  \left(  a\ast b\right)  \ast\left(  c\ast d\right)  .
\end{align*}
Do these $5$ ways all produce the same result?

For a product $a\ast b\ast c$, there are only $2$ ways to insert parentheses:
$\left(  a\ast b\right)  \ast c$ and $a\ast\left(  b\ast c\right)  $. They
produce the same result by associativity.

For $a\ast b\ast c\ast d$, the answer is not quite as immediate. Nevertheless,
repeated use of associativity shows that all $5$ ways give the same result:
\begin{align*}
&  \left(  a\ast\left(  b\ast c\right)  \right)  \ast d\\
&  =\left(  \left(  a\ast b\right)  \ast c\right)  \ast
d\ \ \ \ \ \ \ \ \ \ \left(  \text{by associativity for }a\text{, }b\text{ and
}c\right)  \\
&  =\left(  a\ast b\right)  \ast\left(  c\ast d\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by associativity for }a\ast b\text{,
}c\text{ and }d\right)  \\
&  =a\ast\left(  b\ast\left(  c\ast d\right)  \right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by associativity for }a\text{, }b\text{ and
}c\ast d\right)  \\
&  =a\ast\left(  \left(  b\ast c\right)  \ast d\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by associativity for }b\text{, }c\text{ and
}d\right)  .
\end{align*}


Does this generalize to larger products? Next time we will see the answer.
\end{document}