In the exercises at the end of the chapter on completions in Eisenbud's "commutative algebra with a view toward algebraic geometry" he gives a different proof of the "classical" formulation of Hensel's lemma. One of the steps is the following lemma:
Let $S$ be a ring and let $g_1,g_2 \in S[x]$ be such that $g_1$ is monic and $g_1S[x]+g_2S[x]=S[x].$
Then every $f \in S[x]$ can be written uniquely in the form $$f=g_1h_1+g_2h_2$$ where $h_i \in S[x]$ and $\deg(h_2)<\deg(g_1).$
I can easily prove existence: since $g_1$ and $g_2$ generate the unit ideal, we can certainly write $$f=g_1H_1+g_2H_2$$ for some $H_i \in S[x].$ If $\deg(H_2)<\deg(g_1),$ then we are done so suppose $\deg(H_2)\geq \deg(g_1).$
Since $g_1$ is monic, we can find $q,r \in S[x]$ such that $H_2=qg_1+r$ and $\deg(r)<\deg(g_2).$
Now take $h_1=H_1+g_2q$ and $h_2=r.$
I am stuck on proving uniqueness however.
We must show that if $g_1h_1=g_2h_2$ and $\deg(h_2)<\deg(g_1),$ then $h_1=h_2=0.$
The hint in Eisenbud says that this follows since $g_1$ is not a zero-divisor in $S[x]$ (it's monic).
But I don't see how to use this :(
I would greatly appreciate some more help! Many thanks.