Let $R[x]$ be the ring of polynomials in an indeterminate $x$ with coefficients in a ring $R$. Let $f = a_0 + a_1x + · · · + a_nx^n \in R[x]$ where $a_i \in R$. Show that $f$ is a unit in $R[x] \iff a_0$ is a unit in $R$ and $a_1, \dots, a_n$ are nilpotent.
Suppose that $f$ is an unit. Then there exists $g=b_mx^m+\dots +b_0$ such that $fg=1$ that is $$(a_0 + a_1x + · · · + a_nx^n)(b_0+ b_1x+\dots+b_mx^m) = 1$$ since the rhs doesn't contain any terms with $x$ we must have that $a_0b_0=1$.
How can I proceed to show that the other terms are nilpotents? I was given a hint to compare coefficients, but I don't really understand how to do that in this case.
Multiplying the equations I'll get something of form $$a_nx^nb_mx^m + \dots + a_0b_mx^m+ \dots +a_0b_0 = a_nb_mx^{n+m} + \dots +a_0b_mx^m+ \dots +a_0b_0=1$$ but what can I do with the coefficients?