Shall remainder always be positive? [duplicate]

My cousin in grade 10, was told by his teacher that remainders are never negative. In a specific example,

$$-48\bmod{5} = 2$$

I kinda agree.

But my grandpa insists that

$$-48 \bmod{5} = -3$$

Which is true? Why?


Solution 1:

The first one is saying that $-48$ is $2$ more than a multiple of $5$. This is true. The second one is saying that $-48$ is $3$ less than a multiple of $5$. This is also true.

Solution 2:

The teacher is within his/her authority to define remainders to be numbers $r$, $0\leq r < d$ where $d$ is the divisor. This is just a systematic choice so that all students can apply the same rule and arrive at the same anwer, but the rule is only a convention, not a "truth." The teacher isn't wrong to define remainders that way, but it would be wrong for the teacher to insist that there is no other way to define a remainder. And, anyhow, what your grandpa says is also perfectly true :)

I imagine that ordinary long division is taught with this remainder rule because it makes converting fractions to decimals smoother when students do it later. Another reason is probably that mixed fraction notation (as far as I know) makes no allowance for negatives in the fraction. What I mean is that $1+\frac23=2-\frac13$, but the mixed fraction $1\frac23$ is not usually written as $2\frac{-1}{3}$, although one could make an argument that it makes just as much sense.

As far as modular arithmetic is concerned, you really want to have the flexibility to switch between these numbers, and insisting on doing computations with the positive version all the time would be hamstringing yourself.

Consider the problem of computing $1445^{99}\pmod{1446}$. It should not be necessary to compute powers and remainders of powers of $1445$ when you can just note that $1445=-1\pmod{1446}$, and then $1445^{99}=(-1)^{99}=-1=1445\pmod{1446}$

Solution 3:

The answer depends on whether you want to talk about modular arithmetic or remainders. These two perspectives are closely related, but different. In modular arithmetic, $2\equiv -3 \pmod 5$, so both answers are correct. This is the perspective most answers here have taken. In the division algorithm, though, where remainders are defined, in order to guarantee uniqueness, you need a specific range for the remainder -- when dividing integer $a$ by integer $d$, you get $a=qd+r$, and the integers $q$ and $r$ are unique if $0\leq r<d$ (note that this also places a restriction that $d$ be positive). There are other ways you could set up the condition, but you need some similar range in order to guarantee uniqueness, and this range is the simplest and most common, so in this sense, a negative remainder doesn't work.