An integral that counts the zeros of a function

Given a real function $f$ on an interval $[a,b]$ satisfying mild regularity conditions, we determine the number of zeros of $f$ by evaluating a certain integral. The integrand depends on $f, f'$ and $f''$. In particular, by approximating the integral with the trapezoidal rule on a fine enough grid, we can compute the number of zeros of $f$ by evaluating finitely many values of $f,f'$ and $f''$. A variant of the integral even allows to determine the number of the zeros broken down by their multiplicity.


Introduction
Counting the zeros of a given function f in a certain region belongs to the basic tasks in analysis. If f : C → C is holomorphic, the Argument Principle and Rouché's Theorem are tools which allow to find the number of zeros of f , counted with multiplicity, in a bounded domain of C with sufficiently regular boundary (see, e.g. [3] for an overview of methods used for analytic functions). Descartes' Sign Rule is a method of determining the maximum number of positive and negative real roots (counted with multiplicity) of a polynomial. The Fourier-Budan Theorem yields the maximum number of roots (counted with multiplicity) of a polynomial in an interval. Sturm's Theorem, a refinement of Descartes' Sign Rule and the Fourier-Budan Theorem, allows to count the exact number of distinct roots of a polynomial on a real interval (see, e.g., [4], [1], [6]). The mentioned methods are restricted to holomorphic functions and polynomials, respectively. On the other end of the regularity spectrum, for a merely continuous function f , the Theorem of Bolzano yields the information that at least one zero exists on an interval [a, b] if f has opposite signs at its endpoints, though, it does not count the zeros. Here, we want to construct a method which gives the number of zeros of a real function under only mild regularity assumptions. More precisely, we want to express the number of zeros of a function f by a certain integral (and boundary terms). The integrand depends on f, f ′ and f ′′ . If f is sufficiently regular, the integral (and hence the number of zeros of f ) can be expressed by evaluating the integrand on a sufficiently fine partition of [a, b]. Modifications of the integral even allow to determine the number of the zeros broken down by their multiplicity.
To explain the basic idea, we consider the following elementary connection between the number of zeros of a periodic function and the winding number of the related kinematic curve in the state space with respect to the origin: . Then, the number n of zeros of f in [0, 2π) equals twice the winding number of the curve γ : Figure 1 illustrates a heuristic proof without words: Each colored arc between two zeros of f adds 1 2 to the winding number of γ. In the sequel, we will rigorously prove much more general versions and variants of this result. We will develop integrals that count the number of zeros with and without multiplicity, and we will even be able to determine the number of zeros of a given multiplicity. As a byproduct, a coherent definition of a fractional multiplicity of zeros will be possible. To start with, it is necessary to analyze the nature of zeros of a function.

Zeros of Functions
A function f : (a, b) → R may, in general, show a quite pathological behavior in the neighborhood of one of its zeros (see, e.g., Examples 2.2.3 and 2.9 below). To exclude such exotic cases but still be sufficiently general to cover most of the relevant cases, we use the following definition.
x 2π Figure 1: Number of zeros of f vs. winding number of (f ′ , f ).
If f extends continuously to a (or b) and f (a) = 0 (or f (b) = 0), we will say that f has an admissible zero in a (or b) if Remarks.
1. An admissible zero is necessarily an isolated zero. In fact, if the zero x 0 is an accumulation point of zeros of f then, by Rolle's Theorem, it is also an accumulation point of zeros of f ′ and the limits in Definition 2.1 cannot be plus or minus infinity.
The limit x ր 0 is analogous.
4. If f ∈ C k (a, b) and x 0 ∈ (a, b) is a zero of multiplicity k > 1, i.e. f (ℓ) (x 0 ) = 0 for all ℓ = 0, . . . , k − 1 and f (k) (x 0 ) = 0, then x 0 is admissible. This follows easily by an iterated application of L'Hôpital's rule. Hence the zeros of real-analytic functions and a fortiori zeros of polynomials are admissible.
for a C 1 -function g with g(x 0 ) = 0 and 0 < α ∈ R, then x 0 is an admissible zero of f .
is an open interval and the limits can be defined viaf , provided f (a), f (b) = 0. If f has an admissible zero in a (or b), f can be extended antisymmetrically with respect to a (or b) to an extensionf for which a (or b) is an admissible zero. We will henceforth use this particular extension when computing limits like in (2.2).
x → |x| has an admissible zero in x = 0 (see Remark 5 above).
2. The C ∞ -function has an admissible zero of infinite multiplicity at x = 0 (see Remark 3 above).
3. An example of an isolated zero which is not admissible is given by the C ∞function , which vanishes (together with all derivatives) in 0 but the corresponding limits (2.1) do not exist.
, k ∈ N, if the following holds: 2. f has only admissible (and therefore finitely many) zeros 3. There exists a partition a = y 1 < y 2 < . . Remarks.

