TITLE: Does the Hasse principle hold for the square root problem on symmetric matrices?
QUESTION [12 upvotes]: Let $S$ be an $n \times n$ symmetric matrix with rational entries.
It is known that the equation $XX^T=S$ has a solution in $\text{M}_n(\mathbb{Q})$
if and only if it has a solution in $\text{M}_n(\mathbb{Q}_p)$ for all $p \in \mathcal{P} \cup \{\infty\}$ (indeed, one easily reduces the problem to the case when $S$ is non-singular, and then the problem amounts to characterize the situation when $S$ is rationally congruent to $I_n$).
Does a similar Hasse principle hold for the equation $X^2=S$ with unknown $X \in \text{S}_n(\mathbb{Q})$?

REPLY [5 votes]: The answer is yes, by a series of reductions.
Given a polynomial $f(x)$, there is a unique polynomial $g(x)$ of the same degree whose roots are the squares of the roots of $f$. We can compute its coefficients with the equation $g(x^2)=f(x)f(-x)$.  Suppose $g(x)$ is the characteristic polynomial of $X$.  we can easily construct a diagonalizable matrix $S'$ with characteristic polynomial $f(x)$. Then $S'^2$ will have characteristic polynomial $g(x)$. Since $S'^2$ and $X$ will both be diagonalizable, they will be conjugate over $\mathbb C$, hence, by rational canonical form, they will be conjugate over $\mathbb Q$. (A symmetric matrix over $\mathbb Q$ is diagonalizable over $\mathbb R$.) Say $A S'^2 A^{-1}=X$, then $(AS'A^{-1})^2=X$, so set $S = A S'A^{-1}$, then $S^2 = (AS'A^{-1})^2=X$.
Conversely, if such an $S$ exists, then its characteristic polynomial is such an $f(x)$. So having a solution to the equation is equivalent to having a polynomial $f(x)$ such that $g(x)$ is the characteristic polynomial. So your question is equivalent to: Does the Hasse principle hold for the problem of, given a polynomial $g(x)$, finding a polynomial $f(x)$ such that $f(x)f(-x)=g(x^2)$? 
Given a polynomial $g(x)$, we can factor it into irreducibles. $f(x)$ must handle each irreducible separately, unless some irreducible appears with even multiplicity, since $g(x^2) g( (-x)^2) = \left(g(x^2)\right)^2$. So it is sufficient to check the Hasse principle for an irreducible $g(x)$.
For an irreducible $g(x)$, this equation has a solution over $\mathbb Q$ if and only if the element $x$ in the number field $\mathbb Q(x)/g(x)$ is a perfect square. Otherwise, the extension that comes from adjoining its square root will have a degree too large, and there will be no irreducible polynomial defining its square root.  This equation has a solution over $\mathbb Q_p$ if and only if the element $x$ in the product of local fields $\mathbb Q_p(x)/g(x)$ is a perfect square. This is because, in $\mathbb Q_p$, $g(x)$ factors as a product of distinct terms, hence each term must individually have a square root. 
So the equation has a solution over each place of $\mathbb Q$ if and only if the equation $y^2=x$ has a solution over each place of $\mathbb Q(x)/g(x)$.  By the Chebotarev Density Theorem, this final equation satisfies the Hasse principle.