A Talenti-type comparison theorem for $\mathrm{RCD}(K,N)$ spaces and applications

We prove pointwise and $L^{p}$-gradient comparison results for solutions to elliptic Dirichlet problems defined on open subsets of a (possibly non-smooth) space with positive Ricci curvature (more precisely of an $\mathrm{RCD}(K,N)$ metric measure space, with $K>0$ and $N\in (1,\infty)$). The obtained Talenti-type comparison is sharp, rigid and stable with respect to $L^{2}$/measured-Gromov-Hausdorff topology; moreover, several aspects seem new even for smooth Riemannian manifolds. As applications of such Talenti-type comparison, we prove a series of improved Sobolev-type inequalities, and an $\mathrm{RCD}$ version of the St.~Venant-P\'olya torsional rigidity comparison theorem (with associated rigidity and stability statements). Finally, we give a probabilistic interpretation (in the setting of smooth Riemannian manifolds) of the aforementioned comparison results, in terms of exit time from an open subset for the Brownian motion.


Introduction
In the study of geometric and variational problems in Euclidean spaces, a tool which often proves useful is the technique of symmetrization: one can frequently simplify a complex problem by reducing it to the study of spherically symmetric objects. Specifically, the classical notion of Schwarz symmetrization of a function plays a notable role in proving results such as the Rayleigh-Faber-Krahn Inequality, as well as several variational inequalities for differential boundary problems. The rough idea is the following: for any bounded measurable domain Ω ⊂ R n , one considers the unique ball Ω ⋆ ⊂ R n centered at the origin and having the same volume of Ω; then, given a measurable function u : Ω → [0, ∞), one constructs a "symmetrized" function u ⋆ : Ω ⋆ → [0, ∞) which is radial, decreases in the radial variable, and its super-level sets {u ⋆ > t} have the same Lebesgue measure as the corresponding super-level sets {u > t} of u.
The idea of using symmetrizations to infer comparison results for elliptic boundary value problems goes back (at least) to the proofs by Faber [Fab23] and Krahn [Kra25] of Lord Rayleigh's conjecture about the principal frequency for an elastic membrane, and to the work of Szegő [Sze50;Sze58] on the clamped and buckling plate problems. Estimates on solutions to differential boundary value problems via Schwarz symmetrization have been then obtained by several mathematicians, let us mention Weinberger [Wei62], Bandle [Ban76], Talenti [Tal76], P. L. Lions [Lio79], Alvino-Lions-Trombetti [ATL90]. The corresponding paradigmatic result is now well known in the literature as "Talenti comparison theorem", and we keep such terminology.
The basic idea is to compare the outcomes of the following two procedures: (a) Solve a Poisson problem of the type with f ∈ L 2 (Ω); then consider the Schwarz symmetrization u ⋆ of u.
The aim of the present work is to generalize such a comparison result to a curved, possibly non-smooth, setting. The framework of the paper is the one of metric measure spaces with Ricci curvature bounded below (by a constant K > 0) and dimension bounded above (by N ∈ (1, ∞)) in a synthetic sense, via optimal transport. Recall that a metric measure space is a triplet (X, d, m) where (X, d) is a complete separable metric space, and m is a non-negative Borel measure finite on bounded sets. More precisely, the paper will be in the framework of RCD(K, N ) spaces, with K > 0 and N ∈ (1, ∞). We refer the reader to Section 2.2 for more details about the definition and the relevant literature; for the sake of this introduction, we only mention that the class of RCD(K, N ) spaces includes as remarkable examples: • Riemannian manifolds with Ricci curvature ≥ K and dimension ≤ N , as well as their measured-Gromov-Haudorff limits; • Alexandrov spaces with Hausdorff dimension ≤ N and curvature ≥ K/(N − 1).
Moreover, if K > 0, a generalized version of the Bonnet-Myers theorem implies that spt(m) is compact and thus m(X) < ∞. Up to a constant normalization of the measure, we can thus assume that m(X) = 1 (see Remark 2.7). Let us stress that the results of the paper seems new even for smooth Riemannian manifolds with Ricci curvature bounded below by a positive constant. It is worth to mention that, while in the Euclidean setting the Schwarz symmetrization is defined on balls in the very same Euclidean space, for the curved setting of an RCD(K, N ) space the symmetrization is defined on a "model space" depending only on K > 0 and N ∈ (1, ∞). Such a model space is given by an interval J K,N of the real line, endowed with the Euclidean distance and a measure which is absolutely continuous with respect to the Lebesgue measure: where c K,N is a normalizing constant. Observe that, when N ≥ 2 is an integer, such a model space naturally corresponds to a round sphere of dimension N and constant Ricci curvature K (see Remark 2.9). The main result of the paper is a Talenti-type comparison theorem where we compare the weak solution to a Poisson problem as in (1) defined on an open set Ω of an RCD(K, N ) space (K > 0, N ∈ (1, ∞)) with the solution of an analogous Poisson problem defined on the model space (3) (see Theorem 3.10). Actually, we consider more generally any second order elliptic operator arising as infinitesimal generator of any strongly local, uniformly elliptic bilinear form (see Section 3). The comparison is (trivially) sharp as equality is attained in the model space (3), which is RCD(K, N ).
We will also establish: • A rigidity result (Theorem 4.4) roughly stating that if equality in the Talenti-type comparison Theorem 3.10 is achieved, then the space is a spherical suspension; • A stability result (Theorem 4.15) roughly stating that equality in the Talenti-type comparison Theorem 3.10 is almost achieved (in L 2 -sense) if and only if the space is mGH-close to a spherical suspension.
Finally, as applications of the Talenti-type comparison Theorem 3.10, we will establish: • A series of Sobolev-type inequalities that to best of our knowledge are new in the framework of RCD(K, N ) spaces (Corollary 5.2); • An RCD(K, N ) version of the St. Venant-Pólya torsional rigidity comparison theorem, with associated rigidity and stability statements (Theorem 5.3).
• A probabilistic interpretation (in the setting of smooth Riemannian manifolds) of the comparison results obtained in the paper, in terms of exit time from an open subset for the Brownian motion (Corollary 6.3).
For the reader's convenience, the Appendix gives a self-contained presentation of the statements of the main results for a smooth Riemannian manifold with positive Ricci curvature (as several aspects seem to be new even in this setting).
Definition 2.2 (Perimeter). Let E ∈ B(X), where B(X) denotes the class of Borel sets of (X, d), and let A ⊂ X be open. We define the perimeter of E relative to A as: where (lip u n )(x) is the slope of u at the point x. If Per(E; X) < ∞, we say that E is a set of finite perimeter.
When E is a fixed set of finite perimeter, the map Finally, we recall the notion of Cheeger energy of an L p function, which will be used to define Sobolev spaces on metric measure spaces. For a review of this theory, we refer the reader to [AGS14a;Amb18], as well as the pioneering work [Che99]. As shown in those references, the definition of W 1,p through the Cheeger energy is not the only approach available, but one can prove that other relevant strategies (e.g. Newtonian spaces) turn out to be equivalent in the framework of this paper.
Definition 2.4 (Cheeger energy). Let (X, d, m) be a metric measure space, let p ∈ (1, +∞) and let f ∈ L p (X, m). The p-Cheeger energy of f is defined as where (lip f n )(x) is the slope of f n at the point x.
Definition 2.5 (Sobolev spaces). Given (X, d, m) metric measure space, p ∈ (1, +∞), and an open subset Ω ⊂ X, we define: 1. The space W 1,p (X, d, m) as the space of functions f ∈ L p (X, m) with finite p-Cheeger energy, endowed with the norm which makes W 1,p (X, d, m) a Banach space. 2. The space W 1,p 0 (Ω) as the closure of Lip c (Ω) with respect to the norm of W 1,p (X, d, m). For any f ∈ W 1,p (X, d, m), one can single out a distinguished object |∇f | w ∈ L p (X, m), which plays the role of the modulus of the gradient and provides the integral representation this function is called the minimal p-weak upper gradient of f and can be obtained through an optimal approximation in Equation (5); in order to keep the notation clearer, from now on we will omit the subscript w and simply denote the minimal weak upper gradient of f as |∇f |. We refer the reader to [HKST15; BB11; Che99; AGS14a] for details. A priori the minimal p-weak upper gradient may depend on p; however in locally doubling and Poincaré spaces (and RCD(K, N ) spaces are so, see [Stu06b;Raj12]) it is independent of p by the deep work of Cheeger [Che99]. We now introduce a local notion of Sobolev space, which will be needed in Section 4.2, and relies on the definition given in [AH18, Definition 2.14]. We specialize to the case p = 2, which is the only one we will use. Definition 2.6 (Local Sobolev space). Let (X, d, m) be a metric measure space and let Ω ⊂ X be an open subset. We say that f ∈ L 2 (Ω, m) belongs to W 1,2 (Ω, d, m) if (a) for any φ ∈ Lip c (X, d) with spt(φ) ⊂ Ω, it holds φf ∈ W 1,2 (X, d, m) (where W 1,2 (X, d, m) is the global Sobolev space defined in Definition 2.5); (b) |∇f | ∈ L 2 (Ω, m).
Notice that the property (a), together with the locality properties of the minimal weak upper gradient, guarantees that the condition in (b) is well posed (see again [AH18]).

