An exercise says: Let $R$ be an integral domain, let $m,n\in\mathbb{Z}$ such that $(m,n)=1$, then prove that $a^m = b^m$ and $a^n = b^n$ implies that $a=b$.
I managed to prove it, but without using the fact that we are working on an integral domain:
Because $(m,n)=1$, there exists $r,s\in\mathbb{Z}$ such that $1 = mr + ns$. Now: $$a = a^1 = a^{mr+ns} = (a^{m})^r(a^n)^s = (b^m)^r(b^n)^s = b^{mr+ns} = b^1 = b $$ Q.E.D.
What's faulty with this argument?, there's another version which would use said hypothesis (taking into account that $(a-b)\mid a^n - b^n$ for every $n\in\mathbb{N}-\{0,1\}$)
In a general ring, $a^{mr+ns} = (a^m)^r(a^n)^s$ does not hold unless $m, r, n$ and $s$ are non-negative: if any of them is negative, then that formula is only valid if $a$ is invertible. If $R$ is an integral domain, then your argument works in the field of fractions of $R$ and gives the result you want.