TITLE: Square roots in the $p$-adics
QUESTION [9 upvotes]: Suppose I want to know whether $\sqrt{7}\in\mathbb{Q}_5$, or more generally, whether $\sqrt{n}\in\mathbb{Q}_p$ for $n\in\mathbb{Z}$, $p$ an odd prime. What are the techniques for determining this? Am I supposed to "lift" it from $\mathbb{Z}/p\mathbb{Z}$ using Hensel's lemma? Could I see an example?

REPLY [14 votes]: Suppose $(n,p) = 1$ and $n$ is a square mod $p$, so the square root in ${\mathbb Q}_p$ should exist.
One quick way to explicitly find good approximations of it is Newton's method.  The iteration is $x_{k+1} = \frac{x_k + n/x_k}{2}$
where $x_0$ is an integer with $n \equiv x_0^2 \mod p$. Then $x_{k+1}^2 - n = (x_k - n)^2/4$ so $\|x_{k+1}^2 - n\|_p = \|x_k^2 - n\|_p^2$.  Since $\|x_0^2 - n\|_p \le p^{-1}$ we get $\|x_k^2 - n\|_p \le p^{-2^k}$.  For example, with $n=5$ and $p=11$,
taking $x_0 = 4$ we have $x_1 = (4 + 5/4)/2 = 21/8 = 4 + 4 \cdot 11 + O(11^2)$, $x_2 = 761/336 = 4 + 4 \cdot 11 + 10 \cdot 11^2 + 4 \cdot 11^3 + O(11^4)$,
$x_3 = 1143601/511392 = 4 + 4 \cdot 11 + 10 \cdot 11^2 + 4 \cdot 11^3 + 9 \cdot 11^5
+ 5 \cdot 11^6 + 8 \cdot 11^7 + O(11^8)$, etc.