Q:

Finding the symmetric square roots of diagonal matrices

Let $D=\text{diag}(d_1,\dots,d_n)$ be a real diagonal matrix, where $0\le d_1 \le d_2 \le \dots \le d_n$. Let $a_1 < a_2 < \dots < a_m$ be its distinct  eigenvalues (counted without multiplicities). 
Now, let $A$ be a real symmetric $n \times n$ matrix, satisfying $A^2=D$. Is it true that $A$ must be of the form
$A = \begin{pmatrix}
\sqrt{a_1} B_1 & & & & 0 \\
& \sqrt{a_2} B_2 & & & \\
& & \sqrt{a_3} B_3 & & \\
& & & \ddots & \\
0 & & & & \sqrt{a_m} B_m
\end{pmatrix}
\;\;,\;\;
$
where $B_i$ are symmetric and $B_i^2 = I$?
The size of $B_i$ should be the multiplicity of the value $a_i$ as an eigenvalue of $D$. 
I basically ask whether $A$ should have a block-structure corresponding to the different eigenvalues.
I tried to orthogonally diagonalize $A$, but couldn't proceed.

A:

If one writes $D$ in the form of $a_1I_{k_1}\oplus\cdots\oplus a_mI_{k_m}$, from $AD=DA$ one can derive that $A$ has a block-diagonal structure conforming to the partitioning of $D$. Since each diagonal sub-block must squares to some $a_jI_{k_j}$, the result follows.

