Let T be a normal operator on a finite-dimensional complex inner product space V. Use the spectral decomposition to show that If g is a polynomial, then

g(T) = g(m_1)T_1 + g(m_2)T_2 + ... + g(m_k)T_k, where the m_i's are the eigenvalues of T and the T_i's are the orthogonal projection of T on the eigenspace, W_i corresponding to the eigenvalue m_i.

I know that from the spectral decomposition, we have T = (m_1)(T_1) + (m_2)(T_2) + ... + (m_k)(T_k). Hence, g(T) = g((m_1)(T_1)) + g((m_2)(T_2)) + ... + g((m_k)(T_k)). But how do i pull out the T_i's to obtain the above result?

Thank You.