[proofplan]
We first prove the spectral statement for an arbitrary real-valued Borel function by reducing invertibility of $f(A)-\mu I$ to whether $|f-\mu|$ is bounded away from $0$ outside an $E_A$-null set. If $\mu$ is outside the essential range, the reciprocal $(f-\mu)^{-1}$ is a bounded Borel function on the spectral support and gives a bounded inverse by the functional calculus. If $\mu$ is inside the essential range, spectral projections onto the sets where $|f-\mu|$ is small give approximate eigenvectors, so $\mu$ lies in the spectrum. The continuous cases then follow by identifying the essential range of a [continuous function](/page/Continuous%20Function) on $\sigma(A)$ with the closure of its pointwise image.
[/proofplan]
[step:Define the spectral measures and the natural functional calculus domain]
Let $E_A:\mathcal{B}(\mathbb{R})\to\mathcal{L}(H)$ denote the projection-valued spectral measure of $A$ supplied by the [spectral theorem for self-adjoint operators](/theorems/6911). We use the [Borel functional calculus](/theorems/2696) associated to this spectral measure, including its multiplicative rule, its spectral-measure transformation formula for bounded multipliers, and the fact that real-valued Borel functions define [self-adjoint operators](/page/Self-Adjoint%20Operators) on their natural domains.
For each $x\in H$, define the finite positive Borel measure
\begin{align*}
\mu_x:\mathcal{B}(\mathbb{R})\to[0,\infty)
\end{align*}
by
\begin{align*}
\mu_x(B)=\|E_A(B)x\|_H^2.
\end{align*}
For a real-valued Borel function $f:\mathbb{R}\to\mathbb{R}$, the Borel functional calculus defines
\begin{align*}
f(A):\mathcal{D}(f(A))\subset H\to H
\end{align*}
on the domain
\begin{align*}
\mathcal{D}(f(A))=\left\{x\in H:\int_{\mathbb{R}} |f(\lambda)|^2\,d\mu_x(\lambda)<\infty\right\}.
\end{align*}
For every bounded Borel function $g:\mathbb{R}\to\mathbb{C}$, the operator $g(A)\in\mathcal{L}(H)$ satisfies the multiplicative rule
\begin{align*}
g(A)h(A)=(gh)(A)
\end{align*}
whenever $h$ is bounded Borel, and the identity
\begin{align*}
\|g(A)x\|_H^2=\int_{\mathbb{R}} |g(\lambda)|^2\,d\mu_x(\lambda)
\end{align*}
for every $x\in H$.
[/step]
[step:Invert $f(A)-\mu I$ outside the essential range]
Let $\mu\in\mathbb{R}$ satisfy $\mu\notin\operatorname{ess\,ran}_{E_A}(f)$. By definition of the essential range, there is an open neighbourhood $U\subset\mathbb{R}$ of $\mu$ such that
\begin{align*}
E_A(f^{-1}(U))=0.
\end{align*}
Choose $\varepsilon>0$ such that $(\mu-\varepsilon,\mu+\varepsilon)\subset U$. Then
\begin{align*}
E_A(\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<\varepsilon\})=0.
\end{align*}
Define the bounded Borel function
\begin{align*}
r_\mu:\mathbb{R}\to\mathbb{R}
\end{align*}
by setting $r_\mu(\lambda)=(f(\lambda)-\mu)^{-1}$ on the Borel set $\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|\ge \varepsilon\}$ and setting $r_\mu(\lambda)=0$ on the Borel set $\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<\varepsilon\}$.
Then $\|r_\mu\|_\infty\le \varepsilon^{-1}$, so $r_\mu(A)\in\mathcal{L}(H)$. For every $y\in H$, set $x=r_\mu(A)y$. To prove $x\in\mathcal{D}(f(A))$ without assuming it in advance, use the spectral-measure transformation formula for the bounded multiplier $r_\mu$: for every non-negative Borel function $\varphi:\mathbb{R}\to[0,\infty]$,
\begin{align*}
\int_{\mathbb{R}} \varphi(\lambda)\,d\mu_{r_\mu(A)y}(\lambda)=\int_{\mathbb{R}} \varphi(\lambda)|r_\mu(\lambda)|^2\,d\mu_y(\lambda).
\end{align*}
Taking $\varphi(\lambda)=|f(\lambda)-\mu|^2$ gives the extended-integral identity
\begin{align*}
\int_{\mathbb{R}} |f(\lambda)-\mu|^2\,d\mu_x(\lambda)=\int_{\mathbb{R}} |(f(\lambda)-\mu)r_\mu(\lambda)|^2\,d\mu_y(\lambda)\le \|y\|_H^2.
\end{align*}
Since $|f(\lambda)|^2\le 2|f(\lambda)-\mu|^2+2|\mu|^2$ for every $\lambda\in\mathbb{R}$ and $\mu_x(\mathbb{R})=\|x\|_H^2<\infty$, this implies $x=r_\mu(A)y\in\mathcal{D}(f(A))$. Hence $r_\mu(A)H\subset\mathcal{D}(f(A))$. Since $(f-\mu)r_\mu=1$ outside an $E_A$-null Borel set, the functional calculus gives
\begin{align*}
(f(A)-\mu I)r_\mu(A)=I.
\end{align*}
Also, for every $x\in\mathcal{D}(f(A))$,
\begin{align*}
r_\mu(A)(f(A)-\mu I)x=x.
\end{align*}
Thus $f(A)-\mu I:\mathcal{D}(f(A))\to H$ is bijective with bounded inverse $r_\mu(A)$. Here $\rho(f(A))$ denotes the resolvent set of the closed operator $f(A)$, namely the set of complex numbers $z$ for which $f(A)-zI:\mathcal{D}(f(A))\to H$ is bijective with bounded inverse on $H$. Therefore $\mu\in\rho(f(A))$, and hence
\begin{align*}
\sigma(f(A))\subset \operatorname{ess\,ran}_{E_A}(f).
\end{align*}
[guided]
The point of this step is to translate a spectral question about the operator $f(A)$ into a pointwise question about the scalar function $f$. Suppose $\mu$ is not in the essential range. This means that some open neighbourhood of $\mu$ is missed by $f$ except on a set invisible to the spectral measure $E_A$. Equivalently, after discarding an $E_A$-null set, the quantity $|f-\mu|$ is bounded below.
More precisely, since $\mu\notin\operatorname{ess\,ran}_{E_A}(f)$, there is an [open set](/page/Open%20Set) $U\subset\mathbb{R}$ with $\mu\in U$ and
\begin{align*}
E_A(f^{-1}(U))=0.
\end{align*}
Choose $\varepsilon>0$ such that $(\mu-\varepsilon,\mu+\varepsilon)\subset U$. Then the Borel set on which $f$ comes within $\varepsilon$ of $\mu$ has zero spectral projection:
\begin{align*}
E_A(\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<\varepsilon\})=0.
\end{align*}
This allows us to define a bounded reciprocal. Define
\begin{align*}
r_\mu:\mathbb{R}\to\mathbb{R}
\end{align*}
by setting $r_\mu(\lambda)=(f(\lambda)-\mu)^{-1}$ on the Borel set $\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|\ge \varepsilon\}$ and setting $r_\mu(\lambda)=0$ on the Borel set $\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<\varepsilon\}$. The function $r_\mu$ is Borel measurable because $f$ is Borel measurable, and it is bounded by $\varepsilon^{-1}$. Hence $r_\mu(A)$ is a bounded operator on $H$.
Because $f(A)$ may be unbounded, we must also verify that $r_\mu(A)$ maps $H$ into the natural domain of $f(A)$. Let $y\in H$ and set $x=r_\mu(A)y$. We cannot yet use the norm identity for the unbounded operator $f(A)-\mu I$ on $x$, because membership $x\in\mathcal{D}(f(A))$ is exactly what is being proved. Instead, we use the spectral-measure transformation formula for the bounded multiplier $r_\mu$: for every non-negative Borel function $\varphi:\mathbb{R}\to[0,\infty]$,
\begin{align*}
\int_{\mathbb{R}} \varphi(\lambda)\,d\mu_x(\lambda)=\int_{\mathbb{R}} \varphi(\lambda)|r_\mu(\lambda)|^2\,d\mu_y(\lambda).
\end{align*}
Now choose $\varphi(\lambda)=|f(\lambda)-\mu|^2$. This gives
\begin{align*}
\int_{\mathbb{R}} |f(\lambda)-\mu|^2\,d\mu_x(\lambda)=\int_{\mathbb{R}} |(f(\lambda)-\mu)r_\mu(\lambda)|^2\,d\mu_y(\lambda)\le \|y\|_H^2.
\end{align*}
The right-hand side is finite because $(f-\mu)r_\mu$ is bounded by $1$ outside the $E_A$-null set where $|f-\mu|<\varepsilon$ and is $0$ on that set by definition of $r_\mu$. Since $|f(\lambda)|^2\le 2|f(\lambda)-\mu|^2+2|\mu|^2$ for every $\lambda\in\mathbb{R}$ and $\mu_x(\mathbb{R})=\|x\|_H^2<\infty$, the defining integral for $\mathcal{D}(f(A))$ is finite. Therefore $r_\mu(A)y=x\in\mathcal{D}(f(A))$, and $r_\mu(A)H\subset\mathcal{D}(f(A))$.
The product $(f-\mu)r_\mu$ equals $1$ outside the $E_A$-null set $\{\lambda\in\mathbb{R}:|f(\lambda)-\mu|<\varepsilon\}$. The functional calculus ignores changes on $E_A$-null sets, so the multiplicative rule gives
\begin{align*}
(f(A)-\mu I)r_\mu(A)=I.
\end{align*}
On the natural domain $\mathcal{D}(f(A))$, the same multiplication rule gives
\begin{align*}
r_\mu(A)(f(A)-\mu I)x=x
\end{align*}
for every $x\in\mathcal{D}(f(A))$. Thus $r_\mu(A)$ is a two-sided inverse for $f(A)-\mu I$, and this inverse is bounded because $r_\mu$ is bounded. Therefore $\mu$ belongs to the resolvent set $\rho(f(A))$.
[/guided]
[/step]
[step:Build approximate eigenvectors inside the essential range]
Let $\mu\in\operatorname{ess\,ran}_{E_A}(f)$. For each integer $n\ge 1$, define the Borel set
\begin{align*}
B_n=\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<n^{-1}\}.
\end{align*}
Since $B_n=f^{-1}((\mu-n^{-1},\mu+n^{-1}))$ and $\mu$ is in the essential range, we have
\begin{align*}
E_A(B_n)\ne 0.
\end{align*}
Choose $y_n\in H$ such that $E_A(B_n)y_n\ne 0$, and define
\begin{align*}
x_n=\frac{E_A(B_n)y_n}{\|E_A(B_n)y_n\|_H}.
\end{align*}
Then $\|x_n\|_H=1$ and $E_A(B_n)x_n=x_n$.
Because the spectral measure of $x_n$ is supported in $B_n$, we have $x_n\in\mathcal{D}(f(A))$ and
\begin{align*}
\|(f(A)-\mu I)x_n\|_H^2
=
\int_{\mathbb{R}} |f(\lambda)-\mu|^2\,d\mu_{x_n}(\lambda).
\end{align*}
Since $\mu_{x_n}$ is supported on $B_n$, this becomes
\begin{align*}
\|(f(A)-\mu I)x_n\|_H^2
=
\int_{B_n} |f(\lambda)-\mu|^2\,d\mu_{x_n}(\lambda)
\le
n^{-2}\mu_{x_n}(B_n).
\end{align*}
Also,
\begin{align*}
\mu_{x_n}(B_n)=\|E_A(B_n)x_n\|_H^2=\|x_n\|_H^2=1.
\end{align*}
Therefore
\begin{align*}
\|(f(A)-\mu I)x_n\|_H\le n^{-1}.
\end{align*}
Thus $f(A)-\mu I$ cannot be bounded below on its domain, so it cannot have a bounded everywhere-defined inverse. Hence $\mu\in\sigma(f(A))$. We conclude
\begin{align*}
\operatorname{ess\,ran}_{E_A}(f)\subset\sigma(f(A)).
\end{align*}
[/step]
[step:Identify the spectrum with the essential range for real Borel functions]
The two previous steps prove the equality for real spectral parameters. It remains only to exclude non-real complex numbers from the spectrum. Let $z=a+ib\in\mathbb{C}$ with $a,b\in\mathbb{R}$ and $b\ne 0$. Since $f(A)$ is self-adjoint by the real Borel functional calculus, for every $x\in\mathcal{D}(f(A))$ the Hilbert-space [inner product](/page/Inner%20Product) computation gives
\begin{align*}
\|(f(A)-zI)x\|_H^2=\|(f(A)-aI)x\|_H^2+b^2\|x\|_H^2.
\end{align*}
Thus $f(A)-zI$ is injective and bounded below by $|b|$. To prove surjectivity, define the bounded Borel function
\begin{align*}
s_z:\mathbb{R}\to\mathbb{C}
\end{align*}
by $s_z(\lambda)=(f(\lambda)-z)^{-1}$. The bound $|s_z(\lambda)|\le |b|^{-1}$ for every $\lambda\in\mathbb{R}$ gives $s_z(A)\in\mathcal{L}(H)$, and the same domain argument as in the reciprocal step gives $s_z(A)H\subset\mathcal{D}(f(A))$. For every $y\in H$, set $x=s_z(A)y$. The spectral-measure transformation formula for the bounded multiplier $s_z$ gives
\begin{align*}
\int_{\mathbb{R}} |f(\lambda)-z|^2\,d\mu_x(\lambda)=\int_{\mathbb{R}} |(f(\lambda)-z)s_z(\lambda)|^2\,d\mu_y(\lambda)=\|y\|_H^2.
\end{align*}
Since $|f(\lambda)|^2\le 2|f(\lambda)-z|^2+2|z|^2$ for every $\lambda\in\mathbb{R}$ and $\mu_x(\mathbb{R})<\infty$, it follows that $x=s_z(A)y\in\mathcal{D}(f(A))$. Hence $s_z(A)H\subset\mathcal{D}(f(A))$. The multiplicative rule then gives $(f(A)-zI)s_z(A)=I$ and $s_z(A)(f(A)-zI)x=x$ for every $x\in\mathcal{D}(f(A))$. Hence $z\in\rho(f(A))$.
Combining this non-real resolvent statement with the two real inclusions gives
\begin{align*}
\sigma(f(A))=\operatorname{ess\,ran}_{E_A}(f)
\end{align*}
for every real-valued Borel measurable function $f:\mathbb{R}\to\mathbb{R}$, where $f(A)$ is understood on its natural spectral-calculus domain.
[/step]
[step:Show that continuous functions have essential range equal to the closure of the image of the operator spectrum]
Assume now that $f:\mathbb{R}\to\mathbb{R}$ is continuous. We prove
\begin{align*}
\operatorname{ess\,ran}_{E_A}(f)=\overline{f(\sigma(A))}.
\end{align*}
First let $\mu\notin\overline{f(\sigma(A))}$. Then there is $\varepsilon>0$ such that
\begin{align*}
|f(\lambda)-\mu|\ge \varepsilon
\end{align*}
for every $\lambda\in\sigma(A)$. By the spectral theorem, the projection-valued measure $E_A$ is supported on $\sigma(A)$, meaning $E_A(\mathbb{R}\setminus\sigma(A))=0$. It follows that
\begin{align*}
E_A(\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<\varepsilon\})=0.
\end{align*}
Hence $\mu\notin\operatorname{ess\,ran}_{E_A}(f)$.
Conversely, let $\mu\in\overline{f(\sigma(A))}$, and let $U\subset\mathbb{R}$ be an open neighbourhood of $\mu$. Choose $\lambda_0\in\sigma(A)$ such that $f(\lambda_0)\in U$. Since $f$ is continuous and $U$ is open, the set
\begin{align*}
V=f^{-1}(U)
\end{align*}
is an open neighbourhood of $\lambda_0$. By the support characterization of the spectral measure in the spectral theorem for self-adjoint operators, every open set in $\mathbb{R}$ meeting $\sigma(A)$ has nonzero spectral projection. Since $V$ is open and $\lambda_0\in V\cap\sigma(A)$, we have
\begin{align*}
E_A(V)\ne 0.
\end{align*}
Thus $E_A(f^{-1}(U))\ne 0$ for every open neighbourhood $U$ of $\mu$, which means
\begin{align*}
\mu\in\operatorname{ess\,ran}_{E_A}(f).
\end{align*}
Therefore
\begin{align*}
\operatorname{ess\,ran}_{E_A}(f)=\overline{f(\sigma(A))}.
\end{align*}
Together with the Borel case, this proves
\begin{align*}
\sigma(f(A))=\overline{f(\sigma(A))}
\end{align*}
for real-valued continuous $f$, bounded or unbounded.
[/step]
[step:Deduce the bounded complex-valued continuous case from the unital functional calculus]
Let $f:\mathbb{R}\to\mathbb{C}$ be bounded and continuous. Since $E_A(\mathbb{R}\setminus\sigma(A))=0$, the operator $f(A)$ depends only on the restriction of $f$ to $\sigma(A)$. Let $C_b(\sigma(A))$ denote the unital $C^*$-algebra of bounded continuous functions $g:\sigma(A)\to\mathbb{C}$ with the supremum norm and pointwise operations. The bounded continuous functional calculus gives a unital $*$-homomorphism
\begin{align*}
\Phi:C_b(\sigma(A))\to\mathcal{L}(H)
\end{align*}
defined by
\begin{align*}
\Phi(g)=g(A).
\end{align*}
Let $\mu\in\mathbb{C}\setminus\overline{f(\sigma(A))}$. Then the function
\begin{align*}
r_\mu:\sigma(A)\to\mathbb{C}
\end{align*}
defined by
\begin{align*}
r_\mu(\lambda)=\frac{1}{f(\lambda)-\mu}
\end{align*}
is bounded and continuous on $\sigma(A)$. Since $E_A$ is supported on $\sigma(A)$, applying the bounded functional calculus to $r_\mu$ means applying $\Phi$ to this element of $C_b(\sigma(A))$; equivalently, one may extend $r_\mu$ arbitrarily to a bounded Borel function on $\mathbb{R}$ without changing the resulting operator. By multiplicativity of the bounded functional calculus,
\begin{align*}
(f(A)-\mu I)r_\mu(A)=I
\end{align*}
and
\begin{align*}
r_\mu(A)(f(A)-\mu I)=I.
\end{align*}
Here $\rho(f(A))$ denotes the resolvent set of the bounded operator $f(A)$, namely the set of complex numbers $z$ for which $f(A)-zI$ is bijective with bounded inverse. Thus $\mu\in\rho(f(A))$.
Now let $\mu\in\overline{f(\sigma(A))}$. For every integer $n\ge 1$, the open set
\begin{align*}
V_n=\{\lambda\in\mathbb{R}: |f(\lambda)-\mu|<n^{-1}\}
\end{align*}
meets $\sigma(A)$. By the spectral support property, $E_A(V_n)\ne 0$. Let $\operatorname{Range}(E_A(V_n))=\{E_A(V_n)y:y\in H\}$ denote the range of the spectral projection $E_A(V_n)$. Since $E_A(V_n)\ne 0$, choose a unit vector $x_n\in\operatorname{Range}(E_A(V_n))$. Then
\begin{align*}
\|(f(A)-\mu I)x_n\|_H^2
=
\int_{V_n}|f(\lambda)-\mu|^2\,d\mu_{x_n}(\lambda)
\le n^{-2}.
\end{align*}
Hence $f(A)-\mu I$ is not bounded below, so $\mu\in\sigma(f(A))$.
Therefore
\begin{align*}
\sigma(f(A))=\overline{f(\sigma(A))}
\end{align*}
for every bounded continuous function $f:\mathbb{R}\to\mathbb{C}$. This completes the proof of all stated cases.
[/step]