Last modified: 2026-10-31 15:22:31 (PDT)
Definition 1 (Measurable function) Let \((S, \mathcal{S})\) be a measurable space. A function \(f : S \to \mathbb{R}\) is measurable (with respect to \(\mathcal{S}\)) [1] if, for every real number \(c\), the set of elements where \(f\) is at most \(c\) is measurable:
\[{\mathopen{}\left\{s \in S : f(s) \le c\right\}\mathclose{}} \in \mathcal{S}\]
Remark 1 (Measurable functions in general). Other sources define a function \(f : S \to T\) between measurable spaces \((S, \mathcal{S})\) and \((T, \mathcal{T})\) to be measurable when \({\mathopen{}\left\{s \in S : f(s) \in B\right\}\mathclose{}} \in \mathcal{S}\) for every \(B \in \mathcal{T}\). For \(T = \mathbb{R}\) with the Borel \(\sigma\)-algebra, that definition is equivalent to Definition 1. For example, with \(B = (-\infty, c]\), the general definition requires \({\mathopen{}\left\{s \in S : f(s) \le c\right\}\mathclose{}} \in \mathcal{S}\), which is the condition in Definition 1.
Example 1 (Measurable and not measurable) On the die rolls \(D\), take the \(\sigma\)-algebra \(\mathcal{S}= {\mathopen{}\left\{\emptyset, {\mathopen{}\left\{2, 4, 6\right\}\mathclose{}}, {\mathopen{}\left\{1, 3, 5\right\}\mathclose{}}, D\right\}\mathclose{}}\) of Example 1 in Sigma-Algebras.
With the \(\sigma\)-algebra of all subsets of \(D\) instead, every set \({\mathopen{}\left\{x \in D : g(x) \le c\right\}\mathclose{}}\) is a subset of \(D\), so every function \(D \to \mathbb{R}\), including \(g\), is measurable.
Definition 2 (Integral of a non-negative function) Let \((S, \mathcal{S}, \mu)\) be a measure space, and let \(f : S \to [0, \infty)\) be measurable. The integral of \(f\) with respect to \(\mu\) is [2]
\[ \int_S f \, d\mu\stackrel{\text{def}}{=} \sup {\mathopen{}\left\{\sum_{i=1}^n\mathopen{}\left(\inf_{s \in A_i} f(s)\right)\mathclose{} \mu(A_i)\right\}\mathclose{}} \]
where the supremum is over all ways of writing \(S\) as the union of finitely many nonempty pairwise disjoint sets \(A_1, \ldots, A_n\) in \(\mathcal{S}\), and each \(\inf_{s \in A_i} f(s)\) is the infimum of the values of \(f\) on \(A_i\). In the sums, \(0 \cdot \infty \stackrel{\text{def}}{=}0\), and \(x \cdot \infty \stackrel{\text{def}}{=}\infty\) for \(x > 0\); the supremum is \(\infty\) if some sum is \(\infty\). The integral is also written \(\int_S f(s) \, d\mu(s)\).
Remark 2 (Each sum is a lower estimate). Each sum in Definition 2 splits \(S\) into pieces and weights each piece \(A_i\) by the smallest value \(f\) approaches on it, so each sum is at most the integral. For Lebesgue measure on a closed interval \([a, b]\) and a function \(f \ge 0\) that has a Riemann integral on \([a, b]\), the two integrals agree: \(\int_{[a, b]} f \, d\lambda= \int_a^b f(x) \, dx\) [2].
Example 2 (Integrals with respect to counting measure) Let \(\mu\) be the counting measure on the die rolls \(D\), and let \(g : D \to [0, \infty)\). Every function on \(D\) is measurable (Example 1).
The integral is the sum of the values. For any split of \(D\) into nonempty pairwise disjoint sets \(A_1, \ldots, A_n\):
\[ \begin{aligned} \sum_{i=1}^n\mathopen{}\left(\inf_{x \in A_i} g(x)\right)\mathclose{} \mu(A_i) &= \sum_{i=1}^n\sum_{x \in A_i} \inf_{y \in A_i} g(y) && \text{(} \mu(A_i) \text{ counts the elements of } A_i \text{)} \\ &\le \sum_{i=1}^n\sum_{x \in A_i} g(x) && \text{(an infimum is at most each value)} \\ &= \sum_{x \in D} g(x) && \text{(each } x \in D \text{ is in exactly one } A_i \text{)} \end{aligned} \]
The split into the six single points \({\mathopen{}\left\{1\right\}\mathclose{}}, \ldots, {\mathopen{}\left\{6\right\}\mathclose{}}\) gives exactly \(\sum_{x \in D} g(x)\), so the supremum is \(\int_D g \, d\mu= \sum_{x \in D} g(x)\). For example, with \(g(x) = x\),
\[ \begin{aligned} \int_D g \, d\mu&= 1 + 2 + \cdots + 6 \\ &= 21. \end{aligned} \]
An infinite integral. For the counting measure \(\mu\) on \(\mathbb{N}\) and the constant function \(h(n) = 1\), the split with one set, \(A_1 = \mathbb{N}\), gives the sum
\[ \begin{aligned} 1 \cdot \mu(\mathbb{N}) &= 1 \cdot \infty \\ &= \infty, \end{aligned} \]
so \(\int_{\mathbb{N}} h \, d\mu= \infty\).
Remark 3 (A function in terms of its positive and negative parts). For a function \(f : S \to \mathbb{R}\), with the positive part and negative part, \(f = f^{+} - f^{-}\) and \(\mathopen{}\left|f\right|\mathclose{} = f^{+} + f^{-}\). (\(f^{+}\), \(f^{-}\), and \(\mathopen{}\left|f\right|\mathclose{}\) are measurable when \(f\) is [3], Theorem 13.3.)
Definition 3 (Integral of a real-valued function) Let \((S, \mathcal{S}, \mu)\) be a measure space, and let \(f : S \to \mathbb{R}\) be measurable. Let \(f^{+}\) and \(f^{-}\) be the positive part and negative part of \(f\). The integral of \(f\) with respect to \(\mu\) is
\[\int_S f \, d\mu\stackrel{\text{def}}{=}\int_S f^{+} \, d\mu- \int_S f^{-} \, d\mu,\]
using Definition 2 for each term, when at least one of the two terms is finite; otherwise, the integral of \(f\) is undefined.
Example 3 (An integral with positive and negative parts) For the counting measure \(\mu\) on the die rolls \(D\), let \(f(x) = x - 3\). Its values at \(1, \ldots, 6\) are \(-2, -1, 0, 1, 2, 3\), so:
\(f^{+}\) has values \(0, 0, 0, 1, 2, 3\), and \(\int_D f^{+} \, d\mu= 6\) by Example 2;
\(f^{-}\) has values \(2, 1, 0, 0, 0, 0\), and \(\int_D f^{-} \, d\mu= 3\);
\[ \begin{aligned} \int_D f \, d\mu&= 6 - 3 \\ &= 3, \end{aligned} \]
which is also
\[ \begin{aligned} \sum_{x \in D} (x - 3) &= 21 - 18 \\ &= 3. \end{aligned} \]
pnp_rolls_pf <- 1:6
pnp_f_pf <- pnp_rolls_pf - 3
pnp_plus_pf <- pmax(pnp_f_pf, 0)
pnp_minus_pf <- pmax(-pnp_f_pf, 0)
pnp_f_tbl_pf <- tibble::tibble(
x = pnp_rolls_pf, value = pnp_f_pf, panel = "f (sum = 3)"
)
pnp_plus_tbl_pf <- tibble::tibble(
x = pnp_rolls_pf, value = pnp_plus_pf, panel = "f+ (sum = 6)"
)
pnp_minus_tbl_pf <- tibble::tibble(
x = pnp_rolls_pf, value = pnp_minus_pf, panel = "f- (sum = 3)"
)
pnp_bars_pf <- dplyr::bind_rows(pnp_f_tbl_pf, pnp_plus_tbl_pf, pnp_minus_tbl_pf)
pnp_aes_pf <- ggplot2::aes(x, value, fill = panel)
pnp_colours_pf <- c("#0072B2", "#009E73", "#D55E00")
ggplot2::ggplot(pnp_bars_pf, pnp_aes_pf) +
ggplot2::geom_col() +
ggplot2::facet_wrap(ggplot2::vars(panel)) +
ggplot2::scale_fill_manual(values = pnp_colours_pf) +
ggplot2::scale_x_continuous(breaks = pnp_rolls_pf) +
ggplot2::guides(fill = "none") +
ggplot2::labs(x = "Die roll x", y = "Value")import matplotlib.pyplot as plt
import numpy as np
pnp_rolls_pf = np.arange(1, 7)
pnp_f_pf = pnp_rolls_pf - 3
pnp_panels_pf = [
("f (sum = 3)", pnp_f_pf, "#0072B2"),
("f+ (sum = 6)", np.maximum(pnp_f_pf, 0), "#009E73"),
("f- (sum = 3)", np.maximum(-pnp_f_pf, 0), "#D55E00"),
]
fig, axes = plt.subplots(1, 3, figsize=(7, 3.5), sharey=True,
layout="constrained")
for ax, (title, values, colour) in zip(axes, pnp_panels_pf):
ax.bar(pnp_rolls_pf, values, color=colour)
ax.set_title(title)
ax.set_xlabel("Die roll x")
axes[0].set_ylabel("Value")
plt.show()Definition 4 (Absolutely integrable function, integrable function) Let \((S, \mathcal{S}, \mu)\) be a measure space. A measurable function \(f : S \to \mathbb{R}\) is absolutely integrable with respect to \(\mu\) (often just called integrable) if the integral of its absolute value is finite:
\[\int_S \mathopen{}\left|f\right|\mathclose{} \, d\mu< \infty\]
The property itself is called absolute integrability.
Remark 4 (An absolutely integrable function has a finite integral). If \(f\) is absolutely integrable, then \(\int_S f^{+} \, d\mu\) and \(\int_S f^{-} \, d\mu\) are both finite, because \(f^{+} \le \mathopen{}\left|f\right|\mathclose{}\) and \(f^{-} \le \mathopen{}\left|f\right|\mathclose{}\), so each sum in Definition 2 for \(f^{+}\) or \(f^{-}\) is at most the matching sum for \(\mathopen{}\left|f\right|\mathclose{}\). So \(\int_S f \, d\mu\) (Definition 3) is a real number.
Example 4 (Absolutely integrable and not)
For the counting measure on the die rolls \(D\), \(f(x) = x - 3\) (Example 3) is absolutely integrable:
\[ \begin{aligned} \int_D \mathopen{}\left|f\right|\mathclose{} \, d\mu&= 2 + 1 + 0 + 1 + 2 + 3 \\ &= 9 \\ &< \infty \end{aligned} \]
by Example 2.
For the counting measure on \(\mathbb{N}\), the constant function \(h(n) = 1\) is not absolutely integrable, because
\[ \begin{aligned} \int_{\mathbb{N}} \mathopen{}\left|h\right|\mathclose{} \, d\mu&= \int_{\mathbb{N}} h \, d\mu\\ &= \infty \end{aligned} \]
(Example 2).