Adjoint of the diagonal operator I have defined the diagonal operator as the $$\sum\limits_{n=1}^\infty \langle h,e_n\rangle a_ne_n$$ when ${e_n}$ is an orthonormal basis and $a_n$ is a chosen sequence I want to show that it is a projection if and only if the sequence $a_n$ consists of just $0$'s and $1$'s. 
So in essence I want to show that my operator let's call it T is self adjoint and $T^2 = T$. However I am not sure how to come up with the adjoint of this operator. 
I was thinking it could be the same as the operator except you conjugated the $a_n$. But I was wondering if this is even true and how could I prove that the adjoint is even equal to that. 
Anything helps! Thank you. 
 A: So your operator is defined as
$$Tx = \sum_{n=1}^{\infty} a_n\langle x, e_n\rangle e_n$$
where $(a_n)_n$ is a bounded sequence (such that $T$ is bounded).
We have:
$$\langle Tx, y\rangle = \left\langle \sum_{n=1}^{\infty}a_n\langle x, e_n\rangle e_n, y\right\rangle = \sum_{n=1}^\infty a_n\langle x, e_n\rangle \langle e_n, y\rangle = \left\langle x, \sum_{n=1}^\infty \overline{a_n} \langle y, e_n\rangle e_n\right\rangle $$
Therefore the adjoint map is given by:
$$T^*x = \sum_{n=1}^{\infty} \overline{a_n}\langle x, e_n\rangle e_n$$
On the other hand, let's calculate $T^2$:
$$T^2x = T\left(\sum_{n=1}^{\infty} a_n\langle x, e_n\rangle e_n \right) = \sum_{m=1}^\infty a_m\underbrace{\left\langle \sum_{n=1}^{\infty} a_n\langle x, e_n\rangle e_n, e_m\right\rangle}_{=a_m\langle x, e_m\rangle} e_m = \sum_{m=1}^\infty a_m^2 \langle x, e_m\rangle e_m$$
Therefore, $T^2 = T = T^*$ if and only if $a_n^2 = a_n = \overline{a_n}, \forall n \in \mathbb{N}$ which holds if and only if $a_n \in \{0,1\}, \forall n \in \mathbb{N}$.
