Showing that $a \mid b$ and $b \mid a$ if and only if $a= \pm b$. [closed]

Solution 1:

From $a|b$ we have $b=ka$ for some $k\in\mathbb Z$. From $b|a$ we have $a=mb$ for some $m\in\mathbb Z$. Hence $a=mb=mka$ and $a\cdot (1-mk)=0$, so $a=0$ or $mk=1$. If $a=0$, then also $b=ka=0$ and hence $b=a$. If on the other hand $mk=1$ then $k$ is a unit, hence $k=\pm1$ and $b=\pm a$.

Solution 2:

Hint $\ n = \dfrac{b}a\,$ and $\, \dfrac{1}n =\dfrac{a}b\,$ both integers $\iff n = \,\ldots$

Solution 3:

Hint: Suppose that $p=\frac ab\in\mathbb{Z}$ and $q=\frac ba\in\mathbb{Z}$. Then you have $$ pq=\frac ab\frac ba=1 $$ What factors does $1$ have?