On the extension of Muckenhoupt weights in metric spaces

A theorem by Wolff states that weights defined on a measurable subset of $\mathbb{R}^n$ and satisfying a Muckenhoupt-type condition can be extended into the whole space as Muckenhoupt weights of the same class. We give a complete and self-contained proof of this theorem generalized into metric measure spaces supporting a doubling measure. Related to the extension problem, we also show estimates for Muckenhoupt weights on Whitney chains in the metric setting.


Introduction
On a metric space X with a doubling measure, the familiar Muckenhoupt class A p consists precisely of those weights for which the Hardy-Littlewood maximal operator maps the weighted space L p (X, w dµ) onto itself. In addition to A p weights being ubiquitous in harmonic analysis, weighted norm inequalities have applications in the study of regularity of certain partial differential equations. In order to deduce weighted Poincaré inequalities using the theory of global weights, we would like to extend Muckenhoupt weights defined on subsets to the entire space.
Our main result is the following theorem that provides an abstract starting point for the investigation of extensions. It is the generalization to a metric-space context of a result due to Thomas H. Wolff. The result in R n supposedly originates in an elusive preprint titled "Restrictions of A p weights", that to our knowledge remains unpublished. An outline of the Euclidean proof can be found in [9], Theorem 5.6. However, the metric setting brings about technical challenges that are not present in the Euclidean case. Theorem 1.1. Let X be a complete metric space with a doubling measure, E ⊂ X a measurable set with µ(E) > 0, and w a weight on E. Then, for 1 < p < ∞, the following statements are equivalent.
(i) There exists a weight W ∈ A p (X) such that W = w a. e. on E; (ii) There exists an ε > 0 such that In addition, whenever p = 1, the condition (ii) takes the following form: There exists a constant C > 0 such that for every ball B ⊂ X.
In Section 2 below, we present a complete and self-contained proof of Wolff's extension theorem (above and Theorem 2.13) for measurable sets in a metric space supporting a doubling measure. Comparing (ii) to the classical A p condition, it is clear that we need to deal with weights and maximal functions restricted to arbitrary measurable subsets E ⊂ X. We have chosen to call these classes induced A p weights; see Definition 2.1 below. It is not obvious at the outset whether all properties of globally defined weights hold true for this class as well.
Like the corresponding proof in R n , our proof relies on a factorization theorem, which in turn is based on the boundedness of the maximal operator. In particular, we need to show that the restricted maximal function is bounded on L p (E, w) when the weight w belongs to the induced A q class for some q < p (Theorem 2.6). The proofs of this theorem in the whole space are based either on Calderón-Zygmund decompositions on cubes (when X = R n ) or on Vitali-type coverings of the distributional sets of the maximal function. It is not clear how to adapt these arguments when E is an arbitrary subset, because of the simple fact that the relative balls E ∩ B do not necessarily satisfy a doubling condition, i. e., µ(E ∩ 5B) or w(E ∩ 5B) are not comparable to µ(E ∩ B) or w(E ∩ B) in general.
The reader might wonder why we need to assume the Muckenhoupt-type condition (1) for w 1+ǫ instead of simply stating the corresponding condition for w. A Muckenhoupt weight W ∈ A p (X) in the whole space always satisfies a self-improving property in the sense that W 1+ε also belongs to A p (X) for a suitable ε depending on the characteristic A p constant of W (Lemma 2.12). This is a consequence of the fact that global Muckenhoupt weights satisfy a reverse Hölder inequality (RHI; Proposition 2.11). As a result, one is free to apply Gehring's lemma to obtain the desired self-improving inequality. However, it is unclear whether the induced classes of weights satisfy a RHI, since it is yet again impossible to control the measures of the relative balls B ∩ E in terms of those of B. Even when the measure is positive, µ(B ∩ E) might be too small in comparison to µ(B), unless we tighten our assumptions on the set E. This technicality destroys our ability to compute the averaged integrals that would lead to the RHI.
For an early treatment of harmonic analysis in metric spaces, see [6]. Muckenhoupt weights in particular are discussed in [12] and [28]. A solid reference to the theory, albeit in R n , is [9]. For recent results concerning reverse Hölder inequalities for A ∞ weights or strong A p weights, as well as versions of the Gehring lemma in various spaces, see the articles [1-3, 7, 8, 19, 20, 22-24, 26].
In Sections 3 and 4, we turn to an intended application of Theorem 1.1. This theorem gives a necessary and sufficient condition for the existence of an extension. One might ask what are the subsets E and weights w that satisfy (1) and consequently possess an extension to the entire space. Peter J. Holden [17], working in R n , has verified (1) for weights in A p (E) under additional geometric assumptions on the set E. We made an effort to reproduce Holden's argument in the metric setting, yet were not able to reach the point where we could apply Theorem 1.1. However, we believe that our findings are of independent interest and value for future research. In particular, Lemma 4.4 states that the weights of balls on a Whitney chain are comparable as long as we are able to control the length of the chain. In [17], this lemma is used to recover the Euclidean equivalent of Theorem 1.1 (ii).

