For a normal operator T, we have a resolution of the identity $\int_{{\sigma}(T)} {\lambda}\,dE=T$. If $T$ is in addition compact , we have that $\sum_{n=1}^{{\infty}}{\lambda}_{n}\langle x,e_{n}\rangle e_{n}$ where $e_{n}$ is an orthonormal basis of eigenvectors etc. I'm trying to derive the second from the first. If $T$ is compact then it's spectrum is discrete so the integral will reduce to a sum but I'm not sure how to proceed.
Thanks
Hint.
If $\sigma(T)=\{\lambda_n\}_{n\in\mathbb N}\cup\{0\}$, then $$ T=\int_{\sigma(T)}\lambda\,dE(\lambda)=\sum_{n=1}^\infty \int_{\{\lambda_n\}}\lambda\,dE(\lambda)=\sum_{n=1}^\infty \lambda_n E(\{\lambda_n\}), $$ where $E(\{\lambda_n\})$ is the orthogonal projection to the eigenspace of $\lambda_n$.
Note that $E=E(U)$, $U\in\mathscr B(\mathbb C)$, is a projection-valued measure.