Finding units in the ring of integers In these notes about number theory, trying to compute the class group of the number field $K=\mathbb{Q}[X]/(g(X))$ where $g(X)=X^3+X^2+5X-16$, the author manages to find a fundamental unit by exploiting the relations between prime ideals (p. 73). If $\alpha\in K$ denotes a root of $g$, we can see that the ideals $(9\alpha)$ and $((\alpha-1)(\alpha-2)^4)$ are equal in $O_K$ and thus the two elements differ by a unit
$$ \varepsilon=\frac{(\alpha-1)(\alpha-2)^4}{9\alpha}=4\alpha^2+\alpha-13 $$
I can't see how to find the explicit expression for $\varepsilon$ in terms of the basis $\{1,\alpha,\alpha^2\}$ of $O_K$. I thought that using the isomorphism $O_K\cong \mathbb{Z}[X]/(g(X))$ I could somehow do the division between $(X-1)(X-2)^4$ and $9X$ modulo $g(X)$ but this does not even make sense since $9$ is not invertible in $\mathbb{Z}$. In the case of two polynomials $h,f\in k[X]$ (with $k$ a field) one could write $1=\gcd(f,g)=af+bg$ and then multiply by $h$ to get $h=haf+hbg$ to get that $f/h=ha$ mod $g$, but I don't know how to apply this argument in this case.
 A: I think the equality is somewhat misleading as an expression in $\mathcal{O}_K$, since, in particular, $9\alpha$ is not a unit in $\mathcal{O}_K$, despite the fact that $(\alpha - 1)(\alpha - 2)^4/9\alpha$ is an element of $\mathcal{O}_K$ (this can happen!).
I say this, because one is tempted to simply divide by $9\alpha$ to obtain an expression. In practice, the expression which you derive from the reasoning that $((\alpha - 1)(\alpha - 2)^4) = (9\alpha)$ as ideals looks more like
$$(\alpha - 1)(\alpha - 2)^4 = 9\alpha \varepsilon$$
for some $\varepsilon \in \mathcal{O}_K^\times$. This is much easier to work with, and you can use your method in this case. Indeed, you have
$$(X - 1)(X-2)^4 \equiv -27X^2 - 297X + 576 \bmod g(X).$$
Somewhat suggestively, one might notice that the coefficients are all divisible by $9$ (yay!). Thus, in $\mathcal{O}_K$ you have
$$9\alpha \varepsilon = -27\alpha^2 - 297\alpha + 576$$
and hence
$$\alpha \varepsilon = -3\alpha^2 - 33\alpha + 64.$$
Now write $\varepsilon = a + b\alpha + c\alpha^2$ with $a,b,c \in \Bbb Z$ (i.e. write it in terms of your integral basis $\lbrace 1, \alpha, \alpha^2\rbrace$) and then compare coefficients and you should get that $a = - 13$, $b = 1$, and $c = 4$, which is what you were looking for.
You can even check your answer, by checking that
$$-27X^2 - 297X + 576 - 9X(4X^2 + X - 13) \equiv 0 \bmod g(X).$$
If you want to be sure that this is a unit you can calculate the norm of $4\alpha^2 + \alpha - 13$ and make sure this is equal to $1$ (I'd avoid doing this by hand if you don't like blisters, though). 
