Proving that the algebraic multiplicity of $\lambda$ is the rank of the projection $P.$ 
Let $A \in \mathbb M_n(\mathbb C)$ be a normal matrix and $\lambda$ be an eigenvalue of $A.$ Let $\phi : C(\sigma(A)) \longrightarrow \mathbb M_n (\mathbb C)$ be the continuous functional calculus associated to $A.$ Consider the projection $P : = \phi \left (\mathbf {1}_{\{\lambda\}} \right ).$ Let the algebraic multiplicity of $\lambda$ be $m.$ Then show that $\text {rank}\ (P) = m.$

I am trying to figure out what $P$ is. Here $\phi = \mathscr {G}^{-1} \circ \xi,$ where $\mathscr {G} : A_1 \longrightarrow C \left (\widehat A_1 \right )$ is the Gelfand transform defined on $A_1 = \text {span}\ \{I,A\}$ (Here $\widehat {A_1}$ is the space of all non-zero multiplicative linear functionals on $A$ endowed with the induced weak*-topology) and $\xi : C(\sigma(A)) \longrightarrow C \left (\widehat {A_1} \right )$ is defined by $f \mapsto f \circ \mathscr {G} (A).$ Now what is $P\ $? By the definition of $\phi$ it turns out that $P = \mathscr {G}^{-1} \left (\mathbf {1}_{\{\lambda\}} \circ \mathscr {G} (A) \right ).$ Now what is $\mathbf {1}_{\{\lambda\}} \circ \mathscr {G} (A)\ $? In order to determine this let it act on some element $\psi \in \widehat {A_1}.$ Then we have $$\left ( \mathbf {1}_{\{\lambda\}} \circ \mathscr {G} (A) \right ) (\psi) = \mathbf {1}_{\{\lambda\}} (\psi (A)) = \begin{cases} 1  & \text {if}\ \psi (A) = \lambda \\ 0 & \text {if}\ \psi(A) \neq \lambda \end{cases}$$ Therefore it follows that $\mathbf {1}_{\{\lambda\}} \circ \mathscr {G} (A) = \mathbf {1}_{E},$ where $E = \left \{\varphi \in \widehat {A_1}\ \bigg |\ \varphi (A) = \lambda \right \}.$ So in order to find $P$ we only need to find what is $\mathscr {G}^{-1} (\mathbf {1}_{E}).$ What is that? Since $P \in A_1$ it turns out that $P = \sum\limits_{n \geq 0} c_n A^n,$ where $c_n \in \mathbb C.$ Hence $\mathbf {1}_{E} = \mathscr {G} (P) = \sum\limits_{n \geq 0} c_n \left (\mathscr {G} (A) \right )^n.$ Since $\text {ran} \left (\mathscr {G} (A) \right ) = \sigma (A)$ it turns out that that $\sum\limits_{n \geq 0} c_n z^n = 0$ for all $z \in \mathbb \sigma (A) \setminus \{\lambda\}$ and $\sum\limits_{n \geq 0} c_n \lambda^{n} = 1.$ Now let $c = \prod\limits_{\substack {\mu \in \sigma (A)} \\ \ \ \  {\mu \neq \lambda}} \frac {1} {\lambda - \mu}.$ Then it follows that $$P = c \prod\limits_{\substack {\mu \in \sigma (A)} \\ \ \ \ {\mu \neq \lambda}} \left (A - \mu I \right ).$$ In other words $P$ is the projection onto the eigenspace for the eigenvalue $\lambda$ of $A.$ Now what is $\text {rank}\ (P)\ $? Well since $A$ is diagonalizable the sum of the geometric multiplicities add up to $n$ and hence nullity of $P$ will be $n - \ell,$ where $\ell$ is the geometric multiplicity of $\lambda.$ So by the rank-nullity theorem $\text {rank}\ (P) = \ell,$ which coincides with the algebraic multiplicity of $\lambda$ since $A$ is diagonalizable. Am I right? Could anyone please check it once?
Thanks for your time.
 A: Since you already know that $A$ is (orthogonally) diagonalizable, you may assume without loss of generality that $A$ is diagonal. We may write this as
$$\tag1
A=\sum_{j=1}^r\lambda_jP_j, 
$$
where $\lambda_1,\ldots,\lambda_r$ are the eigenvalues, and $P_j$ the orthogonal projection onto the corresponding eigenspace. Because the projections $P_1,\ldots,P_r$ are pairwise orthogonal, it is trivial to check that
$$\tag2
f(A)=\sum_{j=1}^rf(\lambda_j)\,P_j
$$
for any polynomial $f$, and thus (by taking uniform limits) for any continuous function $f$ (which, since the spectrum is discrete, means any function).
By construction of the continuous functional calculus you have $\phi(f)=f(A)$ for all polynomials $f$, and thus $\phi(f)=f(A)$ for any function $f$, as in $(2)$.
So, for fixed, $\lambda_k$, you have
$$
\phi(1_{\{\lambda_k\}})=\sum_{j=1}^r\phi_{\{\lambda_k\}}(\lambda_j)P_j=P_k. 
$$
From the expression $(1)$, we have
$$
\det(A-\lambda I)=\det\Big(\sum_{j=1}^r(\lambda_j-\lambda)P_j\Big)=\prod_{j=1}^r(\lambda_j-\lambda)^{\operatorname{rank}{P_j}}.
$$
So the algebraic multiplicity of $\lambda_k$ agrees with the geometric multiplicity of $\lambda_k$, which is the rank of $P_k$.
