A rational number can be written as $\frac{p}{q}$, where $p$ is an integer, $q$ is an integer, and $q \neq 0$. Suppose that $r_0$ and $r_1$ are rational numbers, and that $r_0 < r_1$. Prove that there is a rational number $u$ such that $r_0 < u < r_1$. Your proof must be constructive, and your answer must briefly explain why it is constructive.
I just want to know how to start this proof. I am confused where I can get an algorithm from this.
Let $$ r= \frac {r_1+r_2}{2}$$
Suppose $$r_1 = \frac {m_1}{n_1} \le \frac {m_2}{n_2}= r_2 $$
Then $$ r= \frac {m_1 n_2 +m_2 n_1}{2n_1n_2}$$ is rational.
Since $r$ is the average of $r_1$ and $r_2$,
$$ r_1 =\frac {m_1}{n_1} \le \frac {m_1 n_2 +m_2 n_1}{2n_1n_2} \le \frac {m_2}{n_2}= r_2$$
Thus between any two rational numbers there exists a rational number.