The latter makes perfect sense to me, but what's the skinny with the former? I researched but couldn't understand the drift. TIA
-
1If it makes you feel any better, also $1 \equiv -59 \pmod {60}$ – DanielV Jan 11 '20 at 14:32
-
$-1$ is also equal to itself mod $60,$ or whatever. – Allawonder Jan 11 '20 at 15:05
-
1By definition $,a'\equiv a\pmod{60}\iff 60\mid a'-a\iff a' = a+60k,$ for some integer $k$. In your examples $, -1 = 59+60(-1),$ and $, 1 = 1+60(0),\ $ The definition is equivalent to saying that $,a',$ and $,a,$ leave the same remainder after division by $60$. Modular arithmetic works with these equivalence classes of remainders (residues). $\Bbb Z_n \cong \Bbb Z\bmod n,$ is the most general number system (ring) we can construct by adjoining the axiom $,n=0,$ to the ring $,\Bbb Z,$ of integers. – Bill Dubuque Jan 11 '20 at 19:09
6 Answers
Consider the Number line marked with integers. Now, Paste the integer $60$ over $0$ and wrap around the entire number line over the circle formed as above.
Now, we see that when we count on the above number line constructed by the above procedure, the integer $-1$ coincides with the integer $59$. This is called Modular Arithmetic.
Remarks:
$1$. The above construction can be generalized to any positive integer $n$ by replacing $60$ with $n$.
$2$. In general, while doing Modular arithmetic, we look for a solution inside the set $\{0,1,2,...,n-1\}$. But we can consider any set containing "$n$" consecutive integers.
Note: You can refer to any Elementary Number Theory Book. It will be more helpful.
This video Link might be useful for the above-said construction
I hope this answers your questions.
- 1,167
Actually, both (-1 mod 60) ≡ 59 and (-1 mod 60) ≡ -1 are correct.
The result of modulo operation is congruence classes. [-1] and [59] are simply equal.
- 61
Welcome to Maths SX! I suppose you're asking why $-1\bmod 60\equiv 59$? This is is because $59+1\equiv 0\bmod 60$, so in the ring $\;\mathbf Z/60\mathbf Z$, the opposite of the congruence class of $1$ is the congruence class of $59$, by definition of the opposite of an element (i.e. its additive inverse).
- 175,478
Mod 60:
$$\begin{array} {ccc|c|ccc} \cdots & -120 & -60 & 0 & 60 & 120 & \cdots\\ \cdots & -119 & -59 & 1 & 61 & 121 & \cdots \\ \cdots & -118 & -58 & 2 & 62 & 122 & \cdots \\ & \vdots & \vdots & \vdots & \vdots & \vdots \\ \cdots &-63 & -3 & 57 & 117 & 177 & \cdots \\ \cdots &-62 & -2 & 58 & 118 & 178 & \cdots \\ \cdots &-61 & -1 & 59 & 119 & 179 & \cdots \\ \end{array}$$
All the values in the horizontal rows are treated as equal $\pmod {60}$. When you use the modulus as an operator, you typically just select the value from that middle row. E.g. $$-118 \text{ % } 60 = -58 \text{ % } 60 = 2 \text{ % } 60 = 62 \text{ % } 60 = 122 \text{ % } 60 = 2$$
- 23,556
$$y\equiv b\bmod m\iff y=mx+b$$ with all variables integers. Therefore $$59\equiv -1\bmod 60$$ because $$59=60(1)+(-1)$$
See here:
The % (modulo) operator yields the remainder from the division of the first argument by the second. The numeric arguments are first converted to a common type. A zero right argument raises the ZeroDivisionError exception. The arguments may be floating point numbers, e.g., 3.14%0.7 equals 0.34 (since 3.14 equals 4*0.7 + 0.34.) The modulo operator always yields a result with the same sign as its second operand (or zero); the absolute value of the result is strictly smaller than the absolute value of the second operand [2].
So -1 % 60 must return a nonnegative (the same sign as 60) integer that is less than 60 in absolute value, and is congruent to -1 modulo 60. The unique integer satisfying that is 59. If you instead did -1 % -60 you would get -1.
- 20,808
- 1
- 22
- 41
-
Anyone want to explain the downvotes? OP's original question was phrased as "why does -1 % 60 == 59 whereas 1 % 60 == 1"? – kccu Jan 11 '20 at 22:02