Videos
I think I understand the basics of the modulo function. Assuming modulo 3 when counting up you'd go 0 > 1 > 2 > 0 ...
But then I see this equation:
a ≡ b (mod n)
And have trouble understanding it. I'm pretty sure it means that a and b have a congruent relationship when a modulo function of n is applied to them. But I'm not sure if this is correct, and what a congruent relationship is.
Thanks!
That depends on your definition of the remainder, which in turn depends on a definition of 'integer division'.
It's quite easy for positive numbers: the result of division is the largest integer not exceeding the exact result. For example 5/8 = 0. Then the remainder is 5–8*(8/5) = 5–8*0 = 5.
For negative numbers, however, a problem appears with a meaning of 'the largest'. One can assume it is the value largest with respect to its absolute value, i.e. the result is rounded towards zero (some programming languages work this way); then the integer division (–5)/8 results in –0=0, and the remainder is –5.
Or one can take literally the largest value, in which case (–5)/8=–1 and then the remainder is 3.
A quick answer is that when we work with modulo n and you are using the following definition:
two numbers, namely a and b, are congruent modulo n <=> a%n = b%n
We have to consider the same criteria in order for them to be equal, and that is, to consider a remainder of the same sign as the divisor.
The long answer involves some group theory in there. It is not easy to sumarize in a few words, but can be simply explained, using the example you have provided along the way. First, we will consider the group of remainders modulo, that is, a set of posible positive remainders when a integer is divided by n. Through the perspective of the group, -3 and 5 are the same element, because -3 + 8 = 5.
P.D.: I advise you from reading that book if such definition was given, such vague definitions are misleading and not rigorous in mathematics. By the way, if you want a good book about number theory I recommend: H. Rosen, Kenneth, Elementary Number Theory, Fifth Edition, Pearson ISBN-0-321-26314-6