I am currently tackling the following problem.
Problem
Consider the equation $x^2 = q, $ where $ q \in \mathbb{Q}$. Show this has a rational solution $x$ in $\mathbb{Q}$
if and only if there are real solutions and p-adic solutions in $\mathbb{Q_p}$ for all prime $p$.
Progress
Applying the p-adic norm to both sides of the equation, I deduce $\|x\|_p^2 = \|q\|_p $,
which implies $2v_p(x) = v_p(q)$, where $v_p(x)$ is the p-adic valuation of $x$.
From here I am unsure how to proceed, I would really appreciate some pointers!
Extended hints: