Index theorems for graph-parametrized optimal control problems

In this paper we prove Morse index theorems for a big class of constrained variational problems on graphs. Such theorems are useful in various physical and geometric applications. Our formulas compute the difference of Morse indices of two Hessians related to two different graphs or two different sets of boundary conditions. Several applications such as the iteration formulas or lower bounds for the index are proved.


Motivation
The aim of this paper is to derive effective ways of computing the Morse index of second variation of constrained variational problems on graphs. Such problems can be conveniently formulated as optimal control problems. The results of this article can be used to study minimality and stability in a variety of geometrically and physically interesting problems.
Let us start with some examples which motivate the overall set-up in which we are working. Given three points a, b, c on a plane R 2 place a point d ∈ R 2 such that the sum of distances between d and each of the points a, b, c is minimal. It is well known that d should be placed at the Fermat point, a fact central to the Steiner tree problem. In particular, each of the angles ∠adb, ∠adc, ∠bdc should be of 120 • . We could have formulated the same problem in a slightly different, but equivalent way. Consider the tree graph G in Figure 1 and denote by G 0 = {A, B, C, D} the set of its vertices and G 1 the set of its edges. We can parametrize each edge by the interval [0, 1], an operation which also assigns orientations to each of them. Then we would like to find a continuous map F : G → R 2 with smooth restrictions to each edge such that where l is the Euclidean length. So we have reformulated our problem as a minimal immersion of the graph G into the Euclidean subspace R 2 . In this reformulation the following well-known notion plays a central role: Definition 1. A metric graph is a graph G = (G 0 , G 1 ), where G 0 is the set of vertices and G 1 is the set of parametrized edges. Each edge e ∈ G 1 is parametrized either by a finite interval [0, l e ] for some l e > 0 or by [0, +∞).
We can generalize the previous problem in several ways in order to encompass a great variety of situations commonly encountered in applications. For example, we can consider more general metric graphs G, a manifold M instead of R 2 , we can choose a different functional to minimize and, most importantly, we can assume that each edge satisfies a differential constraint. Let us consider some practical examples of this kind in order to see that an abstract approach is useful and allows to treat apparently different problems using the same framework.
Assume that we have a set of elastic rods soldered together to form a graph-like structure. Some vertices of this graph are assumed to be fixed, while others are free. What shapes can it take? This question arises often in civil engineering, for example, in construction of bridges, towers and various other structures ( Figure 2). They have some parts firmly fixed on the ground, which correspond to fixed vertices, while others are free to move in space. It is known that the elastic rods are extremal curves in certain constraint variational problems and stable configurations correspond to local minimizers of the bending energy [11]. and certain boundary condition on the value of ψ at the vertices G 0 which are usually taken to be Dirichlet, Neumann or Kirkchoff (or a combination of the above). Here ψ e are restrictions of ψ to the edge e, l e is the length of edge and 2 ≤ α ≤ 6 is a constant. There is an extensive literature concerning quantum graphs. In particular regarding existence of global minimizers for the NLS energy, see for example [4], [5], [3], [17] (or [15] and [2] for overviews of the results) and references therein. Also in situation that do not fit in our current framework, for example [22] where the same problem is discussed on a graph with an infinite number of edges. For the linear problem when α = 2 the book [14] is a good source.
Another important application comes from quantum physics. In the perturbative approach to quantum mechanics and quantum field theory via the path integral method, a formal analogue of the stationary phase method is used. This formula requires to know the index and a suitable generalization of the determinant of the second variation at a critical point [24,27]. The index is computed in the current paper, while the determinant will be investigated in a forthcoming paper.

Problem statement
In order to transmit better the ideas and simplify the proofs we will make several technical assumptions, starting with the following one. Assumption 1. Graph G has a finite number of edges.
The class of minimization problems we are interested is described in the next definition.
Definition 2. Given a metric graph G = (G 0 , G 1 ) and a manifold M consider the following data: 1. Control constraints U e parametrized by the elements of the edge set e ∈ G 1 , which are subsets U e ⊂ R ke for some k e ∈ N; 2. Families of time-dependent complete vector fields f e t,u ∈ V ec(M ) parametrized by the elements of the edge set e ∈ G 1 and controls u ∈ U e ; 3. Lagrangians ℓ e : [0, l e ] × M × U e → R parametrized by the edge set e ∈ G 1 .

Boundary conditions given by a subset N ⊂ M |G0| .
A graph-parametrized optimal control problem is the problem of finding a continuous map q : G → M with almost everywhere differentiable restrictions to edges q e : [0, l e ] → M , such that it minimizes the following functional ϕ[u] = e∈G1 le 0 ℓ e (q e (t), u e (t))dt → min (1) subject to constraintsq e = f e t,ue(t) (q e ), u e ∈ L ∞ ([0, l e ], U e ), where v 1 , . . . , v |G0| are vertices in G 0 indexed by integers.
All of the examples from Section 1.1 can be formulated as graph-parametrized optimal control problems. The goal of this article is to study the second variation of such minimization problems and characterize local minimizers. Local minimizers play an important role in modelling of various physical phenomena, since they usually correspond to stable configurations observable in nature, which makes them relevant even if there are no global minima.
The next assumption allows to avoid various regularity technicalities.
1. N is an embedded submanifold; 2. U e = R k for some k ∈ N and all e ∈ G 1 ; 3. Vector fields f e u and functions ℓ e are jointly smooth in the space variables q and in the control variables u, piecewise smooth in t for all e ∈ G 1 .
We will give the precise algorithm to do so later, in Subsection 3.1. Note that (4)-(6) by itself is a special case of a graph-parametrized optimal control problem where the metric graph G is the interval [0, 1]. The usual approach for identifying local minimizers of this problem can be roughly described as follows. First one applies first order minima conditions and identifies critical points of the functional ϕ. These critical points are called extremal curves. After that one studies second order conditions. Definition 3. Suppose that u is a critical point of the functional ϕ restricted to the space of admissible variations (i.e. variation satisfying conditions (4)- (5)). Assume that the space of admissible variation is a smooth manifold in a neighbourhood of u, the Hessian (or the second variation) is a quadratic form Q defined on the tangent space to the space of admissible variations. It is given by the second derivative of the functional ϕ.
Often, in constrained variational problems, the space of admissible variations is not a manifold. For this reason we will make additional assumptions in order to guarantee that this space is at least locally smooth in a neighbourhood of a critical point.
Quadratic form Q encodes information about minimality of a given extremal curve in its kernel and negative inertia index ind − Q. In the classical calculus of variations a necessary and sufficient condition for an extremal curve to be a local minimizer is ind − Q = 0, whenever the second variation is non-degenerate. Note that this is not always true for constrained variational problems. Sometimes a critical point stops being a local minimizer only when the inertia index of Q exceeds a certain threshold (see Theorem 20.3 in [9]). Thus we need to find good algorithms for computing ind − Q. This paper provides several efficient ways of doing this in the context of graph-parametrized problems.
This reduction allows us to focus completely on (4)- (6). That problem has a relatively simple characterisation of critical points, known as the Ponrtyagin maximum principle (PMP). In order to describe the PMP in this setting we introduce a family of Hamiltonian functions on where ν ∈ {0, 1} and for any submanifold N ⊆ M × M define which should be thought of as the annihilator of N . 1. the curve q is the projection of λ: q(t) = π(λ(t)); 2. λ satisfies the following Hamiltonian system: 3. the control u is determined by the maximum condition: 4. the non-triviality condition holds: (λ(t), ν) = (0, 0); 5. and the transversality conditions holds: It is known that extremal curves in optimal control problems can have very different behaviour. They are usually separated into several classes, such as regular, singular, bang-bang and others [31,29,12,10]. We will now list the last pair of assumptions that will allow us to focus on a rather broad class of extremals for which a good geometric description of the second variation is possible.

Assumption 3. The maximized Hamiltonian
Assumption 4. If λ : [0, 1] → T * M is an extremal satisfying PMP with control u ∈ L ∞ ([0, 1], R k ), then it satisfies the strong Legendre condition. Which means that there exists a constant c > 0 such that Assumption 3 will permit us to state the results in a simple form using the Hamiltonian flow of H t , while Assumption 4 guarantees that the quadratic form Q from Definition 3 has finite negative index, and that small arcs of a given extremal curve are local minimizers [9, Theorem 20.1].

Main results and structure of the paper
We are now ready to formulate and discuss the main results of this paper. Consider an extremal λ of an optimal control problem (4)- (6), which satisfies a Hamiltonian systeṁ under the Assumption 3. This Hamiltonian vector field H t generates a flow Ψ t : its graph, which is a smooth submanifold of the product space T * M × T * M . When t = 1 we simply write Γ(Ψ) = Γ(Ψ 1 ). We have the following main index theorem for the optimal control problem on the interval.
Theorem 2. Let λ : [0, 1] → T * M be an extremal for (4), (6) and simultaneously for two different boundary conditions N andÑ in (5). Let Q N and QÑ be the two quadratic forms for the second variation corresponding to the two boundary conditions. Denote λ = (λ(0), λ(1)). Then under the Assumptions 1-4 the negative inertia indices ind − Q N , ind − QÑ are finite and where Only one term on the right hand-side still requires an explanation. Here i(T λ A(N ), T λ Γ(Ψ), T λ A(Ñ )) is the negative Maslov index of the triple of Lagrangian subspaces indicated in the bracket of the symplectic space (1) . A precise definition of Lagrangian spaces and of the Maslov index used in this paper will be given in Section 2.2. For now it is enough to know that it is a certain symplectic invariant of the triple of subspaces, which can be computed in an explicit algebraic way.
A relevant example to keep in mind when the conditions of the theorem above are met is when N ⊂Ñ . In this case if λ satisfies the transversality conditions forÑ , then it satisfies the transversality conditions for N automatically. In particular, N can be just the product of two points N = {q 0 } × {q 1 }, for which transversality conditions are trivially satisfied. This allows us to compute the difference between indices of the second variation for the problem with moving and fixed end-points.
Theorem 2 has many interesting applications and allows to have a fresh view even on some classical results. When we consider a graph-parametrized problem (1)-(3) and reformulate it as problem on an interval (4)-(6), the structure of the graph G is completely encoded in the boundary condition N . It is often the case that a single critical point satisfies two graph-parametrized problems with different boundary constraints or even with different underlying graphs.
For example, we can introduce an extra vertex on an edge of a graph, and assume that this vertex is free. This obviously does not change the possible critical points. However, now, we can compare it to a problem where the new vertex is fixed. The simplest example of this technique would be to consider a fixed boundary optimal control problem on an interval (1)-(3) with N = {q 0 } × {q 1 }, introduce several free vertices in the interior of the interval and compare with a problem where each of the vertices is fixed as depicted in Figure 3. In order to formulate the next result, we need the definition of conjugate times and conjugate points.
To simplify notation we will denote by Θ t = (Ψ t ) * the differential (or the linearisation) of the extremal flow. It is straightforward to check that the tangent space T λ Γ(Ψ) is actually the graph of the linear map Θ t : T λ T * M → T Ψt(λ) T * M . We will denote by Γ(Θ t ) said graph and by Γ(Θ) the graph at time t = 1.
A consequence of Theorem 2 is the following result.
As previously discussed a necessary condition for minimality under Assumptions 1-4 is ind − Q = 0. For this reason a necessary condition for minimality of a critical point would be the equality to zero of the right hand side in formula (12). In practice, this allows to determine non-optimal solutions and greatly reduce the number of candidates for the minimal solution.
Another example of this type is given by the k-th iterate γ k of a periodic extremal trajectory γ. If γ has period T , we can view γ k as a periodic trajectory of period kT . Hence it is a graph-parametrized problem with the graph having one edge of length kT and a single vertex. We can add k more equispaced vertices and compare the problem to the k copies of smaller circle graphs which correspond to γ as depicted in Where ω is a primitive k-th root of unity.
The first equality is much in the spirit of [20] and [23]. The second equality in the formula is obtained using a complexified version of Maslov index described in Section 2.2, yielding a result very similar to Bott's original approach given in [16].
The theorems above are examples of index formulas, which try to encode the information about the index of the second variation of variational problems in terms of geometric quantities such as the Maslov index above. In the context of variational problems on 1D objects such as curves or graphs, it is possible to reduce the problem of studying index of a linear operator on an infinite-dimensional space to the study of non-autonomous linear ODEs in finite dimensional spaces. There exist various analogues of this result. For example, in the context of classical calculus of variations an infinite-dimensional version of the Morse index formulas was proven by several groups in works [23,32,18,19]. In the case of strongly indefinite problems the index formulas are replaced by spectral flow theorems, which are valid both in finite [28,25,33] and infinite dimensions [30]. There are also various approaches to infinite-dimensional Morse homology [1]. A very general index theorem for optimal control problems was proven by the first and third author in [8], which encompasses many separate classical constructions for various types of extremals [31,29,12,10,7].
A variant of Theorem 2 was proven by Baryshnikov in [13]. His formula is true in the generic case for a graph with a finite number of edges. In the generic picture, the various intersection terms in (11) disappear. The authors of [26] study the Morse index of Schrödinger operators on graphs. By reducing the problem to an interval, they provide a Morse index formula as the Maslov index of a curve in a Lagrangian Grassmanian of a sufficiently big dimension. Our formulas are different from those in several significant ways. They apply to constrained variational problems, they do not require any genericity assumptions, they work with more general boundary conditions and separate the contribution to the index coming from varying the edges and the contribution to index coming from varying vertices.
The paper has the following structure. It is divided into two parts. The first part consists of Section 2 and Section 3. Section 2 contains all the necessary information regarding symplectic geometry, Lagrangian spaces and Maslov index. This is enough to use Theorem 2 as black box. In Section 3 we focus on applications for the graph-parametrized problems. We prove Theorems 3 and 4 as well as a formula by Baryshnikov which reduces the dimensionality in Theorem 2 using a filtration of the vertices. This section relies only on Theorem 2 and properties of the Maslov index. The reader who only wants to understand how to compute the index and apply the main theorems can focus just on the first part of the paper. The second part is Section 4, where we prove the main Theorem 2. Our strategy will be to reduce the problem (4)-(6) to a problem with fixed end-points. We then derive the Jacobi equation and use it to give a geometric interpretation of various terms entering in the formula for the second variation.

