The question I was working on was asking to find whether the relation $R$ defined on $\mathbb{Z}$ by $a\,R\,b$ if $|a-b|\leq 2$ is reflexive, symmetric, and/or transitive and provide justification. I got that it is reflexive, symmetric, and not transitive. I'm just wondering if my justification for it not being transitive works? Here is what I said:
Assume $a\,R\,b$ and $b\,R\,c$. Then $|a-b|\leq 2$ and $|b-c|\leq 2$. This means $|a-b|+|b-c|\leq 4$. Say $a-b$ and $b-c$ are positive. Then $|a-b|+|b-c|=a-b+b-c = a-c = |a-c|\leq 4$. However, this doesn't necessarily mean $|a-c|\leq 2$, since it is possible $2<|a-c|\leq 4$. Therefore, $R$ is not transitive.
(I know that instead of this I could've just given a counterexample, such as $0\,R\,2$ and $2\,R\,4$ but $0\,\not R\,4$. Just wondering if this more general justification works too.)
You can also consider to provide a counter-example as mentioned by @lulu.
Take $a = 1$, $b = 2$ and $c = 4$.
Then we have that $|a - b| = 1 \leq 2$ as well as $|b - c| = 2 \leq 2$, but $|a - c| = 3 > 2$.
Hence the proposed relation is not transitive.
Hopefully this helps !