Show that there are polynomials $q(x)$ and $r(x)$ with integer coefficients such that $f(x)=g(x)q(x)+r(x)$ and $\deg(r)<\deg(g)$. Let $f(x), g(x)$ be polynomials with coefficients in $\mathbb Z$. Suppose that $\deg(g)≥1$ and that the leading coefficient of $g$ is $1$. Show that there are polynomials $q(x)$ and $r(x)$ with integer coefficients such that $f(x)=g(x)q(x)+r(x)$ and $\deg(r)<\deg(g)$.
 A: By letting $q=0, r=f$, we see that there are polynomials $q,r$ with integer coefficients such that $f=qg+r$. Among all such pairs of polynomials, pick one that minimizes $\deg r$. I claim that $\deg r<\deg g$. Indeed, if we assume that $\deg r\ge \deg g$ is possible where $g(x)=x^n+a_{n-1}x^{n-1}+\ldots +a_0$ and $r(x)=b_mx^m+\ldots +b_0$ with $m\ge n$ and $b_m\ne 0$, say, then for $q^*(x):=q(x)+b_mx^{m-n}g(x)$ and $r^*(x):=r(x)-x^{m-n}g$ we have $f=q^*g+r^*$ and $\deg r^*<m=\deg r$, contradiction.
A: The key idea of the polynomial division algorithm is this: if the leading coefficient of the divisor $= 1$ (or is invertible), and the dividend has degree $\ge$ the divisor, then we can  $\rm\color{#c00}{scale}$ the divisor so that it has the same degree and same leading coef as the dividend, then subtract it from the dividend, which cancels the leading term of the dividend; then recursively apply this process to the $\rm\color{#0a0}{remaining}$ part of the dividend, which has smaller degree (since we killed the leading term of the dividend), viz.
$$  (\overbrace{a x^{k+n} + f}^{\large \rm dividend}) - \color{#c00}{a x^k} (\overbrace{x^n + g}^{\large \rm divisor})\ =\ \overbrace{\color{#0a0}{f-ax^kg}}^{\large {\rm deg}\ <\ k+n}$$
$$\ \Rightarrow\ \dfrac{a x^{k+n}+f}{x^n+g}\, =\ \color{#c00}{a x^k} +\!\!\! \underbrace{\dfrac{f-ax^k g}{x^n + g}}_{\large\rm recurse\ on\ this}$$
where the second equation arises from the first by dividing through by $\,x^n + g.\,$ The long division algorithm for polynomials is simply a convenient tabular arrangement of the process obtained by iterating this descent process till one reaches a dividend having smaller degree than the divisor.
Remark $ $ Polynomial division can be generalizaed to non-monic polynomials as follows
Theorem (nonmonic Polynomial Division Algorithm) $\ $ Let $\,0\neq F,G\in A[x]\,$ be polynomials over a commutative ring $A,$ with $\,a\,$ = lead coef of $\,F,\,$ and $\, i \ge \max\{0,\,1+\deg G-\deg F\}.\,$ Then
$\qquad\qquad \phantom{1^{1^{1^{1^{1^{1}}}}}}a^{i} G\, =\, Q F + R\ \ {\rm for\ some}\ \  Q,R\in A[x],\ \deg R < \deg F$
Proof $\ $ See here for a few proofs.
A: Define $deg(f)=0$ for every constant f.
Use induction on $deg (f)$.
Let $T(n)$ be the statement $\forall f \, (deg(f)=n\implies \exists q,r\,(deg (r)<deg (g)\land f=qg+r))).$
Let $S(n)$ be $\forall j\le n\,(S(j)).$
Observe that $(S(n)\land T(n-1))\iff S(n)$ for every $n\ge 1$ and that $\forall n\ge 0(S(n))\iff \forall n\ge 0\,(T(n)).$
We prove $\forall n\ge 0\,(S(n))$ by induction on $n\ge 0$ as follows:
(1). For $deg (f)=0$ let $q=0$ and $r=f.$  So $S(0)$ is true.
(2). Suppose that $n=deg (f)>0$ and that $S(n-1)$ is true.
$\quad $(2i). If $n<deg(g)$ let $q=0$ and $r=f.$ 
$\quad$ (2ii). If $n\ge deg (g)$ let $F_n$ be the leading co-efficient of $f$ and let $m=n-deg(g).$ Then $deg (f-x^mF_ng)\le n-1$ so by $S(n-1)$ there exist $q_1,r_1$ with $deg(r_1)<deg (g)$ and $$(f-x^mF_ng)=q_1g+r_1.$$ So  we have $$f=(f-x^mF_ng)+x^mF_ng=(q_1g +r_1)+x^mF_ng=(q_1+x^mF_n)g +r_1.$$ So let $q=q_1+x^mF_n$ and $r=r_1.$
$\quad$ (2iii). In both (2i) and (2ii) we have $S(n-1)\land T(n)$ so we have $S(n).$
(3). So $S(0)$ is true, and $S(n-1)\implies S(n)$ for all $n\ge 1.$ Therefore  $S(n)$ is true for all $n\ge 0.$
A: You can get $q(x)$ by doing polynomial division of $\frac{f(x)}{g(x)}$. Then you will find out that all coefficients of $r(x)$ with degree$\ge \deg(g)$ is $0$. Therefore $\deg(r)<\deg(g)$ or $r(x)=0$
It's called division algorithm for polynomials.
