Ring of integers of a quadratic field when not square-free

I know what the ring of integers of $\mathbb{Q}(\sqrt{d})$ looks like when $d$ is square free, but what is the ring of integers for $\mathbb{Q}(\sqrt{d})$ for $d=18,45$ etc. Can I just remove the square factors?

Thank you

-
Yes. For instance $\mathbb{Q}(\sqrt{18}) = \mathbb{Q}(\sqrt{2})$ –  user9413 Apr 23 '12 at 11:30

What you are asking has nothing to do with rings of integers, but simply with the definition of $\mathbb{Q}(\sqrt{d})$: $$\mathbb{Q}(\sqrt{d})=\{a+b\sqrt{d} : a,b\in\mathbb{Q}\}.$$ Now suppose that $d$ is an arbitrary integer. Then, we can find integers $n\geq 1$ and $f\in\mathbb{Z}$ such that $d=n^2f$, and $f$ is square-free. Hence, $\mathbb{Q}(\sqrt{d})=\mathbb{Q}(\sqrt{f})$. Let's see this:

• If $\alpha=a+b\sqrt{d}\in\mathbb{Q}(\sqrt{d})$, then $\alpha=a+b\sqrt{d}=a+b\sqrt{n^2f}=a+bn\sqrt{f}\in\mathbb{Q}(\sqrt{f})$.

• Conversely, if $\beta=u+v\sqrt{f}\in\mathbb{Q}(\sqrt{f})$, then $$\beta=u+\frac{v}{n}\cdot n \sqrt{f}= u+\frac{v}{n} \sqrt{d}\in \mathbb{Q}(\sqrt{d}).$$

Notice that the argument above can be modified slightly to show that, in fact, for every rational number $d\in\mathbb{Q}$ there is a square-free integer $f\in\mathbb{Z}$ such that $\mathbb{Q}(\sqrt{d})=\mathbb{Q}(\sqrt{f})$.

-
You don't have to show this in general, it is enough to show that the generators $\sqrt{d}$ and $\sqrt{f}$ lie in the fields $\mathbb{Q}(\sqrt{f})$ and $\mathbb{Q}(\sqrt{d})$ respectively. –  fretty Apr 24 '12 at 8:42
Yes, that is correct, but I thought that at this level it would be clearer to show the equality of sets completely. –  Álvaro Lozano-Robledo Apr 24 '12 at 11:53
Well it is quite obvious that say $\mathbb{Q}(\sqrt{18}) = \mathbb{Q}(\sqrt{2})$. This just boils down to the fact that $\sqrt{18} = 3\sqrt{2}$, which is a rational multiple of $\sqrt{2}$.