# Find Units in $\mathbb{Z}[\sqrt{n}]$

Find all units in $\mathbb{Z}[\sqrt n] = \{a + b\sqrt n \mid a, b \in \mathbb Z \}$ and $n \in\mathbb N$, $n\ge 2$.

First let $c +d\sqrt n$ be a unit so $$(a +b\sqrt n)(c +d\sqrt n) = 1,$$ $$ac + bdn +(bc + ad)\sqrt n = 1.$$

What next?

-
next you need $ac + bdn = 1$ and $bc + ad = 0$. – MJD Mar 26 '12 at 19:29
– lhf Mar 26 '12 at 22:06
@lhf I don't think this is a duplicate. This question is asking for finding all the units (which is a difficult task), not only to show that there are infinitely many. – user26857 Feb 14 '13 at 10:46

Since $a$, $b$, $c$, $d$, and $n$ are integers, the only way you can have $(ac + bdn) + (bc + ad)\sqrt n = 1$ is if $ac+bdn = 1$ and $bc+ad= 0$. This gives you two equations in $c$ and $d$. If you can solve for $c$ and $d$ in terms of $a$, $b$, and $n$, you will have an expression for the inverse of $a+b\sqrt n$. $a+b\sqrt n$ is a unit whenever this expression is well-defined and yields integers for $c$ and $d$.
If $a+b\sqrt n$ is a unit, so is $a-b\sqrt n$; their inverses are conjugates. So $(a+b\sqrt n)(a-b\sqrt n)=a^2-nb^2$ is both an integer and a unit. Since $\frac{1}{m} \notin \mathbb{Z}[\sqrt n]$ for any $m$ in $\mathbb{Z}$ other than $\pm 1$, we are reduced to solving the equation $a^2-nb^2=\pm 1$. Since we can multiply the equation through by 1, changing the signs on $a$ and $b$, we are looking for the solutions to Pell's equation: $a^2-nb^2=1$.