How to prove this function is monotonic increasing? Let $\:f$ be a continuous function in $\mathbb{R}$,and $\forall q_1,q_2\in \mathbb{Q},\:if\:\:q_1<q_2$ then $f\left(q_1\right)<f\left(q_2\right)$.
Show that $\forall x_1,x_2\in \mathbb{R}\:$, if  $x_1<x_2\:$, then $f\left(x_1\right)<f\left(x_2\right)$.  
So far i thought about assuming in negative that there exist some points $x_1,\:x_2\in \mathbb{R}$ such that $x_1<x_2\:$but $f\left(x1\right)>f\left(x_2\right)$. But from here i stuck, i can't think about using the fact that f is continuous in  $\mathbb{R}\:$.
tnx!
 A: Let $\newcommand{\QQ}{\mathbb{Q}}x_1,x_2\in\mathbb{R}$ be any two real numbers such that $x_1 < x_2$ and 
let $q_1, q_2 \in \QQ$ be any two rational numbers such that $x_1 < q_1 < q_2 < x_2$. Set $$\varepsilon = \frac{f(q_2) - f(q_1)}{3} > 0.$$
Now, let $(a_i)_{i \in \mathbb{N}}$ and $(b_i)_{i \in \mathbb{N}}$ be two sequences of rational numbers $a_i, b_i \in \QQ$ such that


*

*$q_1 > a_0 > a_1 > \ldots > x_1$ and $\lim_{n \to \infty}a_i = x_1$,

*$q_2 < b_0 < b_1 < \ldots < x_2$ and $\lim_{n \to \infty}b_i = x_2$.


By continuity of $f$ we have that
\begin{align}
\lim_{n \to \infty}f(a_i) &= x_1\\
\lim_{n \to \infty}f(b_i) &= x_2
\end{align}
Let $n_1, n_2 \in \mathbb{N}$ be two indices such that $$|f(a_{n_i})-f(x_i)| < \varepsilon,$$ then
$$f(x_1) < f(a_{n_1})+\varepsilon < f(q_1)+\varepsilon < f(q_2) - \varepsilon < f(b_{n_2})-\varepsilon < f(x_2)$$
which concludes the proof.
I hope this helps $\ddot\smile$
A: Let $x_1,x_2 \in \mathbb{R}$ with $x_1<x_2$.
$f$ is continuous so
$$|f(x_1)-f(y_1)| < \epsilon/2 \mbox{ and } |-f(x_2)+f(y_2)| < \epsilon/2$$
From that
$$|x_1-y_1|< \delta_1 \mbox{ and } |x_2-y_2|< \delta_2$$ 
$\mathbb{Q}$ is dense in $\mathbb{R}$ so exists $q_1,q_2 \in \mathbb{Q}$ such that 
$$q_1- x_1< \delta_1 \mbox{ and } x_2-q_2< \delta_2$$ 
Adding $|f(x_1)-f(q_1)| < \epsilon/2 \mbox{ and } |-f(x_2)+f(q_2)| < \epsilon/2$ we have:
$$\epsilon < f(x_1)-f(q_1)-f(x_2)+f(q_2) < \epsilon \Rightarrow f(x_1)-f(x_2) < \epsilon + f(q_1)-f(q_2) < \epsilon +f(q_2)-f(q_2) \Rightarrow f(x_1)-f(x_2) < \epsilon$$ 
so $$f(x_1) \leqslant f(x_2)$$
If $f(x_1) = f(x_2)$ we have $|f(x_2)-f(q_1)|< \epsilon/2$ and $ |f(x_2)-f(q_2)|< \epsilon/2$ so 
$$ f(q_2)-f(q_1)=|f(q_2)-f(q_1)| = |f(x_2)- f(q_1)- (f(x_2)-f(q_2))| <  \epsilon/2 + \epsilon/2 =\epsilon$$
But $\epsilon$ is arbitrarily small so $f(q_2)-f(q_1)=0$
Therefore $$f(x_1) < f(x_2).$$ 
