Given two positive rational number $\frac{a_1}{b_1}$ and $\frac{a_3}{b_3}$ (written in lowest terms) such that $$\frac{a_1}{b_1} < \frac{a_3}{b_3},$$
I want to find a rational number
$\frac{a_2}{b_2}$ such that $$\frac{a_1}{b_1} < \frac{a_2}{b_2} < \frac{a_3}{b_3}$$
and $a_2$ and $b_2$ are the smallest possible numbers
I've come with the solution $a_2 = a_1 + a_3$ and $b_2 = b_1 + b_3$ then dividing $a_2$ and $b_2$ by their greatest common divisor but there must be better solution.
Thanks by advance for your suggestions.
See Wikipedia's article on the mediant, which explains when your solution is the best.