Rational to Integer solutions by computing in the class group of $\mathbb Q(\sqrt{a})$

I saw an interesting remark here, that for a quadratic form "Finding out whether there are integer solutions when you know rational ones exist involves computing in the class group of $\mathbb Q(\sqrt{a})$, and can be complicated."

So does anyone have an example of a quadratic form like this which we can find rational solutions by Hasse-Minkowski, and then have to do some complicated computation in he (non-trivial) class group of $\mathbb Q(\sqrt{a})$ to find the integer ones?

I know how to do the Hasse-Minkowski part with Hensel's lemma but the class group part is would be very interesting to me because I just learned about class group, thank you.

-
I guess(as I have no previous acquaitence with this topic) that Davis Speyer was referring to the following: Embed the number fields in the completion at a modulus, and view the solutions to a quadratic form as a surface. Then to find integer solutions ciould be similar to see if there are points in the intersection of the surface and the lattice of integers. Indeed this depiction is quite primitive and contains many flows, but I think this is an interesting direction. Hope you appreciate it. – awllower Nov 4 '12 at 11:35
@awllower, I appreciate the geometric imagery but which modulus do you mean? Would it be the one associated to the valuation $v_{(\sqrt{a})}$? – sperners lemma Nov 4 '12 at 11:38
I mean by a modulus an element of the adèle of a number field...Is this acceptable? Anyway, in my view, a modulus is a formal product of prime-power ideals, some of them might be real primes of the number field, in this case =$Q(\sqrt(a))$. – awllower Nov 4 '12 at 11:42
In addition, even though the whole description seems so geometric, the point is the lattice, or rather, the ring of integers, interpreted in such a geometric way... – awllower Nov 4 '12 at 11:44
Hope one could find references in this direction! And you are welcomed. – awllower Nov 4 '12 at 11:45

$\def\RR{\mathbb{R}}\def\ZZ{\mathbb{Z}}\def\QQ{\mathbb{Q}}$Here is an example of an equation of this form which has rational solutions, and has no local obstruction to having integer solutions, but in fact does not have integer solutions: $$y^2 + 23 x^2 = 3.$$ Some rational solutions to this equation are $(x,y) = (2/3, 1/3)$, $(5/4, 1/4)$ and $(22/13, 1/13)$. Notice that, for every $p$, either $(2/3, 1/3)$ or $(5/4,1/4)$ gives a solution in $\mathbb{Z}_p$. There are also obviously solutions in $\RR$. It is equally easy to see that there are no solutions in $\ZZ$: We would have to have $|y| \leq \sqrt{3}$, so $y=-1$, $0$ or $1$, and none of them work.

We should look in the class group of $\QQ(\sqrt{-23})$. The prime $(3)$ splits in $\QQ(\sqrt{-23})$ as $\langle 3, 1+\sqrt{-23} \rangle \langle 3, 1-\sqrt{-23} \rangle$. Each of these ideals is nonprincipal.