Symplectic geometry
A symplectic vector space is a finite dimensional vector space Σ with a non degenerate skew-symmetric bilinear form σ (the symplectic form). A symplectic manifold M , is a manifold whose tangent space T M is endowed with a symplectic structure at each point (i.e M together with a closed non degenerate 2−form).
Cotangent spaces of smooth manifolds are always endowed with a symplectic structure which is given by the so called tautological form. Call π : T * M → M the canonical projection. Take λ ∈ T * M and define the 1−form s λ (X) = λ(π * X). One can check that ds is non degenerate and thus (T * M, ds) is a symplectic manifold. The 2−form σ = ds on T * M is called the canonical symplectic form.
A natural way to obtain diffeomorphisms is trough flows. Given a (complete) vector field X one obtains a family of diffeomorphisms Φ t by solving the ODE systeṁ In a similar way one can produce symplectomorphisms using special classes of vector fields: Hamiltonian and symplectic fields. A vector field X, is Hamiltonian if there is a smooth function H such that dH(Y ) = σ(Y, X) for all smooth vector fields Y . H is called Hamiltonian function and X is often denoted by H. A vector field for which we can find a Hamiltonian only locally, i.e. in a neighbourhood of every point, is called symplectic. The flow of Hamiltonian and symplectic vector fields is always a one parameter group of symplectomorphisms.
Given a subspace W of a symplectic vector space Σ, we can define its skew-orthogonal complement W ⊥ using the symplectic form.
Since the symplectic form is non degenerate, dim(W ) + dim(W ⊥ ) = dim(Σ) and Inside a symplectic vector space we distinguish the following classes of subspaces: • Lagrangian V isotropic and maximal, i.e. V = V ⊥ ; Lagrange subspaces are extremely important in symplectic geometry, their collection is a compact manifold called Lagrange Grassmannian. It is denoted by If dim(Σ) = 2n its dimension is n(n + 1)/2.
The following examples of Lagrangian subspaces are often considered: The product space can be endowed with a symplectic structure considering (−σ 0 ) ⊕ σ 1 . Graphs of symplectomorphisms are always Lagrangian subspaces with this choice.
Example 2. If N ⊆ M is a submanifold of a smooth manifold we can always consider the following submanifold of the cotangent bundle T * M : The tangent space to the annihilator at a point λ is a Lagrangian subspace of T λ (T * M ), which means that A(N ) is a Lagrangian submanifold.
If M is a product space i.e. M = M 0 × M 1 , the annihilator of a submanifold N is a Lagrangian submanifold only with respect to σ 0 ⊕ σ 1 , which coincides with the canonical symplectic form on To get a Lagrangian submanifold of (T * M 0 ⊕ T * M 1 , (−σ 0 ) ⊕ σ 1 ) one has to change the sign to the first or the second covector and thus consider the submanifold A(N ) defined in (7). Notice that this distinction is unnecessary when N itself is a product, i.e. when N = N 0 × N 1 .
Example 3. A particular instance of the example above is the vertical fibre i.e. the tangent space to T * q M . This space can be characterized as the annihilator of the point q or as the kernel of the natural projection, ker π * : Example 4. Consider as symplectic space R 2n = {x = (p, q) : p, q ∈ R n } with the canonical symplectic form σ(x, x ′ ) = p, q ′ − q, p ′ . Using the Euclidean scalar product we can represent σ as: The two subspaces B = {p = 0} and Π = {q = 0} are Lagrangian and any subspace of the form V S = {(q, Sq)} and V ′ S = {(Sp, p)} is Lagrangian provided that S = S * . It turns out that if we take two transversal Lagrangian subspaces L 0 and L 2 there always exists a choice of basis, for which L 0 is B and L 2 is Π, and such that the symplectic form σ has the canonical form as in equation (15) (see Theorem 1.15 in [21]). These coordinates are sometimes called Darboux or symplectic.
Using this coordinates we can build charts for the Lagrange Grassmannian Lag(Σ). The map S → V S from the space of symmetric matrices to Lag(Σ) maps onto the set of planes transversal to Π (see for example [21] for details).

Intersection index of Lagrangian subspaces
It is well known that the all pairs of transversal Lagrangian subspaces can be mapped to each other with a linear symplectomorphism [21,Theorem 1.15]. This is no longer true for a triple of Lagrangian subspaces.
Definition 1 (Maslov index). Take three Lagrangian subspaces L 0 , L 1 , L 2 . Consider the isotropic subspace The following quadratic form is called the Maslov form of the triple (L 0 , L 1 , L 2 ): m(l ′ 1 ) = σ(l 0 , l 2 ). By a slight abuse of notation we will also write m(L 0 , L 1 , L 2 ) instead of just m when we want to be explicit about which Lagrangian subspaces are used.
The numbers ind + m, ind − m and sg m and dim ker m are invariants of the triple (L 0 , L 1 , L 2 ). The Kashiwara index is the signature of the Maslov form: The negative Maslov index is defined as Example 5. Suppose L 0 and L 2 are transversal. We can identify the symplectic space with the standard one (R 2n , σ) as given in equation (15). Since any couple of Lagrangian subspaces can be mapped into each other, we can find a symplectomorphism which simultaneously maps L 0 to B and L 2 to Π.
Any L 1 can be represented as If A or C is invertible then the matrix expression of the Maslov form is given by −A −1 C or C −1 A respectively, which have the same signature of ∓AC * .
The Kashiwara index and the Maslov index have the following properties: • Relation between the negative index [6, Lemma 5] which is a Lagrangian subspace of the reduced space. It holds that: The Maslov index satisfies only a generic cocycle property. The next lemma will be used in the proof of Theorem 2 and shows that the defect of being a cocycle is measured by the intersections of the four Lagrangian subspaces one considers. Lemma 1. The following formulas hold: Proof. The proof is just a computation using the cocycle identity for the signature in equation (16). We use formula (17) to get a relation between the signature and the index for each term on the left of (19). The part involving intersections of pairs of Lagrangian spaces, after the summation, gives the contribution The triple intersection do not simplify and thus their coboundary appears. Sometimes it is useful to think about this remainder as the difference of the dimensions of two quotient spaces. L 1 ∩ L 3 in which we factor out the space Next apply the first part with L 3 = L 0 . The right hand side of the formula is then zero. Moreover the terms i L 0 , L 1 , L 0 and i L 0 , L 0 , L 2 are zero since the Maslov form is zero.
It follows that i L 0 , L 1 , L 2 = i L 1 , L 2 , L 0 , i.e. we obtain the invariance under cyclic permutations.
The following lemma will be used in the sequel.
If we compute now the Maslov form, we get: Suppose without loss of generality that N 1 ⊆ N 0 . The equation X 0 + X 2 = X 1 implies that X 2 = X 1 − X 0 ∈ T π(λ) N 0 and thus ν 0 , X 2 = 0. Therefore the quadratic form is the zero form since: For the second part, we work on the cotangent bundle of Label the coordinates as (λ 0 , λ 1 ), call the standard form on T * M ′ , σ ′ and consider the following diffeomorphism: (13) to the corresponding A(N i ) as given by equation (7). Since Maslov index is invariant with respect to the action of symplectomorphisms, the statement follows.

Hermitian Maslov index
In the proof of Iteration Formulae it will be convenient to introduce complex coefficients and work on C 2n . Maslov form extends to this setting in the obvious way. Consider the complex version of the symplectic form: If V is Lagrangian as a real vector space, then V ⊗ C is Lagrangian with respect to the new symplectic form. If we take three Lagrangian subspaces the Maslov form is still well defined. Suppose that λ 1 ∈ L 1 ∩ (L 0 + L 2 ): Lemma 3. The Maslov form is a Hermitian form.
This means that the quadratic form is real and thus m is Hermitian.
Thus the eigenvalues of m are real and the index and the signature is well defined exactly as in the real case. Here we list some of the properties of the σ C and complex Lagrange subspaces: • Darboux basis Since σ C is non degenerate, every time two Lagrangian subspaces L 0 , L 1 are considered, there exists a basis in which σ C has the standard form.
• Grassmannian of Lagrangian subspaces In the real case the Lagrange Grassmannian is a homogeneous space diffeomorphic to U (n)/O(n). It turns out that the complex one is diffeomorphic to U (n) (and thus still real as a manifold). We can diagonalize the symplectic form obtaining: Thus we have two subspaces on which σ C is non degenerate, the eigenspace V i relative to i and V −i , the one relative to −i. It is thus clear that if V is Lagrangian, V must be transversal to both the eigenspaces. So it can always be represented as a graph of an invertible linear operator from V i → V −i (or vice versa). It remains to check what kind of linear maps are allowed. Using again the coordinates in which σ C is diagonal we get: Since we need this quantity to be zero for any x, y ∈ C n we getRR * = 1 and thus R ∈ U (n). It follows that the complex Grassmannian is diffeomorphic to U (n).
• Atlas for the Lagrange Grassmannian Take two transversal subspaces L 0 , L 1 . Using Darboux coordinates, we can build an affine chart as in the real case (compare with example 4). This time though we consider Hermitian matrices. The subspaces • Properties of Kashiwara index The proof of the cocycle property given in [21,Theorem 1.32] works in the Hermitian case as well since our quadratic forms are all real by Lemma 3. It suffice to substitute the word symmetric with the word Hermitian. In particular all the properties listed in the previous section remain true in this setting, with real dimensions replaced by complex ones.

