Given a unital C*-algebra $1\in\mathcal{A}$.
For projection one has: $$P^2=P=P^*\iff\sigma(P)\subseteq\{0,1\}\quad(P=P^*)$$
And all cases can appear: $$\sigma(0)=\{0\}\quad\sigma(0\oplus1)=\{0,1\}\quad\sigma(1)=\{1\}$$
How can I check this?
Given a unital C*-algebra $1\in\mathcal{A}$.
For projection one has: $$P^2=P=P^*\iff\sigma(P)\subseteq\{0,1\}\quad(P=P^*)$$
And all cases can appear: $$\sigma(0)=\{0\}\quad\sigma(0\oplus1)=\{0,1\}\quad\sigma(1)=\{1\}$$
How can I check this?
First write
$$ \lambda I-P = \lambda(I-P+P)-P = \lambda(I-P)+(\lambda-1)P. $$
If $P^{2}=P$ then $(I-P)^{2}=(I-P)$ and $P(I-P)=(I-P)P=0$, and the inverse of the above expression can be spotted for $\lambda\notin\{0,1\}$: $$ (\lambda I-P)^{-1} = \frac{1}{\lambda}(I-P)+\frac{1}{\lambda-1}P. $$
Therefore $\sigma(P)\subseteq \{0,1\}$. And $0\in\sigma(P) \iff P=I$. Likewise $1\notin\sigma(P) \iff P=0$. This part is true of all projections, self-adjoint or not.
Conversely, suppose $\sigma(P)\subseteq \{0,1\}$ and $P=P^{\star}$. Then $Q=P(I-P)$ has spectrum $\sigma(Q)=\{0\}$ by the spectral mapping theorem for polynomials. However, $\|Q\|=r_{\sigma}(Q)=0$ because $Q$ is selfajdoint. So $P=P^{2}$.