Abstract. We consider a continuous curve of linear elliptic formally self-adjoint differential operators of first order with smooth coefficients over a compact Riemannian manifold with boundary together with a continuous curve of global elliptic boundary value problems. We express the spectral flow of the resulting continuous family of (unbounded) self-adjoint Fredholm operators in terms of the Maslov index of two related curves of Lagrangian spaces. One curve is given by the varying domains, the other by the Cauchy data spaces. We provide rigorous definitions of the underlying concepts of spectral theory and symplectic analysis and give a full (and surprisingly short) proof of our General Spectral Flow Formula for the case of fixed maximal domain. As a side result, we establish local stability of weak inner unique continuation property (UCP) and explain its role for parameter dependent spectral theory.1. Statement of the problem and main result 1.1. Statement of the problem. Roughly speaking, the spectral flow counts the net number of eigenvalues changing from the negative real half axis to the non-negative one. The definition goes back to a famous paper by M. Atiyah, V. Patodi, and I. Singer [3], and was made rigorous by J. Phillips [23] and Y. Long [33] in various non-self-adjoint cases, and by B. BoossBavnbek, M. Lesch, and J. Phillips [7] in the unbounded self-adjoint case. We shall give a rigorous definition of spectral flow, most suitable for our purpose, below in Subsection 2.1 together with a review of its basic properties. For a definition of spectral flow admitting zero in the continuous spectrum, we refer to A. Carey and J. Phillips [13].In various branches of mathematics one is interested in the calculation of the spectral flow of a continuous family of closed densely defined (not necessarily bounded) self-adjoint Fredholm operators in a fixed Hilbert space. We consider the following typical problem of this kind. Sobolev space over the boundary. (Note that in this paper the symbols x and y do not denote points of the underlying manifolds M or Σ, but points in Hilbert spaces, sections of vector bundles, etc., following the conventions of functional analysis and dynamical systems.) Assume that each P s defines a self-adjoint elliptic boundary condition for A s , i.e., A s,Ps is a self-adjoint Fredholm operator for each s ∈ [0, 1].Then the spectral flow sf{A s,Ps ; s ∈ [0, 1]} or, shortly, sf{A s,Ps } is well defined. As a spectral invariant it is essentially a quantum variable which one may not always be able to determine directly by eigenvalue calculations. As an alternative, one is looking for a classical method of calculating the spectral flow. There are two different approaches. One setting expresses the spectral flow (of a loop of Dirac operators on a closed manifold) as an integral over a 1-form induced by the heat kernel (for a review see [13]). The other setting is reduction to the boundary, i.e., one expresses the spectral flow (of a path of self-adjoint boundary value problems on a compac...