Curvature-dimension bounds and infinitesimal Hilbertianity
All the results in the paper will be in the framework of RCD(K, N ) spaces. We recall here very briefly and schematically the main definitions involved (for more details see the original papers [LV09; Stu06a; Stu06b; AGS14b; AGMR15; Gig15; EKS15; AMS19; CM16], or [Amb18] for a survey on the subject). In what follows, (X, d, m) will be a complete and separable metric measure space, and K, N will be real numbers with N ∈ (1, ∞).
• For any metric space (Y, d Y ), we denote by P(Y) the space of Borel probability measures on Y, and by P 2 (Y) the space of Borel probability measures with finite second moment.
• The Wasserstein distance W 2 on P 2 (X) is defined as for any µ 0 , µ 1 ∈ P 2 (X), where π (0) is the projection on the first component, π (1) is the projection on the second component, and the subscript ♯ indicates the pushforward of the measure.
• The space Geo(X) is the space of constant speed geodesics on X: For any t ∈ [0, 1], the evaluation map e t is defined on Geo(X) as e t (γ) . = γ(t) for any γ ∈ Geo(X).
• For any θ > 0 and t ∈ [0, 1], the distortion coefficients are defined as • CD condition: we say that (X, d, m) verifies the CD(K, N ) condition for some K ∈ R, N ∈ (1, ∞) if: for any pair of probability measures µ 0 , µ 1 ∈ P(X) with bounded support and with µ 0 , µ 1 ≪ m, there exists ν ∈ OptGeo(µ 0 , µ 1 ) and an optimal plan π ∈ P(X × X) such that • We say that (X, d, m) is infinitesimally Hilbertian if the Cheeger energy Ch 2 defined in (5) is a quadratic form on W 1,2 (X, d, m). In that case, we still denote by Ch the symmetric bilinear form associated to Ch = Ch 2 .
• We say that (X, d, m) satisfies the RCD(K, N ) condition if it satisfies the CD(K, N ) condition and it is infinitesimally Hilbertian.
Remark 2.7 (Scaling properties and standard normalizations). One can define the RCD(K, N ) condition for a complete and separable metric space endowed with a non-negative Borel measure which is finite on bounded subsets. From the very definitions, it is not difficult to check that for any λ and c > 0 the following implication holds If K > 0, the Bonnet-Myers Theorem (proved for CD(K, N ) spaces in [Stu06b]) implies that (X, d) is compact with m(X) ∈ (0, ∞). Thanks to the scaling property (7), up to constant scalings, it is not restrictive to assume m(X) = 1 and K = N − 1.

1-dimensional model spaces
In this Section we recall the 1-dimensional "model" metric measure spaces with Ricci curvature bounded below by K > 0 and dimension bounded above by N ∈ (1, ∞) singled out in [Gro07, Appendix C] and [Mil15] on which we will construct the needed symmetrizations. Let K > 0 and N ∈ (1, ∞). Let J K,N be the interval and define the following probability density function on J K,N : Definition 2.8 (Model spaces). Let K > 0 and N ∈ (1, ∞). We define the one dimensional model space with curvature parameter K and dimension parameter N as (J K,N , d eu , m K,N ), where m K,N . = h K,N L 1 J K,N and d eu is the standard euclidean distance.
Remark 2.9. When N ∈ N, m K,N ([0, x]) represents the measure of the geodesic ball of radius x on the N -dimensional sphere of Ricci curvature K, endowed with the canonical metric. Notice however that Definition 2.8 makes sense when N is not a natural number as well.
Notation 2.10. For the sake of convenience, we will also denote by H K,N the cumulative distribution function of m K,N , i.e.: The following Lemma is an elementary consequence of the definitions of h K,N and H K,N : Lemma 2.11. Let K > 0 and N ∈ (1, ∞) be fixed. Then: Moreover, for any r 1 ∈ 0, π N −1 and For the model space J K,N defined before, we can find an almost explicit expression for the isoperimetric profile.
Lemma 2.12 (Isoperimetric profile of J K,N ). The isoperimetric profile I K,N of the model space is given by the following formula: Moreover, the inf in Equation (4) is attained at the intervals where D K,N . = π N −1 K . In other words: I K,N (v) coincides with the density function computed at the point x such that Proof. The proof is a slight modification of [Bob96], we include it here for the reader's convenience. Thanks to [CM18, Proposition 3.1], we know that if E has finite perimeter in J K,N , then it is m K,N -equivalent to a countable union of closed disjoint intervals, i.e. there exists a sequence of thus it suffices to consider such unions. Moreover, by the same result, if Equation (9) holds then one has: Step 1: We claim that the intervals in Equation (8) are minimal among the class of closed intervals. Let v ∈ (0, 1); notice that the problem trivializes at 0 and 1. We denote by f v : that is: By differentiating with respect to x, one finds: .
By easy computations, one can see that the map z → thus it is always decreasing; on the other hand, f v (·) is strictly increasing. As a consequence, the map x → hK,N (x) is strictly decreasing; moreover, it tends to +∞ when x ↓ 0, while it tends to −∞ when x ↑ H −1 K,N (1 − v). This means there exists a value x v such that p ′ v > 0 on (0, x v ) and , we conclude that the sets in Equation (8) are minimal for the perimeter among intervals.
We also notice that must hold. Indeed, by exploiting the symmetry of h K,N (i.e., the fact that h K,N (D K,N − x) = h K,N (x) for any x ∈ J K,N ), it is easy to see that for any x ∈ 0, As a consequence, Since p v attains its maximum uniquely at Step 2: We claim that the intervals in Equation (8) are also minimal among finite unions of closed intervals. Let now We will move each interval to the left or to the right, keeping the measure constant and lowering the perimeter. Notice that at least one of the following conditions holds true: > x vn (here Equation (10) has been used). Up to a reflection, we can assume without loss of generality that a 1 < x v1 . Then we define E 0 as E 0 now has the same measure as E and smaller perimeter. If n = 2, we skip to the end of the procedure; if otherwise n > 2, we proceed inductively in the following way: at each step 1 ≤ j ≤ n − 2, the set E j−1 will be the union of n + 1 − j closed intervals: with a j 1 = 0. We consider the second of those intervals: The new set E j is a union of n − j closed intervals, having the same m K,N -measure of E j−1 and smaller or equal perimeter.
At the end of the procedure, we are left with the union of two intervals; applying the same argument once again, the final setẼ is either the interval [0, f v (0)] (in which case the claim is proven), or a union of type [0,b] ∪ [ã, D K,N ]. In the latter case, however, we can repeat the above argument for the interval [b,ã] and the measure 1 − v: we move it to the left or to the right applying the same criterion as before, and take the complementary in J K,N . This is an interval of the same type as Equation (8), with the same measure of E but lower perimeter.
Step 3: Finally, we show that the intervals in Equation (8) are also minimal among countable unions of disjoint intervals. Assume E = i∈N [a i , b i ]. Since E has finite perimeter, the only accumulation points for the a i 's can be 0 and D K,N . Assume 0 is an accumulation point; fixī such that bī < DK,N 4 and let I .
has the same measure and lower perimeter than E. Repeating, if necessary, the procedure at D K,N , we find a set which is a finite union of closed intervals and lowers the perimeter of E, so we can recover the result from Step 2.

