Show that $rn(A) = rn(B) \iff A \sim B.$ A projection $p \in M_n(\mathbb{C})$ is a matrix that satisfies $p = p^* = p^2$. I'm trying to prove that if $p,q \in M_n(\mathbb{C})$ are two projections, then
$$rank(p) = rank(q) \iff \exists u\in M_k(\mathbb{C}): p = u^*u , \quad q = uu^*.$$
I managed to prove from right to left:
$$rank(p) = rank(u^*u) = rank(u ^*)=rank(u) = rank(q)$$
Conversely, I'm not sure how to construct $u$. Maybe I can use that $p,q$ are diagonal.
 A: Let the common rank of $p$ and $q$ be $r$. If you are familiar with unitary diagonalisation, the given conditions imply that $p=X(I_r\oplus0)X^\ast$ and $q=Y(I_r\oplus0)Y^\ast$ for some unitary matrices $X$ and $Y$. Now let $u=Y(I_r\oplus0)X^\ast$ and we are done.
Intuitively, since $p$ and $q$ are orthogonal projections, their ranges are orthogonal complements to their respective kernels. As they both have rank $r$, their ranges have equal dimensions and so do their kernels. Thus there exist two orthonormal bases $\{x_1,x_2,\ldots,x_n\}$ and $\{y_1,y_2,\ldots,y_n\}$ such that $\{x_1,x_2,\ldots,x_r\},\,\{y_1,y_2,\ldots,y_r\}$ are respectively the bases of $\operatorname{range}(p)$ and $\operatorname{range}(q)$, and $\{x_{r+1},\ldots,x_n\},\,\{y_{r+1},\ldots,y_n\}$ are respectively the bases of $\ker(p)$ and $\ker(q)$. Now define a linear map $\rho$ by $\rho x_i=y_i$ for each $i$ (which, in the context of the first paragraph, is represented by $\rho=YX^\ast$). Then $\rho$ is an isometry because it maps an orthonormal basis to another orthonormal basis. Moreover, by construction we have $\rho px_i=q\rho x_i$ for each $i$. Therefore $u:=\rho p=q\rho$. Hence
\begin{aligned}
u^\ast u&=p^\ast\rho^\ast\rho p=p^\ast p=p,\\
uu^\ast&=q\rho\rho^\ast q^\ast=qq^\ast=q.
\end{aligned}
