Darboux function and its absolute value being continuous Let $I$ be an interval and $f:I \to \mathbb{R}$ a Darboux function. Prove that, if $|f|$ is continuous, then $f$ is also continuous.
What I tried: since $|f|$ is continuous, it means that it is a Darboux function. Also we have that $\lim_{x\to x_0}|f(x)|=|f(x_0)|, \forall x_0 \in I$ 
Assume that $f$ is not continuous, thus it is discontinuous at some point $x_0 \in I$. Since it is a Darboux function, it means that it cannot have "jump" discontinuities. But I don't know how to combine this with the continuity of $|f|$
 A: Fix $c \in I$. 
We can assume that $f(c) \neq 0$, since the continuity of $|f|$ at those points where $f=0$ implies the continuity of $f$. This is fairly trivial.  
So, since $|f|$ is continuous at $c$, there is a $\delta>0$ such that when $x \in (c-\delta, c+\delta)$, $|f(x)| \in \left(\frac{|f(c)|}{2}, \frac{3|f(c)|}{2}\right)$ which implies $f(x) \in \left(\frac{|f(c)|}{2}, \frac{3|f(c)|}{2}\right) \bigcup \left(-\frac{3|f(c)|}{2}, -\frac{|f(c)|}{2}\right)$
Note that the set $$X = \left(\frac{|f(c)|}{2}, \frac{3|f(c)|}{2}\right) \bigcup \left(-\frac{3|f(c)|}{2}, -\frac{|f(c)|}{2}\right)$$ is nonempty and not connected. Any connected subset of $X$ is necessarily a subset of only one of the two intervals. 
Since $f$ is Darboux, the image of $(c-\delta, c+\delta)$ under $f$ must be connected. This means $f[(c-\delta, c+\delta)] \subset \left(\frac{|f(c)|}{2}, \frac{3|f(c)|}{2}\right)$
 XOR  $\ f[(c-\delta, c+\delta)] \subset \left(-\frac{3|f(c)|}{2}, -\frac{|f(c)|}{2}\right)$
which implies $|f| \equiv f$ for all $x \in (c-\delta, c+\delta)$, XOR $|f| \equiv -f$ for all $x \in (c-\delta, c+\delta)$. In either case, the continuity of $f$ at $c$ follows. 
Since $c$ is arbitrary, we conclude $f$ is continuous on $I$. 