Rearrangements and symmetrizations
Throughout the section (X, d, m) will be a metric measure space with m(X) = 1 and Ω ⊂ X an open subset.
Definition 2.13 (Distribution function). Let u : Ω → R be a measurable function. We define its distribution function µ = µ u : [0, +∞) → [0, m(Ω)] as Remark 2.14. Our definition of distribution function differs from the one adopted in [Kes06], but coincides instead with the one used in the original paper by Talenti [Tal79]: indeed, [Kes06] defines µ(t) as the measure of the superlevel {u > t} for any t ∈ R.
Definition 2.15 (Decreasing rearrangement u ♯ ). Let u : Ω → R be a measurable function. We The decreasing rearrangement u ♯ plays the role of a generalized inverse of the distribution function µ = µ u : • if µ is continuous att with µ(t) =s, and µ is not constant in any interval of the type [t,t + δ) with δ > 0, then u ♯ (s) =t; • if µ is continuous att with µ(t) =s, and [t,t +δ) is the largest interval of this type on which µ is constant, then u ♯ (s) =t +δ; • if µ has a jump discontinuity att, with lim τ →t ± µ(τ ) =s ± , then u ♯ (s) =t for any s ∈ (s − ,s + ]. As the name itself suggests, u ♯ can be easily shown to be non-increasing; moreover, it is by definition left-continuous. Finally, we define the Schwarz symmetrization of a function u defined on a RCD(K, N ) space. Notice that the condition CD(K, N ) on curvature and dimension, together with the assumption that (X, d, m) is essentially non-branching, would be enough to ensure a Pólya-Szegő inequality, as shown in [MS20].
Definition 2.16 ((K, N )-Schwarz symmetrization). Let (X, d, m) be a metric measure space satisfying the RCD(K, N ) condition for some K > 0 and N ∈ (1, ∞). Let Ω ⊂ X be a Borel subset with measure m(Ω) = v ∈ [0, 1] and u : Ω → R be a Borel measurable function. Let Remark 2.17. Being the composition of H K,N , which is increasing, and u ♯ , which is non-increasing, u ⋆ is still a non-increasing function. We state here a collection of useful facts concerning the decreasing rearrangement of a function: these are quite standard and can be found for instance in [Kes06, Chapter 1] in the context of Euclidean spaces (grounding on a slightly different definition of µ u , see our Remark 2.14); the proofs contained there still work with very few straightforward modifications.
for all t > 0. The same identities hold true with the symbols ≥, <, ≤ instead of >.
The converse implications also hold. In that case, moreover,

Lemma 2.19.
Let Ω ⊂ X have finite measure; let f : Ω → R be integrable and let E ⊂ Ω be measurable. Then: Proof. The proof is analogous to the one proposed in [Kes06, Chap. 1] in Euclidean setting, we report it briefly for the reader's convenience. Preliminarily, we observe that thus we can assume without loss of generality that f is non-negative. First notice that, by equimeasurability, Moreover, for any t ∈ R, we have: x As a consequence, taking the infimum of the two sets in the previous inclusion, we get the inequality which gives, together with Equation (13), the desired result.
Finally, we give a (necessary and) sufficient condition for a function to coincide with its (K, N )-Schwarz symmetrization.
Lemma 2.20. Let φ : J K,N → [0, +∞) be a non-increasing and non-negative function. Then out of a countable set. Let L ⊂ J K,N be the set of points where φ is not left continuous (which is countable since φ is nonincreasing), and fix any s Assume by contradiction that the inequality in (15) is strict for some s 0 ∈ (0, 1] \ H K,N (L). Then there exists ε > 0 such that Since by assumption φ is left-continuous at Since The combination of (16), (17) and (18) yields the contradiction ). This concludes the proof.

