# Show that $f(x)=a_0+a_1x+a_2x^2+\cdots+a_nx^n\in R[x]$ is nilpotent iff $a_0,a_1,a_2,\ldots,a_n$ are nilpotent

Let $R$ be a commutative ring. Show that $f(x)=a_0+a_1x+a_2x^2+\cdots+a_nx^n\in R[x]$ is nilpotent if and only if $a_0,a_1,a_2,\ldots,a_n$ are nilpotent.

Now since $f(x)$ is nilpotent then $f^n=0$ for some $n$. Now $f^2=c_0+c_1 x+\cdots+c_n x^n$ where $c_i=\sum _{k=0}^i a_k a_{i-k}$.

But how to write it for $f^n$? How to take it from here?

If $n_i$ be the least positive integer such that $a_i^{n_i}=0$ then what will the positive integer such that $a_i^n=0$ for all $i$??

I think it's easier to do this with induction on $n=\text{deg}(f)$. The case $n=0$ is obvious.
For the induction step, if $g(x)=a_0+a_1x+a_2x^2+\cdots+a_{n+1}x^{n+1}$ is nilpotent, then $a^{n+1}$ is nilpotent by looking at the coefficient of the highest term. That means that $a_{n+1}x^{n+1}$ is nilpotent, so $g(x)-a_{n+1}x^{n+1}=a_0+a_1x+a_2x^2+\cdots+a_nx^n$ is nilpotent. (Sum of nilpotents is nilpotent) By induction hypothesis $a_0,\cdots,a_n$ are all nilpotent.
Conversely if $a_0,\cdots,a_{n+1}$ are all nilpotent, then in particular $a_0,\cdots,a_{n}$ are nilpotent, so $(a_0+\cdots+a_nx^n)^k=0$ for some $k$. Also, $(a_{n+1}x^{n+1})^l=0$ for some $l$. Now expand $((a_0+\cdots+a_nx^n)+(a_{n+1}x^{n+1}))^{k+l}$ using the binomial theorem to see that it's $0$.
Let $f(x)=a_0+a_1x+a_2x^2+\cdots+a_nx^n\in R[x]$ and $f^N=0$ for some $N \in \mathbb{Z_{\ge1}}$, then you get $a_n^N=0$, so $a_n$ is nilpotent, Now apply induction on $f-a_nx^n$ which is also nilpotent (why?) and of degree strictly less than $n$.
Only if part is trivial, for the if part show that if $a_i ^{N_i}=0$ then $(\sum_{i=1}^{n}a_ix^i)^{\sum_{i=1}^{n}N_i+1}=0$ by showing that any general term is 0.