Definition of Division with Remainder

292 Views Asked by At

I have a trivial question. When we divide say 5 by 2, quotient is 2 and remainder is 1. However say we divide -5 by 2, then should we have a quotient -2 and remainder -1 or quotient -3 and remainder 1?

Some people claim that remainder should always be a positive integer smaller than the absolute value of the divisor. But what is the actual formal definition and according to which type of formal arithmetic?

Thanks

2

There are 2 best solutions below

0
On

There is no completely formal definition, but the Euclidean algorithm for, say, the rational numbers, suggests that after choosing a quotient $p/q$ to compute, the remainder should lie between 0 and $q-1$.

0
On

To actually divide $a$ by $b$, what you do is find the largest integer $bq$ that is less than or equal to $a$. Then $r = a - bq$ will be between $0$ and $q -1$. That is, $a = bq + r$ where $0 \le r \lt q$.

For example, to divide $5$ by $2$:
$2\times2 = 4$ is the largest integer of the form $2q$ such that $2q \le 5$.
So $5 = 2\times2 + 1$ where $0 \le 1 \lt 2$.

To divide $-5$ by $2$:
$2\times(-3) = -6$ is the largest integer of the form $2q$ such that $2q \le -5$.
So $-5 = 2\times(-3) + 1$ where $0 \le 1 \lt 2$.