Poisson problem on the model space
As already mentioned, the main content of this note is a comparison between the symmetrization of the solution of an elliptic problem on (X, d, m) and the solution of a symmetrized problem on the model space. We define here the "model problem" on the unidimensional space J K,N (see for example [Amb18, Section 3] for more details about Laplacians on weighted spaces).
Notation 2.21 (Sobolev space on J K,N ). For a subinterval I ⊂ J K,N , we define where v ′ is the distributional derivative defined by We will also endow such space with the norm v W 1,2 (I,deu,mK,N ) .
Remark 2.22. The Sobolev space in Notation 2.21 coincides with the local Sobolev space already defined in Definition 2.6, specializing the latter to the metric measure space (I, d eu , m K,N ).
Remark 2.24. The coefficient (19) can be computed explicitly: indeed, for any x ∈J K,N we have: Accordingly with Definition 2.23, given an interval I ⊂ J K,N and f ∈ L 2 (I, m K,N ), we say that a function w is a weak solution to −∆ K,N w = f in I (with appropriate boundary conditions) if it solves in a distributional sense. In particular, we will be interested in the following Dirichlet problem: if: (ii) Boundary condition: w ∈ W 1,2 0 ([0, r 1 ), d eu , m K,N ), where the latter space is the closure of C ∞ c ([0, r 1 )) in the topology of W 1,2 (I, d eu , m K,N ).
Remark 2.26. The intuition behind this choice of boundary conditions is the following. When N is an integer, we think of (J K,N , d eu , m K,N ) as the sphere S = S N K of dimension N and Ricci curvature K. Consider a geodesic ball B r1 (p) ⊂ S; we look for radial solutionsŵ( Then the condition w(r 1 ) = 0 comes from the Dirichlet condition on ∂B r1 (p).
In the next proposition, we give an explicit solution to the problem in (20).
The problem in Equation (20) admits a unique weak solution w ∈ W 1,2 (I, d eu , m K,N ), which can be represented as or equivalently as Proof. As a preliminary fact, notice that the two expressions are actually equivalent, since and by Lemma 2.12 it holds that We have used the change of variables t = H K,N (s) in the internal integral and the change of variables σ = H K,N (r) in the external integral.
We first show that a weak solution must coincide with the function in Equation (21), and then we prove that such function is actually a solution to Equation (20).
Step 1: Let w ∈ W 1,2 (I, d eu , m K,N ) be a weak solution to Equation (20). We prove that the weak derivative of w coincides m K,N -a.e. with the function Indeed, for any test function φ ∈ C ∞ c ([0, r 1 )) one has, by the Fubini-Tonelli Theorem: Thus, since w is a weak solution to Equation (20), for any φ ∈ C ∞ c ([0, r 1 )) By a classical result (see for example [Bre11,Lemma 8 x ∈ I. This however implies that for any hence C = 0. Now w is a W 1,2 (I, d eu , m K,N ) function, thus in particular it belongs to W 1,2 ((ε, r 1 ), d eu , L 1 ) for any ε > 0; moreover, w satisfies w ′ = g a.e. and w(r 1 ) = 0. Thus, by well known results about Sobolev functions on intervals (see [Bre11,Theorem 8.2], w coincides with the function in Equation (21) for m K,N -a.e. ρ ∈ I.
Step 2: Let now w be defined as in Equation (21). Since the integrand is continuous on (0, r 1 ], w is a C 1 function on (0, r 1 ] (with w(r 1 ) = 0). By straightforward computations, we show that w and w ′ are L 2 (I, m K,N ) functions. Indeed, by Hölder inequality we have that (25) thus, by Lemma 2.11, where C 1 and C 2 are constants depending only on which is finite, again by Lemma 2.11. Moreover, exploiting again Equation (25), , we can conclude that the boundary condition in Definition 2.25 is satisfied.
Finally, by tracing back the identity in Equation (23), the very same argument shows that w is a weak solution to Equation (20).
Remark 2.28. Notice that the derivation of the solution still works in the case r 1 = π N −1 K , provided that the following compatibility condition on f holds true: However, this case will not be treated in this article.

A Talenti-type comparison theorem for RCD(K, N ) spaces
In this Section, we prove a version of Talenti's comparison theorem in the RCD setting. The proof is along the lines of (and generalises to the RCD setting) the approach in the Euclidean framework, e.g. [Kes06, Section 3.1]. Apart from the technical difficulties of working in a non-smooth setting, the key point is to replace the Euclidean isoperimetric inequality by the Levy-Gromov isoperimetric inequality.
Let (X, d, m) be a metric measure space verifying the RCD(K, N ) condition for some K > 0 and N ∈ (1, ∞). Let Ω ⊂ X be an open domain.
Assumption 3.1. From now on we will assume E : L 2 (X, m) × L 2 (X, m) → [−∞, ∞] to be a non-negative definite bilinear form satisfying the following properties: (b) α-uniform ellipticity: there exists α > 0 such that for any u ∈ L 2 (X, m) (c) E is of order 1: there exists β > 0 such that E(u, u) ≤ β u 2 W 1,2 (Ω,d,m) for every u ∈ W 1,2 (Ω, d, m). Definition 3.2 (Domain of L E ). Let E be a uniformly elliptic bilinear form as in Assumption 3.1. We define the domain of L E as the set  d, m)). Let E be a uniformly elliptic bilinear form as in Assumption 3.1; let Ω ⊂ X be an open domain and let f ∈ L 2 (Ω, m). We say that a function u ∈ W 1,2 (X, d, m) is a weak solution to the Dirichlet problem Remark 3.4. An alternative (but slightly less general) approach would be to adopt the language of differential calculus on metric measure spaces, as introduced for example in [Gig18]. In particular, let A be an element of the L 2 (X)-normed L ∞ (X)-module L 2 (T * X) ⊗ L 2 (T * X) and assume it is concentrated on Ω. Assume there exists α > 0 such that for any where we have denoted by |·| the pointwise norm of X, and by L 2 (T X) Ω the sub-module of the tangent module whose elements are concentrated on Ω. Recall now that for an infinitesimally Hilbertian metric measure space X and a function u ∈ W 1,2 (X, d, m) we can define the gradient ∇u ∈ L 2 (T X) as the image of the differential du ∈ L 2 (T * X) through the canonical isomorphism between the two L ∞ -modules. If we denote by then for any f ∈ L 2 (Ω, m), we say that u is a weak solution to the equation Before passing to the proof of the main comparison theorem, we establish few auxiliary results. We begin with a simple Lemma which only requires (X, m) to be a measure space and Ω ⊂ X to be measurable with finite measure.
Then F is differentiable out of a countable set C ⊂ R, and Proof. The proof is quite standard, however we recall it for the reader's convenience.
First of all notice that m({u = t}) > 0 for an at most countable set C ∈ R. Let t ∈ R \ C and h > 0. Then The right hand side converges to 0 by Hölder inequality and continuity of the measure, recalling that m({u = t}) = 0. An analogous procedure works for F (t − h) − F (t): we find taking the limit as h → 0, this gives the claimed identity.
where µ = µ u is the distribution function of u and |∇u| denotes the minimal 2-weak upper gradient of u.
Proof. Let t > 0 be fixed, and consider the following test function: It is easy to see that v t still belongs to the space W 1,2 0 (Ω), thus it can be used as a test function in Equation (28) to obtain By applying Lemma 3.5 we obtain that, for L 1 -a.e.
For fixed t > 0 and h > 0, by bilinearity of E it holds that Moreover, we can explicitly write (33) Notice that, by strong locality and bilinearity of E, for any B ∈ B(X) In particular, it follows from Equations (32) to (34) that By α-uniform ellipticity, then, the following estimate holds true: Consequently, the following chain of inequalities holds for all t ∈ R and h > 0: Hence, if t is a differentiability point for t → E(u, v t ), letting h → 0 and using Equation (31) we get exactly the desired result.
We now state a suitable version of the coarea formula which can be found in [Mir03,Remark 4.3] for a general version in metric measure spaces, and in [MS20, Theorem 2.12] for a contextualization in RCD spaces (the identity in the form we state follows from the latter by a monotone convergence argument). Notice that the most general theorem works for functions of bounded variation (see again [Mir03]). Proposition 3.7 follows from such a BV version combined with [GH16, Remark 3.5], and by the fact that the CD(K, N ) condition with N ∈ (1, ∞) implies properness of the space (implies local doubling, thus properness [Stu06b]).
Next, we recall the Lévy-Gromov isoperimetric inequality in RCD spaces, as obtained by Cavalletti and Mondino in [CM17] (for the Minkowski content) and in [CM18] (for the perimeter).
In particular, the isoperimetric profile of (X, d, m) is bounded from below by I K,N .
By differentiating the coarea formula (37) and exploiting the Lévy-Gromov inequality (38) we get: We have now the tools needed to prove our first main result.
where I = [0, r v ), r v > 0 is such that m K,N ([0, r v )) = m(Ω), and f ⋆ is the Schwarz symmetrization of f . Then 2. For any 1 ≤ q ≤ 2, the following L q -gradient estimate holds: Remark 3.11. The Dirichlet problem in Equation (39) can be explicitly rewritten as , by the definition of ∆ K,N and H K,N .
Proof. Proof of 1. By combining Lemma 2.19, Lemma 3.6 and Corollary 3.9, we obtain the following chain of inequalities: for almost every t > 0, which can be rewritten as Let now 0 ≤ τ ′ < τ ≤ M . Integrating Equation (42) from τ ′ to τ we get Using the change of variables ξ = µ(t) on the intervals where µ is absolutely continuous, and observing that the integrand is non negative, we obtain Let us fix s ∈ (0, µ(0)) and let η > 0 be a small enough parameter (that will eventually tend to 0); consider τ ′ = 0 and τ = u ♯ (s) − η. Notice that, since u ♯ (s) is the infimum of theτ such that µ(τ ) < s, we have that µ(τ ) ≥ s. Using again the non-negativity of the integrand, for any η > 0 we obtain that ∀s ∈ (0, µ(0)).
Notice that on (µ(0), m(Ω)) the function u ♯ vanishes. Finally, by the definition of the symmetrized function u ⋆ = u ♯ • H K,N , we obtain Now we can recognize that the right hand side coincides with the characterization of w we obtained in Equation (22) (Section 2.5), since r v was chosen so that H K,N (r v ) = m(Ω). Note that, since the integrand is non-negative, w is non-increasing, and takes the value zero at r v .
Proof of 2. We start by noticing that since |∇u| = 0 m-a.e. on {u = κ} for any κ ∈ R. Let M := ess sup Ω |u|; fix t > 0 and 0 < h < M − t. By using the Hölder inequality (with exponents 2 q and 2 2−q ) one gets By the very same computations we already performed in Lemma 3.6, exploiting the test functions v t ∈ W 1,2 0 (Ω) defined in Equation (30) Let us now adopt again the notation as in Equation (43). Exploiting again Lemma 2.19, we get: for almost every t. In order to obtain a clean term µ ′ (t) at the right hand side, we multiply both sides of Equation (47) with the respective sides of Equation (42) raised at the power q 2 . This gives, for almost every t ∈ (0, M ): (46) and changing the variables as usual with ξ = µ(t), the following estimate holds:

Inserting this last inequality in Equation
Finally, we recall that w has an explicit expression we can differentiate: by differentiating Equation (21) (with datum f ⋆ α ), we find for all ρ ∈ (0, r v ) Thus, the following identity holds true: where we have used the change of variables ξ = H K,N (ρ) and the fact that I K,N (ξ) = h K,N (H −1 K,N (ξ)). Comparing with Equation (48), we obtain the claimed L q -gradient estimate.

Rigidity in the Talenti-type theorem
Let u ∈ W 1,2 0 (Ω) and w ∈ W 1,2 ([0, r v ), d eu , m K,N ) be as in Theorem 3.10. The next problem we want to approach is the equality case, that is, what we can say about the original metric measure space when u ⋆ = w; in fact, we will prove that if the equality is attained at least at one point, then the metric measure space is forced to have a particular structure, namely it is a spherical suspension. We recall that, in the Euclidean case Ω ⊂ R n , the condition u ⋆ = w forces Ω to be a ball and both u and f to be radial.
In order to tackle this question, we recall the definition of a spherical suspension, we state the Rigidity Theorem for the Lévy-Gromov inequality (as proved in [CM18]) and the Pólya-Szegő Theorem for RCD(K, N ) spaces, which was proved in [MS20].
Given N ≥ 1, we define B × N f F to be the metric measure space where ∼ is the equivalence relation associated to the pseudo-distance d and m Just for simplicity, the following results are stated in the case of RCD(N − 1, N ) spaces; indeed when K > 0 it is not restrictive to assume K = N −1 by (7). Notice, moreover, that this assumption only affects the Rigidity statements, while the Pólya-Szegő inequality holds in the very same form for general K > 0.  The following rigidity result for the Talenti-type comparison theorem will build on top of the rigidity in the Lévy-Gromov and Pólya-Szegő inequalities.
In order to establish Theorem 4.4, we first prove a preliminary lemma which will also be useful in Section 4.2: in the same setting of the Talenti-type Theorem, the difference w−u ⋆ is non-increasing.
Proof of Theorem 4.4. The first statement (u ⋆ = w in [x, r v ]) is a direct consequence of the monotonicity of w − u ⋆ (Lemma 4.5), of the assumption w(x) = u ⋆ (x) and of the Talenti inequality This also implies that µ(t) = ν(t) for any t ∈ (0, u ⋆ (x)), where ν is the distribution function of w. Hence, for any such t, equality holds in Equation (41). In particular, the super-level set {|u| > t} satisfies I N −1,N (m({|u| > t})) = Per({|u| > t}). By the rigidity in the Lévy-Gromov inequality, this implies that (X, d, m) is a spherical suspension.

Stability
In this Section, we will prove a stable version of the rigidity result (Theorem 4.4); we only consider the case where E = Ch, so that L E is the Laplacian. We first need to recall some results on the convergence of metric measure spaces and of functions defined therein.
Assumption 4.6. From now on, the following assumptions will be made: x, m) will be pointed metric measure spaces satisfying the RCD(N − 1, N ) condition for some N ≥ 2, with m i (X i ) = 1, m(X) = 1.
Convergence of spaces: we will assume that X i converge in the pmGH sense to X ; by [GMS15, Section 3.5], pmGH convergence coincides in our setting with pmG convergence; thus we can assume that the following conditions hold: (GH1) X i and X are all contained in a common metric space (Y, d), with d i = d Xi×Xi , and x i → x; (GH2) spt m i = X i and spt m = X; (GH3) The measures m i narrowly converge to m: where C b (Y) is the space of continuous and bounded functions on (Y, d).
Remark 4.7 (Compactness and stability of RCD(K, N ) sequences). Fix K ∈ R and N ∈ (1, ∞). Remark 4.8 (L 2 functions). Assume that B Ri (x i ) and B R (x) are metric balls in X i and X respectively. Let f i ∈ L 2 (B Ri (x i ), m i ) and f ∈ L 2 (B R (x), m) be L 2 functions on such balls; by extending such functions to be 0 out of the balls on which they are defined, we can equivalently assume f i ∈ L 2 (X i , m i ) and f ∈ L 2 (X, m); by the assumption that the spaces X i and X are contained in Y, up to a further extension we actually have f i ∈ L 2 (Y, m i ) and f ∈ L 2 (Y, m).
Definition 4.9 (Convergence of L 2 functions). Let f i ∈ L 2 (B Ri (x i ), m i ) and f ∈ L 2 (B R (x), m) as in Remark 4.8. Following [GMS15, Definition 6.1], we say that: In order to obtain the stability result, we establish a series of auxiliary lemmas of independent interest. We start by showing that L 2 -strong convergence of maps implies the pointwise convergence of the distribution functions to the distribution function of the limit. Lemma 4.10 (Convergence of distribution functions). Let X i pmGH −→ X be pointed metric measure spaces satisfying Assumption 4.6. Let B Ri (x i ) and B R (x) be metric balls in X i and X respectively, Proof. Let us fix t ∈ (0, +∞). We need to show that (except for a countable number of such t) Notice that = (x, g(x)); by the argument above, it holds that Define ν i and ν to be the following push-forward measures on Y × R Our goal (Equation (53)) is equivalent to show that lim i→∞ ν i (Y × (t, +∞)) = ν(Y × (t, +∞)).
Notice that the topological boundary of Y × (t, +∞) is Y × {t}, which is ν-negligible for all but a countable set of t > 0 by the finiteness of m: Thus, it is sufficient to show that the measures ν i converge narrowly to ν in Y × R. To this aim, notice that for every φ ∈ C b (Y×R), one has The next step is to prove that L 2 -strong convergence of functions with bounded W 1,2 -norms implies L 2 -strong convergence of the symmetrizations.  (x), d, m). Then, up to subsequences, the f ⋆ i converge to f ⋆ in the strong L 2 (J N −1,N , m N −1,N ) sense.
Proof. By Proposition 2.18 and the Pólya-Szegő inequality (50), the W 1,2 (J N −1,N , d eu , m N −1,N ) norms of the functions f ⋆ i are bounded by C .
= sup i f i W 1,2 (BR i (xi),d,mi) < ∞, which implies that the f ⋆ i also converge (up to subsequences) to a function g in the strong L 2 (J N −1,N , m N −1,N ) sense. It remains to prove that f ⋆ = g (at least m N −1,N -almost everywhere).
By Lemma 4.10, the distribution functions µ fi converge pointwise to µ f out of a countable set; similarly, µ f ⋆ i converge to µ g out of a countable set. By equi-measurability of f i and f ⋆ i , however, we have that µ fi = µ f ⋆ i , thus µ f = µ g out of a countable set. Since both µ f and µ g are non-increasing and continuous, it follows that µ f ≡ µ g and thus f ♯ ≡ g ♯ , which in turn implies f ⋆ ≡ g ⋆ . Now g was the L 2 -limit of a sequence of non-increasing functions, thus it is non-increasing itself. By Lemma 2.20, we conclude that f ⋆ = g ⋆ = g out of a countable set.
In view of what we seek to achieve in Lemma 4.14, we need the next elementary convergence result, which we shortly prove for the sake of completeness.
Lemma 4.13. Let X i pmGH −→ X be pointed metric measure spaces satisfying Assumption 4.6. Let Proof. For any ε > 0, the inclusions B R−ε (x) ⊂ B Ri (x i ) ⊂ B R+ε (x) hold for i large enough. Thus, by weak convergence of the measures, we have for any ε > 0: Moreover, the following holds (because the space is length): Combining these two facts, and the fact that m(∂B R (x)) = 0 for every R > 0 (which is true on RCD(K, N ) spaces), implies the statement.
The next Lemma analyses the convergence of solutions to the Poisson problem.
Lemma 4.14. Let X i pmGH −→ X be pointed metric measure spaces satisfying Assumption 4.6. Let Then, up to extracting a subsequence: (iii) w i converges in L 2 -strong to a weak solution w of Proof. Assertion (i) is granted by Lemma 4.12 and Lemma 4.13. In Equation (49), the following identity was proved: d,mi) . Thus we have: where c N −1,N > 0 is the constant appearing in the definition of h N −1,N . Since H N −1,N (ξ) is of the same order as ξ → ξ N near 0, the integrand at the right hand side is asymptotic to N when ξ → 0. In particular, the integral is finite and only depends on N and v: the L 2 -norm of w ′ i is thus uniformly bounded: By Poincaré inequality, w i W 1,2 ([0,r1),deu,mN−1,N ) are also uniformly bounded. Using the Talentitype Theorem 3.10 with the associated gradient comparison (40), we infer that u i W 1,2 (BR i (xi),d,mi) are uniformly bounded as well. Thus, by Proposition 4.11 (and up to subsequences), the u i 's converge in L 2 -strong to a function u and the w i 's converge in L 2 strong to a function w; moreover, by Lemma 4.12, u ⋆ i converges in L 2 strong to u ⋆ . In order to prove point (ii) (and, analogously, point (iii)), we apply [AH18, Corollary 4.3]. To this aim, observe that (up to subsequences) we can assume that u i converges to u also weakly in In particular, Y f ψ dm = Ch(u, ψ), thus u is a weak solution of Equation (54). An analogous argument proves statement (iii).
We finally have the tools to prove a stability result, by considering a contradicting sequence, applying a compactness argument, and exploiting the already proven rigidity result on the limit space. ( ((0,rv),mN−1,N ) < δ, then there exists a spherical suspension (Z, d Z , m Z ) such that Proof. We argue by contradiction: assume there existε,N ,v,c such that for any i ∈ N we can find an RCD (N − 1,N ) Up to subsequences, we can assume that: d, x, m), and Assumption 4.6 is satisfied (see Remark 4.7); moreover, m(B R (x)) = v by Lemma 4.13; • f i , u i and w i satisfy the conclusions of Lemma 4.14: that is, for any spherical suspension (Z, d Z , m Z ), by Equation (55). However, by the L 2 -strong convergence of u ⋆ i to u ⋆ (Lemma 4.12) and the L 2 -strong convergence of w i to w, one has which implies that u ⋆ = w. Moreover, since f is the L 2 -strong limit of the f i 's, it has L 2 -norm bounded from below byc, thus it is different from 0 on a non-negligible set. By the rigidity in the Talenti-type comparison (Theorem 4.4), (X, d, m) needs to be a spherical suspension, contradicting (56). Proof. By Lemma 4.5, w − u ⋆ is non-increasing (and non-negative) in [0, r v ]. Thus The result follows from Theorem 4.15 with δ 1 = δ √ v .

