I've tried several things, but I don't know how to properly show it.
Prove $a\mathbb{Z}[x]+x\mathbb{Z}[x]$ is a principal ideal on $\mathbb{Z}[x] \iff a=0$, $a=1$ or $a=-1$.
My try:
Proof:
$\Leftarrow\mid$
Let $a=0$. Then $0\mathbb{Z}[x]+x\mathbb{Z}[x]=x\mathbb{Z}[x]=(x)$ is a principal ideal.
Let $a=1$. Then $1\mathbb{Z}[x]+x\mathbb{Z}[x]=\mathbb{Z}[x]+x\mathbb{Z}[x]=\mathbb{Z}[x]=(1)$ is a principal ideal.
Let $a=-1$. Then $-1\mathbb{Z}[x]+x\mathbb{Z}[x]=-\mathbb{Z}[x]+x\mathbb{Z}[x]=\mathbb{Z}[x]=(-1)=(1)$ is a principal ideal.
I would appreciate a hint to solve the direction $\implies$, because I've tried some things, but without success.
Thanks.
Start by supposing that $a\mathbb Z[x] + x\mathbb Z[x] = (f)$ for some $f\in \mathbb Z[x]$.
On the one hand, we must have $a = gf$ for some $g\in \mathbb Z[x]$, and since $$\deg(fg) = \deg(f)+\deg(g) \ge deg (f),$$ we must have $\deg(f) = 0$ or $f=0$.
When can this happen?