How do I prove this? I proved in the last part that Tr(B) was an integer, but I'm lost on how to prove this fact.
I'm guessing the first step would be to put B in rref form, but I'm not sure how I'd go from there
Where Tr() is trace and rank() is the rank.
It's not just $2 \times2$ matrices. If $B^2=B$ then $B$ is diagonalisable with eigenvalues either $0$ or $1$. The multiplicity of $1$ as an eigenvalue is the rank of $B$.