Improved Sobolev embeddings
As a first application of the Talenti-type comparison Theorem 3.10, we deduce a series of Sobolevtype inequalities that to best of our knowledge are new in the framework of RCD(K, N ) spaces (compare with [Kes06, Section 3.3] for the Euclidean setting). 1. If f ∈ L p (Ω, m) with N 2 < p ≤ ∞, then u ∈ L ∞ (Ω, m) and where we adopt the convention that 1 p = 0 if p = ∞.
If f ∈ L p (Ω, m) for some p ∈ [2, ∞], then by Hölder inequality, by equimeasurability of f and f ♯ (Proposition 2.18), and by the characterization of the isoperimetric profile on J K,N (Lemma 2.12), with the convention that 1 p = 0 if p = ∞. Now by the estimates on h K,N (Lemma 2.11) there exist constants C 0 > 0 and C 1 > 0 only depending on K > 0, N ∈ (1, ∞) and v = m(Ω) ∈ (0, 1) such that for all ξ ∈ [0, m(Ω)] We can thus draw the following conclusions: By Equation (58) and by equimeasurability of u and u ♯ , this implies Equation (57). Case 2: If p = N 2 and q ≥ 1, then Case 3: If 2 ≤ p < N 2 and q ≥ 1, with q 1 Let now 2 ≤ p ≤ ∞. If we define D Ω,p (L E ) to be the space where D Ω (L E ) is the space defined in Definition 3.2, then Theorem 5.1 can be restated as follows: Corollary 5.2 (Improved Sobolev embeddings). Let (X, d, m) be an RCD(K, N ) space for some K > 0, N ∈ (1, ∞), with m(X) = 1. Let Ω ⊂ X be an open domain with measure v . = m(Ω) ∈ (0, 1) and u : Ω → R be a function in W 1,2 0 (Ω). Let E be a bilinear form satisfying Assumption 3.1 with uniform ellipticity parameter α.

