Let $a,b \in \mathbb{Z}$ and suppose that $a | b$ and $b |a$. Then $a=b$ or $a=-b$ Let $a,b \in \mathbb{Z}$ and suppose that $a | b$ and $b |a$. Then $a=b$ or $a=-b$

My attempt

$a|b \Rightarrow b=k_1a$ for some $k_1$

$b|a \Rightarrow a=k_2b$ for some $k_2$

By substitution $a=k_1k_2a \Rightarrow a(1-k_1k_2)=0$

So, we have two cases:-

Case $(1)$

$k_1k_2=1 \Rightarrow k_1=k_2=\pm 1$

Thus, $a=\pm b$

Case $(2)$

I am stuck here, as $a=0 \Rightarrow b=0$.

But then division by $0$ doesn't make sense. What to do?

Note

This question is not a duplicate as it explicitly asks the question for $\mathbb{Z}$ and not $\mathbb{N}$ or nonzero integers.
If $a=0$ then, since $a\mid b$ by hypothesis , we must have that $0=ak=b$ for some $k\in\mathbb{Z}$.
If you read $a | b$, then you can suppose that $a \ne 0$