# Prove that between any two roots of $f$ there exists at least one root of $g$

$$f(x)= 1 - e^x\sin(x)$$ $$g(x)= 1 + e^x\cos(x)$$

Prove that between any two roots of $f$ there exists at least one root of $g$.

I know Rolle's Theorem and the Intermediate Value Theorem (I think) need to be used. Can someone show a step by step proof for this?

One can calculate that $f'(x) = -e^x(\sin(x)+\cos(x))= f(x)-g(x)$. The roots of this function are $x = \pi n - \frac{\pi}{4}$ for $n \in \mathbb{Z}$. With a little bit of work, you can show that these are never roots of $f$, but I'm guessing this would be implied in the question (if $f$ and $f'$ were to share a root, then $f$ and $g$ share this root too).
Now, let $x_1$ and $x_2$ be two consecutive roots of $f$. Then $f'(x_1) \neq 0$, assume that $f'(x_1) > 0$ (the other case is similar). Thus $f$ is positive on the interval $(x_1,x_2)$, and thus $f'(x_2) < 0$.
Now, $f'(x_1) = f(x_1) - g(x_1) = -g(x_1) > 0$ and thus $g(x_1) < 0$. Similarly, we find that $g(x_2) > 0$. Now, apply Bolzano's theorem, a corollary of the intermediate value theorem:
If $g$ is a continuous function and $x_1,x_2 \in \mathbb{R}$ such that $g(x_1)g(x_2) < 0$, then there exists $x_3 \in (x_1,x_2)$ such that $g(x_3) = 0$.
You can consider that \eqalign{ & f(x) = 1 - e^{\,x} \sin (x) \cr & g(x) = 1 + e^{\,x} \cos (x) = 1 - e^{\,x} \sin (x - \pi /2) \cr} so that\eqalign{ & f(x) = 0\quad \to \quad \sin (x) = e^{\, - x} \cr & g(x) = 0\quad \to \quad \sin (x - \pi /2) = e^{\, - x} \cr} and since the roots of $f(x)$ and $g(x)$ cannot be separated by less than $\pi$, it follows ...