Reducing 12 modulo 9 This example is from a text on Modular Arithmetic

We want to reduce 12 modulo 9. Here are several results which are
correct according to the definition:
1) 12 ≡ 3 mod 9,     3 is a valid remainder since 9|(12−3)
2) 12 ≡ 21 mod 9,    21 is a valid remainder since 9|(21−3)
3) 12 ≡ −6 mod 9,    −6 is a valid remainder since 9|(−6−3)

I understand the first one.
For a ≡ r mod m, we can write m | (a - r)
So in the first example, a = 12 r = 3 m = 9.
So from that we get 9 | (12 - 3)
But for the second, a similar substitution would be
9 | (12 - 21) - But in the example, they have (21 - 3) instead of (12 - 21)
Likewise in the $3^{rd}$, they have (-6 -3) instead of (12 + 6)
How do they arrive at this in the $2^{nd}$ &amp; $3^{rd}$ example?
If $a \equiv b \pmod m$ and $b \equiv c \pmod m$, then $a \equiv c \pmod m$. This is called transitivity and you should prove that it is true.
For your second example: The author in your text uses $12 \equiv 3 \pmod 9$ and $3 \equiv 21 \pmod 9$, so $$ 12 \equiv 3 \equiv 21 \pmod 9.$$ Of course, you can also just check $9 \mid 12 - 21$, as you said.
I am answering my own question. I think the author is trying to find all answers which form an equivalence class for mod 9.
3, 21 &amp; -6 are all part of the equivalence class for mod 9.
{ ...-15, -6, 3, 12, 21, ... } is one of the 9 equivalence classes for mod 9.
That's how he gets to (2) &amp; (3) from (1)