Let $G$ be a group, and let $n\in\mathbb Z$. Show that $(ab)^n=a^nb^n\iff(ab)^{1-n}=a^{1-n}b^{1-n}$.
Assuming that the book has a typo, we prove $(ab)^n=a^nb^n$ if and only if $(ba)^{1-n}=b^{1-n}a^{1-n}$. Left and right multiply $(ab)^n$ by $a^{-1}$ and $b^{-1}$ respectively and we get $(ba)^{n-1}$. This follows since $$(ab)^n=abab\ldots ab$$ for $n$ positive, and by taking inverses for $n$ negative. Thus we have $$(ba)^{n-1}=a^{n-1}b^{n-1}.$$ Take inverses to get one implication. Can you do the other yourself?