Spectrum of $f(T)$, where $T$ is a self-adjoint operator Consider on a Hilbert space $\mathcal{H}$ a self-adjoint operator $T$ with spectrum given by $\sigma(T)=\{\lambda_n\}_{n \in \mathbb{N}} \subseteq \mathbb{R}$ (let's suppose for simplicity that the spectrum is discrete).
Let it be $\{|\lambda_n,d_n\rangle\}_{n,d_n}$ a Hilbert basis of $\mathcal{H}$ formed by the eigenvectors of $T$, where $|\lambda_n,d_n\rangle$ is the eigenvector of $T$ such that:
$$
T|\lambda_n,d_n\rangle=\lambda_n|\lambda_n,d_n\rangle\,.
$$
Here $d_n$ is an index that represents the degeneration of $\lambda_n$.
Consider the continuous function $f\colon \mathbb{R} \to \mathbb{R}$. We can define the self-adjoint operator
$$
f(T) \equiv \sum_n\sum_{d_n} f(\lambda_n)|\lambda_n,d_n\rangle\langle\lambda_n,d_n|\,.
$$
Obviously:
$$
f(T)|\lambda_n,d_n\rangle=f(\lambda_n)|\lambda_n,d_n\rangle\,,
$$
i.e., every eigenvector of $T$ associated to $\lambda_n$ is also an eigenvector of $f(T)$ associated to $f(\lambda_n)$. So we have that:
$$
f(\sigma(T)) \subseteq \sigma(f(T))\,,~~~\mbox{where}~~~f(\sigma(T))=\{f(\lambda_n) \in \mathbb{R} \mid \lambda_n \in \sigma(T)\}\,.
$$
My question is: is it true in general that $f(\sigma(T))=\sigma(f(T))$?

My attempt:
Let's suppose that there exists an eigenvalue $\mu \in \sigma(f(T)) \setminus f(\sigma(T))$.
Let it be $|\mu\rangle$ an eigenvector of $f(T)$ associated to $\mu$, namely $f(T)|\mu\rangle=\mu|\mu\rangle$.
So we have that $\langle \lambda_n,d_n \mid \mu \rangle=0$ for every $n,d_n$, being $f(T)$ self-adjoint (then eigenvectors corresponding to different eigenvalues are orthogonal).
So we have that $|\mu\rangle=0$ ($\{|\lambda_n,d_n\rangle\}$ is a Hilbert basis), and this is a contradiction.
Then we have that $f(\sigma(T))=\sigma(f(T))$.
Is my approach correct? Thank you in advance.
 A: 
is it true in general that (())=(())?

The answer is negative already for continuous functions $f: \mathbb{R} \to \mathbb{R}$.
Elementary conterexample. Consider the Hamiltonian $H$ of the harmonic oscillator and then focus on $H^{-1}$. The spectrum of the latter includes the further point $0$ which does not belong to $1/\sigma(H)$.  As a matter of fact, the spectrum of $H^{-1}$ admits also $0$ as (unique) element of the continuous part of spectrum $\sigma_c(H^{-1})$.  $\qquad\blacksquare$
As a general fact, if   is selfadjoint and $f: \mathbb{R} \to \mathbb{C}$ is Borel-measurable, then () is closed and normal.
In particular () is selfadjoint as well, if  as above is real-valued. Obviously continuous functions are Borel-measurable so everything applies to that case.
For continuous functions, the general relation is
$$\sigma(f(T))=\overline{f(\sigma(T))}\:.$$
(()) may be different from (()). The former is always closed for the very definition of spectrum, the latter may not, even if  is continuous. The conterexample above is an elementary case.
However,
PROPOSITION.
$$\sigma(f(T))=f(\sigma(T))$$
if $T=T^*$ is bounded and $f: \mathbb{R} \to \mathbb{R}$ is continuous.
Proof.   bounded is equivalent to  () is bounded since $||T||= \sup |\sigma(T)|$. In that case () is compact (closed and bounded set in $\mathbb{R}$), and thus (()) is compact as well because $f$ is continuous, hence (()) is closed   since it is a compact  subset of $\mathbb{R}$. In that case,
$$\sigma(f(T))=\overline{f(\sigma(T))}=f(\sigma(T))\:.$$
QED
It is therefore clear that, when $f: \mathbb{R} \to \mathbb{R}$ is continuous,  problems may pop up only for unbounded (seldafjoint) operators.
Restricting to the point part of the spectrum, as a general fact we have that $f(\sigma_p(T)) \subset \sigma_p(f(T))$, the proof essentially is the one you wrote. It is valid for every (Borel-measurable) function $f: \mathbb{R} \to \mathbb{R}$. The converse inclusion is false in general. To this end consider the position operator $X$ whose point spectrum is empty. Next consider the map $f: \mathbb{R}\ni x  \mapsto 1 \in \mathbb{R}$. Evidently $f(X)=I$. Therefore $\sigma_p(f(X)) = \sigma(I) = \{1\}$, but $f(\sigma_p(X))= \emptyset$ since $\sigma_p(X)= \emptyset$. Therefore $f(\sigma_p(X)) \subsetneq \sigma_p(f(X))$.
