Index Laws/Product of Indices/Monoid

Theorem
Let $\left({S, \circ}\right)$ be a monoid whose identity element is $e$.

For $a \in S$, let $\circ^n a = a^n$ be the $n$th power of $a$.

Then:
 * $\forall m, n \in \N: a^{n m} = \left({a^n}\right)^m = \left({a^m}\right)^n$

That is:
 * $\forall m, n \in \N: \circ^{n m} a = \circ^m \left({\circ^n a}\right) = \circ^n \left({\circ^m a}\right)$

Proof
Because $\left({S, \circ}\right)$ is a monoid, it is a fortiori a semigroup.

Hence, from Index Laws for Semigroup: Product of Indices:
 * $\forall m, n \in \N_{>0}: \circ^{n m} a = \circ^m \left({\circ^n a}\right) = \circ^n \left({\circ^m a}\right)$

That is:
 * $\forall m, n \in \N_{>0}: a^{n m} = \left({a^n}\right)^m = \left({a^m}\right)^n$

It remains to be shown that the result holds for the cases where $m = 0$ and $n = 0$.

... so the condition holds for either $n = 0$ or $m = 0$.

Finally, we also have:


 * $\circ^n \left({\circ^0 a}\right) = e = \circ^0 \left({\circ^m a}\right)$
 * $\circ^0 \left({\circ^n a}\right) = e = \circ^m \left({\circ^0 a}\right)$