A Gauss-Bonnet-like Formula on Two-Dimensional Almost-Riemannian Manifolds

We consider a generalization of Riemannian geometry that naturally arises in the framework of control theory. Let $X$ and $Y$ be two smooth vector fields on a two-dimensional manifold $M$. If $X$ and $Y$ are everywhere linearly independent, then they define a classical Riemannian metric on $M$ (the metric for which they are orthonormal) and they give to $M$ the structure of metric space. If $X$ and $Y$ become linearly dependent somewhere on $M$, then the corresponding Riemannian metric has singularities, but under generic conditions the metric structure is still well defined. Metric structures that can be defined locally in this way are called almost-Riemannian structures. They are special cases of rank-varying sub-Riemannian structures, which are naturally defined in terms of submodules of the space of smooth vector fields on $M$. Almost-Riemannian structures show interesting phenomena, in particular for what concerns the relation between curvature, presence of conjugate points, and topology of the manifold. The main result of the paper is a generalization to almost-Riemannian structures of the Gauss-Bonnet formula.


Introduction
Our goal is to prove the existence and to assign a value to the limit lim εց0 {q∈M|d(q,Z)>ε} where d(·, ·) is the distance globally defined by the almost-Riemannian structure on M . The goal will be attained under the following additional assumption. Generically the singular locus Z is smooth and ∆(q) is one-dimensional at every point of Z. We say that q ∈ Z is a tangency point if ∆(q) is tangent to Z. Under generic assumptions, Z contains only a discrete set of tangency points. The hypothesis under which the main results of the paper are obtained is that Z contains no such point.
Define M + (respectively, M − ) as the subset of M \ Z on which the orientation defined by dA s coincides with (respectively, is opposite to) that of M . If M has no tangency point, then the limit (2) turns out to exist and is equal to 2π(χ(M + ) − χ(M − )), where χ denotes the Euler characteristic.
When the almost-Riemannian structure is trivializable, we have that χ(M + ) = χ(M − ) and thus the limit (2) is equal to zero. Once applied to the special subclass of Riemannian structures, such result simply states that the integral of the curvature of a parallelizable compact oriented surface (i.e., the torus) is equal to zero. In a sense, in the standard Riemannian construction the topology of the surface gives a constraint on the total curvature through the Gauss-Bonnet formula, whereas for an almost-Riemannian structure induced by a single pair of vector fields the total curvature is equal to zero and the topology of the manifold constrains the metric to be singular on a suitable set.
It is interesting to notice that every oriented compact surface can be endowed with a trivializable almost-Riemannian structure satisfying the requirement that there are no tangency points.
The paper is organized as follows. In Section 2, we introduce two equivalent definitions of rank-varying sub-Riemannian structure on a manifold of any dimension, first by using the language of moduli and then by identifying it with an atlas of orthonormal frames. Rank-varying sub-Riemannian structures have already been studied, from a different perspective, in [12,15].
A notion of orientability for rank-varying sub-Riemannian structure is then introduced. Almost-Riemannian structures are defined as rank-varying sub-Riemannian structures of maximal rank.
Starting from Section 3 we focus on the case of almost-Riemannian structures on two-dimensional manifolds. Geodesics associated with such structures are characterized in Section 3.1 using the Pontryagin Maximum Principle. In Section 3.2 we study the Grushin plane, for which we compute the cut and the conjugate loci.
In Section 4 we provide local normal forms for generic almost-Riemannian structures, which are used in Section 5 to prove a generalization of the Gauss-Bonnet formula to almost-Riemannian structures without tangency points. The formula is then specialized to the case of trivializable almost-Riemannian structures. In Section 5.5 we show that every compact orientable two dimensional manifold admits a trivializable almost-Riemannian structure with no tangency points.

