Why are module preserving elements units? Let $K$ be a real quadratic field and $M \subset K$ be a subgroup of the additive group of $K$ of rank $2$. Why is each $\varepsilon \in K$ with $\varepsilon M=M$ a unit, so an element of $\mathcal O_K^\times$?
What I tried: We can find a basis $b_1,b_2 \in M$ for $M$ such that
$M=b_1 \mathbb Z + b_2 \mathbb Z$. Then there is an integer valued matrix of determinant $\pm 1$ with
$\begin{pmatrix} a & b \\ c & d \end{pmatrix}\begin{pmatrix} b_1 \\ b_2 \end{pmatrix}=\begin{pmatrix} \varepsilon b_1 \\ \varepsilon b_2 \end{pmatrix}.$
From that you can deduce equations like $\varepsilon = a+b b_2/b_1$. But I couldn't find a monic polynomial with root $\varepsilon$ and integer coefficients. When I have that I would be done since this shows $\varepsilon \in \mathcal O_K$ and we get with the same argument $\varepsilon^{-1} \in \mathcal O_K$, so we are done.
EDIT: Now I found the monic polynomial (thanks to Barry Smith). It is the characteristic polynomial of the matrix because $\varepsilon$ is an eigenvalue of it.

In case that $M$ is a fractional ideal this answer is simple: $ M = \varepsilon M =(\varepsilon) M $, so the principal ideal generated by $\varepsilon$ has to be $\mathcal O_K$. Hence, $\varepsilon \in \mathcal O_K$.
