Consider $\mathcal{A}, \mathcal{B}$ two unital $C^*$-algebras and $\varphi: \mathcal{A} \rightarrow \mathcal{B}$. Let $A \in \mathcal{A}$ be a selfadjoint element and consider $f \in C(\sigma(A), \mathbb{C})$. I need to prove the following:
$(i)$ $\sigma(f(A)) = f(\sigma(A)) = \{f(\lambda) : \lambda \in \sigma(A)\}$;
$(ii)$ $\varphi(f(A)) = f(\varphi(A))$.
I know that as $A$ is selfadjoint, $\sigma(A) \subset [-\vert\vert A\vert\vert, \vert\vert A \vert\vert]$. I also know that if $\mathcal{P}$ is a polynomial, then $\sigma(\mathcal{P}(A)) = \mathcal{P}(\sigma(A))$. I was thinking about approximating any function $f \in C(\sigma(A), \mathbb{C})$ by polynomials, but I'm not sure how the spectrum behaves.
Also, for $(ii)$, I know that as $\varphi$ is a $*$-homomorphism, then $\sigma(\varphi(A)) \subset \sigma(A)$.
In fact, if $\lambda \in \sigma(\varphi(A))$, we have that $(\lambda1 - \varphi(A))$ is not invertible. But using the fact that $\varphi$ is a $*$-homomorphism, we can write $\lambda1 - \varphi(A) = \varphi(\lambda1 - A)$ and it follows that $\lambda1 - A$ is not invertible. So we get that $\lambda \in \sigma(A)$.
I don't know how to proceed in any of the cases. Could someone help me?
The first part, use the fact that the Gelfand transform is an isomorphism between $C^*(A)$ and $C(\sigma(A))$, hence preserves spectra, and that $\sigma_{C^*(A)}(f(A))=\sigma_{\mathcal A}(f(A))$.
For the second part, approximate $f$ by polynomials, which commute with a $*$-homomorphism.