The extension theorem
The results in this section apply in a complete metric measure space (X, d , µ). In addition, we assume that the nontrivial Borel regular measure µ satisfies the doubling condition: there exists a constant C d = C d (µ) > 1 only depending on µ such that for all balls B ⊂ X. The constant C d is spoken of as the doubling constant. In particular, we assume that every ball in X has positive and finite measure. An argument involving the Vitali covering lemma shows that X is separable and that every ball is totally bounded. This implies that X is locally compact and proper, which in turn means that every closed and bounded subset of X is compact. A ball is determined by its center x and radius r and denoted B = B(x, r) = {y ∈ X :d (x, y) < r}, where the center and radius are left out when not relevant to the discussion. Observe that in general, the center and the radius of a ball B are not uniquely determined by B as a set. We use the notation rad(B) = r when B = B(x, r) and, at times, cB = B(x, cr) for the ball dilated by a constant c.
For any two nonnegative numbers A and B, if there exists a constant C ∈ (0, ∞) such that A ≤ CB, we write A B. Furthermore, we write A ≈ B whenever there exist constants C 1 , C 2 ∈ (0, ∞) such that C 1 A ≤ B ≤ C 2 A. This notation is used where the exact magnitude of the constants is not of interest.
Whenever E ⊂ X is a measurable subset and the function f is integrable on every compact subset of E we say that f is locally integrable on E, denoted f ∈ L 1 loc (E). If the measure ν is absolutely continuous with respect to µ and if there exists a nonnegative locally integrable function w such that dν = w dµ, we call ν a weighted measure with respect to µ, and w a weight. [28] In practice, we assume w to be positive almost everywhere in E. For any measurable subsets F ⊂ E and a weight w on E, we write w(F ) = F w dµ.
For the purposes of Theorem 2.13, we introduce the following classes of induced Muckenhoupt weights on a subset, which we denote by A p .
If p = 1, we define A 1 (E) as the class of weights w for which there exists C > 0 with for every ball B ⊂ X. We denote by w 1 the infimum of the C > 0 for which the inequality (4) holds.
Observe that conditions (3) and (4) imply that w is integrable on each B ∩ E, where B ⊂ X is a ball. Whenever E = X, the above classes coincide with Muckenhoupt weights as usually defined. In this case we will denote them by A p (X) and A 1 (X), respectively. Notice that it is not possible to reduce (3) to the A p (X) condition e. g. by replacing w with X E w.

