TITLE: Prove that only units of $\Bbb Z[\sqrt d] $ are $\pm 1$.
QUESTION [5 upvotes]: Let $d(\in \Bbb Z)<-1$ such that $d$ is not divisible  by the square of a prime.
  Prove that only units of $\Bbb Z[\sqrt d] $  are $\pm 1$.

$$a+b\sqrt d \text{ is a unit }\implies (a+b\sqrt d)(c+e\sqrt d)=1\implies (a^2-db^2)(c^2-de^2)=1\implies a^2-db^2=\pm 1\implies a+b\sqrt d=\pm1\implies a+b\sqrt d \text{ is a unit}$$    
Where did we use that $d$ is not divisible  by the square of a prime.
Is my proof wrong?

REPLY [2 votes]: I'm going to assume that you meant $d \not \equiv 1 \bmod 4$. If you did mean that, my answer might need slight adjustments.

$$a + b\sqrt d \text{ is a unit }\implies (a + b\sqrt d)(c + e\sqrt d) = 1$$

So far so good. Of course it should be noted that $\{a, b, c, e\} \in \mathbb{Z}[\sqrt{d}]$. More importantly, however, either $c = -a$ and $e = b$ or $c = a$ and $b = -e$. Without loss of generality (I'm using that correctly, right?), let's rewrite $c + e \sqrt{d}$ as $a - b \sqrt{d}$. Then

$$(a + b\sqrt d)(a - b \sqrt d) = 1 \implies (a^2 - db^2)(a^2 + db^2) = 1 \implies a^2 - db^2 = \pm 1$$

It is at this point that I would invoke Mr. Soupe's shortcut. Replace $d$ by $-d$ and replace $a^2 - db^2$ with $a^2 + db^2$. Then $d$ is positive and $a^2 + db^2 = -1$ has no solutions. If $d > 1$ (remember the replacement we made just a minute ago), and $b \neq 0$, then $db^2 > 1$ and $a + b \sqrt{d}$ can't be a unit.
So for that number to be a unit, we require $b = 0$. And then if $a > 1$ or $a < -1$ then $a^2 > 1$. I don't have to tell you what happens if $a = 0$. Then, by the process of elimination, $a = \pm 1$, $b = 0$ and therefore the only numbers in the group of units are $\{-1, 1\}$.