Prove that all ideals in $\mathbb{Z}[x]$ are generated by two elements.

As Angina Seng pointed out, your mistake is that you think you can do polynomial division as if you were working over a field. You cannot reduce $a(x)$ modulo $b(x)$ and expect a low degree remainder. If the leading coefficient of $a(x)$ is not divisible by that of $b(x)$ you are dismounted at the first obstacle: what choice of $q(x)$ would give a low degree $r(x)$ when for example $$ r(x)=(4x^5+7)-q(x)(3x^3+5)? $$ You see what the problem is? The leading coefficient of the product $q(x)(3x^3+5)$ will be divisible by three, and hence cannot be equal to four, which is what you would need to cancel the term $4x^5$.


You can (and arguably should) use a general proof of Hilbert basis theorem. The following minor shortcut is available in $\Bbb{Z}[x]$. Leaving the steps as exercises :-)

Let $I$ be a non-zero ideal of $\Bbb{Z}[x]$.

  1. Let $J\subseteq\Bbb{Z}$ be the set of leading coefficients of polynomials of $I$. Prove that $J$ is an ideal of $\Bbb{Z}$. Warning: Proving that $J$ is closed under addition requires a bit of care.
  2. Why does there exist an integer $m$ such that $J=m\Bbb{Z}$? Why does there exist a polynomial $b(x)\in I$ such that the leading coefficient of $b(x)$ is equal to $m$?
  3. Fix a polynomial $b(x)\in I$ as in the previous step. Let's denote $n=\deg b(x)$. If $a(x)\in I$ is arbitrary, why does the polynomial division work well enough to allow us to conclude that there exists a polynomial $q(x)\in\Bbb{Z}[x]$ such that $$r(x)=a(x)-q(x)b(x)$$ has degree $<n$?
  4. Consider the set $$I_n=\{a(x)\in I\mid \deg a(x)<n\}.$$ Why is it a finitely generated free abelian group?
  5. Prove that $b(x)$ together with a $\Bbb{Z}$-basis of $I_n$ generates $I$ as an ideal of $\Bbb{Z}[x]$.