Constraint from level sets of an analytic function Let $\theta$ and $f$ be two real analytic non-constant functions defined on $[0,2\pi]$. For simplicity we assume $f$ has just two critical values $m<M$ (in the picture $-1$ and $1$); we index as $\{f_j\}_{j \in\{1,2,...,N\}}$ its invertible branches. Our hypotesis is that $\theta$ and $f$ satisfy $\forall \;a\in(m,M)$
$$
\sum_j \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{|f'(f_j^{-1}(a))|}=0.
$$
This is a balancing condition for 2-dimensional vectors represented with complex numbers and involving all points in a given level set (which is finite since $f$ is analytic).

EDIT. As pointed out in the comments it was probably unclear that the hypotesis is about a pair of functions $\theta$ and $f$ that satisfy the condition above. I am not claiming this relation holds for any $\theta$. Such pair of functions can for example be constructed by considering a closed regular curve on $[0,2\pi]$ of the form
$$
\gamma(t)=\sum_{j=1}^N a_j \sin(j\cdot t)+i\sum_{j=1}^N b_j \cos(j\cdot t),
$$
and observing that for example $\int_0^{2\pi}\gamma(t) \Bigl(\cos((N+1)\cdot t)\Bigl)^n=0$, $\forall n$. Reparametrizing by arc-length $t=v(s)$ and denoting with $\theta(s)$ the turning angle of $\gamma$ we get
$$
\int \text{e}^{i\theta(s)} \Bigl(\cos((N+1)\cdot v(s))\Bigl)^n=0.
$$
From here one can show that if such property holds for $\cos((N+1)\cdot v(s))$ then it must hold for any composition of this function with $g \in L^1$. Picking $g$ as the characteristic function of $[a,a+\delta]$ and derivating in $\delta$, we get the equality above for $f=\cos((N+1)\cdot v(s))$. You can read more about that in this other question of mine:
Given $\theta$, find $f$ such that $\int_{\mathbb{T}} \text{e}^{i\theta} \cos(h \cdot f) = 0,$ for all $h \in \mathbb{N}$.


We observe
$$
0=\lim_{a \to m^+} \sum_j \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{|f'(f_j^{-1}(a))|} = - 2 \lim_{a \to m^+} \sum_{j \text{ odd }} \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{f'(f_j^{-1}(a))}, 
$$
where the second equality follows from the analiticity of $f$ at inner points. Similarly, derivating in $a$, one obtains $\forall \; n \in \mathbb{N}$
$$
\lim_{a \to m^+} \frac{d^n}{da^n} \sum_{j \text{ odd }} \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{f'(f_j^{-1}(a))}=0.
$$


I would like to prove from these hypoteses that also the sum over odd indices is constantly $0$, that is $\forall \;a\in(m,M)$. 
    $$
\sum_{j \text{ odd }} \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{f'(f_j^{-1}(a))}=0.
$$


Note that the fact that all the derivatives are $0$ in the limit is not enough. We could theoretically have something like $\text{e}^{-1/x}$, whose derivatives go to $0$ when $x$ approches $0$, but the function is not constant. Nevertheless, I have experimental evidence that this does not happen in our setting. I tried to exploit the fact that here we are dealing with a single analytic function and that its global behaviour is determined by its Taylor expansion at any point but I could not conclude the implication this question is about. 

EDIT 2. Calling our function $F(a):=\sum_{j \text{ odd }} \frac{\text{e}^{i \theta(f_j^{-1}(a))}}{f'(f_j^{-1}(a))}$, proving that it is constantly $0$ is equivalent to prove the existence of $C_\varepsilon>0$ such that 
$$
\| F^{(n)}(a) \| \leq C_\varepsilon^{n+1} n!, \; \forall n \in \mathbb{N}, \; a \in (m,m+\varepsilon).
$$
In this case, the series $0 \equiv \sum F^{(n)}(a) \frac{a^n}{n!}$ would converge uniformly to $F(s)$ in a neighbohood of $0$, providing the desired identity. This implication is explained for example in One-Sided Analyticity Condition Guarantees Analytic Function?.


Although this approach looks reasonable I am still stuck. Does anyone have some hints?



The question is pretty specific but I guess an answer in the positive could connect to properties of analytic functions interesting also from a more general perspective. Thanks.
 A: Something is still strange. Let's take $f=\cos(3x)$. Then the "odd" level set is $t,t+\frac{2\pi}3,t+\frac{4\pi}3$ and the "even" one is the same with $2\pi-$ everywhere for not too large $t$. The derivatives at the pre-images are all the same in absolute value, so we are just asking if the function $g(t)=e^{i\theta(t)}+e^{i\theta(t+\frac{2\pi}3)}+e^{i\theta(t+\frac{2\pi}3)}$ can satisfy $g(t)+g(2\pi-t)=0$ without being identically $0$. Let $\theta(t)=t+\psi(t)$ where $\psi$ is real-analytic, $2\pi$-periodic. We are interested in the Fourier coefficients of $e^{i\theta(t)}$ with indices divisible by $3$. It is enough to obtain some non-trivial sequence satisfying $a_{-k}=-a_k$ for $3\mid k$. This means that we should get some prescribed sequence for the Fourier coefficients of $e^{i\psi(t)}$ with indices $k\equiv -1\mod 3$. The restriction that $\psi$ must be real relates only the pairs of indices  $m$ and $-m$, so we have no relation for the indices in our set and the differential (in any reasonable Banach algebra of real-analytic $2\pi$-periodic functions) of the mapping $\psi(\cdot)\mapsto e^{i\psi(\cdot)}$ is just $i$ times the identity, so as a mapping from real functions to the sequences of Fourier coefficients with indices congruent to $-1$ modulo 3 is onto with bounds, which means that we can get any sequence that is sufficiently small, thus refuting your conjecture. Am I missing anything?
