This should be wellknown, but I can't find a reference (or a proof, or a counterexample...). Let $d$ be a positive squarefree integer. Suppose that there is no element in the ring of integers of $\mathbb{Q}(\sqrt{d})$ with norm $1$. Then I believe that no element of $\mathbb{Q}(\sqrt{d})$ has norm $1\ $ (in fancy terms, the homomorphism $H^2(G,\mathscr{O}^*)\rightarrow H^2(G,\mathbb{Q}(\sqrt{d})^*)$, with $G:=\operatorname{Gal}(\mathbb{Q}(\sqrt{d})/\mathbb{Q})=$ $\mathbb{Z}/2 $, is injective). Is that correct? If yes, I'd appreciate a proof or a reference.

1$\begingroup$ You might find the following paper useful: arxiv.org/abs/1309.1071 $\endgroup$ – GH from MO Aug 22 at 17:20
This is false. The smallest counterexample is $d = 34$. Let $K = \mathbb{Q}(\sqrt{34})$. The fundamental unit in $\mathcal{O}_{K} = \mathbb{Z}[\sqrt{34}]$ is $35 + 6 \sqrt{34}$, which has norm $1$, and therefore, there is no element in $\mathcal{O}_{K}$ with norm $1$.
However, $\frac{3}{5} + \frac{1}{5} \sqrt{34}$ has norm $1$, so there is an element of norm $1$ in $K$.

2$\begingroup$ Thanks very much to Jeremy Rouse for the nice answer, and to everybody else for the very enlightening comments. $\endgroup$ – abx Aug 22 at 18:24
Jeremy Rouse already gave a counterexample, but let me expand on that somewhat. The question of whether $\mathbb{Q}(\sqrt{d})$ contains an element of norm $1$ is purely local: this happens if and only if $d$ is a sum of two squares of rational integers. Indeed if we assume $d$ is squarefree, this is saying that all odd primes dividing $d$ are congruent to $1$ modulo $4$.
The question of whether the ring of integers of $\mathbb{Q}(\sqrt{d})$ contains an element of norm $1$ is much more subtle, and is really a question about the class group of $\mathbb{Q}(\sqrt{d})$ and the narrow class group. If we put $K_d = \mathbb{Q}(\sqrt{d})$ and $\text{CL}(K_d), \text{CL}^\sharp(K_d)$ to be the class group and narrow class group of $K_d$ respectively, then the existence of an element of norm $1$ in $\mathcal{O}_{K_d}$ is equivalent to $\text{CL}(K_d) \cong \text{CL}^\sharp(K_d)$. This is a subtle condition. One can simplify the criterion somewhat, since really only $2^\infty$torsion matters. The simplified criterion is the assertion that $\text{CL}(K_d)[2^k] \cong \text{CL}^\sharp(K_d)[2^k]$ for all $k \geq 1$. The condition that $\text{CL}^\sharp(K_d)[2] \cong \text{CL}(K_d)[2]$ is equivalent to the field $K_d$ containing an element of norm $1$, and is of course a necessary condition for the ring of integers to contain an element of norm $1$.
Edit: I should emphasize that asymptotically the sets $$S_1 = \{d : K_d \text{ contains an element of norm } 1\}$$ and $$S_2 = \{d : \mathcal{O}_{K_d} \text{ contains an element of norm } 1\}$$ do not have the same density, hence there are infinitely many counterexamples. This is proved by Fouvry and Kluners in this paper. In the same paper they also mention that one expects an asymptotic formula for the density of $S_2$, given by Stevenhagen.

3$\begingroup$ When you say in the 1st paragraph "if and only if $d$ is a sum of two squares" it's worth clarifying where it is a sum of two squares, or more to the point that it is the same in $\mathbf Z$ as in $\mathbf Q$: an integer that is a sum of two rational squares is a sum of two integral squares. The setting of the OP's question is about solving an equation in $\mathbf Q(\sqrt{d})$ or in its ring of integers, so it's nice to know this distinction does not occur for $n=x^2+y^2$ in $\mathbf Q$ and in $\mathbf Z$. You have a typographical error with $\mathbf Q(\sqrt{d})$ in the 2nd paragraph. $\endgroup$ – KConrad Aug 22 at 17:08

