I just did the following exericse:
Prove that for given intergers $a$ and $b$ with $b>0$ holds:
There are unique integers $q$ and $r$ such that $a = qb+r$ and $-b/2 < r \le b/2$.
I did the following:
$$-b/2 < r = a-qb \le b/2$$ $$\implies \frac{a}{b} + \frac{1}{2} > q \ge \frac{a}{b}-\frac{1}{2} $$ $$\implies q = \lceil{ \frac{a}{b} + \frac{1}{2}\rceil}$$
I am insecure about the ceil in the end, could you tell me if I am right?
I find the argument below simpler.
We have $a = Qb+R$, with $0 \le R < b$.
If $R \le b/2$, then take $q=Q, r=R$.
If $R > b/2$, then take $q=Q+1, r=R-b$. Then $-b/2 < R <0 < b/2$.