Saturday, March 16, 2019

modular arithmetic - How to find remainder of denominator is greater than numerator?



I am learning modular arithmetic and trying to figure out, how to find remainder where denominator is greater than numerator?



For example:



i) 2mod5= ?




I tried to solve this but I got 0 as remainder whereas in calculators it is 2 . I was solving it with regular math operators like adding 0 and value after points.



ii) 2mod5 = ?



Also I wanted to know, how to handle negative number in modular arithmetic?


Answer



Remember, by definition, the remainder when dividing m/n is such a number r such that





  1. $0\leq r
  2. There exists some k such that kn+r=m



by that definition, the remainder when dividing 2 by 5 is 2, because 05+2=2






As far as modular arithmetic is concerned, remember that xymodn


if and only if n|xy. As a consequence, it is always true that x+knxmodn
for any integer k. In your case, that means that 33+15mod5



No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...