Applications and proofs of Theorem and Theorem 4 3.1 Reduction of the problem on a graph to a problem on an interval
Let us transform problem (1)-(3) to a problem on a single interval [0, 1]. We can assume without any loss of generality that l e = 1 for every e ∈ G 1 simply by rescaling the time interval [0, l e ], when l e < +∞. If l e = +∞ we can compactify the semi-line [0, +∞) via a suitable change of coordinates in the time variable, provided that the compactification satisfies Assumption 4, fact that may depend on the choice of change of variables. This will merely change the Lagrangians ℓ e and the vector fields f e t,u and they can be redefined accordingly. Let us ignore for the moment the boundary conditions (3) and treat the restriction of the optimal control problem to every edge as an independent problem. Define the map π e : M G1 → M e , it is the projection on the copy of M relative to edge e. Then functional J[u] and the control system can be seen as a part of an optimal control problem on M G1 . We define the new Lagrangian ℓ : and a new family of time dependent vector fields f t u ∈ V ec(M G1 ) such that for a fixed edge e ∈ G 1 Finally, let us consider the boundary conditions (3). In order to make this construction cleaner, we need the following definitions.
Since we use I as an index set, for a given subset J ⊂ I we can define the projection map by forgetting the copies of W indexed by the elements of I \ J.
Definition 6. Let I, J be two finite index sets, W an arbitrary set and f : I → J a surjective map. Then the pull-back product f * (W J ) is a subset of W I characterized by the property that for every j ∈ J Similarly if X ⊂ W J the pull-back f * (X) is a subset of W I defined by the property that for every j ∈ J.
Let us look at an example when I = {1, 2} and J = {1} and f (1) = f (2) = 1. In this case the preimage of 1 is all of I and hence Now we can describe the reduction procedure. The idea is intuitive, but a bit involved when written down formally. We want to use the orientations on edges of G and pull-back the set of boundary constraints N , a priori defined just on the vertex set G 0 , to a new manifold embedded in (M × M ) G1 . This allows us to separate the dynamic on each edge from the boundary conditions, exactly as we did a few lines above.
Saying that each edge e ∈ G 1 is oriented is equivalent to having source and target maps s, t : G 1 → G 0 . The image of the source and the target of an edge e are Taking a product indexed by G 1 we obtain that where G 1 ⊔ G 1 is a disjoint union of two copies of G 1 . The source and the target maps induce a surjective map s ⊔ t : G 1 ⊔ G 1 → G 0 . This allows us to pull-back the boundary conditions tõ Hence we have reduced the optimal control problem (1)-(3) to an optimal control problem (4)-(6) with the configuration space M G1 and the boundary conditions (s ⊔ t) * (N ), which encode all the information about the graph structure.
The final remark concerns the symplectic form on (T * M × T * M ) G1 that will be used for the calculation of the Maslov index. We will assume that each copy of T * M corresponding to a source vertex carries minus the standard symplectic form −σ, while every target copy T * M carries σ, the standard one.

Discretization
In this subsection we prove Theorem 3. Fix a partition Ξ = {t i : t 0 = 0, t n = 1, t i < t i+1 } of the unit interval.
We will work with an optimal control problem and Assumptions 2−4. In particular, Assumption 4, the strong Legendre condition along the extremal, ensures that the Morse index is finite and that the conjugate points form a discrete set. This will guarantee that, under mild conditions and after enough successive refinements of the partition, formula (12) will give exactly the Morse index of the extremal.
Let us first prove the formula when only one extra vertex is introduced. Let γ = π(λ) be an extremal curve in a problem with fixed end-points. Take a point t * ∈ (0, 1). Let us call γ 1 = γ| [0,t * ] and γ 2 = γ| [t * ,1] the restrictions. Q γi will denote the second variation of the segment as an extremal curve with fixed points. Recall that Π i = T λ(ti) (T * π(λ(ti)) M ) ≃ T * π(λ(ti)) M is the vertical subspace over the point γ(t i ). Proposition 1. The index of the second variation Q γ can be computed as follows: ). Proof. Let us consider the following three points in M : Variations of γ as a curve form q 0 to q 2 do not necessarily pass by the point q 1 at time t * but satisfy a continuity condition there. We perform the reduction to a single interval as discussed in Subsection 3.1. To do this we break up [0, 1] in two intervals and consider the dynamics separately (i.e. duplicate the variables). The new boundary conditions which allow us to glue the two pieces together are of the form: Now we are going to compare the following two problems. The first one is fixed end-points, we impose that the curve starts from (q 0 , q 1 ) and arrives to (q 1 , q 2 ). The second one is curves satisfying the constraints given by the manifold N = {q 0 } × ∆ × {q 2 } defined above.
Recall that γ is a projection of a solution λ : [0, 1] → T * M of the Hamiltonian system. Let us consider the tangent space to the annihilator of N at the point λ = (λ(0), λ(1), λ(1), λ(2)). Fix a system of coordinates, which determines a complement to the subspace ker π * = Π 1 which we call B. In these coordinates the annihilator reads: The other space appearing is the graph of the two symplectomorphisms Θ 1 and Θ 2 coming from the Hamiltonian flows of PMP on intervals [0, t * ] and [t * , 1]. It will be denoted by Γ(Θ 1 × Θ 2 ).
Let us look at the subspace on which the Maslov form m is defined, This is defined by the following equations,  where α, ν i , for i = 1, 2 and µ j for j = 1, . . . 4 lie in the vertical subspace over the respective points, whereas X ∈ B is in the horizontal space. In particular Maslov form reads: So, if we call η = Θ 2 (ξ 2 ) ∈ Π 2 and ξ = ξ 1 we have ξ ∈ Π 0 , η ∈ Π 2 and Θ −1 2 (η) − Θ 1 (ξ) ∈ Π 1 and see that the form coincides with: ). The additional terms popping up in Theorem 2 are ) as a quick calculation shows.
We can now prove Theorem 3.
Prood of Theorem 3. The statement will follow from Proposition 1. First of all notice that in equation (21)  Iteratively replacing the terms ind − Q γ| [0,t j ] we obtain the following formula: ). Here as described in the statement the maps Θ j,j−1 are the linearisation of the Hamiltonian flow of equation (10). The notation is related to law of composition of non autonomous flows and is justified by the fact that Θ j,k • Θ k,l = Θ j,l .
The index is presented as sum of three positive terms: the first one Q γi is zero when each segment γ| [ti,ti+1] is minimizing [9,Theorem 21.3]. Under Assumption 4 this is the case when sup i |t i − t i−1 | is small enough (see [9] for instance). The same goes for dim ( ). Moreover dim(Θ i,0 (Π 0 ) ∩ Π i ) is zero precisely when t i is not a conjugate time for γ.
Thus equality holds exactly when our hypotheses on the partition are satisfied.
Remark 1. The hypothesis on the partition Ξ can be weakened if we change a bit our way of counting. If we add to the dimension of the negative space the dimension of the null space of the Maslov form we can essentially forget about avoiding conjugate points of γ.
You can see that the correction term k in Proposition 1 is in fact the dimension of the kernel of the Maslov • Θ 1,0 (Π 0 ) still approximates from below the negative index and includes the contribution of conjugate points of γ that are possibly present in the partition.
Remark 2. If we combine Theorem 2 and Theorem 3 we can obtain a formula for the index involving just the Maslov index i and dimension of intersections for arbitrary boundary conditions.