Rank-varying distributions and sub-Riemannian structures
Let M be a n-dimensional smooth manifold. Recall that Vec(M ), the set of smooth vector fields on M , is naturally endowed with the structure of C ∞ (M )-module. Given an open subset Ω of M , a submodule ∆ of Vec(M ) is said to be generated on Ω by the vector fields {V 1 , . . . , V m } if every V ∈ ∆ can be written as V = a 1 V 1 + · · · + a m V m on Ω where a 1 , . . . , a m belong to C ∞ (M ).
Definition 1 A (n, k)-rank-varying distribution is a pair (M, ∆) where M is a n-dimensional smooth manifold, ∆ is a submodule of Vec(M ), and k ≤ n is such that for every q ∈ M and every small enough neighborhood Ω q of q, the restriction to Ω q of ∆ is generated by k vector fields and cannot be generated by less than k vector fields.
From now on the expression ∆(q) will denote the linear subspace {V (q) | V ∈ ∆} ⊂ T q M . When the dimension of ∆(q) is independent of q, we recover the standard definition of distribution as a smooth field of linear subspaces of T q M . Notice that ∆ cannot be identified with the map q → ∆(q). Indeed, it can happen that two different moduli ∆ 1 and ∆ 2 are such that ∆ 1 (q) = ∆ 2 (q) for every q ∈ M . Take for instance M = R and ∆ 1 , ∆ 2 generated, respectively, by Denote by Lie(∆) the smallest Lie subalgebra of Vec(M ) containing ∆ and let Lie q (∆) = {V (q) | V ∈ Lie(∆)} for every q ∈ M . We say that (M, ∆) satisfies the Lie bracket generating condition if Lie q (∆) = T q M for every q ∈ M . We also introduce the flag of a rank-varying distribution (M, ∆) as the sequence of submodules ∆ 0 = ∆ ⊂ ∆ 1 ⊂ . . . ⊂ ∆ m ⊂ · · · defined through the recursive formula As above, we let ∆ m (q) = {V (q) | V ∈ ∆ m }.
In order to provide an example of rank-varying distribution, let us introduce the Grushin distribution. Take as M the plane R 2 and let ∆ be generated by the vector fields F 1 (x, y) = (1, 0) and F 2 (x, y) = (0, x). Then (R 2 , ∆) is a (2, 2)-rank-varying distribution. Notice that ∆(q) is equal to R × {0} when q is on the y-axis and to R 2 elsewhere. The Grushin distribution is Lie bracket generating since ∆ 2 (q) = R 2 for every q ∈ R 2 .
Crucial in what follows is the notion of generic (n, k)-rank-varying distribution. Denote by W the C 2 -Whitney topology defined on Vec(M ) and by (Vec(M ), W) k the product of k copies of Vec(M ) endowed with the corresponding product topology. We recall that if M is compact (as it is the case in most of what follows), then W is the standard C 2 topology.
Definition 2 A property (P ) defined for (n, k)-rank-varying distributions is said to be generic if there exists an open and dense subset O of (Vec(M ), W) k such that (P ) holds for every (n, k)-rank-varying distribution which is generated by elements of O.

Orientable rank-varying distributions
Let (M, ∆) be a (n, k)-rank-varying distribution. A k-form on (M, ∆) is a multilinear skew-symmetric map We say that a k-form ω is a volume form if, for every q ∈ M , there exist k vector fields F 1 , . . . , F k ∈ ∆ such that ω(F 1 , . . . , F k )(q) = 0. Definition 3 We say that a (n, k)-rank-varying distribution (M, ∆) is orientable if it admits a volume form, otherwise we say that (M, ∆) is non-orientable.
Notice that a rank-varying distribution can be orientable even if M is a non-orientable manifold (see example below). However, the distribution (M, Vec(M )) is orientable if and only if M is.
Remark 4 Thanks to its multilinearity, a volume form is completely characterized by its action on the generators. Given a trivializable rank-varying distribution ∆ and a global system of generators F 1 , . . . , F k , the equality ω(F 1 , . . . , F k ) = 1 uniquely defines a volume form on ∆. Hence every trivializable rank-varying distribution is orientable.
Remark 5 Let ω be a k-form on a (n, k)-rank-varying distribution (M, ∆). Then ω acts as a tensor on the open subset of M made of points q such that the dimension of ∆(q) is equal to k, i.e., for every V 1 , . . . , V k ∈ ∆ the value of ω(V 1 , . . . , V k )(q) depends only on V 1 (q), . . . , V k (q). Indeed, let {F 1 , . . . , F k } be a local system of generators of ∆ on a neighborhood Ω of q and take a ij ∈ C ∞ (M ), 1 ≤ i, j ≤ k, such that V i = k j=1 a ij F j on Ω. The multilinearity and skew-symmetricity of ω implie that ω(V 1 , . . . , V k )(q) = det(a ij (q))ω(F 1 , . . . , F k )(q). Therefore, ω(V 1 , . . . , V k )(q) depends on V 1 , . . . , V k only through the matrix (a ij (q)), which is uniquely determined by V 1 (q), . . . , V k (q). Let us present some example of orientable and non-orientable rank-varying distributions. All these examples are (2, 2)-rank-varying distributions, since this is our main case of interest in the following.
The Grushin distribution. Let M = R 2 and recall that ∆ is generated by the vector fields F 1 (x, y) = (1, 0) and F 2 (x, y) = (0, x). The distribution ∆ is orientable. A volume form can be defined by for every pair of vector fields V 1 , V 2 belonging to ∆. Equivalently we could have defined ω on the generators F 1 , F 2 by requiring that ω(F 1 , F 2 )(x, y) = 1.
Notice that ω is not a tensor on the y-axis.
A non-orientable rank-varying distribution on the torus. Let M be the two-dimensional torus [−π, π]× [−π, π] with the standard identifications. Consider the open covering of M given by Let ∆ be generated by the vector fields This rank-varying distribution is non-orientable. In fact a volume form ω should acts on the local generators as where f 1 and f 2 are two never-vanishing smooth functions. On Ω 1 ∩ Ω 2 we would have contradicting the constant-sign assumption on f 1 , f 2 . As a consequence ∆ is not trivializable.
An orientable rank-varying distribution on the Klein bottle. Let M be the Klein bottle seen as the square [−π, π] × [−π, π] with the identifications (x, −π) ∼ (x, π), (−π, y) ∼ (π, −y). Consider the vector fields which are well defined on M . The distribution generated by F 1 and F 2 is orientable since it is trivializable.

