# Explicit description of the extension generated by the square root of a fundamental unit of a real quadratic field

Suppose $$K={\mathbb{Q}}(\sqrt{m})$$ is a real quadratic field which contains a totally positive fundamental unit $$\epsilon$$ (hence its norm is $$1$$). Suppose that $$\epsilon \equiv 1 \pmod 8$$, so that the quadratic extension $$K(\sqrt{\epsilon})$$ is unramified over $$K$$. In particular, it is contained in the genus field; i.e., there exists $$d \mid m$$ such that $$K(\sqrt{\epsilon}) = K(\sqrt{d})$$. Is there a recipe for $$d$$ in terms of $$\epsilon$$?

A guess: suppose $$m$$ is odd; then for each odd prime $$p \mid m$$ let $$\tilde{p}$$ denote the unique ideal in $$K$$ dividing $$p$$, so in particular $$\epsilon \equiv \pm 1 \pmod{\tilde{p}}$$. Is it true that $$d = \prod p$$ where the product is over the primes dividing $$m$$ where $$\epsilon \equiv 1$$ (or $$-1$$ as $$d$$ and $$m/d$$ give the same extension)?

This has nothing to do with ramification. Write your unit in the form $$\varepsilon = t + u \sqrt{m}$$; then $$t^2 - mu^{2} = 1$$, hence $$t^2 - 1 = (t-1)(t+1) = mu^2$$. If $$t$$ is odd, then unique factorization implies $$t-1 = 2ar^2$$ and $$t+1 = 2bs^2$$, where $$ab = m$$, hence $$t = ar^2 + bs^2$$. It is then easily verified that $$(r\sqrt{a} + s \sqrt{b})^2 = t + u \sqrt{m}$$, and $$k (\sqrt{\varepsilon}) = k(\sqrt{a})$$. The case where $$t$$ is even is taken care of similarly.