How to shift two CDF's to maximize the number of crossings So suppose I have two continuous, monotone increasing function $F$ and $G$ defined on an interval $I_F=\{x:0<F(x)<1\}=(l_F,u_F)$ and $I_G=\{x:0<G(x)<1\}=(l_G,u_G)$ which can be computed but don't have an analytical form.$(l_G,u_G)$ and $(l_F,u_F)$, however, are known.
Consider the function:
$$M=\max_{a\in I_A}S(F,G,a)$$
--where $S(F,G,a)$ counts the number of times $F(x)$ and $G(x+a)$ cross--
Given $F$ and $G$ and $I_A$, I would like to know if $M>1$. The issue is that $F(x)$ and $G(x+a)$  are very expensive to evaluate. What I mean is computing $F$ and $G$ for a grid of values of $x$ on $I_F$ and $I_G$ is do-able but trying all values of $G(x+a)$ for all shifts $a\in I_A$ (the naive solution) is definitely not.
What is the smart way to approach this problem?
P.S.: @Modo: if you think this is not the correct venue to ask this type of question, please let me know and I will try to find a better place. Thanks in advance!
 A: A crossing 
$$
F(x) = G(x + a)
$$
can be written as
$$
G^{-1}(F(x)) = x + a
$$
or
$$
a = G^{-1}(F(x)) - x.
$$
So counting the number of times $y = F(x)$ and $y = G(x+a)$ cross is equivalent to counting the number of times $y = a$ and $y = G^{-1}(F(x)) - x$ cross.
The function $S(a)$ changes only when $y = a$ passes through some extremum of $y = G^{-1}(F(x)) - x$, that is
$$
F'(x) = G'(G^{-1}(F(x)))
$$
or using $z = F(x)$
$$
F'(F^{-1}(z)) = G'(G^{-1}(z)) \tag{*}
$$
If there's at least one solution to the $(*)$ and that is an extremum (not an inflection point) then $S$ changes by 2 when $y = a$ passes through the extremum.
Consider an example
$$
F(x) = \tanh x\\
G(x) = \frac{2\arctan \pi x}{\pi}
$$
Inspecting their graphs shows three intersection points ($S = 3$ for $a = 0$).
The equation $(*)$ becomes
$$
1 - z^2 = 1 + \cos \pi z
$$
with roots
$$
z = \pm 1,\quad z \approx \pm 0.629847
$$
The $z = \pm 1$ roots are spurious, but the $z = \pm 0.629847$ are true ones and those correspond to $x = F^{-1}(z) \approx \pm 0.741163$.
Finally, evaluating $G^{-1}(F(x)) - x$ there gives the desired critical values for $a$:
$$
a \approx \pm 0.256836
$$
Here's a picture of $G(x)$ vs $F(x - 0.256836)$