Definition 2.2. The Hardy-Littlewood maximal function is defined by
where X is a metric space, B ⊂ X are balls and f ∈ L 1 loc (X). Whenever E ⊂ X is a measurable set and x ∈ E, we also define a maximal function relative to the set E by In the following we verify a number of propositions regarding the A p classes, leading to the proof of the extension theorem. These correspond to well-known results for A p weights in R n . While the proofs are based on those in A p (R n ), we have chosen to present them in full, because our notion of induced weights along with the metric setting presents some difficulties that do not appear in R n .
Throughout the rest of this section (X, d, µ) will denote a complete metric measure space, with the measure µ satisfying doubling condition (2) and thus all the properties mentioned at the beginning of the section.
To begin with, the following proposition is a generalization of a well-known result for A 1 (R n ); see [13], p. 502.
Proof. The first inequality is a consequence of the Lebesgue differentiation theorem for µ. For a proof of this classical theorem in a metric space with a doubling measure see [15], p. 4. As for the second one, let A = {x ∈ E : m E w(x) > w 1 w(x)}. We aim to show that µ(A) = 0. Because X is separable, there exists a dense sequence of points {z k } k in X. Define a countable collection of balls F = {B(z k , q) : k ≥ 1, q ∈ Q + }. Then, for every x ∈ A, there exist a δ ∈ (0, 1) and a ball B = B(z, r) ∋ x such that For every ε ∈ (0, 1) denote B ε = B(z, (1 − ε)r). Because w is integrable on B ∩ E, by the absolute continuity of the Lebesgue integral there exists an η > 0 such that if F ⊂ B is measurable and We have shown that w(x) < ess inf B ′ ∩E w, which means that x belongs to the set which is a countable union of sets of measure zero.
We remark that the above proposition remains true if the maximal function m E is defined by taking a supremum over closed balls instead. The proof is similar, except that the absolute continuity of the Lebesgue integral is not needed.
The next lemma follows from Proposition 2.3, and is needed in the proof of Theorem 2.13 below.
Lemma 2.4. For a measurable set E ⊂ X with µ(E) > 0 and a weight w ∈ A 1 (E), the function wX E is in L 1 loc (X) and its maximal function M (wX E ) is finite at almost every point of X. Here wX E is the function in X that coincides with w on E and vanishes outside E.
Proof. It is immediate that wX E ∈ L 1 loc (X) because B∩E w is finite for every ball B ⊂ X. As for the second statement, Proposition 2.3 implies that M (wX E )(x) = m E w(x) < ∞ for a. e. x ∈ E. It remains to verify that M (wX E ) < ∞ on X \ E. Defining A = {y ∈ E : m E w(y) ≤ w 1 w(y) < ∞}, Proposition 2.3 shows that µ(E \ A) = 0, and therefore M (wX E ) = M (wX A ) on X. For a. e.
x ∈ X \ A, the Lebesgue differentiation theorem states that and thus there exists a radius r x > 0 such that For almost every x / ∈ A, we estimate the averages over balls B such that x ∈ B, r(B) > r x , and B ∩ A = ∅. For such a ball B it clearly holds that d (x, A) ≤ 2r(B), and consequently r(B) ≥ max{r x , d (x, A)/2}. Also, there exists a point y 0 = y 0 (x) ∈ A such that d (x, y 0 ) < max{r x , 2d(x, A)}. Denoting by z the center of B, we have and hence y 0 ∈ 5B. Using the doubling condition for µ and the definition of A, we obtain In the following two technical lemmas, we will not be using the fact that the measure is doubling.
Proof. We will use the following basic estimate. Let A ⊂ X be measurable, 0 ≤ s ≤ 1, and h ∈ L 1 (A). Then it follows from Hölder's inequality that Since the exponents δ and δ(p − 1)(q − 1) −1 are in [0, 1], we can apply (5) to obtain Since the exponents Then (6) and (7) lead to which proves the statement for p > 1. In the case δ ∈ [0, 1], v ∈ A 1 (E), and q > 1, using first (5) and then the definition of A 1 (E) we can write where we have used the fact that δ ≤ 1. For q = 1, the result follows immediately from (5).
Proof. We may and do assume g ≥ 0. In the case q > 1, applying Hölder's inequality we readily obtain When q = 1, the assertion follows immediately from the definition of A 1 (E) (4).
The Hardy-Littlewood maximal function is well known to satisfy a weak type inequality. The following lemma provides a version for the maximal function relative to a subset. Notice that by letting E = X, we recover the classical result.
where the constant C only depends on q, v q , and the doubling constant C d (µ).

Proof.
We may assume f ≥ 0. We restrict the supremum defining the maximal function to balls with radius no greater than R, and denote the resulting function by m R E f. Once we show the estimate for m R E , the statement will follow by the monotone convergence theorem.
Since the space X is separable, by the Vitali covering lemma we can find a disjoint sequence of balls {B j } j belonging to this collection such that x∈Et B x ⊂ j 5B j . Now let us write For each j, we apply Lemma 2.6 with B = 5B j and g = f X B j ∩E to deduce that the sum (8) is smaller than By the choice of the balls B x , this in turn is smaller than where we have applied the doubling property of µ.
We next show a strong-type estimate for the maximal function m E restricted to E, in the space L p (E, v), provided v is an induced Muckenhoupt weight of a higher class.
where the constant C depends only on p, q, v q , and the doubling constant C d (µ).
Proof. For simplicity, we again assume that f ≥ 0, and proceed to write

