Prove that $f$ in monotonic In my assignment I have to prove the following: 

Let $f$ a continuous function in $\Bbb R$. 
  Prove the following:
if $|f|$ is monotonic increasing, in R then $f$ is monotonic in R. 
Hint: Prove that $f(x)\ne 0$ for every $x \in \Bbb R$

My proof is rather long and I didn't use the fact the $f$ is continuous, which is kind of worrying. 
Is there a way proving that with using the continuity? 
Please let me know if I have a mistake somewhere, as I want to know if I'm correct.

Proof

Assume in contradiction that there is some $x=0$ such that $f(x)=0$
$$==>f(x)=0\to|f(x)=0|$$
Since $|f|$ in increasing, there is some $f(x_1)$ such that $$|f(x_1)|<|f(x)| =>|f(x_1)|< 0$$ That means the I found two values which in them |f| is decreasing which is a contradiction. Therefore, $$f(x)\ne0$$ for all $x$.
I claim that $x>0$ for all x. 
Proof of that statement:
Assume in contradiction that there is $x<0$ such that $f(x)=y$


*

*if $f(x)<0$ then there is some $t$ such that $f(t)=0$ according to the intermidate value theorem. That is a contradiction to the fact that $f(x)\ne0$

*if $f(x)>0$ then $|f(x)|=f(x)$ so according to intermidate value theorem there is some $t$ such that $f(t)=0$, in contradiction to my previous proof.That is also a contradiction to the fact the $|f(x)|$ is increasing.


Therefore, x>0 and |f| is increasing.


*

*If $f(x)>0$ then $f$ is increasing since $|f|$ is increasing.

*if $f(x)<0$ then $f$ is decreasing since $|f|$ in increasing. I assume is contradiction the opposite and prove accordingly.


I'm sorry it's that long. Is my solution true?
Thank you for reading!

It's too complicated and some aguments seem to be not justifief: e.g. Why do ypu try to prove $x> 0$  for all $x$? $x$ is the variable, it can take any value. As you noticed, we can't have $f(x=0, because this is the same as $\lvertf(x)\rvert=0$, which would imply that if $x'

From there, as $f$ is continuous, $f(x)$ has always the same sign (else it would have a root by the IVT).
If $f(x)>0$, then $f=\lvert f\vert$, and it is increasing. If $f(x)<0$, then $f=-\lvert f\vert$, and it is decreasing.