Filtration formula
In the previous subsection we have proven a discretization formula for the fixed end-point problem on an interval. The idea was to introduce extra vertices inside the single edge and apply an iterative procedure of fixing each of the new vertices one by one. Note that if we would have fixed all of the vertices at the same time, a direct application of (11) would result in computation of the Maslov index in a symplectic space of a very big dimension. Instead the recursive nature of the proof allows us to reduce greatly the dimensionality of the problem.
A way of reducing the dimensionality in formula (11) for problems with separated boundary conditions is discussed in paper [13]. The argument works when all of the Lagrangian spaces in the final formula are transversal. We can reproduce this argument in a greater generality using Theorem 2.
Assume that each vertex v ∈ G 0 is constrained to lie on a separate submanifold N v ⊂ M . We denote by N boundary conditions, which are obtained after the reduction of the problem to an interval. We can introduce a filtration of vertices To each set G j 0 we associate boundary conditions N j ⊂ N in the following way. We assume that vertices v ∈ G j 0 vary on N v , while vertices v ∈ G 0 \ G j 0 are assumed to be fixed. Thus we activate variations of each individual vertex at a time and track how the index changes as we do so.
We now apply Theorem 2 to compute ind − Q Nj+1 − ind − Q Nj . Let us introduce some simplifying notations. Recall that s, t : G 1 → G 0 are the source and the target maps. Let v j ∈ G j+1 0 \ G j 0 be the activated vertex. We introduce a separate notation for the set of edges that are incident to v j : A naive guess would be that when we activate a vertex, the only relevant contributions come from the edges incident to a given vertex. Thus we define forgetful projections π G j 1 which forget all the edges except the ones incident to v j : Subspaces TλA(N j−1 ) and TλA(N j ) can have a big intersection. For sure this intersection contains the subset V j = π −1 G j 1 (0), which is an isotropic subspace. This means that we can perform a symplectic reduction to the projection maps for each j = 1, . . . , |G 1 |. We can then define shortened notations for the images: A j j−1 = π j (TλA(N j−1 )), A j j = π j (TλA(N j )), Γ(Θ j ) = π j (Γ(Θ)).
By property (18), we can factor out V j in the definition of the Maslov index and get i(TλA(N j−1 ), Γ(Θ), TλA(N j )) = i(A j j−1 , Γ(Θ j ), A j j ) and for the same reason Finally since N j−1 ⊂ N j , we have that Now we collect all of the terms and sum by the index j = 1, . . . , |G 0 |. As the result we obtain a formula that expresses the difference between the index of the second variation Q of the original problem with the index of the second variation Q 0 := Q N0 of the problem with the same graph and fixed vertices: This is the same formula as in [13] modulo terms containing dimensions of intersections. We end this subsection with a couple of remarks regarding this formula. First of all, in practice the dimensions are reduced even more because A j j−1 ∩ A j j = ∅. Nevertheless further reductions depend on the structure of the graph and the filtration chosen. Secondly, at first sight it may seem that the formula is a sum of local contributions, because we have used only edges incident to a given vertex in the derivation. However, this is not the case. The non-locality is hidden in the reduced space V ⊥ j /V j and the corresponding projection π j . For example, in the case when G 1 is a tree, we can define a partial order ≤ on G 0 by saying that v ≤ w if the minimal path from v to the root crosses less or equal number of vertices than the minimal path from w to the root. If we choose a filtration, which orders vertices one by one compatible with the partial ordering, one can identify the set G j 0 with a sub-tree of G. Then the formula for the indices i(A j j−1 , Γ(Θ j ), A j j ) will contain terms involving symplectomorphisms of all of the edges in the sub-tree determined by G j 0 and not only of the incident edges. This can be checked via a long but straightforward calculation.

Iteration Formulae
Now we prove Theorem 4. For clarity we prove separately the two formulas since the strategies in the two cases are a bit different.
Suppose that γ is a closed periodic extremal trajectory. It is straightforward to see that iterations (i.e. concatenation of γ with itself) are still critical points.
We will use the following notation: γ k will denote the k−th iteration of γ whereas ind − Q γ and ind − Q γ k the Morse index of γ and γ k respectively as periodic trajectories. We want to compute the difference ind First of all we compute the difference ind − Q γ k − ind − Q γ k−1 . Let us consider the following manifolds of constraints: When we restrict to variations satisfying the boundary conditions given by ∆ , we consider variations of γ k as a periodic trajectory, whereas when we take boundary conditions ∆ 2 , we consider independent variations of γ k−1 and γ as periodic trajectories. See Figure 4 for a visual explanation between the two boundary conditions. Now we prove the following lemma: Lemma 4. Here n = dim(M ), let Γ j = Γ(Θ j ) the graph of Θ j . Then: Proof. The statements follows applying Theorem 2. We take as N 1 = ∆ and as N 2 = ∆ 2 . The part coming from the dimension is immediate, the intersection of the tangent spaces has dimension n while the dimension of ∆ 2 is 2n. So we get a −n.
From the definitions it follows that, when we impose the boundary conditions ∆ 2 , we have ind − Q N2 = ind − Q γ k−1 + ind − Q γ , so the only thing to check is the Maslov index part.
The equation defining the subspace are the following: By subtracting the second and the third equations, and then the first and the fourth equations we find Changing coordinates and setting η = Θ k−1 (ξ 1 ), Y 1 − Y 2 = η 1 and η 2 = ξ 2 we get: So we can see that the Maslov form reduces to a form on ∆ ∩ (Γ k−1 + Γ k ). Moreover the quadratic form reads: Which is exactly m(Γ k−1 , T λ A(∆), Γ k ) in the coordinates just introduced. And thus the formula is proved.
The first iteration formula is now a direct consequence of the Lemma just proved: Theorem (Iteration Formulae I). The index of the k−th iteration of γ as a periodic trajectory satisfies: Proof. We will use an inductive procedure in a similar spirit as in the proof of Theorem 3. First we will look at γ k as the concatenation of γ k−1 and γ and express the difference ind − Q γ k − ind − Q γ in terms of ind − Q γ k−1 . This is the first step of the scheme and was proved in Lemma 4. Then we apply the argument iteratively to obtain: Which is precisely the formula in the statement. Now we prove the second iteration formula.
Theorem (Iteration Formulae II). The index of the k−th iteration of γ as a periodic trajectory satisfies: Where ω is a primitive k−th root of the unity.
Proof. We work on the space M k = M × · · · × M . The first set of boundary conditions we are going to consider is the following: Set q 0 = γ(0) = γ(1). Any curve satisfying the boundary conditions ∆ at (q 0 , . . . , q 0 ) gives a variation of the k−th iterate of γ seen as periodic trajectory.
The other sets of constraints we are going to introduce are the following: The first boundary condition is the product of 2k copies of the diagonal. Any curve satisfying this set of constraints at point (q 0 , . . . , q 0 ) is a variation of γ k as k independent periodic trajectories γ. The second boundary condition corresponds to k copies of a single point q 0 . Variations of γ k satisfying these latter conditions are k independent variations of γ as a trajectory with fixed points.
Set for brevity ∆ k = T λ A(∆ k ), ∆ = T λ A(∆ ) and Γ = Γ(Θ × · · · × Θ) to be the product of k copies of Γ(Θ). We have T λ A(q 0 ) = Π 2k λ(0) = Π 2k where λ(0) is the initial covector of the lift to the cotangent bundle. First of all we compute directly ind − Q γ k using Theorem 2, comparing with the fixed points problem. We get: Here the notation ind − Q 0 stands for the index of Q at γ seen as a trajectory with fixed end points. First of all we analyse the term i Π 2k , Γ, ∆ . To compute it we present the Maslov form as the direct sum of k forms defined on a n−dimensional subspace. This is done in Lemma 5, where we use the complexified version of Maslov index.
The term i Π 2k , Γ, ∆ is thus the sum of contributions of the type i Π 2 , Γ(ω j Θ), ∆ where ω is a primitive root of unity.
Now we apply Theorem 2 to the second set of boundary conditions, i.e. ∆ k . We find that: Exactly as in the previous case the piece i Π 2k , Γ, ∆ k splits as a sum. But this time the reason is more apparent: we are considering independent variation on each iteration. It follows that i Π 2k , Γ, ∆ k = k i Π 2 , Γ(Θ), ∆ Now we subtract the two equations and we are left with the following expression for ind Let's rewrite the term involving the intersections. It is straightforward to see that dim In turn this can be easily seen to be k dim(ker(Θ − 1) ∩ Π).
For the second piece it holds that: We prove this below, in Proposition 2. Putting all together we get: Now we can use the cocycle property given in equation (19) with the subspaces Π, Γ(ω j Θ), Γ(Θ) and ∆ to express the terms in the sum using the Maslov index of the spaces Γ(ω j Θ) and ∆. These computations are collected in Proposition 2. What we find is that: Since we are summing over j = 0, . . . , k−1 and ω is a primitive k-th root of unity, we have that and thus the intersection of the eigenspaces with the fibre cancel out with the part coming from triple intersection given in equation (24).
Summing up we finally obtain: Which is exactly the statement of the theorem.

