I am having trouble with how to begin with this problem from Abstract Algebra by Dummit and Foote (2nd ed):

Let $R$ be a commutative ring with 1.

Let $p(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0$ be an element of the polynomial ring $R[x]$. Prove that $p(x)$ is a zero divisor in $R[x]$ if and only if there is a nonzero $b\in R$ such that $bp(x)=0$.

Hint: Let $g(x)=b_mx^m+b_{m-1}x^{m-1}+\cdots+b_0$ be a nonzero polynomial of minimal degree of such that $g(x)p(x)=0$. Show that $b_ma_n=0$ and so $a_ng(x)$ is a polynomial of degree less than $m$ that gives 0 when multiplied by $p(x)$. Conclude that $a_ng(x)=0$. Apply a similar argument to show by induction on $i$ that $a_{n-i}g(x)=0$ for $i=0,1,\cdots,n$ and show that implies $b_mp(x)=0$.

My attempt:

Suppose $p(x)$ is a zero divisor. Let $g(x)=b_mx^m+b_{m-1}x^{m-1}+\cdots+b_0$ be a nonzero polynomial of minimal degree of such that $g(x)p(x)=0$. Then $g(x)p(x)=(b_mx^m+\cdots+b_0)(a_nx^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0)=b_ma_nx^(m+n)+\cdots+b_0a_0=0$ by the assumption. so $a_ng(x)$ is a polynomial of degree less than $m$ that gives 0 when multiplied by $p(x)$. Thus, $a_ng(x)=0$ because $R$ is commutative then the polynomial ring is, too.

thanks

Cbarker1