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.

  • 3
    $\begingroup$ It is only a convention followed by some and not all. $\endgroup$ Nov 11, 2019 at 8:50
  • 2
    $\begingroup$ 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/… $\endgroup$ Nov 11, 2019 at 8:54
  • $\begingroup$ 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. $\endgroup$
    – sh.3.ll
    Nov 11, 2019 at 9:09
  • $\begingroup$ But, but, but, but, but, your question has that answer whether you like it or not. $\endgroup$ Nov 11, 2019 at 9:46
  • $\begingroup$ @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.) $\endgroup$ Nov 11, 2019 at 15:21

2 Answers 2


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


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


which we can interpret as either


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


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.$

  • $\begingroup$ negative residues are sometimes used for magnitude advantages in hand computation by contrast. $\endgroup$
    – user645636
    Nov 11, 2019 at 13:34
  • $\begingroup$ @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. $\endgroup$
    – Allawonder
    Nov 11, 2019 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.