I wasn't happy with the proof provided by the book, so I had an attempt at it, but I don't know if it's right. The theorem is:
Let $a,b\in\mathbb{Z}$ and $b\neq0$. Then there exist unique $m,r\in\mathbb{Z}$ such that $a=mb+r$ and $0\leq r< |b|$.
I'm not going to attempt uniqueness here, and also just refer to the case for $a\geq 0, b>0$.
Suppose b|a. Then by definition, $\exists m$ such that $a=mb$. Then choose $r=0$ and the result is proved.
Suppose $b\nmid a$. Then $\exists m$ such that $\textrm{gcd}(a,mb)=1$ and $a-b <mb<a$. Then choose $r=a-mb$. Since $r=||a|-|mb||<|a-(a-b)|=b$ by the triangle inequality, then $0<r<b$, and the result is proved.
Suppose $b\nmid a$. Then $\exists m$ such that $\textrm{gcd}(a,mb)=1$ is a wrong assumption.
Take $a=4$ and $b=6$. $4$ does not divide $6$. However you can't find $m$ such that $\textrm{gcd}(4,m6)=1$.