1$\begingroup$ @KConrad thanks for the comment! I have fixed these two issues and also added an explanation that there are infinitely many counterexamples to the claim in the question. $\endgroup$ – Stanley Yao Xiao Aug 22 at 17:11

1$\begingroup$ References for the first paragraph: Hasse's norm theorem (or the HasseMinkowski theorem for ternary quadratic forms) combined with basic properties of the Hilbert symbol (cf. Ch.III in Serre: A course in arithmetic). $\endgroup$ – GH from MO Aug 22 at 17:18

1$\begingroup$ Actually one can see directly the following reciprocity phenomenon: $1$ is a norm from $\mathbb{Q}(\sqrt{d})$ if and only if $d$ is a norm from $\mathbb{Q}(\sqrt{1})$. Indeed, both statements are equivalent to $x^2+y^2dz^2$ having a nontrivial zero over $\mathbb{Q}$. Now $d$ is a sum of two squares in $\mathbb{Q}$ if and only it is a sum of two squares in $\mathbb{Z}$, so one can do without the references in my previous comment. This observation also resonates with KConrad's comment. $\endgroup$ – GH from MO Aug 22 at 17:42
Dirichlet's version of Gauss composition is in the book by Cox, (page 49 in first) with a small typo corrected in the second edition. For our purpose, duplication, it has a better look to equate $a=a'$ from the start, with $\gcd(a,b) = 1$ sufficing, $$ \left( ax^2 +bxy+ acy^2 \right) \left( aw^2 +bwz+ acz^2 \right) = c X^2 + b XY + a^2 Y^2 $$ where $$ X = axz + ayw+byz \; \; , \; \; \; Y = xw  c yz $$ so that the square of $\langle a,b,ac \rangle$ is $\langle c,b,a^2 \rangle.$
Today's question concerns $c=1$
$$ \left( ax^2 +bxy ay^2 \right) \left( aw^2 +bwz az^2 \right) =  X^2 + b XY + a^2 Y^2 $$ where $$ X = axz + ayw+byz \; \; , \; \; \; Y = xw + yz $$ so that $$\langle a,b,a \rangle^2 = \langle 1,b,a^2 \rangle.$$ We also see Stanley's fact that the discriminant is the sum of two squares, $b^2 + 4 a^2$ the way I wrote things.
By the Gauss theorem on duplication, $ \langle 1,b,a^2 \rangle$ is in the principal genus
Furthermore, we now know that the principal form is $SL_z \mathbb Z$ equivalent to $$ \langle 1,b,a^2 \rangle $$ The principal form may not integrally represent $1$ but does so rationally.
As to being in the same genus, we can use Siegel's definition of rational equivalence without essential denominator.
$$ \left( \begin{array}{rr} 0 & 1 \\ a^2 & b \\ \end{array} \right) \left( \begin{array}{rr} 1 & \frac{b}{2} \\ \frac{b}{2} & a^2 \\ \end{array} \right) \left( \begin{array}{rr} 0 & a^2 \\ 1 & b \\ \end{array} \right) = \; a^2 \; \left( \begin{array}{rr} 1 & \frac{b}{2} \\ \frac{b}{2} & a^2 \\ \end{array} \right) $$
$$ \left( \begin{array}{rr} b & 1 \\ a^2 & 0 \\ \end{array} \right) \left( \begin{array}{rr} 1 & \frac{b}{2} \\ \frac{b}{2} & a^2 \\ \end{array} \right) \left( \begin{array}{rr} b & a^2 \\ 1 & 0 \\ \end{array} \right) = \; a^2 \; \left( \begin{array}{rr} 1 & \frac{b}{2} \\ \frac{b}{2} & a^2 \\ \end{array} \right) $$