This is an exercise in Heinonen's book "Lectures on analysis on metric spaces" in the chapter about maximal function.
Suppose that $\mathcal{В} = \{B_1, B_2, \ldots \}$ is a countable collection of balls in a doubling space $(X, \mu)$ and that $a_i \ge 0$ are real numbers. Show that $$ \int_X \left(\sum_{\mathcal{B}} a_i \chi_{\lambda B_i}\right)^p d\mu \le C(\lambda, p, \mu) \int_X \left(\sum_{\mathcal{B}} a_i \chi_{B_i}\right)^p d\mu $$ for $1 < p < \infty$ and $\lambda > 1$.
There is a hint in the book: use the maximal function theorem together with the duality of $L^p(\mu)$ and $L^q(\mu)$ for $p^{-1} + q^{-1} = 1$.
The only way that came to my mind about how one can use duality here is the following property of $L^p$-norm: $$ \left(\int_X \left(\sum_{\mathcal{B}} a_i \chi_{\lambda B_i}\right)^p d\mu \right)^{1/p}= \sup_{||g||_{L^q} \le 1} \left|\int_X g \sum_{\mathcal{B}} a_i \chi_{\lambda B_i} d\mu\right|. $$ One can represent the last integral as $$ \int_X g \sum_{\mathcal{B}} a_i \chi_{\lambda B_i} d\mu = \int_{0}^{\infty} \mu\{x : g(x) \sum_{\mathcal{B}} a_i \chi_{\lambda B_i}(x) > t \} dt. $$ Then I need somehow to use the maximal function theorem. I tried to use weak type estimate, but didn't get any result. How can I proceed? Any other approach is also appreciated.