Why is the fact that $n$ is square free important to consider? Let $N_{1}$ be the set of all positive integer greater than $1$.Let $n \in N_{1}$ is square free. Let us consider $\mathbb Z [\sqrt{n}] = \{a + b {\sqrt{n}} : a,b \in \mathbb Z \}$, for some square free positive integer $n \in N_{1}$.Then prove that an element $a + b {\sqrt{n}}$ of $\mathbb Z [\sqrt{n}]$ is irreducible if $|a^{2} - nb^{2}|$ is a prime number.
My attempt :
Let $a + b {\sqrt{n}} \in \mathbb Z [\sqrt{n}]$ such that $|a^{2} - nb^{2}|$ is a prime number, say $p$.Now if $a + b {\sqrt{n}} = (c + d {\sqrt{n}})(e + f {\sqrt{n}})$, then $a = ce + ndf$ and $b = cf + de$.Thus $p = |a^{2} - nb^{2}| = |(ce + ndf)^{2} - n(cf + de)^{2}| = |c^{2}e^{2} + 2ncdef + n^{2}d^{2}f^{2} - n(c^{2}f^{2} + 2cdef + d^{2}e^{2}| =|(c^{2} - nd^{2})(e^{2} - fd^{2})| = |c^{2} - nd^{2}||e^{2} - nf^{2}|$. Since $p$ is prime we have either $|c^{2} - nd^{2}| = 1$ or $|e^{2} - nf^{2}| = 1$.If $|c^{2} - nd^{2}| = 1$, then we have $|(c + d {\sqrt{n}})(c - d {\sqrt{n}})| = 1$ which implies $c + d {\sqrt{n}}$ is a unit where $(c + d {\sqrt{n}})^{-1} = c - d {\sqrt{n}}$ or $-(c - d{\sqrt{n}})$.Similarly if $|e^{2} - nf^{2}| = 1$ it can be shown that $e + f {\sqrt{n}}$ is a unit.Consequently $a + b {\sqrt{n}}$ is irreducible.

I think it's ok, but there is a problem here. I can't use the fact that $n$ is square-free. Why is it important? Please tell me.

Thank you in advance.
 A: We can write every positive integer $n>1$ in an unique way as $n=m^2r$, where $r$ is known as the square-free part of $n$. A proof can be found in this answer. 
Now, using the above result it's easy to prove that $\Bbb{Q}[\sqrt n]=\Bbb{Q}[\sqrt r]$ as extensions of $\Bbb{Q}$ (here $\Bbb{Q}[\sqrt n]=\{a+b\sqrt n: a,b\in\Bbb{Q}\}$). This means that it's enough to consider the case when $n$ is itself a square-free number. In particular, we only need to work with $\Bbb{Z}[\sqrt n]$ when $n$ is square-free. 


*

*This link can be useful to know more about $\Bbb{Q}[\sqrt n]$ and $\Bbb{Z}[\sqrt n]$.

A: I think that the real question is why consider $\mathbb{Z}[\sqrt{n}]$ in the first place?
Consider the problem:
Find all integer solutions to the equation $$x^2-ny^2 =1.$$ 
First note that for any $0<n\in \mathbb{N}$ there are integer solutions, namely $(\pm 1,0)$.
Next note that if $n$ is a square, say $n=k^2$ then $$x^2-ny^2 =(x-ky)(x+ky)=1.$$
As $x,y$ and $k$ are integers, $x-ky$ and $x+ky$ are integers as well. Also, $x+ky=(x-ky)^{-1}$. It follows that $(\pm 1,0)$ are the only solutions.
On the other hand, if $n$ is not a square then the equation still factors in a similar way but in $\mathbb{Z}[\sqrt{n}]$
 $$x^2-ny^2 =(x-y\sqrt{n})(x+y\sqrt{n})=1.$$
This gives a motivation to define for an element $\alpha =a+b\sqrt{n}\in\mathbb{Z}[\sqrt{n}]$ the conjugate $\bar{\alpha}=a-b\sqrt{n}$ and the norm $N(\alpha)=\alpha\bar{\alpha}$.
Now the eqution is $$N(\alpha)=1$$