So there is no principal ideal in $\mathbb{Z}[\sqrt{-23}]$ with norm $3$. Equivalently, there is no $x+y \sqrt{-23}$ in $\ZZ[\sqrt{-23}]$ with $N(x+y \sqrt{-23}) = 3$. Equivalently, there is no solution in integers to $x^2+23 y^2 =3$. (Note: The ring of integers in $\QQ[\sqrt{-23}]$ is actually $\ZZ[\frac{1+\sqrt{-23}}{2}]$, not $\ZZ[\sqrt{-23}]$. I'll try to postpone this detail mattering for as long as possible.)

Let's see where rational solutions come from. The class group of $\QQ(\sqrt{-23})$ is $\mathbb{Z}/3$, with $\langle 3, 1+\sqrt{-23} \rangle$ serving as a generator. Notice that means that $\langle 3, 1+\sqrt{-23} \rangle^3$ should be principal. So there should be an element of $\ZZ[\sqrt{-23}]$ with norm $27$. Indeed, there is: $$2^2 + 23 \cdot 1^2 = 27.$$ Clearing out a factor of $3^2$ from both sides, we find the solution $$\left( \frac{2}{3} \right)^2 + 23 \left( \frac{1}{3} \right)^2 = 3.$$

The prime $13$ also splits into non-principal factors: $\langle 13, 4+\sqrt{-23} \rangle$ and $\langle 13, 4-\sqrt{-23} \rangle$ are both prime ideals with norm $13$. If I worked it out correctly, then $\langle 3,1+\sqrt{-23} \rangle$ and $\langle 13, 4-\sqrt{-23} \rangle$ are in the same ideal class, and their conjugate ideals are each in the other class. So $\langle 3,1+\sqrt{-23} \rangle \cdot \langle 13, 4-\sqrt{-23} \rangle^2$ should be a principal ideal of norm $3 \cdot 13^2$. In other words, we predict that there should be an integer solution to $$x^2+ 23 y^2 = 3 \times 13^2 = 507$$ and sure enough there is: $22^2 + 23 \cdot 1^2 = 507$. Clearing out $13^2$ from each side, we find the solution $(22/13, 1/13)$. By the way, it is also true that $\langle 3,1+\sqrt{-23} \rangle \cdot \langle 13, 4+\sqrt{-23} \rangle$ should be principal, so there should be a integer solution to $x^2+ 23 y^2 = 39$ and, sure enough, there is: $4^2 +23 \cdot 1^2 = 39$. But that isn't useful in finding rational solutions to $x^2+23 y^2 = 3$.

The prime $2$ is a little tricky. In $\ZZ[(1+\sqrt{-23})/2]$, the prime $2$ splits into two non-principal ideals: $\langle 2, (1+\sqrt{-23})/2 \rangle$ and $\langle 2, (1-\sqrt{-23})/2 \rangle$. Just as with the prime $13$, this implies that there should be an element of $\ZZ[(1+\sqrt{-23})/2]$ with norm $12$, and there is: $(5 +\sqrt{-23})/2$. But when you try to clear out factors of $2^2$, you get the solution $(5/4, 1/4)$, which has denominator $4$ rather than the $2$ that the example of $13$ lead you to expect. The extra $2$ is because the ring of integers is $\ZZ[(1+\sqrt{-23})/2]$, not $\ZZ[\sqrt{-23}]$.

In general, suppose we have an equation $y^2+ D x^2 = N$. For simplicity, suppose that the ring of integers of $\QQ(\sqrt{-D})$ is $\ZZ[\sqrt{-D}]$. Let $N$ factor as $p_1 p_2 \ldots p_r$ in $\ZZ$. For further simplicity, let's assume that the $p_i$ are distinct and relatively prime to $2D$.

Finding solutions to $x^2 + D y^2 = N$ in integers corresponds to finding a principal ideal in $\ZZ[\sqrt{-D}]$ with norm $N$. Such an ideal must factor as $\pi_1 \pi_2 \cdots \pi_r$ where $N(\pi_i) = p_i$. (Using that the $p_i$ are distinct.) If any $p_i$ remains prime in $\ZZ[\sqrt{-D}]$, this is simply impossible since there are no primes of norm $p_i$. If $p_i$ splits, then it is $\pi_i \overline{\pi}_i$, the product of two prime ideals with inverse classes in the class group. To solve $x^2+D y^2 = N$, you need to look at each of the $2^r$ products where we choose one of $\pi_i$ and $\overline{pi}_i$ and see whether that product is principal in the class group. In our running example, the class group is $\ZZ/3$, and $r=1$. Neither of $\langle 3, 1+\sqrt{-23} \rangle$ nor its inverse is principal, so there is no solution.

To solve $x^2+D y^2 = N$ in rationals is equivalent to solving $x^2 + D y ^2 = M^2 N$ in integers, with the freedom to choose $M$. In other words, we now want to know whether we can find some ideal $\eta$ so that $\pi_1 \pi_2 \cdots \pi_r \eta^2$ is principal. This is a much easier computation, because you only need to check one thing rather than $2^r$: Replacing $\pi_i$ by $\bar{\pi}_i$ changes the product by $\bar{\pi}_i/\pi_i=\bar{\pi}_i/p \sim \bar{\pi}_i^2$, where $\sim$ is equality in the class group. So either all of the $2^r$ products are squares (in the class group) or none of them are.

Further things to work out: Dealing with when the ring of integers is bigger than $\ZZ[\sqrt{-D}]$; dealing with the equation $x^2-D y^2$, where we don't have the guarantee that norm will be positive; dealing with equations $a x^2 + c y^2 = N$. I leave these all to you.

-
this is great! thank you! Does it mean to say "The prime (3) splits in Q(√−3) as"? – sperners lemma Nov 12 '12 at 16:07
Oops! Should be "in $\mathbb{Q}(\sqrt{-23})$". Fixed now. – David Speyer Nov 12 '12 at 17:08
Reading the words:"Finding solutions to $x²+Dy²=N$ in integers corresponds to finding a principal ideal in $Z[\sqrt(-D)]$ with norm $N$." reminds me somewhat the kernel of the Artin map, which, if the reciprocity law holds, is just the product of the norm group and the principal ideal group. Since in this case the extension is cyclic of degree 2, the kernel is of index 2 in the class group. For the norm group is contained in the kernel, we find that the norm group is of index greater than 2, hence =2. So the intersection of the two groups is just where the integer solutions occur. Any comment – awllower Nov 19 '12 at 5:40
...is welcomed. Thanks. – awllower Nov 19 '12 at 5:40