[guided]Recall that $P:\mathcal B(\mathbb R)\to\mathcal L(L^2(X,\mathcal E,\mu))$ is defined by
\begin{align*}
P(B)f=\mathbb{1}_{m^{-1}(B)}f
\end{align*}
for every Borel set $B\in\mathcal B(\mathbb R)$ and every $f\in L^2(X,\mathcal E,\mu)$. The projection-valued measure $P$ should represent the operator by the spectral-integral formula displayed in the exact part of this step. To verify this, we first compute the scalar measure seen by a fixed vector $f\in L^2(X,\mathcal E,\mu)$. Define $\nu_f:\mathcal B(\mathbb R)\to[0,\infty)$ by
\begin{align*}
\nu_f(B)=(P(B)f,f)_{L^2(X)}.
\end{align*}
Using the definition of $P(B)$, this becomes
\begin{align*}
\nu_f(B)
=
\int_X \mathbb{1}_{m^{-1}(B)}(x)|f(x)|^2\,d\mu(x).
\end{align*}
Thus $\nu_f$ is the pushforward of the finite measure $|f|^2\,d\mu$ through the measurable map $m:X\to\mathbb R$. Consequently, for every non-negative Borel function $\varphi:\mathbb R\to[0,\infty]$,
\begin{align*}
\int_{\mathbb R}\varphi(\lambda)\,d\nu_f(\lambda)
=
\int_X \varphi(m(x))|f(x)|^2\,d\mu(x).
\end{align*}
The domain of an unbounded spectral integral is controlled by the square-integrability of the multiplier. For each $n\in\mathbb N$, define the truncated identity function $\iota_n:\mathbb R\to\mathbb R$ by $\iota_n(\lambda)=\lambda\,\mathbb{1}_{[-n,n]}(\lambda)$. More precisely, by the spectral-integral construction for projection-valued measures in the Spectral Theorem for [Self-Adjoint Operators](/page/Self-Adjoint%20Operators), $\int_{\mathbb R}\lambda\,dP(\lambda)$ is the closed operator obtained from the bounded truncations $\int_{\mathbb R}\iota_n(\lambda)\,dP(\lambda)$, and its domain consists exactly of those vectors for which the second moment of the scalar spectral measure is finite. Taking $\varphi(\lambda)=|\lambda|^2$ gives
\begin{align*}
\int_{\mathbb R}|\lambda|^2\,d\nu_f(\lambda)
=
\int_X |m(x)|^2|f(x)|^2\,d\mu(x).
\end{align*}
The right-hand side is finite exactly when $mf\in L^2(X,\mathcal E,\mu)$. Hence
\begin{align*}
\mathcal D\left(\int_{\mathbb R}\lambda\,dP(\lambda)\right)
=
\mathcal D(M_m).
\end{align*}
It remains to identify the action of the integral. For a bounded Borel [simple function](/page/Simple%20Function) $\varphi:\mathbb R\to\mathbb C$, write $\varphi=\sum_{j=1}^{N}a_j\mathbb{1}_{B_j}$ with pairwise disjoint Borel sets $B_j$. Then
\begin{align*}
\int_{\mathbb R}\varphi(\lambda)\,dP(\lambda)=\sum_{j=1}^{N}a_jP(B_j).
\end{align*}
so for $f\in L^2(X,\mathcal E,\mu)$,
\begin{align*}
\left(\int_{\mathbb R}\varphi(\lambda)\,dP(\lambda)f\right)(x)=\sum_{j=1}^{N}a_j\mathbb{1}_{m^{-1}(B_j)}(x)f(x).
\end{align*}
Since $x\in m^{-1}(B_j)$ exactly when $m(x)\in B_j$, this equals
\begin{align*}
\varphi(m(x))f(x).
\end{align*}
for $\mu$-a.e. $x\in X$.
This formula must be extended from bounded Borel simple functions to bounded Borel functions before we use truncated identity functions. Let $S:\mathbb R\to\mathbb C$ be bounded and Borel. Choose bounded Borel simple functions $(S_j)_{j=1}^{\infty}$ such that $|S_j|\le \|S\|_{\infty}$ and $S_j(\lambda)\to S(\lambda)$ for every $\lambda\in\mathbb R$. The simple-function formula gives the multiplication formula for each $S_j$. The [dominated convergence theorem](/theorems/4) applies first to the scalar spectral measures because $|S_j-S|^2\le 4\|S\|_\infty^2$, and it applies on $X$ with measure $\mu$ because $|(S_j(m)-S(m))f|^2\le 4\|S\|_\infty^2|f|^2$ with $|f|^2\in L^1(X,\mathcal E,\mu)$. Hence the spectral-integral side and the multiplication side converge in $L^2(X,\mathcal E,\mu)$ to the corresponding expressions with $S$. Hence the action formula holds for every bounded Borel $S$.
Now approximate the identity function by the bounded Borel functions $\iota_n:\mathbb R\to\mathbb R$ defined by $\iota_n(\lambda)=\lambda\,\mathbb{1}_{[-n,n]}(\lambda)$.
If $f\in\mathcal D(M_m)$, then
\begin{align*}
|\iota_n(m(x))f(x)-m(x)f(x)|^2\le |m(x)f(x)|^2.
\end{align*}
and the right-hand side is $\mu$-integrable. Since $\iota_n(m(x))f(x)\to m(x)f(x)$ pointwise for $\mu$-a.e. $x\in X$, and since $|m f|^2\in L^1(X,\mathcal E,\mu)$ for $f\in\mathcal D(M_m)$, the dominated convergence theorem gives convergence in $L^2(X,\mathcal E,\mu)$. Therefore
\begin{align*}
\left(\int_{\mathbb R}\lambda\,dP(\lambda)f\right)(x)
=
m(x)f(x)
\end{align*}
for every $f\in\mathcal D(M_m)$ and $\mu$-a.e. $x\in X$.[/guided]