From Norman Biggs, Algebraic Graph theory 2j, p13: The adjacency matrix has a spectral decomposition $A = \sum \lambda_aE_a$, where the matrices $E_a$ are idempotent and mutually orthogonal. (...) It follows that if $f$ is any function for which $f(A)$ is defined, then $$ f(A) = \sum f(\lambda_a) E_a$$
I can't see how to show this last statement. It looks to me that we might need to show that $A$ and $f(A)$ have the same eigenspaces, but I can't see even how to do that.
Since $A$ is symmetric we can write it as $A= PDP^{T}$ then $f(A) = P\,f(D) \, P^{T}$, where $D$ is a diagonal matrix with $D_{ii} = \lambda_{ii}$ and $P$ is the matrix with columns corresponding to the eigenvectors of $A$ such that $P = (v_1, \ldots ,v_{n})$. A quick multiplication can show that
\begin{equation} A = PDP^{T} = \lambda_1 v^{T}_1v_1 + \ldots + \lambda_n v^{T}_n v_n. \end{equation}
similarly \begin{equation} f(A) = P\,f(D)\,P^{T} = f(\lambda_1) v^{T}_1v_1 + \ldots + f(\lambda_n) v^{T}_n v_n. \end{equation}
Clearly, the matrices $E_i= v^{T}_i v_{i}$ are idempotent and mutually orthogonal. A very instructive example to follow is the adjacency matrix of the line between two vertices.