Let $f : \mathbb R^n \to \mathbb R$ be Lebesgue-integrable. We define the Hardy–Littlewood maximal function $Mf: \mathbb R^n \to [0, \infty]$ by
$$ M f(x) :=\sup _{r>0} \frac{1}{|B(x, r)|} \int_{B(x, r)} |f(t)| \mathrm d t $$ where $B(x, r)$ is the open ball of radius $r$ centred at $x$, and $|E|$ denotes the $n$-dimensional Lebesgue measure of $E \subset \mathbb R^n$.
Theorem: $Mf$ is Borel measurable.
I'm trying to adapt the strategy in this thread to higher dimension. Could you have a check on my attempt?
Proof: Let $$ g_r (x) := \frac{1}{|B(x, r)|} \quad \text{and} \quad h_r(x) := \int_{B(x, r)} |f(t)| \mathrm d t \quad \forall r>0, \forall x \in \mathbb R^n. $$
Because Lebesgue measure is translation-invariant, we get $g_r (x) = g_r (y)$ for all $x, y \in \mathbb R^n$. This means $g_r$ is constant. Let's prove that $h_r$ is continuous. Let $x, x_n \in \mathbb R^n$ such that $x_n \to x$. Because the $n$-dimensional Lebesgue measure of a sphere is $0$, we have $1_{B(x_n, r)} \to 1_{B(x, r)}$ a.e. It follows that $$ 1_{B(x_n, r)} |f| \to 1_{B(x, r)} |f| \quad \text{a.e.} $$
By dominated convergence theorem, we get $h_r (x_n) \to h_r (x)$ and thus $(g_rh_r) (x_n) \to (g_rh_r) (x)$. It follows that $g_rh_r$ is measurable. The supremum of a collection of measurable functions is measurable, so $$ Mf = \sup_{r>0} g_rh_r $$ is measurable.