Lemma 5.
Let ω ∈ C be a primitive k−th root of the unity. The Maslov form m(Π 2k , Γ, ∆ ) = Proof. We will use the Hermitian version of Maslov index. Any real subspace V appearing in the proof will stand for its complexification V ⊗ C without any mention of the tensor product operation. Let us write down the equation defining the space (Π 2k + ∆ ) ∩ Γ.
On the other hand belonging to Π 2k + ∆ means: Maslov form is computed in the following way. Let Where in the third equality we simply shifted the second index cyclically. Suppose that ω is a primitive k−th root of the identity and make the following change of variables.
which essentially is just the Kronecker product of the identity with the transpose of Vandermonde's matrix obtained with {1, ω, . . . , ω k−1 }. In the new coordinates the equation reads: So in the new coordinates the space (Π 2k + ∆ ) ∩ Γ splits as the direct sum k l=1 {η : η − ω l Θ(η) ∈ Π}. The inverse transformation is given by the following rule: If we plug in the second term of the Maslov form we have: (ω i(s−l) )ω 1−s σ(Θ(η s ), η l ) .
In particular the only non zero terms are those for which s = l since the sum of powers of any primitive root (up to k) is zero.
We can handle similarly the first term. In this way we find that the Maslov form on our subspace splits in the following way: The factor 1 k is irrelevant for us and comes just from the change of coordinates. The last step is to identify the summands with m(Π 2 , Γ(ω s−1 Θ), ∆). Let's write down the kernel for these forms. The space we have to look at is (Π 2 + ∆) ∩ Γ(ω s−1 Θ). It is defined by: By the definition the Maslov form is given by Proposition 2. The following relation holds: . Moreover the space Γ ∩ Π 2k ∩ ∆ splits as a direct sum and its dimension is given by: Proof. The second part can be deduced by the proof of Lemma 5. In fact the space Π 2k ∩ Γ ∩ ∆ is isomorphic to i ker(Θ − ω i ) ∩ Π. This can be either directly computed from the definition of the spaces or deduced in the following way. Let P represent the standard k−cycle which maps ξ i → ξ i+1 and ξ k → ξ 1 . A direct calculation shows that ∆ = Γ(P ). Thus any element of ∆ ∩ Γ can be written as i.e. an eigenvalue problem. The core of the proof of Lemma 5 consisted in the diagonalization of the following matrix: with the remaining elements understood to be zero. The transformation diagonalizing the matrix we used preserves the fibre. So it follows that Π 2k ∩ Γ ∩ ∆ is the sum of the eigenspaces ker(Θ − ω j ) intersected with the fibre Π. Now we prove the first part of the proposition. Let us apply the cocycle property to Π 2 , Γ(ω j Θ), Γ(Θ) and ∆.
We can invert the equations to write them on Π 2 . We get ξ 2 = 1 1−ω j (ν 1 −Θ −1 (ν 2 )) and ξ 1 = 1 1−ω j (Θ −1 (ν 2 )− ω j ν 1 ) and thus the form is equivalent to: This form has zero signature and kernel isomorphic to two copies of Θ(Π) ∩ Π. This is a general fact and can be seen as follow. Suppose the matrix representing the quadratic form has the following expression: Let be Q and R unitary matrices which gives the singular values decomposition for X, i.e. QXR = D for D = diag(d 2 i ), diagonal and with non negative entries. Apply the following change of coordinates to M: And then apply another change: Thus the non zero eigenvalues of the matrix M are ±d 2 i , where d 2 i > 0 are the positive singular values of X. The kernel of M has dimension 2 dim ker(X). This is precisely our situation: fix a Lagrangian complement to the fibre Π, and consider the matrices associated to Θ and ω −j ω −j −1 JΘ −1 . In blocks they can be written as: We are using coordinates in which the fibre Π is the span of the first n coordinates. Thus the block we have to consider is always the upper left one. Our form, with this conventions, is written as: So for us X = ω −j 1−ω −j C * . Thus our form has zero signature, is defined on a 2 dim(M ) dimensional vector space and the kernel is isomorphic to two copies of the kernel of X. The latter is easily seen to be Θ(Π) ∩ Π.
We can consider the function S 1 ∋ z → i(Γ(Θ), ∆, Γ(zΘ)). It has very nice properties and an explicit description in terms of the monodromy matrix Θ. These ideas are collected in the following proposition. Proposition 3. The number i Γ(Θ), ∆, Γ(ω j Θ) corresponds to the number of negative eigenvalues of the following matrix: If we consider the function S 1 ∋ z → i Γ(Θ), ∆, Γ(zΘ) , it is locally constant with at most 2n jumps at eigenvalues of Θ. Moreover the jumps are bounded in amplitude by dim(ker(Θ − z)) where z ∈ S 1 .
Proof. The first part is just a straightforward computation. Take for any α ∈ S 1 : If α = 1 the two graphs are always transversal and the Maslov quadratic form can be written in terms of the variable X: It follows that the kernel is M α = 1 1−ᾱ J ᾱ + 1 −ᾱΘ − Θ −1 . For the second part notice that the map α → M α is continuous away from 1 with values in the space of Hermitian matrices.
A change of index can occur only at those points in which the determinant of M z is zero, thus at most 2n times. Moreover the jumps are the following: det(M α ) = 0 ⇐⇒ det(ᾱ + 1 −ᾱΘ − Θ −1 ) = 0, α = 1.
In particular, notice that Θ and Θ −1 can be put in the same block triangular form. For example one can choose to put Θ in its Jordan form. On the diagonal, at a block corresponding to eigenvalue λ of Θ, the elements areᾱ + 1 −ᾱλ − 1 λ . This quantity is zero if and only if α = λ |λ| 2 i.e. if α is an eigenvalue of Θ that lies on the circle.
Thus the jumps are at most 2n. The part on the bound follows by this observation: take a Jordan block of Θ with eigenvalue λ. Then the corresponding block of Θ −1 will haveλ on the diagonal and (−1) kλk+1 on the k−th upper diagonal. This implies that on the first upper diagonal of the λ block ofλΘ + Θ −1 we considered you end up with −λ +λ 2 , which is different from zero. Thus each λ−block contributes with a single eigenvalue and so the jumps are controlled by dim(ker(Θ − λ)).