Rank-varying sub-Riemannian structures
In this section we see how to introduce a a smoothly-varying Riemannian structure on every subspace ∆(q). A (n, n)-rank-varying sub-Riemannian structure is called a n-dimensional almost-Riemannian structure.
Let S = (M, ∆, G) be a (n, k)-rank-varying sub-Riemannian structure. Reasoning as in Remark 5, we get that G is a tensor at the points q where dim(∆(q)) = k. Although this is not necessarily the case everywhere on M , we can define, for every q ∈ M , a quadratic form G q on ∆(q) through For every q ∈ M , it is possible to find a neighborhood Ω q of q and an orthonormal frame on Ω q , i.e., a set of k vector fields X 1 , . . . , X k ∈ ∆ such that G(X i , X j ) = δ i,j on Ω q . One easily proves that orthonormal frames are local generators in Ω q .
If S is orientable then a volume form ω can be chosen in such a way that |ω(X 1 , . . . , X k )| = 1 on every local orthonormal frame.
The distance induced by S on M is the function It is a standard fact that l(γ) is invariant under reparameterization of the curve γ. Moreover, if an admissible curve γ minimizes the so-called energy functional ] is a minimizer of E(·). A geodesic for which G γ(t) (γ(t),γ(t)) is (constantly) equal to one is said to be parameterized by arclength.
The finiteness and the continuity of d(·, ·) with respect to the topology of M are guaranteed by the Lie bracket generating assumption on the rank-varying sub-Riemannian structure. The distance d(·, ·) gives to M the structure of metric space. The local existence of minimizing geodesics is a standard consequence of Filippov Theorem (see for instance [2]). When M is compact any two points of M are connected by a minimizing geodesic.
A convenient way to deal with a rank-varying sub-Riemannian structure is to identify it with an atlas of local orthonormal frames. In the case of an orientable rank-varying sub-Riemannian structure, one can impose that all orthonormal frames are coherently oriented. In this way one is led to the following equivalent definition.
Definition 7 Let M be a n-dimensional smooth manifold, fix k ∈ N, and consider a family where {Ω µ } µ∈I is an open covering of M and, for every µ ∈ I, {X µ 1 , . . . , X µ k } is a family of smooth vector fields defined on M , whose restriction to Ω µ satisfies the Lie bracket generating condition. We assume moreover that for every µ ∈ I and every open nonempty subset Ω of Ω µ , the submodule of Vec(Ω) generated by X µ 1 , . . . , X µ k on Ω cannot be generated by less than k vector fields. We say that S is a (n, k)-rank-varying sub-Riemannian structure if, for every µ, ν ∈ I and for every q ∈ Ω µ ∩ Ω ν , there exists an orthogonal matrix R µ,ν (q) = (R µ,ν i,j (q)) ∈ O(k) such that We say that two rank-varying sub-Riemannian structures S 1 and S 2 on M are equivalent if S 1 ∪ S 2 is a rankvarying sub-Riemannian structure. Given an open subset Ω of M and a set of k vector fields (X 1 , . . . , X k ), we say that (Ω, If S is equivalent to a rank-varying sub-Riemannian structure of the form {(M, X 1 , . . . , X k )}, i.e., for which the cardinality of I is equal to one, we say that S is trivializable.
If S admits an equivalent rank-varying sub-Riemannian structure such that each R µ,ν (q) belongs to SO(k), we say that S is orientable.
Notice that R µ,ν (q) is uniquely defined by equation (5) and, moreover, is smooth as a function of q. In the following, when dealing with an orientable rank-varying sub-Riemannian structure, we always assume that the atlas of local orthonormal frames is positive oriented, i.e., such that each R µ,ν belongs to SO(k). For such an atlas, a volume form ω can be chosen such that ω(X µ 1 , . . . , X µ k ) = 1 on Ω µ , for every µ ∈ I. In terms of Definition 6, ∆ is the module that is locally (in Ω µ ) generated by X µ 1 , . . . , X µ k . Moreover for every q ∈ Ω µ and v ∈ ∆(q).
Definition 8 A property (P ) defined for (n, k)-rank-varying sub-Riemannian structures on M is said to be generic if there exists an open and dense subset O of (Vec(M ), W) k such that (P ) holds for every (n, k)-rankvarying sub-Riemannian structure admitting an atlas of local orthonormal frames whose elements belong to O.
Given a (n, k)-rank-varying sub-Riemannian structure S, the problem of finding a curve minimizing the energy between two fixed points q 0 , q 1 ∈ M is naturally formulated as the optimal control probleṁ Here µ, u 1 , . . . , u k are seen as controls and T is fixed. It is a standard fact that this optimal control problem is equivalent to the minimum time problem with controls u 1 , . . . , u k satisfying u 2 1 + · · · + u 2 k ≤ 1. Notice that if the rank-varying sub-Riemannian structure is trivializable, then the role of µ is empty and (6), (7) can be rewritten as a classical sub-Riemannian control probleṁ

Two-dimensional almost-Riemannian structures
Henceforth the paper is focused on the special case of (2, 2)-rank-varying sub-Riemannian structures, i.e., twodimensional almost-Riemannian structures (2-ARSs for short). In this case a local orthonormal frame on Ω µ is a pair of Lie bracket generating vector fields (X µ , Y µ ). Given a 2-ARS S, we call singular locus the set Z ⊂ M of points q at which the dimension of ∆(q) is equal to one. Denote by g the restriction of the quadratic form G on M \ Z. By construction g is a Riemannian metric satisfying g(X µ (q), X µ (q)) = 1, g(X µ (q), Y µ (q)) = 0, g(Y µ (q), Y µ (q)) = 1, for every µ in I and every q ∈ Ω µ \ Z. Denote moreover by dA the Riemannian density associated with (M \ Z, g), which coincides with |dX µ ∧ dY µ | on Ω µ \ Z, for every µ ∈ I.
Finally, one can define on M \ Z the Gaussian curvature K associated with g, which is easily expressed in each open set Ω µ \ Z through the formula (see for instance [2], equation (24.6)) and X µ β µ (respectively, Y µ α µ ) denotes the Lie derivative of β µ with respect to X µ (respectively, of α µ with respect to Y µ ).

Minimizers, cut and conjugate loci
A natural tool to look for geodesics in almost-Riemannian geometry is to apply the necessary condition for optimality given by the Pontryagin Maximum Principle (see [13]). As a result we obtain the following proposition. In view of later applications in the paper, we consider as initial and final conditions not only points, but submanifolds as well.

Proposition 9 Define on T * M the Hamiltonian
(Notice that H is well defined on the whole T * M , thanks to (5).) Consider the minimization probleṁ where M in and M fin are two submanifolds of M and the final time T > 0 is fixed. Then every solution of (8) is the projection on M of a trajectory (λ(t), q(t)) of the Hamiltonian system associated with H satisfying λ(0) ⊥ T q(0) M in , λ(T ) ⊥ T q(T ) M fin , and H(λ(t), q(t)) = 0.
Remark 10 The simple form of the statement above follows from the absence of abnormal minimizers, which follows from the Lie bracket generating assumption. As a consequence a curve is a geodesic if and only if it the projection of a normal extremal.

Remark 11
Notice that H is constant along any given solution of the Hamiltonian system. Moreover, H = 1/2 if and only if q(.) is parameterized by arclength.
Fix q ∈ M . For every λ ∈ T * q M satisfying H(λ, q) = 1/2 (9) and every t > 0 define E(λ, t) as the projection on M of the solution, evaluated at time t, of the Hamiltonian system associated with H, with initial condition λ(0) = λ and q(0) = q. Notice that if q / ∈ Z then condition (9) defines an ellipse in T * q M ; otherwise it identifies a pair of parallel straight lines.

An example: the Grushin almost-Riemannian structure
Consider again the Grushin distribution X(x, y) = (1, 0), Y (x, y) = (0, x) on the plane R 2 . If we consider X and Y as an orthonormal frame, we get an almost-Riemannian structure. As already remarked, the singular locus coincides with the y-axis. Therefore, every trajectory crossing the y-axis does it horizontally. The Riemannian metric g associated with the Grushin metric on R 2 \ {(x, y) ∈ R 2 | x = 0} explodes when one is approaching the y-axis, Also the curvature and the Riemannian density explode while approaching the y-axis, According to Proposition 9, geodesics are the projection on the (x, y)-plane of the solutions of the Hamiltonian system corresponding to Fixing the initial condition x(0) = 0, y(0) = 0, the normalization H = 1/2 implies that λ x (0) = ±1. Taking a = λ y (0) ∈ R, the geodesics starting from the origin are for a = 0 x 0 (t) = ±t y 0 (t) = 0, for a = 0 x a (t) = ± 1 a sin(at) y a (t) = 1 2a t − 1 4a 2 sin(2at).
Due to the symmetries of the problem, one can easily check that the time at which a geodesic (x a (t), y a (t)) loses optimality ist = π/|a|, for a = 0, and that (x a (t), y a (t)) belongs to the y-axis. The geodesics corresponding to a = 0 are optimal for every positive time. As a consequence the cut locus from the origin is the set In Figure 1A geodesics for some values of a are portrayed, while Figure 1B illustrates the set of points reached in time t = 1. Notice that this set has a non-smooth boundary. In contrast with what would happen in Riemannian geometry, this is the case for every positive time, as it happens in constant-rank sub-Riemannian geometry. However, this is a consequence of the fact that the initial condition belongs to Z.
One can check that, even if the curvature is always negative where it is defined, a geodesic (x a (t), y a (t)), a = 0, has its first conjugate point at time τ /|a|, where τ ∼ 4.49 is the first positive root of the equation tan(τ ) = τ . As a consequence the first conjugate locus is the parabola One could ask whether the presence of conjugate points is the consequence of the particular initial point on the set Z. In fact this is not the case. Consider as initial condition the point x(0) = −1, y(0) = 0. Define, for every a ∈ [0, 1], Then every geodesic from the point (−1, 0) belongs to one of the four families The geodesics in G1 and G2 lie in the half plane {y ≥ 0}, while those in G3 and G4 lie in {y ≤ 0}. Let us describe the cut locus from (−1, 0). Consider first a geodesics (x + (t, a), y + (t, a)) belonging to the family G1. One can check that π/a is the first positive time at which (x + (t, a), y + (t, a)) intersects another geodesic, namely (x − (t, a), y − (t, a)), which belongs to G2. The situation is similar for the families G3 and G4. As a consequence the cut locus from (−1, 0) is the set {(1, α) | α ∈ [π/2, ∞) ∪ (−∞, −π/2]}. As above, one can also check that every geodesic (except those corresponding to a = 0) has a conjugate time (see Figure 2). In particular π is a conjugate time for the geodesics corresponding to a = 1. Notice that conjugate points appear on geodesics which have already crossed Z. (Before crossing Z a geodesic is Riemannian and lies in a Riemannian space with negative Gaussian curvature.)

Normal forms for generic 2-ARSs
The following proposition is a standard corollary of the transversality theorem. It formulates generic properties of a 2-ARS in terms of the flag of the distribution ∆ (see equation (3)).

Proposition 14
Let M be a two-dimensional smooth manifold. Generically, a 2-ARS S = {(Ω µ , X µ , Y µ )} µ∈I on M satisfies the following properties: (i) Z is an embedded one-dimensional smooth submanifold of M ; (ii) The points q ∈ M at which ∆ 2 (q) is one-dimensional are isolated; (iii) ∆ 3 (q) = T q M for every q ∈ M .
Remark 15 Notice that properties (i), (ii), and (iii) are actually generic for every (2, 2)-rank-varying distribution, since they do not involve the metric structure. Lemma 17 Let S be a 2-ARS and let W be a smooth embedded one-dimensional submanifold of M . Assume that W is transversal to the distribution ∆, i.e., such that ∆(q) + T q W = T q M for every q ∈ W . Then, for every q ∈ W there exists an open neighborhood U of q such that for every ε > 0 the set is a smooth embedded one-dimensional submanifold of U . Moreover, there exists a pair of vector fields (X, Y ) such that (U, X, Y ) is compatible with S and, up to a smooth change of coordinates defined on U , q = (0, 0) and W, X, Y have the form where f (x, y) is a smooth function defined on U .
Let E(t, α) be the solution at time t of the Hamiltonian system given by the Pontryagin Maximum Principle with initial condition (q(0), λ(0)) = (w(α), λ 0 (α)) (see Proposition 9). Fix q ∈ W and defineᾱ by q = w(ᾱ). In order to prove that E(t, α) is a local diffeomorphism around the point (0,ᾱ), let us show that the two vectors are not parallel. On one hand, since v 1 is equal to dw dα (ᾱ), then it spans T q W . On the other hand, being H quadratic in λ, Thus v 2 does not belong to the orthogonal to λ 0 (ᾱ), that is, to T q W . Therefore for a small enough neighborhood U of q we have that the set {q ′ ∈ U | d(q ′ , W ) = ε} is given by the intersection of U with the images of E(ε, ·) and E(−ε, ·). This proves the first part of the statement. To prove the second part, let us take (t, α) as a system of coordinates on U and define the vector field X by Notice that, by construction, for every q ′ ∈ U the vector X(q ′ ) belongs to ∆(q ′ ) and G q ′ (X(q ′ ), X(q ′ )) = 1. In the coordinates (t, α) we have X = (1, 0). Let Y be a vector field on U such that (X, Y ) is compatible with S.
We are left to prove that the first component of Y is identically equal to zero. Indeed, were this not the case, the norm of X would not be equal to one.
Proof of Theorem 16. Let us start from the case in which ∆(q) = T q M . Let W be any one-dimensional submanifold passing through q. Lemma 17 provides us with a possible choice of orthonormal frame X = (1, 0), Y = (0, f (x, y)) in a neighborhood U of q. Since, without loss of generality, X and Y are everywhere linearly independent in U , then f (x, y) = 0 for every (x, y) ∈ U . By applying a smooth coordinate transformation of the type x → x, y → ν(y) we get the new expressions X = (1, 0), Y = (0, ν ′ (y)f (x, y)). A normal form of type (F1) is obtained by choosing ν in such a way that ν ′ (y)f (0, y) = 1. Let now q ∈ Z and assume that ∆ 2 (q) = T q M . Assume, moreover, that the generic condition (i) holds true. One can easily check that ∆(q) is transversal to the submanifold Z at q. Hence we can apply Lemma 17 with W = Z. As a result we obtain a possible choice of orthonormal frame X = (1, 0), Y = (0, f (x, y)) in a neighborhood U of q. Since X and Y are linearly dependent on Z, which is identified with the y-axis, then f (0, y) = 0. The condition ∆ 2 (q) = T q M implies that, by taking U small enough, ∂ x f (0, y) = 0. Hence f admits a representation of the type f (x, y) = xe φ(x,y) , with φ smooth. Again, a change of coordinates x → x, y → ν(y) can be used in order to ensure that φ(0, y) = 0. The normal form (F2) is obtained.
Remark 18 Because of Remark 15, for a generic distribution ∆, every 2-ARS having ∆ as corresponding distribution can be locally represented by one of the normal forms (F1), (F2), (F3).
Definition 19 Let S be a 2-ARS and assume that the generic conditions (i), (ii), (iii) of Proposition 14 hold true. A point q ∈ M is said to be an ordinary point if ∆(q) = T q M , hence, if S is locally described by (F1). We call q a Grushin point if ∆(q) is one-dimensional and ∆ 2 (q) = T q M , i.e., if the local description (F2) applies. Finally, if ∆(q) = ∆ 2 (q) is of dimension one and ∆ 3 (q) = T q M we say that q is a tangency point and S can be described near q by the normal form (F3).
Let us take advantage of the common expressions of the normal forms (F1), (F2), (F3), which are all of the type X(x, y) = (1, 0), Y (x, y) = (0, f (x, y)), in order to investigate the local behavior of g, K, and dA.
Lemma 20 Let X(x, y) = (1, 0) and Y (x, y) = (0, f (x, y)) be two smooth vector fields on R 2 . Let D = {(x, y) ∈ R 2 | f (x, y) = 0} and g be the Riemannian metric on D having (X, Y ) as an orthonormal frame. Denote by K the curvature of g and by dA the Riemannian density. We have

An example of tangency point
A simple example of tangency point can be observed in the 2-ARS defined by The pair (X, Y ) appears in the classification of planar phase portraits of pairs of vector fields given by Davydov in [7]. For this system one has g = dx 2 + (y − x 2 ) −2 dy 2 , and The graph of K is illustrated in Figure 3. Notice that, in contrast with the behavior of the curvature in the Grushin plane (see Section 3.2), in this case lim sup q→(0,0) K(q) = +∞, while we still have lim inf q→(0,0) K(q) = −∞.

Statement
Let M be an orientable two-dimensional manifold and let S be an orientable 2-ARS on M . Chose a positive oriented atlas of orthonormal frames {(Ω µ , X µ , Y µ )} µ∈I and denote by ω the volume form on S such that ω(X µ , Y ν ) = 1 on Ω µ for every µ ∈ I. As noticed in Remark 5, ω acts as a tensor on M \ Z. Define a two-form dA s on M \ Z by the rule dA s (V (q), W (q)) = ω(V, W )(q). Notice that dA s = dX µ ∧ dY µ on Ω µ \ Z for every µ ∈ I.
Fix now an orientation Ξ of M . Recall that the choice of Ξ determines uniquely a notion of integration on M \ Z with respect to the form dA s . More precisely, given a dA-integrable function f on Ω ⊂ M , if for every q ∈ Ω, Ξ and dA s define the same orientation at q (i.e. if Ξ(q) = αdA s (q) with α > 0), then Then For every ε > 0 let M ε = {q ∈ M | d(q, Z) > ε}, where d(·, ·) is the almost-Riemannian distance (see equation (4)). We say that K is S-integrable if lim ε→0 Mε K dA s exists and is finite. In this case we denote such limit by KdA s . Remark 23 In the results stated above, the hypothesis that there are not tangency points seems to be essential. Technically, the difficulty comes when one tries to integrate the Hamiltonian system given by the Pontryagin Maximum Principle applied to a system written in the normal form (F3). However it is our hope to extend the Gauss-Bonnet formula even in presence of tangency points, using a more general approach.
It is anyway interesting to notice that the hypotheses of Corollary 22 are never empty, independently of M . Indeed: Lemma 24 Every compact orientable two-dimensional manifold admits a trivializable 2-ARS satisfying the generic conditions of Proposition 14 and having no tangency points.
The proof of Lemma 24 is given in Section 5.5.

Proof of Theorem 21
As a consequence of the compactness of M and of Lemma 17 one easily gets: Lemma 25 Let M be compact and oriented. For a generic 2-ARS S on M the set Z is the union of finitely many curves diffeomorphic to S 1 . Moreover, there exists ε 0 > 0 such that, for every 0 < ε < ε 0 , the set M \ M ε is homeomorphic to Z × [0, 1]. Under the additional assumption that M contains no tangency point, ε 0 can be taken in such a way that ∂M ε is smooth for every 0 < ε < ε 0 .
Fix M and a 2-ARS S as in the statement of Theorem 21. Thus, S can be described, around each point of Z, by a normal form of type (F2).
Take ε 0 as in the statement of Lemma 25. For every ε ∈ (0, ε 0 ), let M ± ε = M ± ∩ M ε . By definition of dA s and M ± , The Gauss-Bonnet formula asserts that for every compact oriented Riemannian manifold (N, g) with smooth boundary ∂N , we have where K is the curvature of (N, g), dA is the Riemannian density, k g is the geodesic curvature of ∂N (whose orientation is induced by the one of N ), and ds is the length element.
Applying the Gauss-Bonnet formula to the Riemannian manifolds (M + ε , g) and (M − ε , g) (whose boundary smoothness is guaranteed by Lemma 25), we have Thanks again to Lemma 25, χ(M ± ε ) = χ(M ± ). We are left to prove that Fix q ∈ Z and a (F2)-type local system of coordinates (x, y) in a neighborhood U q of q. We can assume that U q is given, in the coordinates (x, y), by a rectangle [−a, a] × [−b, b], a, b > 0. Assume that ε < a. Notice that We are going to prove that Then (10)  , the horizontal edges of ∂U q , are geodesics minimizing the length from Z. Therefore, Z can be covered by a finite number of neighborhoods of type U q whose pairwise intersections have empty interior.) Without loss of generality, we can assume that a downwards orientation (see Figure 4). The curve s → c(s) = (ε, y(s)) satisfyinġ is an oriented parametrization by arclength of ∂M + ε , making a constant angle with X. Let (θ 1 , θ 2 ) be the dual basis to (X, Y ) on U q ∩ M + , i.e., θ 1 = dx and θ 2 = x −1 e −φ(x,y) dy. According to [14, Corollary 3, p. 389, Vol. III], the geodesic curvature of ∂M + ε at c(s) is equal to λ(ċ(s)), where λ ∈ Λ 1 (U q ) is the unique one-form satisfying

