TITLE: Using Hensel's Lemma to Factor a Polynomial over $\mathbb{Z}_4[x]$
QUESTION [9 upvotes]: We recently learned about codes over $\mathbb{Z}_4$, and Hensel's Lemma. The lemma is as follows:

Let $f(x) \in \mathbb{Z}_4[x]$. Suppose $\mu(f(x)) = h_1(x)h_2(x) \cdots h_k(x)$, where $h_1(x), h_2(x), \ldots , h_k(x)$ are pairwise coprime polynomials in $\mathbb{F}_2[x]$. Then, there exist $g_1(x),g_2(x), \ldots , g_k(x)$ in $\mathbb{Z}_4[x]$ such that:
(i) $\mu(g_i(x)) = h_i(x)$ for $1 \leq i \leq k$,
(ii) $g_1(x), g_2(x), \ldots , g_k(x)$ are pairwise coprime, and
(iii) $f(x) = g_1(x)g_2(x) \cdots g_k(x)$.

The map $\mu: \mathbb{Z}_4[x] \rightarrow \mathbb{F}_2[x]$ is defined by $\mu(f(x)) = f(x)(\mbox{mod } 2)$. It is also known at the reduction homomorphism. 
I am interested in trying to factor $x^7 + 2x^6 + 2x^4 + 2x + 3$ as a product of basic irreducible polynomials in $\mathbb{Z}_4[x]$. I'm trying to follow the proof of this theorem, which can be found in Fundamentals of Error Correcting Codes by Huffman and Pless, on page 477.
So far, I figured out that $\mu(f(x)) = x^7 + 1$, which can be factored into: $$(x + 1)(x^3 + x^2 + 1)(x^3 + x + 1).$$
Now, I know these are pairwise coprime in $\mathbb{F}_2[x]$, but I am having trouble finding the pairwise coprime polynomials $g_1(x), g_2(x),$ and $g_3(x)$ such that $f(x) = g_1(x)g_2(x)g_3(x)$ and $\mu(g_i(x)) = h_i(x)$ for $i=1,2,3$.
I've been messing around with this, but I can't get anywhere. Any help would be greatly appreciated.
EDIT
After messing around with various combinations of $x+1$, $x^3 + 2x^2 + x + 1$, and $x^3 + x^2 + 2x + 1$ on WolframAlpha, I somehow stumbled across a combination in $Z_4[x]$ that works, but I'm not sure how to figure it out using a more concrete method. 
$$g_1(x) = x+1,$$
$$g_2(x) = x^3 + 3 x^2 - 1,$$
$$g_3(x) = x^3 - 2x^2 + x + 1.$$

These are pairwise coprime
$\mu(g_1(x)) = x+1$, $\mu(g_2(x)) = x^3 + x^2 + 1$, $\mu(g_3(x)) = x^3
   + x + 1$
$g_1(x)g_2(x)g_3(x) = x^7+2 x^6-4 x^5-2 x^4+8 x^3+4 x^2-2 x-1 = x^7 + 2x^6 + 2x^4 + 2x + 3 = f(x)$.

REPLY [2 votes]: We are going to lift the $\mathbb{F}_2$-factorization $$\bar{f} = (\underbrace{x^3 + x + 1}_{=:g})(\underbrace{x^4 + x^2 + x + 1}_{=:h})$$ to $\mathbb{Z}_4$. That is, considering $g$ and $h$ as polynomials in $\mathbb{Z}_4[x]$, we look for lift-polynomials $a,b\in\mathbb{F}_2[x]$, $\deg(a)\leq 2$, $\deg(b)\leq 3$ such that $$f = (g + 2a)(h + 2b).$$
Since $2\cdot 2 = 0$, we get
$$f = gh + 2(ah + gb)$$
With $gh = x^7 + 2x^5 + 2x^4 + 2x^3 + 2x^2 + 2x + 1$ this implies
$$2(ah + gb) = 2x^6 + 2x^5 + 2x^3 + 2x^2 + 2.$$
Equivalently, in $\mathbb{F}_2[x]$
$$ah + gb = x^6 + x^5 + x^3 + x^2 + 1.$$
Writing $a = a_2x^2 + a_1x + a_0$ and $b = b_3x^3 + b_2x^2 + b_1x + b_0$, expanding the left hand side gives $$(a_2 + b_3)x^6 + (a_1 + b_2)x^5 + (a_0 + a_2 + b_3)x^4 + (a_1 + a_2 + b_0 + b_2 + b_3)x^3 + (a_0 + a_1 + a_2 + b_1 + b_2)x^2 + (a_0 + a_1 + b_0 + b_1)x + (a_0 + b_0)\\ = x^6 + x^5 + x^3 + x^2 + 1.$$
Rewriting this as a system of $\mathbb{F}_2$-linear equations:
$$\begin{pmatrix}
0 & 0 & 1 & 0 & 0 & 0 & 1 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 \\
1 & 0 & 1 & 0 & 1 & 0 & 1 \\
0 & 1 & 1 & 1 & 0 & 1 & 1 \\
1 & 1 & 1 & 0 & 1 & 1 & 0 \\
1 & 1 & 0 & 1 & 1 & 0 & 0 \\
1 & 0 & 0 & 1 & 0 & 0 & 0 
\end{pmatrix}
\begin{pmatrix}
a_0 \\ a_1 \\ a_2 \\ b_0 \\ b_1 \\ b_2 \\ b_3
\end{pmatrix}
= 
\begin{pmatrix}
1 \\
1 \\
0 \\
1 \\
1 \\
0 \\
1
\end{pmatrix}.
$$
Note that the equation system matrix is the Sylvester matrix of $g$ and $h$. It is invertible, because its determinant is the resultant of $g$ and $h$ which is nonzero since $g$ and $h$ are coprime.
So there is a unique solution $(a_0,a_1,a_2,b_0,b_1,b_2,b_3) = (0,0,1,1,1,1,0)$ which finally gives the $\mathbb{Z}_4$-factorization $$f = (x^3 + 2x^2 + x + 1)(x^4 + 3x^2 + 3x + 3)$$
You can do the same again to find the $\mathbb{Z}_4[x]$-factorization of $x^4 + 3x^2 + 3x + 3$. The final result is $$f = (x^3 + 2x^2 + x + 1)(x+1)(x^3 + 3x^2 + 3).$$