Index formulas and proof of Theorem 2 4.1 Reduction to a variational problem with fixed end-points
In this section we prove Theorem 2. We will consider first the case in which the boundary constraints in (5) are separated. This means that we look for a minimizer γ with initial point γ(0) in N 0 and final point γ(1) in N 1 , where N 0 , N 1 ⊂ M are embedded submanifolds. The general case will be reduced to this one.
Given an extremal trajectory γ of the optimal control problem (4)- (6) with N = N 0 × N 1 , we will now construct an extended optimal control problem with fixed end-points and interpret γ as the restriction of an extremalγ. Moreover we will show that the two problems are equivalent on a neighbourhood of γ andγ.
Denote q i = γ(i) ∈ N i for i = 0, 1. We want to construct the extended control system in such a way that all admissible curvesα connecting q 0 with q 1 sufficiently close to γ are concatenationsα = α 1 * α * α 0 , where α i are curves inside N i and α connects N 0 to N 1 .
To do so fix neighbourhoods O(q i ) ⊂ M , i = 0, 1 of the two points q 0 , q 1 . If O(q i ) are sufficiently small, we can construct regular foliations of O(q i ) such that N i ∩ O(q i ) are leaves passing through q i . We can consider the union of all tangent space to each leaf of the foliation. This gives us two integrable distributions D 0 and D 1 in each neighbourhood. Without loss of generality, we can choose a set of vector fields f j i , j = 1, . . . , dim N i defined on O(q i ), which generate these distributions: Using these vector fields we define an extended control system for times from −1 to 2, which is linear in the controls for t ∈ [0, 1] c . Namely: where u 0 ∈ R dim N0 and u 1 ∈ R dim N1 . The space of the extended controls (u 0 , u, and it is identified with functions which are locally constant on [−1, 0] and on [1,2] with values in R dim N0 and R dim N1 respectively. In Figure 5 the construction is explained visually. The local foliations are depicted in grey scale with the white surfaces being N 0 and N 1 . An admissible curveα of an extended system is confined to the leaf of the starting point up to time 0, evolves with the law prescribed by the initial system and then continues inside the leaf reached at time 1. In particular, if we are interested in extended admissible curvesα which connect q 0 and q 1 , we get thatα| [0,1] must connect N 0 to N 1 . We define the new optimal control problem aṡ  Proof. If an admissible curve α of the original control system with control u satisfies α(i) ∈ O(q i ) ∩ N i for i = 0, 1, then it can be lifted to an admissible curve of the new system connecting q 0 and q 1 . Indeed, take the unique controls u i for which where exp denotes the flow of the vector field inside the brackets at time t = 1. Then the liftα is defined aŝ Conversely, if we have an admissible curveα such thatα(−1) = q 0 andα(2) = q 1 , then its restriction α =α| [0,1] is a curve that connects N 0 to N 1 and such that α(i) ∈ O(q i ). Thus we obtain a local bijection between two spaces of admissible curves.
In order to finish the proof, it only remains to notice thatφ(û) = ϕ(u).

Computation of first and second variation of the extended problem
Let λ : [0, 1] → T * M be an extremal satisfying PMP for the problem (4)- (6) with N = N 0 × N 1 . Denote bỹ u the corresponding control and by γ(t) = π(λ(t)), t ∈ [0, 1] the extremal curve on the manifold M . As was indicated in the proof of Lemma 6 we can extend γ to an admissible curve of (26)-(28) aŝ In order to simplify slightly the notations, we will omit in the future the hat symbol forû by essentially identifyingũ ∼ (0,ũ, 0). In this section we compute the first and second variations of the problem (26)-(28) at a critical pointũ. To do this, we use the already existing formulas for the fixed end-point problem which can be found in several references such as [9]. In order to do this we need to define all of the objects appearing in the formulas for the first and second variation which are written below.
The Hamiltonian of PMP is given by: According to PMP a minimal control must maximizeĥ t u (λ). Given an extremalλ : [−1, 2] → T * M , let λ 0 and λ 1 be its restrictions to the intervals [−1, 2] and [0, 1]. Since this family is linear in u 0 and u 1 , λ i must lie in the annihilators A(N i ). In particular, if λ : [0, 1] → T * M was an extremal of the original problem such that γ(t) = π(λ(t)), ∀t ∈ [0, 1], we can extend λ to an extremalλ of problem (26)-(28) exactly as before: Denote byΦ t the flow generated byĥ t u , or more preciselŷ Since the vector field associated toũ is zero on [−1, 0] ∪ [1,2] the flow is a constant transformation. Composing the Hamiltonian with the flowΦ t gives uŝ Then we can defineẐ . and denote Z 0 and Z 1 to be restrictions ofẐ t to the time intervals [−1, 0] and [1,2] correspondingly, so that It is worth noting that Z 0 and Z 1 are constant, since b t u (λ) is linear in u 0 and u 1 for t ∈ [0, 1] c . Finally we can define the quadratic form Note that since b t u is linear in the control parameters for t ∈ [−1, 0] ∪ [1, 2], we have H t ≡ 0 on the two intervals. Recall that Π := Π λ0 denotes the vertical subspace, namely the tangent space to fibre T * q M described in equation (14). With the notation set above, the kernel of the differential of the endpoint mapping and the second variation are: wherev,ŵ ∈ ker dũE. We can expand the expressions for the first and second variations knowing the particular form ofẐ t . We split the integrals into three integrals over the intervals [−1, 0], [0, 1] and [1,2] and simplify the integrands using the skew-symmetry of σ: They read as: where we have used the fact thatẐ t is constant for t ∈ [0, 1] c and its image lies in a Lagrangian subspace, and hence σ(Ẑ tv (t),Ẑ τŵ (τ )) = 0 for all τ, t ∈ [−1, 0], all τ, t ∈ [1, 2] and any variationsv,ŵ ∈ ker dũE. We finish the discussion of the first and second variations with an important observation concerning Z i v i , i = 0, 1.
Recall that f 0i generate the tangent space to N 0 close to q 0 . We define the Hamiltonians Then A(N 0 ) can be equivalently described as the common part of the zero locus of l i : But then by the definition of a Hamiltonian vector field where the last equality is due to involutivity of the family f 0 v 0 . Similarly one has that Z 1 u 1 is always tangent to the image of A(N 1 ) under the diffeomorphism (P 1 u ) −1 .

Jacobi equation and second variation
For brevity denote V = ker dũE. Inside V we look at a distinguished subspace which corresponds to variations that fix the end-points q 0 , q 1 of an extremal curve γ at first order. More precisely, they constitute the tangent space to the manifold of controls fixing the end-points of γ. Hence Q| V is the second variation of the optimal control problem with fixed end-points and there exist efficient ways of computing the index of this quadratic forms using generalisations of classical Jacobi fields [9, Section 21]. Our goal is to compute the difference ind Q − ind Q| V in terms of geometric objects on the manifold M , which will result in formula (11) when N = N 0 × N 1 . The main tool for computing the difference of indices is the following folklore lemma.
Lemma 8. Suppose that Q is a continuous quadratic form on a Hilbert space. Then for any subspace V of finite codimension it holds: For us the Hilbert space will be the subspace V. Thus and the kernel of Q on V is ker Q = {v ∈ V : Q(v,ŵ) = 0, ∀ŵ ∈ V}.
In the following discussion we derive boundary value problems whose differential equation is a Jacobi equation. The solution to those boundary value problems encode all the information about each term in formula (34).
By definition the subspace V is the set of variationsv = (v 0 , v, v 1 ) such that Using formula (32) we have that for almost every t ∈ [0, 1] and a vector ν ∈ Π: By the strong Legendre condition H t is invertible. This allows us solve the equation for the variation v and obtain Set Differentiating η and plugging in the expression for the variation v shows that η satisfies the following equation for almost all t ∈ [0, 1]: This equation is known as the Jacobi equation [9,Theorem 21.1]. Using the definition of Z 0 and Lemma 7 we find that η(t) satisfies (35) with π * η(0) ∈ T q0 N 0 . To obtain conditions at t = 1, we have to use the fact that v ∈ V. In this case from (31) it follows that there exists ξ ∈ Π such that Thus the variationv ∈ V ⊥Q defines a function η : [0, 1] → T λ(0) (T * M ) which solves the following boundary value problem The second space in the boundary condition is the pull back of N 1 to q 0 using the flow of the control system with the extremal controlũ. From this it is immediate to compute the dimension of V ∩ V ⊥Q . It is enough to substitute v i = 0 in the above equations and thus consider solution starting from Π and arriving to Π. Since the Jacobi equation derived above is exactly the same as the Jacobi equation for problem with fixed points, we immediately see that dim(V ∩ V ⊥Q ) is the multiplicity of the point q 1 as conjugate point.
In the same spirit we can compute the dimension of ker Q ∩ V using the Jacobi equation. We have Using the same argument as above we find that for every ν ∈ Π The second equation allows us to recover a solution of the Jacobi equation η using the same argument as above, when we considered variationsv ∈ V ∩ V ⊥Q . The first equality gives us a condition on ν and consequently on η(0), while the third condition give us a condition for η(1). Namely The following proposition collects all the facts proved above and clarifies the correspondence between controls and solutions of the boundary value problems.
Proposition 4. Consider system (35), to any solution η satisfying the boundary value problem (36) we can associate a variation v ∈ V ⊥ Q such thatη(t) = Z t v(t) and vice-versa, modulo solutions satisfying η(0), η(1) ∈ Π andη = 0. Moreover: (i) elements inside V ∩ V ⊥Q correspond to solutions of (35) satisfying the boundary conditions: (ii) elements of ker Q ∩ V correspond to solutions satisfying the boundary conditions: (iii) elements in ker Q correspond to solutions of (35) satisfying the boundary conditions: Proof. Following the derivation of the Jacobi equation and associated boundary conditions it only remains to prove the first part by computing the kernel of the map η → v. Ifv = 0, then v ≡ 0 for all t ∈ [0, 1] and v 0 = 0, v 1 = 0. This implies that η ≡ ν. Vice versa, let η be constant with η(0) ∈ Π. Since Z i are injective and have non-trivial projections to T π(λ(0)) M , it follows that v i = 0. Moreoverη(t) = Z t v(t) = 0 and consequently, by definition of V ⊥Q , In particular H t (v(t), v(t)) = 0 for almost every t ∈ [0, 1]. But then by the strong Legendre condition v ≡ 0. Point (iii) can be obtained in a similar fashion as point (i) and (ii).
As before let Θ be the differential of the Hamiltonian flow given in equation (10) and Γ(Θ) the graph of Θ.
Remark 3. It can be shown that (35) is closely related to the linearisation of the extremal flow along the fixed extremal λ we are considering, see for example [10]. It is the linearisation at λ(0) of the Hamiltonian flow of b t u (λ) = (H − hũ (t) ) • Φ t (λ) which coincides with the linearisation of (Φ t ) −1 • e tH . Let us denote by Θ J the flow of the Jacobi equation (35) at time one and let be its graph. Then in this notation Γ(Θ) = (I × Φ t ) * Γ(Θ J ).
We can now compute the restriction of Q to V ⊥Q and prove the following result.
Proposition 5. Let Q be the quadratic form of second variation for the problem (26)- (28) and V be the subspace of variations (33). Then Moreover, the Maslov index of the triple can be replaced by λ and the superscript means everything is computed on the reduced subspace with respect to W . Proof. In view of Proposition 4 and Remark 3 it only remains to prove that Combining the last expression with (32) gives us: where we have used that From the derivation of the Jacobi equation it follows that Hence the restriction of Q to V ⊥Q coincides with the quadratic form Note that Q| V ⊥ Q is actually defined on a slightly smaller space, because Z 0 v 0 do not span the whole T λ(0) A(N 0 ) and similarly Z 1 v 1 does not span T λ(0) (Φ −1 t A(N 1 )) correspondingly. Nevertheless we obtain the correct Maslov form. In fact, the map Z 0 : R k → T λ(0) A(N 0 ) is injective and its image is transversal to Π ∩ T λ(0) A(N 0 ) (and the same is true for the Z 1 ). The sum of spaces Π ∩ T λ(0) A(N 0 ) and Π ∩ T λ(0) (Φ −1 t A(N 1 )) lies in the kernel of the Maslov form. Removing it does not change the domain since im Z 0 + Π = T λ(0) A(N 0 ) + Π (and similarly for Z 1 ).
and assume that a curve λ : [0, 1] → T M is an extremal in both problems simultaneously, which simply means that λ is a solution of the Hamiltonian system of PMP and satisfies the transversality conditions for both boundary conditions at the same time, i.e. λ i annihilates the sum T λi N i + T λiÑi . A relevant example to keep in mind is when N ⊂Ñ . In this case if λ satisfies the transversality conditions forÑ it satisfies the transversality conditions for N automatically. Consider the two second variations Q N and QÑ corresponding to the two optimal control problems with boundary conditions like above. Using Proposition 5 we can find the difference between the Morse indices of those two quadratic forms. Corollary 1. Using the notations of this section the following formula holds Proof. Apply Proposition 5 to get an expression for ind − QÑ and ind − Q N . Subtracting one from the other gives Apply formula (19) with L 0 = Π 2 λ , L 1 = Γ(Θ), L 2 = T λ A(Ñ ) and L 3 = T λ A(N ). After cancellations this results in Terms dim(Γ(Θ) ∩ T λ A(N )), dim(Γ(Θ) ∩ T λ A(N ) ∩ T λ A(Ñ )) are already exactly as in the formula of the statement. It remains to simplify all of the remaining terms. By formula (20) i Γ(Θ), T λ A(Ñ ), T λ A(N ) = i T λ A(N ), Γ(Θ), T λ A(Ñ ) since we have an even permutation of subspaces inside. By lemma 2 we have Finally, straight from the definition of an annihilator, it follows that dim(Π 2 λ ∩ T λ A(Ñ )) = 2 dim M − dim T π(λ)Ñ and dim(Π 2 λ ∩ T λ A(N ) ∩ T λ A(Ñ )) = 2 dim M − dim T π(λ)Ñ − dim T π(λ) N + dim(T π(λ) N ∩ T π(λ)Ñ ).
Combining all of the above results in formula (38).
Remark 4. Notice that if N = {q 0 } × {q 1 } we obtain exactly the formula from Proposition 4 as expected.
Another necessary remark is that formula (38) might seem asymmetric at first. We expect, that if we exchange N andÑ , then the resulting right-hand side will change sign. This is not entirely obvious just from the expression itself. However, this is indeed the case, because the difference between i T λ A(N ), Γ(Θ), T λ A(Ñ ) and i T λ A(Ñ ), Γ(Θ), T λ A(N ) is not zero, but an expression involving dimensions of intersections of various subspaces as can be seen from formula (19). Now we are ready to prove Theorem 2. We will reduce the case of general boundary conditions (q 0 , q 1 ) ∈ N ⊆ M × M to the case with separated boundary conditions by introducing extra dummy variables.
It is clear that there is a one-to-one correspondence between admissible curves of (4)-(6) and admissible curve of (39)-(40). For this reason we can consider admissible curves (39)-(40) which minimize the functional (6).
The Hamiltonian system of PMP is then given by μ = 0, λ = H t (λ), λ, µ ∈ T * M. and its flow is given by I × Ψ t .
In order to deal with the last term choose Darboux coordinates around λ(0) and λ(1) which fix the horizontal and the vertical subspaces. For this computation we identify T λ(0) (T * M ) ≃ T λ(1) (T * M ) =: Σ. Let S : Σ → Σ be the map, which changes the sign of the vertical part. In Darboux coordinates it is given by the matrix −1 0 0 1 .
Let us write down explicitly each individual subspace entering the formula. Due to our conventions of signs for the symplectic form on (T * M ) 4 we have −σ on the first two copies of T * M and σ on the last two. We have to distinguish the two definitions of annihilator here,Â(N ) is the annihilator when we use σ ⊕ σ (as given in equation (13)) whereas A(N ) is given by equation (7), and is the right object to use when the symplectic form is (−σ) ⊕ σ. Notice once again that S × I(Â(N )) = A(N ). In order to simplify the Maslov index term, we note that the intersection of annihilators contains the following isotropic subspace W = {(Sξ, ξ, 0, 0) : ξ ∈ Σ}.