It is a well-known fact that if an integer is a sum of two rational squares then it is a sum of two integer squares. For example, Cohen vol. 1 page 314 prop. 5.4.9. Cohen gives a short proof that relies on Hasse-Minkowski, but he attributes the theorem (without reference) to Fermat, who didn't have Hasse-Minkowski available. So my question is, how did Fermat prove this theorem? and part 2 of the question is, what is the simplest direct proof? I googled for this result and found a manuscript with a proof that doesn't use Hasse-Minkowski, but it's not very short.



sums of rational squares
This result is pretty shy of needing the full Hasse-Minkowski Theorem. Indeed, since Fermat already knew which integers were a sum of two integer squares, it would suffice for him to show that those that weren't (i.e., those with an odd power of some prime congruent to 3 mod 4 showing up in its prime factorization) could also not be written as a sum of two rational squares. But this is the *easy* direction of Hasse-Minkowski: To show that (let's say) a prime $p\equiv 3\pmod{4}$ can't be written as a sum of two rational squares, it suffices to check that it can't be a sum of two $\ell$-adic rational squares for some $\ell$. Of course, Fermat did not have the language of the $\ell$-adics, so this would have had been replaced with mod-$q^k$ conditions for various $k$. 


Specifically, the modern Hasse-Minkowski proof boils down to the statement that a prime which is 3 mod 4 can't be written as a sum of two rational squares because it can't be done so 2-adically. Indeed, one can just compute the single Hilbert symbol
$$
p\equiv 3\pmod{4}\Rightarrow (p,-1)\_2=(-1)^{(p-1)/2}=-1,
$$
showing that $x^2=pz^2-y^2$ has no $2$-adic, and hence no rational, solutions, which afte the substitutions $a=x/z$ and $b=y/z$, implies one cannot write $p=a^2+b^2$ with $a,b\in\mathbb{Q}$. Of course (again), Fermat did not have Hilbert symbols, but this is just a change of language away from Fermat's approach (I imagine). It would not be hard to unwind the above calculation into a single (probably lengthy) mod-8 calculation, since that's all that goes into deciding which elements of $\mathbb{Q}\_2$ are squares, which in turn is essentially all that lives behind the Hilbert symbols.


