$k[[X_1,\ldots,X_n]]$ is UFD for $k$ field

As the title says, I'm trying to prove that $k[[X_1,\ldots,X_n]]$ is UFD for $k$ field. In Lang's Algebra, there is a proof by induction on $n$. The base of induction is clear (we even have discrete valuation ring).

Let $R_n = k[[X_1,\ldots,X_n]] \cong R_{n-1}[[X_n]]$ and assume that $R_{n-1}$ is UFD. Let $f\in R_n$, $f(X_1,\ldots,X_n)\neq 0$. Lang now handwaves that one could apply some change of variables to conclude that without loss of generality $f(0,\ldots,0,X_n)\neq 0$. Since $R_{n-1}$ is complete local ring with unique maximal ideal ${\frak m}=(X_1,\ldots,X_{n-1})$, this means that coefficients of $f$ are not all in $\frak m$. This is necessary to apply Weierstrass preparation theorem to conclude that $f = gu$ where $g\in R_{n-1}[X_n]$ and $u$ is invertible in $R_n$. Since $R_{n-1}[X_n]$ is UFD, $g$ can be factored into irreducible polynomials $g = g_1\ldots g_k$. Lang now claims that this gives existence of factorization in $R_{n-1}[[X_n]]$.

Question. Why does factorization into irreducibles of $g$ in $R_{n-1}[X_n]$ induce factorization into irreducibles in $R_{n-1}[[X_n]]$? How do we know that $g_i$'s are irreducible in $R_{n-1}[[X_n]]$ (actually they could as well be invertible, which is definitely not a problem, but what in the case that they are not?) I'm probably missing something very obvious here.

Bonus question. Is there a better way to prove the theorem?

• $R_n$ is the completion of a polynomial ring over a field, and therefore it is regular. But regular local rings are UFDs. – user26857 Oct 3 '16 at 19:30
• I think you are being loose (and being unfair to Lang). It is clear that once you fix $x_1,\ldots, x_{n-1}$ as you have, in general you can not make $f(0,\ldots,0, x_n)\neq 0$. So, you must do this first and thus pick your variables dictated by this choice. Secondly, given this you write $f=gu$, but omits one of the most important property (which Lang says) that $g$ is not only a polynomial in $x_n$, but in fact monic. Notice that once it is monic, the natural map $R_{n-1}[x_n]\to R_n/gR_n$ is onto, which will prove most of what you want. – Mohan Oct 4 '16 at 0:27
• @user26857, thank you for the comment. I always enjoy short concise argumentation. – Ennar Oct 4 '16 at 10:43
• @Mohan, I'm not exactly sure what you mean by loose or unfair. If I were unfair, that was certainly not my intention. I can see that the map you mention is onto, but I still can't see why this proves that $g_i$'s are either invertible or irreducible in $R_n$. Could you please offer some more guidance? – Ennar Oct 4 '16 at 11:24
• Writing $g=g_1\cdots g_k$ as you have, one easily checks that either $g_i\in R_{n-1}$ or $g_i$ is monic in $x_n$. In the first case, it is clear that $g_i$ is irreducible in $R_n$ as well. In the second case, one has an isomorphism $R_{n-1}[x_n]/g_i\to R_n/g_i$ and since the first is a domain, so is the second and thus $g_i$ is irreducible in $R_n$. – Mohan Oct 4 '16 at 14:03