Can the difference of two bounded decreasing functions oscillate? Let $f,g$ be two functions defined near $x=0$, e.g. on $[0,1]$. Suppose that $f,g$ are continuous (differentiable on the interior), bounded, positive, and decreasing on this interval. Suppose further that $f(0) = g(0)$. Can $f-g$ have an infinite number of zeroes? In particular, can the zeroes of $f-g$ accumulate at $x=0$?
I tried to construct an example by requiring $f = g + x\sin(1/x)$, so
$$ f' = g' +  \sin(1/x) - \frac{\cos(1/x)}{x^3} \leq g' + 1 + \frac{1}{x^3},$$
and we would need that $g'(x) \leq -1 -1/x^3$ to make $f$ (and incidentally $g$) decreasing. But I am not sure how to construct $g$ to satisfy this while keeping it bounded.
 A: Yes, the difference of two monotone functions on $[0, 1]$ can have infinitely many zeros, and these can accumulate at the boundary of the interval.
An example: $h(x) = x\sin(\ln(x))$, $h(0) = 0$, is continuous on $[0, 1]$ with zeros at $x_k = e^{-k\pi}$ for all positive integers $k$.
We have $|h(x)| \le 1$ and
$$|h'(x)| = |\sin(\ln(x)) + \cos(\ln(x))| \le 2 \, .$$
Therefore
$$
 f(x) = 3 - 2x + h(x), \\
 g(x) = 3 - 2x
$$
are both positive and decreasing on $[0, 1]$, and their difference “oscillates.”
A: $(2+\sin(x))\,e^{-x}$ and $2e^{-x}$ are both decreasing functions whose difference is $\sin(x)\,e^{-x}$, which obviously alternates sign as $x\to\infty$. To make them fit the constraints of the question, we flip and shrink the domain with $1/x-1:(0,1]\to[0,\infty)$ and flip the range with $2-x$:
$$
\begin{align}
f(x)&=\left\{\begin{array}{}2-(2+\sin(1/x-1))\,e^{1-1/x}&\text{if }0\lt x\le1\\2&\text{if }x=0\end{array}\right.\\
g(x)&=\left\{\begin{array}{}2-2\,e^{1-1/x}\phantom{({}+\sin(1/x-1))}&\text{if }0\lt x\le1\\2&\text{if }x=0\end{array}\right.\\
\end{align}
$$
The points where $f(x)=g(x)$ are at $x=\frac1{n\pi+1}$, which accumulate at $x=0$.
