A formula about best rational within an interval In this Wikipedia page, it claims that for real numbers $x,y>0$, if
$$x=[a_0;a_1,a_2,...,a_{k-1},a_k,...],$$$$y=[a_0;a_1,a_2,...,a_{k-1},b_k,...],$$ then $$z(x,y):=[a_0;a_1,a_2,...,a_{k-1},\min(a_k,b_k)+1]$$
is the rational number with smallest denominator between $x$ and $y$, provided $x,y$ are irrational.
It also gives a conclusion in the case that $x,y$ are rational.
Since there is no reference in that page, I would like to know if anyone can provide the proof of these results, or where can I find related references? Thanks a lot.
 A: If you want a general treatment of continuous fractions you can read Hardy and Wright, An Introduction to the Theory of Numbers. I think they don't directly prove the result you want but you can derive it using the continued fraction algorithm, which is in there.
If (without loss of generality) $x<z<y$, then
$$\lfloor x\rfloor=\lfloor y\rfloor=a_0\implies \lfloor z\rfloor=a_0$$
$$x-a_0<z-a_0<y-a_0$$
So the first term in the continued fraction of $z$ coincides with those of $x$ and $y$. For the second:
$$\frac 1{x-a_0}>\frac 1{z-a_0}>\frac 1{y-a_0}$$
and repeat the flooring operation and you find that the second term in the continued fraction of $y$ is also $a_1$. Repeating this you find that $y=[a_0;a_1,\dots ,a_{k-1},\dots]$. Now on the last term, there's a small mistake on Wikipedia. $a_k$ is either $\min(a_k,b_k)$ or $\min(a_k,b_k)+1$. For example if $x=\sqrt 3=[1;1,2,1,2\dots]$ and $y=\sqrt{3}-0.005=[1;1,2,1,4\dots]$, the rational with smallest denominator between them is $\frac{19}{11}=[1;1,2,1,2]$. $\frac{26}{15}=[1;1,2,1,3]$ is too large. That's because on even convergents increasing the number in the continued fraction makes the fraction larger and on odd ones smaller. Either way, one of those two is guaranteed to work. Also, the reason why you want to choose the minimum on  the last term is because increasing that term increases the denominator of the fraction, which you can verify with the recursive formula for the convergents.
