- #1
pc2-brazil
- 205
- 3
Homework Statement
Find a formula for the integer with smallest absolute value that is congruent to an integer a modulo m, where m is a positive integer.
Homework Equations
An integer x is congruent to an integer a modulo m if and only if:
[tex]x \equiv a \pmod m[/tex]
The Attempt at a Solution
From the definition:
[tex]x \mod m = a \mod m[/tex]
or:
[tex]x - a = km[/tex]
where k is an integer.
From the division "algorithm":
[tex]x = mq + a\mod m[/tex]
where q is the quotient.
But I'm not sure on how to proceed from here. The textbook gives a strange answer: [itex]x \mod m[/itex] if [itex]x \mod m \leq \left \lceil m/2 \right \rceil[/itex] and [itex](x \mod m) - m[/itex] if [itex]x \mod m > \left \lceil m/2 \right \rceil[/itex]
I would say that the smallest absolute value of x is when the quotient (q above) is 0. Thus:
[tex]x=a\mod m[/tex]
According to the answer, [itex]x=a\mod m[/itex] is only true if [itex]x \mod m \leq \left \lceil m/2 \right \rceil[/itex], but I can't figure out why.
Thank you in advance.