I think that Seber's book is the best for this stuff.
I loved that book in grad school.
He proves in the appendix that the trace of P equals the rank of P,
where P is your projection matrix ...
I will use c for lambda.
Px=cx, where c is our e.value and x our e.vector.
Then multiply on the left by x', the transpose of x.
cx'x=x'Px=x'P^2x by idempotent
SO all our e.values are 0 or 1.
P has r e.values equal to 1 and rest equal to 0.
WHERE r is the rank.