I found the following post: Let $a,b$ be in a group $G$. Show $(ab)^n=a^nb^n$ $\forall n\in\mathbb{Z}$ if and only if $ab=ba$..
It means for $a, b\in G$, if $ab = ba$, then $(ab)^{n} = a^{n}b^{n}$. But if we let $G = (\mathbb{Z}, +)$, wouldn't this not be true? For example, take $a = b = 5$ so that $(a + b)^{2} = 100 \neq 625= a^{2}b^{2}.$
I'm new to abstract algebra. Maybe my understanding of what the theorem is saying is off.
This is one of those annoying notation issues. Bear in mind that $a^n$ in a group $G$ with operation $\ast$ means
$$a^n = \underbrace{a \ast a \ast a \ast \cdots \ast a}_{n \; a's}$$
If $G$ is $\Bbb Z$ and your operation is addition, then the notation $a^n$ means
$$a^n = \underbrace{a + a + a + \cdots + a}_{n \; a's} = na$$
It's a bit confusing. In general, though, for abelian groups (those where $a \ast b = b \ast a$ for every $a,b \in G$), this is why we instead adopt the additive notation $na$ instead of the multiplicative notation $a^n$.
Thus, in this light, we have
$$(ab)^n = a^n b^n \text{ means } n(a+b) = na + nb$$