How to compute the following sum of the differentiable map? Let $f : \mathbb{R} \rightarrow \mathbb{R}$ be a differentiable map such that $f(x) = x$ for $x \notin [-T, T]$ for some $T>0$ and such that $0$ is a regular value. Compute the $$\sum\limits_{x\in f^{-1}(0)}\frac{f'(x)}{|f'(x)|}.$$
We know that the fraction is $1$ or $-1$ : $1$ if $f'(x)$ positive and $-1$ otherwise. However, $f^{-1}(0)$ does not converge. I can take some functions and compute the sum and it is always $1$, however this is not what the question is about.
Any ideas of how to compute this sum?
 A: First note that $f^{-1}(0)$ is finite. It this was not the case, there would be infinitely many distinct point $x_n\in f^{-1}(0)$, and taking a subsequence we can assume they converge to some $y$, which would also be in $f^{-1}(0)$ by continuity. But then $f'(y)=\lim_n (f(x_n)-f(y))/|x_n-y|=0$, contradicting regularity of $0$.
Now you prove that $\sum_{x\in f^{-1}(0)}\frac{f'(x)}{|f'(x)|}=1$. Let $f^{-1}(0)=\{x_1,\ldots,x_n\}$, with $x_1<x_2<\cdots<x_n$. The idea here is that if $f$ increases around $x_i$ then $f$ has to decrease around $x_{i+1}$ and vice versa.


*

*Prove that $f'(x_1)>0$ and that $f'(x_n)>0$

*If $i<n$ and $f'(x_i)>0$, then $f'(x_{i+1})<0$;

*If $i<n$ and $f'(x_i)<0$, then $f'(x_{i+1})>0$;


You prove these using regularity of $0$ and the intermediate value theorem. From these, you conclude that the only possibility is for $n$ to be odd, and $f'(x_i)>0$ for $i$ odd and $f'(x_i)<0$ for $i$ even, and therefore $\sum_{x\in f^{-1}(0)}f'(x)/|f'(x)|=1$. I'll leave the details for you to figure out.


 Solution for 2.: We can prove this by contradiction. Suppose $f'(x_i)>0$ and $f'(x_{i+1})>0$. For all $y>x_i$, sufficiently close to $x_i$< we have $f(y)>0$, and for all $z<x_{i+1}$ also sufficiently close to $x_{i+1}$, we have $f(z)<0$. So take $y,z$ as above, with $x_i<y<z<x_{i+1}$. But then the Intermediate value theorem implies that there is some $w\in(y,z)$ with $f(w)=0$, i.e., $w\in f^{-1}(0)$ but $w\neq x_j$ for all $j$, a contradiction.

