Prove that if a and b are integers, then there are unique integers q and r such that $a = bq + r$, $-|b|/2 < r \le |b|/2$ Prove that if a and b are integers, then there are unique integers q and r such that $$a = bq + r,$$ with the restriction that$$-|b|/2 < r \le |b|/2$$

Using the division algorithm, we can find $q,r$ such that $a = bq + r$ and $0 \le r < |b|$. If $r \le \frac{1}{2}|b|$, we are done. If not, $\frac{1}{2}|b| < r < |b|$, so we let $r' = r - |b|$, which gives $-\frac{1}{2} |b| < r' < 0$.

If you don't have the division algorithm: Let $S = \{ a - bn \mid N \mid n \in \mathbb{Z} \} \cap \mathbb{N_0}$. It is easy to see it is non-empty, and it's a subset of $\mathbb{N}$, so it has a least element, call it $r$. By the definition of $S$, there is a $q$ such that $a - bq = r$.
Assume, for the sake of contradiction, that $r \ge |b|$. Then we let $r' = r - |b|$, and note that $0 \le r' < r$. We can write $r'$ as a combination of $a$ and $b$: $r' = r - |b| = a - bq - |b| = a - b(q \pm 1)$, depending on the sign of $b$. So $r' \in S$, but this breaks the minimality condition on $r$, so by contradiction, $r < |b|$.

Uniqueness: Let $r$ and $r'$ be two solutions. Then $r = a - bq$ and $r' = a - bq'$. So $r - r' = b(q' - q)$. Since $0 \le r$, $b(q' - q) \le r'$. But the only way for this to happen is if $q' = q$. (Or if it's negative, but then you look at the other inequality).
........