An RCD version of St. Venant-Pólya's torsional rigidity comparison theorem
Given an open domain Ω ⊂ R n , it is well known (see e.g. [Eva10]) that the Poisson boundary value problem −∆u = 2 in Ω u = 0 on ∂Ω (60) has a unique weak solution u ∈ W 1,2 0 (Ω) which, by standard elliptic regularity, turns out to be of class C ∞ (Ω) (classical solution of class C ∞ (Ω), provided ∂Ω is C ∞ ). Define also When n = 2 and Ω is simply connected, u and T (Ω) are known in the literature as stress function and torsional rigidity of Ω, respectively (see [Ban80,p. 63] or [PS51, Ch. 5.2] for more details). For simplicity of notation we will keep using this terminology in general. St. Venant in 1856 conjectured that, among simply connected domains of a given volume v ∈ (0, ∞), the torsional rigidity is maximized by the round ball. Polya in 1948 [Pól48] settled the St. Venant conjecture by proving more generally that for every bounded open set Ω ⊂ R n of volume v ∈ (0, ∞), it holds ]. An inequality in the spirit of (61) was recently proved for smooth compact Riemannian manifolds with Ricci curvature bounded below in [GHM15].
As an application of the techniques developed in this work, we establish the next far reaching extension to RCD spaces of the torsional rigidity comparison (61). To this aim let us introduce a bit of notation.
Given v ∈ (0, 1), K > 0, N ∈ (1, ∞), let m K,N be as before and r v ∈ 0, π N −1 K such that Proof. First of all, notice that the weak solution u ∈ W 1,2 0 (Ω, d, m) to the Poisson problem (60) is the unique minimizer of the energy functional Since J(u) ≥ J(|u|), it follows that u ≥ 0 m-a.e. on Ω and thus u ⋆ ≥ 0. The fact that u ⋆ ≤ u K,N,v m K,N -a.e. on [0, r v ] is a direct consequence of the Talenti-type Theorem 3.10. Recalling Proposition 2.18, we infer that Clearly, if T (Ω) = T K,N,v then u ⋆ = u K,N,v m K,N -a.e. on [0, r v ] and we can apply Theorem 4.4 to infer that (X, d, m) is isomorphic as a metric measure space to a spherical suspension (provided N ∈ [2, ∞) and K = N − 1). We prove the last claim by contradiction. Assume that there existε,N,v such that for any i ∈ N we can find an RCD (N − 1,N ) Up to subsequences, we can assume that R i → R and that: • (X i , d i , x i , m i ) converge to an RCD(N −1, N ) space (X, d, x, m), and Assumption 4.6 is satisfied (see Remark 4.7); moreover, m(B R (x)) = v by Lemma 4.13; • u i satisfy the conclusions of Lemma 4.14: that is, u i converges in L 2 -strong to a weak solution u ∈ W 1,2 0 (B R (x)) of −∆u = 2 in B R (x) (with zero boundary condition). In particular, it follows that (see [GMS15, Eq. (6.7)]) Notice that for any spherical suspension (Z, d Z , m Z ), by Equation (64). However, combining (65) with the rigidity proved above in part 2, we infer that (X, d, m) needs to be a spherical suspension, contradicting (66).

