0

Consider the following 4 results

 7 %  3 =  1
-7 %  3 =  2
 7 % -3 = -2 
-7 % -3 = -1

I'm struggling to see why these outputs have been selected as such

7 % 3 is clear. Imagining | as 0, I can chunk up 7 into 3 groups of 3, and I have 1 left over going away from |

|*** *** *** *

Of course, we could say this is -1 as in "take away 1 from your numerator to make it divisible" or we could say it's -2 or 2, they all represent in some way how far off we are from having a perfect divisor.

The convention for -7 % 3 is odd to me, but I can reason about it. I would've thought it was -1 (3 groups of 3 and a remaining -1), but it's 2. I guess that's just convention.

* *** *** ***|

I'm really struggling reasoning about 7 % -3 and -7 % -3, though. Can someone explain this to me so I can intuitively understand this operation more quickly?

Side note, if I were creating a remainder operator, it would have these results

 7 %  3 =  1 # remaining 1
-7 %  3 = -1 # remaining -1
 7 % -3 = -1 # -ve version of 7 % 3
-7 % -3 =  1 # same as 7 % 3
doliphin
  • 103
  • 2
    Of course % is implemented in a certain computer language or calculator. Since mathematicians do not use that notation, perhaps this is better asked of the implementors of the computer language or calculator. – GEdgar Oct 29 '22 at 10:02
  • 2
    Maple does this: $$7 \mod 3 = 1;\(-7) \mod 3 = 2;\7 \mod (-3) = 1; \(-7) \mod (-3) = 2;$$The meaning is "remainder on division" where $$7 = (2)(3)+1\-7 = (-3)(3)+2\7 = (-2)(-3)+1\-7 = (3)(-3)+2$$ – GEdgar Oct 29 '22 at 10:10

0 Answers0