Q:

assuring factorization for R[x] when R is a UFD

I wanted to ask, suppose the ring $R$ is a UFD (Unique factorization domain) and I look at $R[x]$, the ring of polynomials over $R$. I wanted to know, how can I assure that when I have some polynomial $f\in R[x]$, that I can factor it into a finite number of irreducible elements?  It seems trivial and true, but I could not come out with a proof, nor to find one online. 

A:

For nonzero $f\in R[x]$, let $e(f)$ be the number of prime factors in the leading coefficient of $f$, and define $d(f)=(\deg(f), e(f))\in\mathbb{N}^2$.  Note that $\mathbb{N}^2$ is well-ordered with respect to the lexicographic order $<$ (first compare degrees, then compare $e$ if the degrees are the same).   Also, note that $d(fg)=d(f)+d(g)$ (adding each component) and $d(f)=(0,0)$ iff $f$ is a unit.   It follows that if $h\mid f$ but $f\not\mid h$, then $d(h)<d(f)$.
Let us now prove that any non-unit has an irreducible factor.   Fix a nonzero $f\in R[x]$.  We use induction on $d(f)$.  If $f$ is irreducible, we're done.   Otherwise, it has a non-unit proper factor $g$, and $d(g)<d(f)$.  By induction, $g$ has an irreducible factor, which is then an irreducible factor of $f$.
Finally, we prove that any nonzero $f$ can be factored into irreducible elements (and a unit).   We again use induction on $d(f)$.  If $f$ is a unit, we are done.   Otherwise, it has an irreducible factor $g$.  Then $d(f/g)<d(f)$, so by induction we have a factorization of $f/g$.  Adding $g$ to this factorization, we get a factorization of $f$.

A:

If $\,f = ax^n+\cdots$  has degree $n$ and lead coef $a$ then define $\,d(f) = k+n\,$ where $\,k = $ number of primes in the unique factorization of $a$. Now we can prove by induction on $\,d\,$ that every $\,f\neq0\,$ has factorization as a product of irreducibles times a unit.  If $\,d =0\,$ then $\,f\,$ is a unit.  if $\,f\,$ is ireducible then we are done.  Else $\,f = gh\,$ and $\,d(g),d(h)< d(f)\,$ so by induction $\,g,h\,$ have such factorizations, which appended, with units multiplied, yield a factorization for $\,f.\ $
Remark $\ $ The idea is that leading terms $\, a\, x^n\,$ have finite factorization in the unique factorization monoid $\,\Bbb Z^{*}\langle x\rangle$ freely generated by the prime $\,x\,$ and all primes $\,p\in\Bbb Z.\,$ This has a natural "degree" function $\,d\,$ being the total number of primes $= k+n.\,$ The proof merely pulls back this finiteness to $\,\Bbb Z[x],\,$ using that the lead coefficient map is a multiplicative monoid hom. 
The total number of primes also serves as a degree function for a generalization of the Euclidean algorithm to arbitrary PIDs.  Namely, the Dedekind-Hasse criterion: 
 a domain $\rm\,D\,$ is a PID $\iff$ given  $\rm\:0\neq a, b \in D,\:$ 
 either $\rm\:a\:|\:b\:$ or some D-linear combination $\rm\:a\,d+b\,c\:$ is "smaller" than $\rm\,a.\,$ 
It is clear that such a domain must be PID (since then 
 the "smallest" element in an ideal must divide all others).  
 Conversely, since a PID is UFD, an adequate "smaller" metric is 
 the number of prime factors (if $\rm\,a\nmid b\:$ then their gcd $\rm\,c\,$ 
 must have fewer prime factors; for if $\rm\:(a,b) = (c)\:$ then 
  $\rm\,c\:|\:a\:$ properly, else $\rm\,a\:|\:c\:|\:b\:$ contra hypothesis). 