If $a^m=b^m$ and $a^n=b^n$ for $(m,n)=1$, does $a=b$? 
Possible Duplicate:
Prove that $a=b$, where $a$ and $b$ are elements of the integral domain $D$ 

Something I'm curious about, suppose $a,b$ are elements of an integral domain, such that $a^m=b^m$ and $a^n=b^n$ for $m$ and $n$ coprime positive integers. Does this imply $a=b$?
Since $m,n$ are coprime, I know there exist integers $r$ and $s$ such that $rm+sn=1$. Then
$$
a=a^{rm+sn}=a^{rm}a^{sn}=b^{rm}b^{sn}=b^{rm+sn}=b.
$$
However, I'm worried that if $r$ or $s$ happen to be negative then $a^{rm}, a^{sn}$, etc may not make sense, and moreover, I don't see where the fact that I'm working in a domain comes into play. How can this be remedied?
 A: If $a=0$ or $b=0$, the conclusion follows, so we may assume $a\neq 0$ and $b\neq 0$. 
Suppose that $s\lt 0$ (in which case $r\gt 0$). Write $s=-t$ with $t\gt 0$. Then $rm = 1+tn$. So we have
$$aa^{tn} = a^{1+tn} = a^{rm} = (a^m)^r = (b^m)^r = b^{rm} = b^{1+tn} = bb^{tn}.$$
Since $a^{tn} = (a^n)^t = (b^n)^t = b^{tn}$, we conclude from $aa^{tn}=bb^{tn}$ that $a=b$. 
A symmetric argument holds if $r\lt 0$.
(Basically, we are going to the field of fractions and then clearing denominators "behind the scenes"). 
Alternatively, say $m = qn+r$, $0\leq r\lt n$. Then $a^ra^{qn} = b^rb^{qn}=b^ra^{qn}$, which yields $a^r=b^r$; so you can replace $m$ with its remainder modulo $n$. Repeating as in the Euclidean Algorithm, we get that if $a^n=b^n$ and $a^m=b^m$, then $a^{\gcd(n,m)} = b^{\gcd(n,m)}$.
A: That works as long as you pass to the fraction field. But using fractions, the proof is much simpler: excluding the trivial case $\rm\,b=0,\,$  we have $\rm\:(a/b)^m = 1 = (a/b)^n\:$ hence the order of $\rm\,a/b\,$ divides the coprime integers $\rm\,m,n,\,$ thus the order must be $1.\,$ Therefore $\rm\,a/b = 1,\,$ so $\rm\,a = b.\,$ 
For a proof avoiding fraction fields see this proof that I taught to a student. Conceptually, both proofs exploit the innate structure of an order ideal. Often hidden in many proofs in elementary number theory are various ideal structures, e.g. denominator/conductor ideals in irrationality proofs.  Pedagogically, it is essential to bring this structure to the fore.
A: Hint: Let $d$ be the least positive integer such that $a^d=b^d$.  Show that $d|n$ and $d|m$.
This approach will not require $R$ commutative, or even that $R$ have a multiplicative identity, only that it not have zero divisors.
Specifically, use the division algorithm to show that if $n=dq+r$ with $0\leq r<d$. Then if $r>0$, show $a^r = b^r$, contradicting that $d$ was the least example.
A: Your concerns address each other :)
You are worried that $r$ and $s$ may be negative, indicating you wish that inverses for $r$ and $s$ exist so that negative powers for them are defined. 
But if you are in a commutative domain, you can work in the field of fractions for the domain, where they are defined!
So, as far as I can see, your logic is completely right, in the field of fractions of the domain.