Using the subadditivity of the maximal function
. Combining this observation with Cavalieri's principle for the measure v dµ, and then using Proposition 2.7 for q and f t , we arrive at where C depends on p, q, v q , and C d (µ).
The following factorization theorem will be one of the main ingredients in the proof of Theorem 1.1.
Notice that q 1 < p and q 2 < p ′ .
Proposition 2.8 applied first with v and q 1 , and then with v −1/(p−1) and q 2 , yields that m E is a bounded operator both in L p (E, v) and L p ′ E, v −1/(p−1) , with norms bounded by constants depending only on r, p, and v r p . Let v be as per the hypothesis and p ≥ 2, and This is a bounded operator in L p (E), which can be verified by applying Proposition 2.8: The series converges absolutely, and by the com- It follows that the weights In the case as above, and raise this equation to the power 1/(1 − p ′ ).
The following proposition is one half of the Coifman-Rochberg characterisation of A 1 weights. We will not be needing the reverse statement.
Proposition 2.10. Let 0 < ε < 1, g a nonnegative function such that g, g −1 ∈ L ∞ (X), and f ∈ L 1 loc (X) a nonnegative function such that M f < ∞ a. e. in X. Then, the weight g (M f ) ε = w belongs to A 1 (X).
Proof. Since g, g −1 ∈ L ∞ (X), it is enough to show that for every ball B ⊂ X and x ∈ B where the constant C depends on ε and the doubling constant Then, owing to subadditivity of the maximal function, we have Each term is estimated separately. Beginning with (M f 1 ) ε , by Cavalieri's principle we have The first of these integrals can be estimated simply by As for the second, Proposition 2.7 applied with E = X for f 1 ∈ L 1 (X) has it that We choose a = µ(B) −1 4B |f | dµ and combine the two parts. We may and do assume that a is positive, as otherwise f = 0 on B and the desired inequality follows immediately. Then (10) becomes where we have used the fact that µ satisfies the doubling condition (2).
On to (M f 2 ) ε . Let x, y ∈ B = B(z, r) and let B ′ = B(z ′ , r ′ ) be another ball containing y. Assume first that there exists a point p ∈ B ′ \ 4B. We claim that r ≤ r ′ . Indeed, otherwise we have implying that y / ∈ B, a contradiction. Using that r ≤ r ′ , we have for any q ∈ B which shows that B ⊂ 4B ′ . In particular x ∈ 4B ′ and we can write In the case B ′ ⊂ 4B, we have that B ′ |f 2 | dµ = 0, and the preceding estimate trivially holds. In both cases, the right-hand side does not depend on the choice of y, and we have M f 2 (y) = sup which completes the proof of the proposition.
In order to show that (i) implies (ii) in Theorem 1.1, we are going to need the self-improving property of classical A p (X) weights. This is Lemma 2.12, which is straightforward to prove with the following reverse Hölder inequality at hand. Proposition 2.11. Let 1 ≤ p < ∞, and w ∈ A p (X). Then there exist constants δ > 0 and 0 < C < ∞ such that for all balls B ⊂ X we have For a proof of Proposition 2.11 see [28], Theorem I.15.
Proof. Let ε > 0 be such that w satisfies the reverse Hölder inequality (11) with δ = ε. If p = 1, applying the said inequality (11) and the A 1 condition (14) of w we have for any ball B ⊂ X which implies that w 1+ε ∈ A 1 (X).
As for p > 1 we start by observing that, as a consequence of Jensen's inequality, if a weight v satisfies (11) for some δ > 0, then v safisfies the same inequality for every 0 < δ ′ ≤ δ. It immediately follows from the A p condition (3) As a consequence, we obtain that both w and w 1−p ′ satisfy a reverse Hölder inequality (11) for ε > 0 small enough. Together with the fact that w ∈ A p (X), this implies which is the A p (X) condition for w 1+ε .
We are now ready to prove our main result, Theorem 1.1.
Theorem 2.13. Let X be a complete metric space with a doubling measure, E ⊂ X a measurable set with µ(E) > 0, and w a weight on E. Then, for 1 ≤ p < ∞, the following statements are equivalent.
(i) There exists a weight W ∈ A p (X) such that W = w a. e. on E; (ii) There exists an ε > 0 such that w 1+ε ∈ A p (E).
Proof. The implication (i) ⇒ (ii) follows from Lemma 2.12. Because W ∈ A p (X) for a given 1 ≤ p < ∞, there exists an ε > 0 such that W 1+ε ∈ A p (X). Assume first that p > 1. Then, for all balls B ⊂ X, Next, let us prove (ii) ⇒ (i). Let us define the weight v = w 1+ ε 2 on E. Consider first the case p > 1. Because w 1+ε ∈ A p (E), it is clear that v satisfies the hypothesis of Proposition 2.9, so we can write where M is the Hardy-Littlewood maximal function, and X E v i is the function in X that coincides with v i on E and vanishes outside E. These are weights in A 1 (X) as per Lemma 2.4 and Proposition 2.10. Then, V 1 V 1−p 2 is again an A p (X) weight such that we see that g, g −1 ∈ L ∞ (X), g > 0, and for almost every x ∈ E. The weight W = gV 1 V 1−p 2 is in A p (X) and satisfies W = w a. e. on E. Finally, if p = 1, we reproduce the above argument taking v 1 as v and discarding the weight v 2 .

