The Division Algorithm

42 Views Asked by At

Question: Find integers $q$ and $r$ such that $m = qd + r$, $0$ $\leq$ $r$ $<$ $d$. Given: $m = -2$, $d = 5$.

This is what I have so far: $-2 = 5q +r$
Dividing $2$ into $5$ gives $q = 2$ and $ r = 1$
So, then
$-2 = 5(2) + 1$
Because $-m$ is positive, we can write $-m = dq + r$:
$2 = 5(-2) + 1$
But since $r$ $\neq$ $0$, $m = d(-q) -r = d(-q) - r + d - d = d(-q-1) + (d-r)$
So, after plugging in, we have
$2 = 5(-3) +4$
Obviously, the left hand side of the equation does not equal the right hand side. I cannot seem to figure out what I am not doing right.

3

There are 3 best solutions below

0
On

Let's redo it. You have to write $-2=5q+r$, with $0\le r<5$.

Change $-2$ into $2$: you have $2=5\cdot0+2$ (certainly not $2=5\cdot 2+1$: you have to divide $5$ into $2$, not $2$ into $5$). So $$ -2=0d-2=5\cdot0-2=5\cdot 0-5+5-2=5\cdot(-1)+3 $$

In general, if you have $m<0$ and $d>0$, you can do $$ -m=dq+r $$ and so $$ m=d(-q)-r $$ You're done if $r=0$; otherwise $0<r<d$ and you can do $$ m=d(-q)-d+d-r=d(-q-1)+d-r $$ and $0<d-r<d$, so you're done as well.

0
On

Another approach. We want to find two integers $q$ and $r$ such that $-2=5q+r$ and $0\leq r<5$. You can write $r=-2-5q$ and impose the two conditions that $r$ must satisfy: $$ \begin{cases} -5q-2\geq 0\\-5q-7<0\\ \end{cases} \Leftrightarrow \begin{cases} q\leq -\frac 25\\q>-\frac 75\\ \end{cases}. $$ Since $q$ has to be an integer number, then $q=-1$ and thus $r=-2+5=3$.

0
On

We can simply solve equation $5q+r=-2$, for this we first solve equation:

$5q+r=0$

$q=-1$ and $r=5$ and general solutions are:

$q=-t+q_1$ and $r=5t+r_1$ where $q_1=5$ and $r=-27$ are one set of solution. so we have:

$q=-t+5$ and $r=5t-27$; $t∈ Z$, $-∞ < t < = 5$ satisfies the condition $r<q$.