TITLE: A number $a$ is a square in $\mathbf{Q}$ if and only if it is a square in $\mathbf{R}$ and $\mathbf{Q}_p$ for all primes $p$
QUESTION [6 upvotes]: Problem from Schikhof's Ultrametric Calculus.
As I understand it, the intersection of $\mathbf{R}$ and all $\mathbf{Q}_p$ is just $\mathbf{Q},$ so it seems that $x^2-a$ having a zero in $\mathbf{Q}$ implies that $\sqrt{a}\in\mathbf{R}$ and $\mathbf{Q}_p$ for all primes $p.$ And on the other hand, if $\sqrt{a}\in\mathbf{R}$ and $\mathbf{Q}_p$ for all $p,$ then in particular it is in their intersection, which implies $\sqrt{a}\in\mathbf{Q}.$
But this seems like such a trivial proof that I feel like I've misunderstood what is really going on, because it suggests a more general principle that a polynomial has a rational zero if and only if it has a real zero and a $p$-adic zero for any prime $p.$ In that case, why should the question have been specifically about squares?
Hoping someone can correct or verify what is going on here.

REPLY [3 votes]: Another argument, which some people may like better:
If a rational is a square, then certainly it’s a square in every $\Bbb Q_p$. It’s the converse that’s interesting. Any rational $\lambda$ has a unique representation $\lambda=(-1)^\varepsilon\prod_pp^{v_p(\lambda)}$, where $\varepsilon$ is $0$ or $1$, and the (finite) product over all primes has the exponents $v_p(\lambda)=$ the $p$-order of $\lambda$. Any square in $\Bbb Q_p$ has even $p$-order, so every exponent in the product above is even, and $\varepsilon=0$ to give a positive rational, necessary for it to be a square in $\Bbb R$. And that does it.