Assume I have a Lagrange polynomial
$$p(\lambda) = \sum_{k=1}^n L_k(\lambda) = 1 \\ L_k(\lambda) = \prod_{j=1 \\ j \neq k}^n \frac{\lambda - \lambda_j}{\lambda_k - \lambda_j}$$
where I derived that $p(\lambda)$ is a constant polynomial, since for $\lambda_k, k \in \{1..n\}$, $p(\lambda_k) - 1 = 0$. Thus, since the degree of $p$ is $\leq n-1$, and it has $n$ zeros, $p(\lambda) = 1$ for all $\lambda \in \Bbb{R}$.
Now, I need to prove that $p(A) = \sum_{k = 1}^n L_k(A) = I$, where $A$ is any n x n matrix. How can I show it?
I also assumed that $\lambda_k, k \in \{1..n\}$ are distinct eigenvalues of $A$, but I still do not understand how to show this. I would guess it uses Cayley-Hamilton theorem somehow, but still don't know how to proceed.
NB. This is section 7.15 ex.16 part (c) in Apostol. He just says I need to "deduce" it from the constant statement I showed above... ¯_(ツ)_/¯