When does a complex matrix have a square root? What is the neccessary and sufficient condition for a matri$A \in C^{n 
\times n}$ so that it has a "square root" , that is there is a matrix $B \in C^{n \times n}$ such that $A=B^2$.
I am not quite sure but I was thinking that it would be that A and B are similar.
 A: Here is a necessary and sufficient criterion:


*

*For $0<i\le n$, let $B_i = \operatorname{rank} A^{i-1} - \operatorname{rank} A^i$.
($B_i$ is the number of Jordan blocks of size at least $i\times i$ for eigenvalue $0$ in the Jordan normal form of $A$).

*For $0<i<n$, let $C_i = B_i - B_{i+1}$.
($C_i$ is the number of Jordan blocks of size exactly $i\times i$).

*For $0<i<n$, let $D_i$ be the number of $j\ge i$ for which $C_j$ is odd.

*$A$ has a square root if and only if $\forall 0<j<n: C_j = 0 \Rightarrow D_j \text{ is even}$.
To see that this works: First, anything that is similar to a square is itself a square: $PAP^{-1}=B^2$ implies $A=(P^{-1}BP)^2$.
Thus, without loss of generality assume that $A$ is on Jordan normal form. Each Jordan block for a nonzero eigenvalue $\lambda$ has a square root (because the square of a Jordan block with $\sqrt\lambda$ on the diagonal has as its only eigenvalue $\lambda$ with geometric multiplicity $1$, and is therefore similar to the original Jordan block), so we only need to consider the nilpotent Jordan blocks.
Thus, suppose $A$ is nilpotent and has a square root $B$ (which, of course, must itself be nilpotent). Each Jordan block in $B$ of size $2k$ splits into two blocks of size $k$ in $A$, and a block of size $2k+1$ splits into one of size $k$ and one of size $k+1$. Thus $A$ has a square root if the sizes of its Jordan blocks can be made as a combination of such pairs. The condition above merely checks that this is possible.