Observe that
) for all k ∈ N by construction.

Every analytic function is in
is not necessarily a continuous curve.
As a building block of the intended results we need the following: where h : R → R is any piecewise continuous function such that the improper integral ∞ −∞ h(x) dx = 1. Then we have the following theorem.
Proof. Consider first the case, where f (a), f (b) = 0. Then the zeros of f are given by is a priori undefined whenever f vanishes or whenever f ′′ is undefined. We decompose the integral and compute the resulting improper integrals using unilateral limits. Since f is admissible, we have x j+1 x j Integrating over a neighborhood of a point y where f ′′ is undefined does not introduce further boundary terms and therefore The computation above suggests that n(f ) > 1 but one can check that formula (2.5) holds true for n(f ) = 1 and n(f ) = 0 as well.
If f has zeros in a and b and therefore gives and hence ( Since we conclude thatn(f ) counts the zeros of f in (a, b).
Remark. If h(x) := 1/(π(1 + x 2 )) and f is an admissible, 2π-periodic function, then the number n of zeros of f in [0, 2π) equals since the integral-free terms cancel out in this case. In this way we obtain Lemma 1.1 as a corollary of Theorem 2.4. Observe that a 2π-periodic C 2 function with an odd number of zeros on [0, 2π) gives rise to a curve x → (f ′ (x), f (x)) having a half-integer valued winding number. This idea, further developed, leads to a generalized version of the Residue Theorem (see [2]).
Observe, that for a C 2 function f with only zeros of multiplicity one, the integrand in (2.8) is continuous provided h is continuous. This remains true for zeros of higher multiplicity in the following way: Proposition 2.5. Let h : R → R be continuous and h(x) ∼ C x 2 for |x| → ∞. Then, the integrand in Theorem 2.4 , n ≥ 2, has only zeros of multiplicity ≤ n.
Proof. It suffices to show that I is continuous in 0 if 0 is a zero of multiplicity n.
Then, by Taylor expansion, we have where r i are continuous functions with lim x→0 r i (x) = 0. Using these expressions in I, we get for continuous functions s i with lim x→0 s i (x) = n. Thus If we only assume that h(x) = O(1/x 2 ) for |x| → ∞ in the previous proposition, the proof shows that then I is at least bounded.
As a corollary of Proposition 2.5 we obtain that if h is continuous and h(x) ∼ C x 2 , then I is in C 0 provided f is analytic. Nontheless, the function f may behave in the neighborhood of a zero in such a pathological way, that I becomes unbounded (see Example 2.7.3). This is why, in general, the integrals in Theorem 2.4 have to be interpreted as improper integrals. This means that the concrete computation requires the zeros of f to be known a priori in order to evaluate the improper integrals. It is therefore of practical importance to formulate conditions (see Propositions 2.8 and 2.10) with additional assumptions which guarantee that I is in L 1 : To this end we will slightly sharpen the admissibility condition for a function and impose some conditions on the behaviour of the zeros of f ′′ in neighborhoods of the zeros of f . Furthermore we will require h to have at least quadratic decay at infinity.
The proof of Proposition 2.5 for the case C = 1 indicates, how we can generalize the notion of multiplicity of zeros in a natural manner: .
Since the zeros of functions in A 0 are admissible, it follows that µ f (x 0 ) 0 whenever it exists, however, it can take values in [0, ∞] (see Example 2.7.3 and 2.7.4 below). This definition of the multiplicity of a zero will be useful for a variant of Theorem 2.4 that takes the multiplicities of the zeros into account.
where z 1 , z 2 , . . . denote the countably many zeros of f ′′ in U . Then Proof. Choose neighborhoods U 1 , . . . , U n of the n zeros of f , which do not (with the possible exception of the respective zero itself) contain singular points of f ′′ or zeros of f ′ and let Since |f | ≥ η for some η > 0 on the complement U c and W 2, Consider now wlog the neighborhood U i of the zero x i = 0 and assume U i = (−ε, ε) for some ε > 0. We need to show that I (−ε,ε) ∈ L 1 . Since h(x) = O(1/x 2 ) for |x| → ∞, there exists a constant C > 0 such that ) denotes the Newton-Operator of f and BV(−ε, ε) denotes the space of functions g : (−ε, ε) → R of bounded variation. It follows from the admissibility of the zero that N : (−ε, ε) \ {0} → R can be continuously extended to N(0) = 0 and it holds that for x = 0. Let µ > 0 denote the multiplicity of the zero according to Definition 2.6. It holds that According to the mean value theorem we have N(x)/x = N ′ (ξ) for some ξ between 0 and x and deduce that N ∈ C 1 (−ε, ε). The Taylor expansion of N around x = 0 is given by In any case there exists a constant K > 0 such that (2.10) We will now show that N ∈ BV([0, ε)), the argument on (−ε, 0] being similar. We start by noticing that N is absolutely continuous on [δ, ε) for every 0 < δ < ε since x, f (x) and f ′ (x) are absolutely continuous and f ′ (x) = 0 on [δ, ε). In particular, N ∈ BV([δ, ε)) for every 0 < δ < ε.
We will now distinguish two cases: If f ′′ ≡ 0 on (0, ε), then N ≡ 0 and we are done.
In the remaining case we first consider the case when the set of zeros of f ′′ in (0, ε) is empty: Then N is monotone on [0, ε) and hence N ∈ BV ([0, ε)). Otherwise the zeros of f ′′ in [0, ε) are given by z 1 > z 2 > . . . and we may set δ := z 1 . According to (2.10) and since the zeros of f ′′ are precisely the zeros of N ′ we can estimate the total variation of N on (z k+1 , z k ) by where the series converges by assumption and the integral is finite since N ∈ BV([δ, ε)).
Remark. The key estimate (2.10) in the proof above follows from the admissibility and the positive multiplicity of the zeros. We will however formulate a variant of Proposition 2.8 below (Proposition 2.10), which covers admissible functions that have zeros of ill-defined multiplicity for which (2.10) still holds true: Take e.g. the C 1 function f : x → x 3 (sin(1/x) + 2) + x which has an admissible zero in x = 0, but for which µ f (0) does not exist, however, (2.10) holds true since f (x)/(xf ′ (x)) is bounded near 0 -in fact Example 2.7.3 shows an admissible function for which (2.10) does not hold true. In the mentioned example, the first derivative is unbounded. But even functions with higher regularity may behave in such a pathological way near an admissible zero, that (2.10) does not hold true, as the following example shows: Then f (x) = x 0 k(t) dt is of class C 3 and has an admissible zero in x = 0 but f (x)/(xf ′ (x)) is unbounded near 0.
where z 1 , z 2 , . . . denote the countably many zeros of f ′′ in U \ {x 0 }. Then Proof. Choose neighborhoods U 1 , . . . , U n of the n zeros of f , which do not (with the possible exception of the respective zero itself) contain singular points of f ′′ or zeros of f ′ such that (2.11) holds on each punctured neighborhood. As in the proof of Proposition 2.8 we obtain I L 1 (U c ) < ∞, where U = U 1 ∪ . . . ∪ U n and the estimate (2.9). Let wlog 0 be a zero of f and let (−ε, ε) be its respective neighborhood for some ε > 0. As in the proof of Proposition 2.8, we are done if we show that N ∈ BV([0, ε)).
from which we conclude that N extends continuously to [0, ε) (where N(0) = 0) and This is just estimate (2.10) with K = K + 1. The rest of the proof is exactly the same as the one of Proposition 2.8.

Counting Zeros with Multiplicities
Let again h : R → R be a piecewise continuous function such that Since 1 · e + 2 · √ e ≈ 6.0157 and 2 · e + 1 · 3 √ e ≈ 6.8322 we conclude that f has two simple zeros and one of multiplicity 3.

Numerical Aspects
The number of zeros of a function f in a given interval [a, b] is of course an integer. Therefore is suffices to compute the integral in Theorem 2.4 with an error ε < 1 2 . In particular, for the trapezoidal rule with N + 1 equidistant grid points, the error ε(N ) is estimated by Thus we have • h(x) = 1 π(1 + x 2 ) , H(x) = arctan x π .
• h(x) = e x (1 + e x ) 2 , H(x) = − Moreover, with smooth functions γ and κ that satisfy sign γ(x) = sign κ(x) = sign x for all x = 0 and γ(x) ∼ C 1 |x| α sgn x and κ(x) ∼ C 2 |x| β sgn x as x → 0, where 0 < α β, one can modify the integrand I as follows and the proof of Theorem 2.4 still goes through: In this case the boundary terms in a and b have to be taken with the function H γ(f ′ (x)) κ(f (x)) .