Balls and chains
The aim of this section is to collect several preparatory results concerning balls in a metric space with a doubling measure. Our reason to delve into the geometry of Whitney-type balls is that they can be used to give estimates for Muckenhoupt weights over chains. In particular, Lemma 3.8 is needed to prove Lemma 4.4 in the next section, which in turn is an integral part of Holden's argument in [17]. We have found it necessary to provide an explicit proof of Lemma 3.8, as we could not locate one in the literature.
While most results in this section do not require any additional assumptions, on occasion we need to assume the existence of geodesics joining every pair of points. To cite an example of geodesic spaces relevant to partial differential equations, Corollary 8.3.16 in [16] states that a complete, doubling metric space that supports a Poincaré inequality admits a geodesic metric that is bilipschitz equivalent to the underlying metric, with constant depending on the doubling constant of the measure and the data of the Poincaré inequality.
We will invoke the following well-known property of geodesics: if [a ′ , b ′ ] ⊂ [a, b], the subarc γ | [a ′ ,b ′ ] of the geodesic γ : [a, b] → X is a geodesic too. Hence, for any three points γ(t i ) on the geodesic γ such that a ≤ t 0 < t 1 < t 2 ≤ b, the triangle inequality for d becomes an equality: , γ(t 2 )).

Slightly abusing notation, we write
Throughout the rest of this section, we will assume that (X, d, µ) is a complete metric measure space such that µ satisfies the doubling condition (2). Also, when using the notation A ≈ B or A B for any two real numbers A, B, we understand that the constants involved may depend on the doubling constant C d (µ).
We begin by showing two lemmas in metric geometry for future reference. In the first one, the measure does not play any role. Proof. By assumption, there is a constant 0 < a ≤ 1 such that a rad(B) ≤ rad(B ′ ). In the first place, assume that d (z, z ′ ) ≤ 1 2 rad(B). Let z and z ′ denote the centers of B and B ′ respectively. In this case, define B ′′ as the ball centered at z ′ and of radius a 4 rad(B). Since a rad(B) ≤ rad(B ′ ), it is obvious that B ′′ ⊂ B ′ . On the other hand, for any x ∈ B ′′ we can write , which shows that B ′′ ⊂ B, and we also have rad(B ′′ ) = a 4 rad(B) ≈ rad(B). Consider then the case d (z, z ′ ) > 1 2 rad(B). Let γ be a continuous curve joining z and z ′ with , there exists a point p ∈ γ such that d (p, z) = 1 2 rad(B). Let q ∈ γ be the midpoint between z and p, that is, d (z, q) = d (q, p) = 1 2 d (z, p). We define B ′′ as the ball centered at q and radius 1 2 , which completes the proof of the lemma.
As a result, there exists a constant 1 ≤ λ < ∞ such that d(x, z B ) ≤ λ rad(B) for every q ∈ B ′ , which means that B ′ ⊂ λB and therefore µ(B ′ ) ≤ µ(λB). But µ(λB) µ(B) because the measure is doubling, so µ(B ′ ) µ(B). Reversing the roles of B and B ′ gives the inequality in the other direction.
For our Whitney decomposition we follow Lemma 2.8 in [14], whose proof is based on ideas from [ Properties (iv) and (v) are not explicitly stated in [14,Lemma 2.8], but they are direct consequences of (ii) and Lemma 3.2. The next lemma pertains to balls whose radius is comparable to their distance from the boundary. This, of course, includes but is not limited to actual Whitney balls.
The B i being Whitney balls, the collection This proves that N is bounded above by a constant only depending on the doubling constant.
The statement for measures then follows from Lemma 3.2.
By a domain D of X we understand a nonempty proper open subset of X with the property that every two points in D can be joined by a rectifiable curve entirely contained in D.
Definition 3.5. Let D ⊂ X be a domain, k ∈ {0, 1, 2, . . .}, and B j ∈ W(D) for j = 0, . . . , k. We say that C(B 0 , B k ) = (B 0 , . . . , B k ) is a (Whitney) chain joining B 0 to B k , if B j ∩ B j−1 = ∅ for every j ∈ {1, . . . , k}. In this case, we say that k is the length of the chain C(B 0 , B k ). The length of the shortest chain in D from B 0 to B k is denoted by k D (B 0 , B k ). Because there is no possibility of confusion, we drop the subscript D from now on.
We will be measuring distances in D in terms of the quasihyperbolic metric, which was introduced by Gehring in the 1970s to study quasiconformal mappings in R n ; see [11] and [10]. Definition 3.6. Let X be a geodesic space. For a domain D ⊂ X and two points x 1 , x 2 ∈ D, the quasihyperbolic distance between them is where the infimum is taken over all rectifiable curves γ ⊂ D with endpoints x 1 and x 2 . The quantity k D satisfies the axioms of a metric on D × D. A rectifiable curve γ : [0, 1] → D is called a quasihyperbolic geodesic if, for each pair of points y 1 , y 2 ∈ γ, it holds that .
. As there is no risk of ambiguity, we will leave out the subscript D in the following.
It is easy to see that the quasihyperbolic diameter of any Whitney-like ball is bounded, which is the content of the following lemma.
Lemma 3.7. Assume further that X is a geodesic space and let D ⊂ X be a domain. If B ⊂ D is a ball such that d(B, ∂D) ≈ rad(B), then k(x, y) ≤ C for any two points x, y ∈ B.
Proof. Let z denote the center of B, and let γ ⊂ B be a rectifiable curve connecting z and x such that ℓ(γ| [z,x] ) = d(z, x). Then Similarly we obtain k(z, y) ≤ C, and the triangle inequality implies k(x, y) ≤ C.
The next lemma establishes an equivalence between shortest Whitney chains and quasihyperbolic distance. It is essentially contained in the proof of Lemma 9 in [29]. For a detailed proof of the corresponding lemma in R n , see Proposition 6.1 in [18]. Notice that if the space X is geodesic and D ⊂ X is a proper subset, the distance functions d (·, ∂D) and d (·, X \ D) coincide over D. We are then allowed to use Lemmas 3.3 and 3.4 with the distance d (·, ∂D) instead of d (·, X \ D).
Lemma 3.8. Assume further that X is a geodesic space. Let D ⊂ X be a domain and Proof. Let M = k(B 1 , B 2 ) be the length of the shortest Whitney chain joining B 1 to B 2 . In the case x 1 = x 2 , both quantities amount to zero and there is nothing to prove. Suppose now x 1 and x 2 are distinct points. First, we prove k(B 1 , B 2 ) k(x 1 , x 2 ). Denote by γ the quasihyperbolic geodesic joining x 1 and x 2 , and take z to be an arbitrary point on γ. Of all the Whitney balls containing z, we choose the one with the smallest radius, say, B = B(x, r). Consider the ball B z centered at z and with radius r. It is clear that B z ⊂ 2B, and thus B z is contained in D with d (B z , ∂D) ≥ d (2B, ∂D) ≥ r by virtue of Lemma 3.3 (ii). Also, by the properties of the Whitney decomposition (Lemma 3.3 (ii)), we have and we conclude that d (B z , ∂D) ≈ rad(B z ) = r.
Let γ z be a subarc of γ ∩ B z passing through z and of maximal length. We claim that ℓ(γ z ) ≥ C 1 r at all times. Whenever γ is not entirely contained in B z , by the continuity of γ, there exists a point q ∈ γ z such that d(q, z) > r/2. Then we have ℓ(γ z ) ≥ d(q, z) = r/2. In the case γ ⊂ B z , by the properties of the Whitney decomposition there exists a constant 0 < c < 1 such that ℓ(γ z ) = ℓ(γ) ≥ d(x 1 , x 2 ) ≥ cr 1 . Furthermore, Lemma 3.4 (i) gives r ≈ r 1 and consequently ℓ(γ z ) ≥ C 1 r. Recalling that γ z ⊂ B z and d (z, ∂D) ≤ 8r, in all cases it holds that Next, we cover the geodesic γ by balls {B z i } i , with the points {z i } i ⊂ γ chosen so that every point is contained in at most two balls B z i . Among these collections we choose the one with the smallest cardinality, say m = #{B z i }. For any z ∈ γ, Lemma 3.4 (ii) shows that there are at most C Whitney balls intersecting B z . Now let M 1 be the minimal number of Whitney balls needed to cover i B z i , and denote this collection by F. Clearly M 1 ≥ M , because M was the length of the shortest chain joining B 1 and B 2 . Also, we have that # F = M 1 and, by minimality, for every B ∈ F there is at We obtain Cm ≥ M 1 ≥ M. Now, denoting γ i = γ ∩ B z i and applying (12) on each of these subarcs, we obtain the estimate As for the inequality in the other direction, take the the shortest chain We have k(x j , p j ) ≤ C and k(x j+1 , p j ) ≤ C owing to Lemma 3.7. Using the triangle inequality repeatedly, we obtain whereby the statement is proven.

Estimates for weights on Whitney chains
In a metric measure space X we call a domain D ⊂ X an extension domain for the Muckenhoupt class A p , if whenever w ∈ A p (D) there exists a W ∈ A p (X) such that W = w a. e. on D. Holden [17] gives certain sufficient conditions for extension domains in R n . Holden's strategy of proof is to verify Wolff's condition (1) by propagating estimates on cubes along Whitney chains. In this final section we adapt [17,Lemma 2] into the metric setting, resulting in Lemma 4.4 below. In Holden's Euclidean argument, [17,Lemma 2] is used to estimate integrals over each cube in a dyadic decomposition of Q ∩ E in terms of integrals over cubes arising from Holden's assumptions that enjoy additional good properties.
To put the extension problem in context, it is instructive to outline the situation regarding the space of functions of bounded mean oscillation (BMO). These are intimately related to Muckenhoupt weights: whenever a weight w belongs to A p , then log w is of bounded mean oscillation. Conversely, whenever f ∈ BMO, then exp(δf ) ∈ A p for small enough δ. Peter W. Jones [21] has shown that extension domains for BMO functions in the Euclidean space R n are precisely uniform domains, that can be characterized in terms of the quasihyperbolic metric. Vodop'yanov and Greshnov [29] extended Jones' characterization to metric spaces supporting a doubling measure. Recently, Butaev and Dafni [5] proved the analogue of Jones' characterization for functions of vanishing mean oscillation in R n .
For Muckenhoupt weights, the question remains open. Some examples and counterexamples concerning necessary or sufficient conditions for extension domains for A p are discussed by Holden [17] and Koskela in his corresponding review [25].
For the purposes of this section we need to introduce classical A p weights defined on a subset. Compare this to Definition 2.1. By L 1 loc (D) we denote the class of functions that are integrable on every compact subset of D.
The supremum is taken over all balls B ⊂ D. For p = 1, a nonnegative function w ∈ L 1 loc (D) belongs to A 1 (D) if there exists a constant C > 0 such that for all balls B ⊂ D We denote by [w] 1 the infimum of the C > 0 for which the inequality (14) holds.
Provided that the underlying measure µ satisfies a doubling condition and w is an A p weight, the weighted measure w dµ satisfies the doubling condition for balls B such that 2B ⊂ D. This property follows from statement (ii) of the next lemma, that collects some estimates for weights on balls and chains. Throughout the rest of the section, we will assume that (X, d, µ) is a complete metric measure space such that µ satisfies (2).
(iii) (the A ∞ condition) There exist constants 0 < C w , δ(w) < ∞, depending only on the doubling constant C d (µ) and the weight w, such that for all balls B ⊂ D and all measurable subsets .
(iv) Assume further that D is a domain. If B 1 , B 2 ∈ W(D), then where C is a constant only depending on C d , p, and [w] p .
Proof. To prove (i), we may assume that p > 1 because A 1 (D) ⊂ A 2 (D). Now, the inequality (i) follows from the A p condition (Definition 4.1). Indeed, notice that the function t → exp −t(p − 1) −1 is convex, and apply Jensen's inequality: .
When p > 1, the statement (ii) is a consequence of the A p condition (Definition 4.1): where the last estimate follows from Hölder's inequality. Besides, when p = 1, w ∈ A 1 (D) implies For a proof of the A ∞ condition (iii) we refer to [28], Theorem I. 15. There, the weights are globally defined in X, but the proof for weights in A p (D) is exactly the same. Indeed, provided that w satisfies a reverse Hölder inequality with exponent 1 + δ over balls B ⊂ D (compare Proposition 2.11), using it and the classical Hölder inequality we have for all balls B ⊂ D and all measurable subsets E ⊂ B. The fact that w satisfies a reverse Hölder inequality can be proven using a version of Gehring's lemma for weights in A p (D), whose proof is similar to that for A p (X) weights because in Definition 4.1 we only consider balls that are entirely contained in D. A proof of Gehring's lemma for A p (X) weights can be found in [4], p. 77.
Finally, let us prove (iv). Let B j = B(p j , r j ) and B j+1 = B(p j+1 , r j+1 ) be two consecutive balls in the chain C(B 1 , B 2 ). Then B j ∩ B j+1 = ∅. To begin with, we show that there is a constant C such that To this effect, let y ∈ B j ∩ B j+1 and suppose first that d (y, p j+1 ) < 1 8 r j+1 . For any z ∈ X, we have 1 8 r j+1 in the above and applying (iv) of Lemma 3.3, we have d (z, p j ) < 1 8 r j+1 + r j + 1 8 r j+1 ≤ 1 4 · 4r j + r j = 2r j , which shows that 1 8 B j+1 ⊂ 2B j ⊂ D as guaranteed by (i) of Lemma 3.3. Using (ii) of the current lemma and the fact that µ is doubling, we may write which proves (15). Now suppose that d (y, p j+1 ) ≥ 1 8 r(B j+1 ). The balls B * j+1 = B(y, 1 8 r j+1 ) and 1 8 B j+1 have the same radius and d (y, p j+1 ) ≈ 1 8 r j+1 . Then, by Lemma 3.2 and the doubling condition (2), it holds that µ(B * j+1 ) ≈ µ 1 8 B j+1 ≈ µ(B j+1 ). Using the triangle inequality, Lemma 3.3 (iv), and the fact that y ∈ B j ∩ B j+1 , we easily obtain for a z ∈ B * j+1 d(z, p j+1 ) ≤ d (z, y) + d(y, p j+1 ) ≤ 1 8 r j+1 + r j+1 < 2r j+1 , d (z, p j ) ≤ d (z, y) + d(y, p j ) ≤ 1 8 r j+1 + r j ≤ 3 2 r j < 2r j , which implies that B * j+1 ⊂ 2B j+1 ∩ 2B j . Applying (ii) of the current lemma, we conclude that Thus, in any case we have B j+1 w dµ [w] p B j w dµ. Reversing the roles of B j and B j+1 , we obtain B j w dµ ≈ B j+1 w dµ, where the constants involved depend on p, the doubling constant, and [w] p . Furthermore, by Lemma 3.3 (v), there exists a constant C 1 such that Recalling that k(B 1 , B 2 ) is the number of balls in W(D) in the shortest chain from B 1 to B 2 , we apply this recursively to obtain Choose C = log C 1 to get the desired expression.
Remark 4.3. In the proof of property (iv) above, we in fact showed that whenever µ is doubling and w ∈ A p (D), then for any two Whitney balls B 1 , B 2 ∈ W(D) such that B 1 ∩ B 2 = ∅ it holds that B 1 w ≈ B 2 w. Statement (ii) is a "reverse A ∞ condition" that follows immediately from the A p condition. Namely, whenever E ⊂ B, then Proof. Let B ′ i = B(z ′ i , r ′ i ) ∈ W(D), i = 1, 2, contain the centers of B 1 = B(z 1 , r 1 ) and B 2 = B(z 2 , r 2 ) respectively. Lemma 3.4 (iii) guarantees that there exist balls B ′′ i ⊂ B i ∩ B ′ i , i = 1, 2, such that rad(B ′′ i ) ≈ rad(B ′ i ) ≈ rad(B i ) and µ(B ′′ i ) ≈ µ(B ′ i ) ≈ µ(B i ). Furthermore, it holds that k(z ′ 1 , z ′ 2 ) ≤ C. To see this, let x 1 , x 2 be points contained in B 1 and B 2 respectively such that k(x 1 , x 2 ) ≤ k(B 1 , B 2 ) + C. Using the triangle inequality for k we have k(z ′ 1 , z ′ 2 ) ≤ k(z ′ 1 , z 1 ) + k(z 1 , x 1 ) + k(x 1 , x 2 ) + k(x 2 , z 2 ) + k(z 2 , z ′ 2 ). Observe that z i ∈ B ′ i , x i ∈ B i , and k(x 1 , x 2 ) ≤ 2C. By Lemma 3.7, the quasihyperbolic diameters of the balls B i and B ′ i are uniformly bounded, and we have k(z ′ 1 , z ′ 2 ) ≤ C 1 .