Are projections with the same kernels the same? This question is related to another question I just asked. 
I thought I figured it out but I got confused again. Given two projections $k^n\rightarrow k^n$, represented by $n\times n$ matrices $A$ and $B$, if they have the same range $H$ which is a subspace $H\subset k^n$ with dimension $r$, and the same kernel, how to prove that they are identical?
Since they are projections, $A^2=A$, $B^2=B$. They have the same kernel, so $A$ is row equivalent to $B$. So $A=PB$ for some invertible matrix $P$. This gives
$$(PB)(PB)=PB\implies BPB=B\implies BA=B \text{  or  } BA=B^2$$
How to get $A=B$ then? Thank you for any help!

A projection $P$ is a linear operator satisfying $P^2=P$, so it is annihilated by the polynomial $X^2-X=X(X-1)$. Since that polynomial is split with simple roots $0,1$, a projection is diagonalisable with eigenvalues contained in $\{0,1\}$, which means that the whole space is the direct sum of the eigenspaces $\ker(P)$ for $\lambda=0$ and $\ker(P-I)$ for $\lambda=1$. The latter eigenspace is equal to the image of$~P$ (as $P$ acts invertibly, in fact identically, on it, while it kills the other summand).
That this information determines $P$ is just an instance of the general fact that knowing the eigenvalues and the eigenspaces of a diagonalisable operator determines that operator completely. To see this, just choose a basis of eigenvectors (i.e., vectors in these eigenspaces), and express the operator by a (diagonal) matrix on that basis.
