I know that in general, we can represent a number $x$ as follows:
$x = qn + r$
where $r$ is the remainder, $n$ is the divisor, and $q$ is the quotient.
But suppose we try to calculate $-3 \div12$. An answer elsewhere on Math StackExchange suggests that the answer is:
$-3 = -1 \times12+9$
In other words, that $-3 \mod 12 = 9$.
But can't we represent this as:
$-3 = -2 \times 12 + 21$
And get a different answer?
$\endgroup$ 74 Answers
$\begingroup$It's true that $-3\equiv 21 \bmod 12$. And also that $-3\equiv 117 \bmod 12$, and and of course $-3\equiv 9 \bmod 12.$ All of these numbers are in the same congruence or residue class. Typically the smallest non-negative value is used to represent the class.
$\endgroup$ $\begingroup$The general definition is that $$ a\equiv b\bmod n \iff \text{$n$ divides $a-b$}. $$ If you take $a=-3$, $b=9$ and $n=12$ you see that the definition is met.
$\endgroup$ $\begingroup$"$x \mod 12$" is really a shorthand for the (infinite) set of numbers that are congruent to $x$ modulo 12. So
$-3 = 9 = 21 \mod 12$
because $-3, 9$ and $21$ are all members of the same congruence class modulo 12. In other words, their differences are all divisible by 12.
We could write this congruence class as $\{\dots,-15, -3, 9, 21, 33, \dots\}$ but that would become tedious so by convention we represent the congruence class by just one of its members, often the smallest non-negative member. So we represent $\{\dots,-15, -3, 9, 21, 33, \dots\}$ by $9 \mod 12$.
$\endgroup$ $\begingroup$I think you’re overcomplicating it. It simply boils down to this:
$$b\equiv c\pmod m \iff \frac{b-c}{m}\in\Bbb Z$$
where $\Bbb Z$ contains negatives as well as positives.
Since $$\frac{-3-9}{12}=-1$$ we say $-3\equiv 9\pmod {12}$ or alternatively $-3\bmod 12 =9$.
$\endgroup$