# Modular arithmetic (Solve -10 mod 7 by hand)

For: -10 mod 7

I know the answer is 4, but how do you actually get to the answer by hand?

-
Add $2 \cdot 7 = 14$... and the 2 is $\lceil \frac{10}{7} \rceil$. – vonbrand Feb 28 '13 at 19:01

$-10\equiv -10 + 7\equiv -3\equiv -3 + 7\equiv 4\mod 7$, because adding $7$ when working $\mod 7$ does not change the congruence class of your original number. More generally, adding any integer multiple of your modulus to your original number preserves the congruence class: $$m\equiv m + kn\mod n\quad\forall k\in\mathbb{Z}$$

-

$4 - (-10) = 14$, which is divisible by 7.

-

You can use a number line visualization.

These emphasized points are all $\equiv 0\text{ mod } 7$. You can see that -10 is 4 points to the right of $-2\times7$. It's also 3 points to the left of $-1\times7$.

Since -10 is negative, the remainder from -10/7 gets you the left-facing offset (-3 in this case). But you can then just add 7 to this to get the right-facing offset.

Mathematica source code for the number line graphic.

Graphics[
{PointSize[.012], Point[{7*#, 0}] & /@ Range[-5, 5]},
Axes -> {True, False}, PlotRange -> {{-15, 15}, {-1, 1}}]

-

Integer multiple of 7 less than or equal to -10 is -14, now how much you need to add to the -14 so that it becomes equal to -10 : -14 + 4 = -10; the term you added to make it equal to -10 is the -10 mod 7 so this way answer is 4.

-