<s>[INST] Show that $a + b\sqrt{n}$ is an irreducible element of $\mathbb{Z}[\sqrt{n}]$ Let $n(\neq 0,1)$ be a square-free integer. Suppose that $|a^2 - nb^2|$ is a prime integer for $a,b \in \mathbb{Z}$. Show that $a + b\sqrt{n}$ is an irreducible element of $\mathbb{Z}[\sqrt{n}]$. Then, show that $p = |a^2-nb^2|$ is not irreducible in $\mathbb{Z}[\sqrt{n}]$. 
I can't prove the first part. I think the question is a bit un clear too. Are all $a + b\sqrt{n}$ is an irreducible element of $\mathbb{Z}[\sqrt{n}]$? Or just those with norm being a prime? For the second, I find it weird because i thought all primes in an integral domain is irreducible. Is $\mathbb{Z}[\sqrt{n}]$ not an integral domain? If so, can someone give me an example of a zero divisor in $\mathbb{Z}[\sqrt{n}]$ or a proof of $\mathbb{Z}[\sqrt{n}]$ not being an integral domain?
Thanks.
My attempt:
Claim 1
$N((a+b\sqrt{n})(c+d\sqrt{n}) = N(a+b \sqrt{n})N(c+d\sqrt{n})$
Proof
\begin{align*}
& N((a+b\sqrt{n})(c+d\sqrt{n}) \\
&=  N((ac + bdn) + (ac + bd)\sqrt{n}) \\
&=  |(ac+bdn)^2 - n(ac+bd)^2| \\
&= |(a^2c^2 + 2abcdn + b^2d^2n^2) - n(a^2c^2 + 2abcd + b^2d^2)| \\
&= |a^2c^2 + 2abcdn + b^2d^2n^2 - a^2c^2n - 2abcdn - b^2d^2n| \\
&= |a^2c^2 + b^2d^2n^2 - a^2c^2n - b^2d^2n| \\
&= |(a^2 - nb^2)(c^2 - nd^2)| \\
&= |a^2 - nb^2||c^2 - nd^2)| \\
&= N(a+b\sqrt{n})N(c+ d \sqrt{n})
\end{align*}
Claim 2.
$a+b\sqrt{n}$ is a unit in $\mathbb{Z}[\sqrt{n}]$ if and only if $N(a+b\sqrt{n}) = 1$.
Proof
Since $a+b\sqrt{n}$ is a unit in $\mathbb{Z}[\sqrt{n}]$, we can find $(c+d \sqrt{n}) \in \mathbb{Z}[\sqrt{n}]$ such that $(a+b\sqrt{n})(c+d \sqrt{n}) = 1$. This gives us $N(a+b\sqrt{n})N(c+ d \sqrt{n}) = N((a+b\sqrt{n})(c+d \sqrt{n})) = N(1) = 1$. From the way the norm is defined, $N(a+b\sqrt{n}) \geq 0$ and $N(c+ d \sqrt{n}) \geq 0$. Therefore, we must have $N(a+b\sqrt{n}) = 1$ and $N(c+ d \sqrt{n}) = 1$. 
I am having trouble proving the other direction
Proof for the question
First part
Suppose $a + b\sqrt{n}$ is reducible in $\mathbb{Z}[\sqrt{n}]$, then $a + b\sqrt{n} = (\alpha_1 + \beta_1 \sqrt{n})(\alpha_2 + \beta_2 \sqrt{n})$ for some non-units $\alpha_1 + \beta_1 \sqrt{n}, \alpha_2 + \beta_2 \sqrt{n} \in \mathbb{Z}[\sqrt{n}]$. This gives us $ |a^2 - nb^2| = N(a + b\sqrt{n}) = N(\alpha_1 + \beta_1 \sqrt{n})(\alpha_2 + \beta_2 \sqrt{n}) = N(\alpha_1 + \beta_1 \sqrt{n})N(\alpha_2 + \beta_2 \sqrt{n})$. By claim 2, $N(\alpha_1 + \beta_1 \sqrt{n}) \neq 1$ and $N(\alpha_2 + \beta_2 \sqrt{n} \neq 1$ as $\alpha_1 + \beta_1 \sqrt{n}, \alpha_2 + \beta_2 \sqrt{n}$ are non-units. This implies that $N(\alpha_1 + \beta_1 \sqrt{n}) = p$ and $N(\alpha_2 + \beta_2 \sqrt{n}) = p$ as $p$ is prime. This presents us with a contradiction as $p = N(a + b\sqrt{n}) =  N(\alpha_1 + \beta_1 \sqrt{n})N(\alpha_2 + \beta_2 \sqrt{n}) = p^2$. Hence, $a + b\sqrt{n}$ is irreducible in $\mathbb{Z}[\sqrt{n}]$.
Second part
If $p$ is irreducible in $\mathbb{Z}[\sqrt{n}]$, then if $p = ab$ for some $a,b \in \mathbb{Z}[\sqrt{n}]$, $a$ is a unit or $b$ is a unit . This gives us $p^2 = N(p) = N(a)N(b)$. If $a$ is a unit, then $N(b) = p^2$.
I don't know how to continue
If $|ab| \neq |a||b|$, then my proof probably fail, but i think this is true.
 [/INST] The first part of the question is asking you to show that if $|a^2-nb^2|=p$ is prime as an integer, then $a+b\sqrt{n}$ is irreducible in $\mathbb Z[\sqrt{n}]$. The second part asks you that this $p$ is not irreducible (and therefore not prime) viewed as an element of $\mathbb Z[\sqrt{n}]$; that is, $p$ has a factorization as a product of non-units in $\mathbb Z[\sqrt{n}]$. For example, $3$ is not prime as an element of $\mathbb Z[\sqrt{3}]$, since
$3=\sqrt{3}\sqrt{3}$ and $\frac{1}{\sqrt{3}}=\frac{1}{3}\sqrt{3}\not\in\mathbb Z[\sqrt{3}]$. 
(It isn't the case that $\mathbb Z[\sqrt{n}]$ is not an integral domain; it clearly is a domain, since it is a subring of the real numbers.) 
Both parts follow from the following lemmas:
Lemma 1: Let $||a+b\sqrt{n}||=|a^2-nb^2|$. Then for any $\alpha=a+b\sqrt{n}$
and $\beta=c+d\sqrt{n}$, $||\alpha\beta||=||\alpha||\cdot||\beta||$.
Idea of proof:
Note that $||a+b\sqrt{n}||=|a+b\sqrt{n}|\cdot|a-b\sqrt{n}|$ and compute $(a\pm b\sqrt{n})(c\pm d\sqrt{n})$.
Lemma 2: Suppose $\alpha\in \mathbb Z[\sqrt{n}]$. 
Then $\alpha^{-1}\in\mathbb Z[\sqrt{n}]$ if and only if $||\alpha||=1$.
Idea of proof: If $\beta\in \mathbb Z[\sqrt{n}]$ then $||\beta||$ is a non-negative integer so Lemma 1 implies one direction. The other direction just requires a little high school algebra: rationalize a fraction with denominator $a+b\sqrt{n}$ by multiplying the numerator and denominator by the conjugate $a-b\sqrt{n}$.
</s>