$a^m=b^m$ and $a^n=b^n$ imply $a=b$

No generality is lost by supposing $m < n$. So $a^n=b^n$ implies $a^{m+(n-m)}=b^{m+(n-m)}$, or $a^ma^{n-m}=b^mb^{n-m}$. In integral domains, there's a cancellation property, so $a^{n-m}=b^{n-m}$.

The pair $(m,n)$ has now been replaced by the pair $(m,n-m)$. If you iterate that process, replacing the pair you've got with the pair consisting of the larger of the two and the difference---the larger minus the smaller, that's Euclid's algorithm. It ends when you reach the gcd.


I came across a similar problem but with the condition that $m$ and $n$ are positive coprime integers. The following is my solution.

If $a=0$, then $b^m=a^m=0$. It follows that $b=0=a$ since $D$ is an integral domain.

If $a \ne 0$, since gcd(m,n)=1, $\exists s, t\in \mathbb z $ such that $1=sm+tn$. Because $ m, n>1$, $s,t \in \mathbb z$ and $1 = sm + tn$, we have either $s>0, t<0$ or $t>0, s<0$ (Otherwise we cannot have $1=sm+tn$).

Let's assume $s>0, t<0$. Then $-t>0$. From $a^m = b^m$, we have $(a^m)^s=(b^m)^s$. From $a^n=b^n$, we have $(a^n)^{-t}=(b^n)^{-t}$. We can factor out as follows.

$$a^{-tn}(a^{sm+tn})=b^{-tn}(b^{sm+tn})$$

$$a^{-tn}(a^{sm+tn})=a^{-tn}(b^{sm+tn})$$ $a^{-tn} \ne 0$ since $a \ne 0$ and $a$ is in an integral domain. We can cancel $a^{-tn}$ on both sides.Then we get $a^{sm+tn}=b^{sm+tn}$, i.e. $a^1=b^1$.

The proof for the case where $s<0, t>0$ is similar.


Since $m$ and $n$ are coprime then $x m - y n=1$ for some $x,y \in \mathbb Z$. The equality $a^m=b^m$ implies that $a^{xm}=b^{xm}$ so $a^{1+yn}=b^{1+yn}$ which implies that : $$(*)\;\;\; \;a a^{yn}=b b^{yn}$$ Since $a^{n}= b^{n}$ then $a^{yn}=b^{yn}\not = 0$ so we can cancel $a^{yn}$ and $b^{yn}$ from both sides of $(*)$ since we are working in an integral domain, and then we get $a=b$.