In an integral domain prove that $a=b$ 
Let R be an integral domain  and $a,b\in R$ are elements satisfying $a^7=b^7$ and $a^{12} = b^{12}$. Prove that $a=b$.

My attempt:-
  Since $R$ is an integral domain, R is commutative. That is all I could conclude...could you please help me out?
 A: If $a=0$, then the statement is trivially true. Otherwise, let $a \in D$. Since $D$ is an integral domain, therefore $a$ is not a zero divisor. Consequently $a^k$ is not a zero divisor for all $k \geq 1$. 
Then,
$$a^{12}=b^{12} \implies a^{36}=b^{36},$$
and
$$a^{7}=b^{7} \implies a^{35}=b^{35}.$$
Consequently,,
$$a^{36}=b^{36} \implies a^{36}-b^{36}=0 \implies a^{35} \cdot a-b^{35} \cdot b=0 \implies a^{35}(a-b)=0.$$
But by the no zero divisor condition, we get $a=b$.
A: $\newcommand{gcd}{\operatorname{gcd}}$If $b=0$, then $a=0$ because integral domain. If $b\ne 0$, those conditions translate to two identities in the field of fractions $\operatorname{Frac}R$ $$\begin{cases} \left(\frac ab\right)^7-1=0\\ \left(\frac ab\right)^{12}-1=0\end{cases}$$
Therefore $\frac ab$ is a root of $\gcd(x^7-1, x^{12}-1)$ by Bézout in $(\operatorname{Frac}R)[x]$. Now, \begin{align}\gcd(x^{12}-1,x^7-1)&=\gcd(x^7-1,x^5-1)=\gcd(x^5-1,x^2-1)=\\&=\gcd(x^2-1,x-1)=x-1\end{align}
Therefore $a=b$.
A: If $b=0$ then $a^6=0$ but $R$ is an integral domain, so $a=0=b$
We suppose that $b\neq 0$. Then 
$a^{12}-b^{12}=(a^6-b^6)(a^6+b^6)=0$
but $R$ is an integral domain, so 
$a^6-b^6=0$ or $a^6+b^6=0$
If $a^6=b^6$ then 
$b^7=a^7=aa^6=ab^6$ that implies 
$b^6(b-a)=0$ 
but $b\neq 0$ then $b=a$
Conversely, if $a^6=-b^6$, then 
$b^7=a^7=aa^6=-ab^6$ so
$b^6(b+a)=0$ that means $b=-a$
In this case we get $b^7=a^7=(-1)^7b^7$. Thus
$(-1)^7=1$ that means $2=0$. So your ring must be $\mathbb{Z}/2\mathbb{Z}$ and we have $b=1=a$.
