Square root of matrix Let $A^2$ be a symmetric matrice such that the spectral theorem allows us to write 
$$A^2 = P\operatorname{Diag}(\lambda_1 \dots \lambda_n)P^T$$
Suppose $\forall i \in [\![ 1, n]\!], \lambda_i \geq 0$.
I want to know if the following proposition is true:
$$A^2 = P\operatorname{Diag}(\lambda_1 \dots \lambda_n)P^T \implies A = P\operatorname{Diag}(\sqrt{\lambda_1} \dots \sqrt{\lambda_n})P^T$$
 A: This is partially wrong; see discussion below
This is false. If you know that $A^2= \mathrm{diag}(x_1,...,x_n)$ in some basis, then in this basis $A=\mathrm{diag}( \pm \sqrt{x_1},....,\pm \sqrt{x_n})$. Thus in general knowing $A^2$ there are $2^n$ choices for (symmetric) $A$. Of course taking square roots becomes unique if you restrict attention to positive matrices.
Correction It was pointed out to me in the comments that answer above is wrong without additional assumptions. Let's take a closer look. We know that $A$ commutes with $A^2$, so (since both are diagonalizable), there exists a common eigenbasis. If $A^2$ has nondegenerate spectrum then this already implies that $A$ is diagonal in the same basis as $A^2$. Otherwise we can group eigenvalues into blocks, so that (perhaps after reshuffling rows and columns) $A^2= \mathrm{diag}(y_1,...,y_1,y_2,...,y_2,...,y_n,...y_k)$, where $y_i \neq y_j$ for $i \neq j$ and $y_i \geq 0$ is repeated $g_i$ times. Now $A$ has to leave each eigenspace of $A^2$ invariant, so it is a direct sum of $g_i \times g_i$ matrices of the form $\sqrt{y_i} S_i$, where $S_i^2 = 1$, $S_i^T = S_i$. For $g_i=1$ the only matrices of this form are $\pm 1$ (reproducing the previous answer), but in general this is not the only possibility. For example for $g_1 = 2$ there is the Pauli $x$ matrix $\sigma_x = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$.