Figure 4:
A trivial computation shows that λ = ∂ x (x −1 e −φ(x,y) )dy . Thus, where the last equality is obtained taking y = y(−s) as new variable of integration.
We reason similarly on ∂M − ε ∩ U q , on which M − ε induces the upwards orientation. An orthonormal frame on M − ∩ U q , oriented consistently with M , is given by (X, −Y ), whose dual basis is (θ 1 , −θ 2 ). The same computations as above lead to

A counterexample in the non-generic case
In this section we justify the assumption that the 2-ARS is generic, by presenting an example of 2-ARS such that the conclusion of Theorem 21 does not hold, although Z is smooth and ∆(q) is transversal to Z at every point q of Z. Let M be the two-dimensional torus [−π, π] × [−π, π] with the standard identifications, and consider the trivializable 2-ARS associated with the vector fields X(x, y) = (1, 0), Y (x, y) = (0, 1 − cos(x)).
In this case Z is the circle {0} × [−π, π] and one among M + and M − is empty (say M − ). Notice that the generic condition (ii) is not verified since [X, Y ](q) = 0 at every q ∈ Z. By Lemma 20 we have

Trivializable 2-ARSs
The aim of this section is to characterize topologically trivializable 2-ARSs having no tangency point.
Lemma 26 Let M be orientable. For a generic trivializable 2-ARS on M without tangency points the Euler characteristics of M + and M − are equal.
Proof. Let us consider on M a notion of angle, induced by any fixed, globally defined, Riemannian metric g 0 . For every θ in S 1 , denote by R θ : T M → T M the corresponding rotation of angle θ.
Since, by hypothesis, the map Z ∋ q → ∆(q) is a one-dimensional distribution everywhere transversal to the smooth submanifold Z, then we can define a smooth function φ : Z → (0, π) such that R φ(q) (∆(q)) = T q Z for every q ∈ Z. Let θ : M × [0, 1] → S 1 be a C ∞ map such that For every t ∈ [0, 1] define a vector field X t on M by the relation X t (q) = R θ(q,t) X(q).
Then X 1 is a smooth vector field tangent to Z at every point of Z. Notice that {q ∈ M | X 1 (q) = 0} = {q ∈ M | X(q) = 0} ⊂ Z. Moreover, under the generic assumption that the zeroes of X are non-degenerate, the same is true for those of X 1 .
Consider now the manifoldM + obtained by gluing smoothly two copies of M + along Z. Since X 1 is tangent to Z, the vector fieldX 1 , obtained as a double copy of X 1 | M + , is well defined, continuous, and has isolated zeroes. Thus, χ(M + ) is equal to the sum of the indices of the zeroes ofX 1 . Notice thatX 1 (q) = 0 if and only if q ∈ Z and X 1 (q) = 0. Moreover, the index ofX 1 at q is equal to that of X 1 , since the latter is non-degenerate. The same reasoning on M − and X 1 | M − shows that the Euler characteristic ofM − , obtained by gluing two copies of M − along Z, is again equal to the sum of the indices of the zeroes of X 1 , i.e., to χ(M ). Therefore,

Construction of trivializable 2-ARSs with no tangency points
In this section we prove Lemma 24, by showing how to construct a trivializable 2-ARS with no tangency points on every compact orientable two-dimensional manifold.
For the torus, an example of such structure is provided by the standard Riemannian one. The case of a connected sum of two tori can be treated by gluing together two copies of the pair of vector fields X and Y represented in Figure 5A, which are defined on a torus with a hole cut out. In the figure the torus is represented as a square with the standard identifications on the boundary. The vector fields X and Y are parallel on the boundary of the disk which has been cut out. Each vector field has exactly two zeros and the distribution spanned by X and Y is transversal to the singular locus. Examples on the connected sum of three or more tori can be constructed similarly by induction. The resulting singular locus is represented in Figure 5B.