How many real square roots can a real invertible matrix have? Let A be a real square matrix nxn. The real matrix B with the size nxn is considered to be a square root of a matrix A if A=B*B. So I wonder, how many different real square roots can an invertible real matrix have.
I know there can be 0 square roots. If a matrix has a negative determinant, it cannot have square roots. I also know that a matrix can have infinitely many square roots. The example is an identity matrix of a size 2x2. Also a matrix can have exactly 2^n square roots. The example is any positive definite matrix. Generally, if a matrix has a finite amount of square roots, it has to be even, since for every square root matrix B, the matrix -B is also a square root.
So the question is, are there any other options?
I need the answer to prove another theorem, the link is here Prove that there is no isomorphism between groups of matrices of a size n with determinant 1 and matrices of a size n with determinant +1/-1
If it turns out these are all the options, the theorem is proven. Otherwise, I'll need to find at least a single example of a matrix with the smallest non-zero amount of square roots.
The link to wikipedia article on square roots is here, it might also help: https://en.wikipedia.org/wiki/Square_root_of_a_matrix
 A: The matrix $A:=\begin{bmatrix} 1 &1 \\ 0 & 1\end{bmatrix}$ has precisely 2 square roots.
For, if $B = \begin{bmatrix} a&b\\c&d\end{bmatrix}$ is a square root of $A$, then we find that $$\begin{bmatrix} a^2 + bc & ab+bd\\ ca+dc & cb+b^2\end{bmatrix} = \begin{bmatrix} 1 & 1\\ 0 & 1\end{bmatrix}.$$
The bottom left equation tells us that $c(a+d) = 0$ so either $c =0$ or $a=-d.$  But note that if $a=-d$, then the top right entry is $0$, instead of $1$.
Thus, we must have $c = 0$.  Then the top left and bottom right equations implies that $a,d\in \{\pm 1\}$.  Since we already know that $a\neq -d$, we must have $a=d = \pm 1$.  The top right equation now tells us that $b = \frac{1}{2a}$.
In summary, the only square roots of $A$ are $$B = \begin{bmatrix} 1 & \frac{1}{2}\\ 0 & 1\end{bmatrix}\text{ and } \begin{bmatrix} -1 & -\frac{1}{2} \\ 0 & -1\end{bmatrix}.$$
More generally, I claim for each $n$, we can find an $n\times n$ matrix with precisely two square roots.  In fact, we can use an $n\times n$ generalization of the above matrix $A$, which is the identity matrix with 1s right above the main diagonal, but $0$s everywhere else has precisely two square roots.  So, for example, the $4\times 4$ matrix I am talking about is $A = \begin{bmatrix} 1 &1 & 0 & 0\\ 0 & 1 & 1 & 0\\ 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 1\end{bmatrix}$.
The matrix $A$ has at most $2$ square roots.
Assume $B^2 = A$.  Note that $A$ is in Jordan normal form with precisely one block.  It follows that the Jordan normal form of $B$ must also have one block.  Since the eigenvalues of $A$ are all one, the eigenvalues of $B$ must therefore be either all $1$s or all $-1$s.  By replacing $B$ with $-B$ if necessary, we may assume the Jordan normal form of $B$ is a single block with all eigenvalues $1$.  That is, the Jordan normal form of $B$ is $A$.  We will show that this property characterizes $B$, so that there are at most $2$ square roots of $A$:   $B$ and $-B$.
So, assume there are two matrices $B$ and $\widetilde{B}$ which are both square roots of $A$ and with both having $A$ as a Jordan form.
Thus, there is a matrix $C$ with $CBC^{-1} = A$.  Likewise, there is a matrix $\widetilde{C}$ with $\widetilde{C}\widetilde{B}\widetilde{C}^{-1} = A$.  Squaring both of these equations, and using the fact that both $B$ and $\widetilde{B}$ are square roots of $A$, we find $$CAC^{-1} = A^2\text{ and } \widetilde{C} A \widetilde{C}^{-1} = A^2.$$  Thus, $CAC^{-1} = \widetilde{C}A\widetilde{C}^{-1}$.  Rearranging, we find that $\widetilde{C}^{-1} C A  = A \widetilde{C}^{-1} C$.  That is, the matrix $\widetilde{C}^{-1} C$ commutes with $A$.
From this MSE question and answer, we deduce that $\widetilde{C}^{-1} C = p(A)$ where $p(A)$ denotes some polynomial in $A$.  Thus, $C = p(A) \widetilde{C}$.  Since $C$ is invertible, so is $p(A)$.  And, since $A$ obviously commutes with $p(A)$, it now follows that $A$ also commutes with $p(A)^{-1}$.
Thus, we find $$B = C^{-1} A C = \widetilde{C}^{-1} p(A)^{-1} A p(A) \widetilde{C} = \widetilde{C}^{-1} A p(A)^{-1}p(A) \widetilde{C} = \widetilde{C}^{-1} A \widetilde{C} = \widetilde{B}.$$
Thus, there are at most $2$ square roots of $A$:  $B$ and $-B$.
The matrix $A$ has at least $2$ square roots
From this MSE question, we know that $A^2$ has $A$ as a Jordan normal form.  So, there is matrix $C$ with $CA^2 C^{-1} = A$.  Then $\pm CAC^{-1}$ are both square roots of $A$.  Indeed, $$(\pm CAC^{-1})^2 = CA^2 C^{-1} = A.$$