An alternative proof for the RCD version of Rayleigh-Faber-Krahn-Bérard-Meyer comparison theorem
The next result was proved for the p-Laplacian by Mondino and Semola [MS20] in the more general setting of essentially non-branching CD(K, N ) spaces (for K > 0), as a consequence of a Pólya-Szegő type inequality. We give below an alternative proof in case p = 2, based instead on Talenti's comparison theorem for RCD spaces. Firstly, we recall the notions of first eigenfunction and first eigenvalue of the Laplacian: Definition 5.4. Let Ω ⊂ X be an open domain. For any non-zero function w ∈ W 1,2 (Ω, d, m) we define the Rayleigh quotient to be We say that: , w ≡ 0 is the first eigenvalue of the Laplacian in Ω with Dirichlet homogeneous conditions; (ii) u ∈ W 1,2 0 (Ω) is a first eigenfunction of the Laplacian in Ω (with Dirichlet homogeneous conditions) if it minimizes R Ω among functions w ∈ W 1,2 0 (Ω), w ≡ 0 (that is, R Ω (u) = λ Ω ). When (X, d, m) = (J K,N , d eu , m K,N ), v ∈ (0, 1), and Ω = [0, H −1 K,N (v)), we will denote the first eigenvalue with λ K,N,v .

Proof.
Step 1: A first eigenfunction exists. This is standard and was already proved for example in [MS20, Theorem 4.3], but we recall here the argument: let {u n } n be a minimizing sequence for R Ω with u n ∈ W 1,2 0 (Ω), u n L 2 (Ω,m) = 1 and Ω |∇u| 2 dm ց λ Ω . Since the embedding W 1,2 (X, d, m) ⊂ L 2 (X, m) is compact for an RCD(K, N ) space with K > 0, N ∈ (1, ∞) (see [GMS15,Proposition 6.7]), the sequence u n converges to a function u ∈ W 1,2 0 (Ω) in the strong L 2 (Ω, m) sense. Thus u L 2 (Ω,m = 1; moreover, from the very definition of λ Ω and by the L 2 -lower semicontinuity of the Cheeger energy, it holds that Thus u is a first eigenfunction. Step 2: Any first eigenfunction u ∈ W 1,2 0 (Ω) is a weak solution of: This relies on a standard variational argument: for any w ∈ W 1,2 0 (Ω), we can explicitly compute the derivative of ε → R Ω (u + εw) at ε = 0: Since this derivative must vanish, the identity Ch(u, w) = λ Ω Ω uw dm needs to hold for any w ∈ W 1,2 0 (Ω), which proves that u is a weak solution of (69).
Step 3: Since RCD(K, N ) spaces are locally doubling and Poincaré (see [Stu06b;Raj12]), the Harnack-type results proved in [LMP06] hold in these spaces: hence any first eigenfunction is continuous (Theorem 5.1 therein), and is strictly positive in Ω up to multiplying by a constant (Corollary 5.7 and Corollary 5.8 therein). The same results also imply the uniqueness of the first eigenfunction up to a multiplicative constant: if u 1 and u 2 are two first eigenfunctions with u1 u2 non-constant, then there exists γ > 0 such that u 1 − γu 2 is a first eigenfunction that changes sign in Ω.
Step 4: Let now w be a solution to −∆ K,N w = λ Ω u ⋆ in [0, r v ) with w(r v ) = 0. By the definition of w and by using w itself as a test function, it holds that rv 0 |∇w| 2 dm K,N = λ Ω rv 0 u ⋆ w dm K,N ; by the Talenti-type theorem it holds that 0 < u ⋆ ≤ w. Thus 6 Appendix: the case of a smooth Riemannian manifold with positive Ricci curvature Since some of the results of the paper seem to be new even in the setting of smooth Riemannian manifolds (compare with [CLM18]), in this appendix we briefly give the corresponding smooth statements without the technicalities of RCD(K, N ) spaces. In this way, our aim is to make the results accessible to a more general audience.
Let (M, g) be a complete N -dimensional Riemannian manifold, N ≥ 2, with Ricci curvature tensor satisfying Ric g ≥ K g for some constant K > 0. By Bonnet-Myers theorem, M must be compact. Denote with vol g the Riemannian volume measure and with m g . = vol g (M ) −1 vol g the associated normalized measure. Let h ∈ Γ meas (T * M ⊗T * M ) be a symmetric bilinear form on M with measurable coefficients and assume there exists α, β > 0 such that Notice that the upper bound in terms of β immediately yields that the coefficients of h in local coordinates are in L ∞ . Let Ω ⊂ M be an open subset with m g (Ω) ∈ (0, 1) and consider the bilinear form E h : W 1,2 0 (Ω) × W 1,2 0 (Ω) → R defined by Let A h ∈ Γ meas (T M ⊗T * M ) be the symmetric endomorphism associated to h (i.e. with local representation A h = g −1 h) and define the differential operator ∆ h : W 1,2 0 (Ω) → W −1,2 (Ω) where div g is the divergence with respect to g. Of course, if h = g we have that ∆ g is the standard Laplace-Beltrami operator of g. Integration by parts gives Given f ∈ L 2 (Ω), we say that a function u ∈ W 1,2 0 (Ω) is a weak solution to the Poisson problem Let S N K be a sphere of dimension N ≥ 2 and constant Ricci curvature K > 0. Denote with m K,N the normalized volume measure on S N K . Fix p ∈ S N K once for all. For every measurable subset Ω ⊂ M with volume m g (Ω) = v ∈ (0, 1), let r v > 0 be such that m K,N (B rv (p)) = v.
For a measurable function u : Ω → R, define the Schwarz symmetrization u ⋆ : where u ♯ : [0, m(Ω)] → [0, ∞] is the decreasing rearrangement of u defined in (11). Let us stress that while u is defined on Ω ⊂ M , the symmetrized function u ⋆ is defined on B rv (p) ⊂ S N K . Our Talenti-type comparison theorem compares the Schwarz symmetrization u ⋆ of a weak solution u to the Poisson problem (75) with the weak solution w ∈ W 1,2 0 (B rv (p)) of the following symmetrized Poisson problem on S N K : where ∆ S N K is the standard Laplace-Beltrami operator on S N K . Notice that, by equi-measurability, f ⋆ ∈ L 2 (B rv (p)) with f L 2 (Ω) = f ⋆ L 2 (Br v (p)) . Moreover, since f ⋆ depends only on the radial coordinate from p, (77) reduces to an ODE on the interval [0, r v ], corresponding to the model problem studied in Section 2.5.
We are now in position to state our main results (Theorems 3.10, 4.4 and 4.15 and Corollary 5.2) in the smooth framework. Theorem 6.1 (A Talenti-type comparison for Riemannian manifolds with positive Ricci curvature). Let (M, g) be an N -dimensional compact Riemannian manifold without boundary with Ric g ≥ K g for some constant K > 0, N ≥ 2. Let Ω ⊂ M be an open subset with m g (Ω) = v ∈ (0, 1). Let f ∈ L 2 (Ω, m) and u ∈ W 1,2 0 (Ω) be a weak solution to the Poisson problem (75), where the operator ∆ h was defined in (74) (see also (72), (73), (76)).
Let w ∈ W 1,2 0 (B rv (p)) be a weak solution to the Poisson problem (77) on B rv (p) ⊂ S N K . Then • Pointwise comparison: u ⋆ (x) ≤ w(x), for every x ∈ B rv (p).
• Gradient comparison: For any 1 ≤ q ≤ 2, the following L q -gradient estimate holds: • Rigidity: if u ⋆ (x) = w(x), for at least a point x ∈ B rv (p), then (M, g) is isometric to S N K . • Stability: see Theorem 4.15.
We only comment the rigidity statement: from Theorem 4.4 we know that (M, g) is a (K, N )spherical suspension, in particular it has diameter π N −1 K . By the Cheng's maximal diameter theorem, it follows that (M, g) is isometric to the round sphere S N K .

A probabilistic interpretation in the smooth setting: the exit time of Brownian motion
In this section we consider the smooth setting of a compact 2 ≤ N -dimensional Riemannian manifold (M, g) without boundary, with Ricci curvature tensor satisfying Ric g ≥ K g for some constant K > 0. Let Ω ⊂ M be an open subset, fix x ∈ Ω and let (X t ) t≥0 be the Brownian motion starting from x (a good reference for the Brownian motion on Riemannian manifolds is the monograph by Hsu [Hsu02]). The exit time from Ω is the Random variable τ Ω defined on the Brownian probability space as: τ Ω (X) := inf{t > 0 : X t / ∈ Ω}.
The connection between exit time and Poisson equations in the Euclidean setting is classical (it goes back at least to Kakutani [Kak44]), in the next proposition we give the natural generalization to the Riemannian setting. Then u can be written as where E x (Y ) denotes the mean of the random variable Y on the Brownian probability space, when the Brownian motion starts at x.
Proof. The proof in the Riemannian setting goes along the same lines of the classical Euclidean proof, thus we only sketch the main steps. By Itô's formula (see for instance [Hsu02, Proposition 3.2.1]), the quantity ∆u(X s ) ds, ∀t ∈ [0, τ Ω (X)), defines a local Martingale. Since u ∈ C ∞ (Ω) solves (79), it follows that also is a local Martingale on [0, τ Ω (X)). Moreover, by the very definition (78) of exit time we have that lim t↑τ Ω (X) u(X t ) = 0. Letting t ↑ τ Ω (X) and applying E x gives (80) (for more details see for instance [Dur84,).
In other terms, the stress function u evaluated at x corresponds to the expected exit time of the Brownian motion starting at x. In the same spirit, can be interpreted as the average exit time of a Brownian motion starting at a random point x ∈ Ω (with respect to the uniform probability vol g (Ω) −1 vol g ). Notice that T (Ω) = 1 vol g (Ω) T (Ω), where T (Ω) is the torsional rigidity of Ω defined in Section 5.2. Hence, specializing Theorem 6.1 (see also Theorem 5. 3) to f ≡ 2 and h = g gives the following: Corollary 6.3 should be compared with [CLM18] where also higher order average exit times are estimated in a smooth Riemannian manifold with strictly positive Ricci curvature. The novelty of Corollary 6.3 lies in particular in the stability statement.