Let $n\in \mathbb N$ be a natural number, $x_1,\cdots.x_n$ be formal variables. Consider the following $n\times n$-matrix $M_n:=diag\{x_1^2+\cdots+x_n^2,\cdots,x_1^2+\cdots+x_n^2\}$, can we find a solution $A=(a_{ij})$ such that
- (Square root): $A^2=M_n$.
- (Polynomial): $a_{ij}\in \mathbb F[x_1,\cdots,x_n]$ be a polynomial, where $\mathbb F$ is a number field such as $\mathbb Q, \mathbb R$ or $\mathbb C$.(However this condition is not essential and we may use formal series $\mathbb F[[x_1,\cdots,x_n]]$.)
Of course, we do not order $A$ is diagonal. Moreover, as Wil pointed out there is no solution for odd cases when $n\geq3$ since the determinant is not a square. For $n=2$ we have an example $$ \begin{pmatrix} x_1^2+x_2^2 &\\ &x_1^2+x_2^2 \end{pmatrix}=\begin{pmatrix}\pm x_1 & x_2\\ x_2& \mp x_1\end{pmatrix}^2 .$$