SOLUTION: I need some help understanding modula. I put -101 mod 3 into a mod calculator and the answer comes up as 3. Shouldn't it be 2? -101 / 3 = 33 with 2 remaining. Or does it change

Algebra ->  Sequences-and-series -> SOLUTION: I need some help understanding modula. I put -101 mod 3 into a mod calculator and the answer comes up as 3. Shouldn't it be 2? -101 / 3 = 33 with 2 remaining. Or does it change      Log On


   



Question 921969: I need some help understanding modula.
I put -101 mod 3 into a mod calculator and the answer comes up as 3.
Shouldn't it be 2?
-101 / 3 = 33 with 2 remaining.
Or does it change somehow with a negative?

Found 2 solutions by rothauserc, Theo:
Answer by rothauserc(4718) About Me  (Show Source):
You can put this solution on YOUR website!
You handle the same way you handle positive numbers.
29 ≡ 2 (mod 3)
-101 ≡ -2 (mod 3)
definition of modulus
a congruent b mod m
our example is -101 congruent b mode 3, implies that
-101 -b = 3k for some integer k and therefore -101 -b / 3
-101 -(-2) / 3 = -99 / 3, says that
-101 is congruent to -2 mod 3

Answer by Theo(13342) About Me  (Show Source):
You can put this solution on YOUR website!
it does change with a negative number but i came up with a different answer than you did.

i got:

101 modulo 3 = 2
-101 modulo 3 = 1

i believe the rule is as follows:




-x modulo y = y - x modulo y

where x >= 0 so that, if x = 5, then -5 is equal to -x.

based on that rule, -101 module 3 is equal to 3 minus 101 module 3 which is equal to 3 minus 2 which is equal to 1.

-101 modulo 3 is not 3 as you stated.

i verified with an online modulo calculator and with excel mod function.

the results of my excel calculations are shown below:

these results confirm the rule is good.

$$$

it was difficult to find a reference on the web that didn't confuse me more than i was before i started looking.

after a while i was able to piece it together.

some of the better links i looked at are shown below.

as you will be able to see, there are numerous different methods for how to calculate the modulo of a negative number.

https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic

https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-quotient-remainder-theorem

https://answers.yahoo.com/question/index?qid=20080922034737AAsFEfY

http://www.miniwebtool.com/modulo-calculator/?number1=-340&number2=60

http://mathforum.org/library/drmath/view/52343.html