Square Root of $-I$ in Odd Dimensions I suspect that there is no real-valued 3D matrix $A$ which solves:
$$A^2 = \left(\begin{array}{cc}
-1 & 0 & 0\\
0 & -1 & 0\\
0 & 0 & -1
\end{array}\right)$$
To be clear, the normal complex-valued solutions (which basically convert the above to 6D) are not allowed.
But, there are an infinite number of real-valued solutions in 4D (these are matrices similar, using any invertible $P$, to the 4D representation of the normal complex-valued 2D solutions):
$$A = P^{-1}\left(\begin{array}{cc}
0 & 1 & 0 & 0\\
-1 & 0 & 0 & 0\\
0 & 0 & 0 & 1\\
0 & 0 & -1 & 0
\end{array}\right)P$$
How can I prove that there is no real solution for 3D and, more generally, for any odd dimension?
 A: The characteristic polynomial $f(\lambda)=\det(A-\lambda I)$ has roots exactly the eigenvalues of $A.$ Since $f$ is a real polynomial of dimension $3,$ it has a real root, so $A$ has a real eigenvalue.
But given $\lambda$ an eigenvalue, $\lambda^2$ is an eigenvalue of $A^2.$
This is true for any $n\times n$ matrix when $n$ odd.
More generally, for any $n,$ and $A$ a real $n\times n$ matrix where $A^2$ is diagonal, there must be an even number of negative entries in $A^2.$
That works even with a zero on the diagonal, so that using $(\det A)^2=\det(A^2)$ does not yield a contradiction.
Less obvious, but also true, is that those even number of negative values must come in equal pairs. If $d_1,d_2,\dots,d_{2k}$ are the negative diagonal elements, there is an ordering of them so that $d_1=d_2,\dots,d_{2k-1}=d_{2k}.$
So there is no $A$ so that:
$$A^2=\begin{pmatrix}-1&0&0\\0&-2&0\\0&0&1
\end{pmatrix}$$
Given a real diagonal entries $D=\operatorname{diag}(d_1,\dots,d_n),$ there is a real matrix $A$ with $A^2=D$ if and only if:

There is a permutation $\sigma$ on $\{1,\dots,n\},$ such that $\sigma(i)=i$ if and only if $d_i\geq 0,$ and $\sigma^2(i)=i$ for all $i.$

You can write $A=(a_{ij})$ explicitly as:
$$a_{ij}=\begin{cases}
\sqrt{d_i}&i=j, d_i\geq 0\\
\sqrt{-d_i}&\sigma(i)=j, i<j,d_i<0\\
-\sqrt{-d_i}&\sigma(i)=j, i>j, d_i<0\\
0&\text{otherwise}
\end{cases}$$
