Modular Arithmetic - Changing a Congruence Modulo Relation Here the solution for $27^{17} \pmod{15}$ is shown.

Why is $27 \equiv 12 \pmod{15}$ rewritten as $27 \equiv -3 \pmod{15}$?
What is the logic/proof?

It can be proved by arguing that $15| (27-12)$ and $15|(27-(-3))$.
This is because in general, $$a\equiv b \pmod{n} \iff n|(a-b)$$
We can use this to show that $$a \equiv a-n \pmod{n}$$
This can be applied to your case : $27 \equiv 27-15=12 \pmod {15}$ and $12\equiv 12-15=-3\pmod{15}$
