# Why should the sign of remainder be same as dividend?

I was reading binary division from this site and this statement came across that "remainder will have the same sign as the dividend". But why? Like from the utmost conceptual level, the very basic idea of remainders and negative numbers.

• It is only a convention followed by some and not all. Nov 11, 2019 at 8:50
• Indeed, in number theory it is much more useful to adopt the convention that the remainder is always nonnegative (and strictly less than the dividend). Example: study.com/academy/lesson/… Nov 11, 2019 at 8:54
• But I even had this question in my 3rd-year undergrad paper of Computer Architecture. I couldn't just write that it's the convention. I had to think. That's why I asked it here. Nov 11, 2019 at 9:09
• But, but, but, but, but, your question has that answer whether you like it or not. Nov 11, 2019 at 9:46
• @GregMartin, I think you meant to say divisor, not dividend. (And also, how can the remainder be both nonnegative and strictly less than the dividend if the dividend, whatever it is, is negative? Presumably you meant strictly less than the absolute value of the divisor.) Nov 11, 2019 at 15:21

I'm going to hazard a guess at why someone might adopt a convention that the remainder should have the same sign as the dividend. (As others have noted, the usual convention, when writing $$n=qd+r$$ is that $$0\le r\lt|d|$$, where, to fix terminology, $$n$$ is called the dividend, $$q$$ the quotient, $$d\not=0$$ the divisor, and $$r$$ the remainder. This convention is convenient for most number-theoretic purposes, although occasionally one wants to use the convention $$-|d|/2\lt r\le |d|/2$$.)

Let's start with a non-controversial example: $$17$$ divided by $$5$$. No one, I hope, objects to writing

$$17=3\cdot5+2$$

for the answer. Now the easiest thing to do, if we put a negative sign in front of the $$17$$, is to write

$$-17=-3\cdot5-2$$

which we can interpret as either

$$-17=(-3)\cdot5-2$$

if we are dividing $$-17$$ by $$5$$, or as

$$-17=3\cdot(-5)-2$$

if we are dividing $$-17$$ by $$-5$$. (The final combination of signs, $$17$$ divided by $$-5$$, is $$17=(-3)\cdot(-5)+2$$.)

In other words, the convention used in the OP's link begins by taking absolute values of both the dividend and the divisor, does the non-controversial calculation to get absolute values for the quotient and remainder, and then inserts signs in the appropriate places to turn $$|n|=|q||d|+|r|$$ into $$n=qd+r$$. The key here is that the final adjustment doesn't affect the digits of any of the numbers, only the numbers' signs. Given the link's computer-sciencey nature, that makes sense as a desirable feature for a convention.

It is a very important convention since we usually take our dividends to be positive. This is also in other contexts called the modulus, and the remainder the residue. Thus given a modulus $$d> 0$$ and an integer $$n,$$ we have that there are always integers $$q$$ and $$r\ge 0$$ such that $$n=qd+r.$$ whatever negativity is absorbed by the first part, in particular with the quotient $$q.$$

• negative residues are sometimes used for magnitude advantages in hand computation by contrast.
– user645636
Nov 11, 2019 at 13:34
• @RoddyMacPhee Of course they are. My point is that they're more usually taken in their positive incarnations, especially when referred to in definitions and proofs as opposed to applications. Nov 11, 2019 at 16:51