Best approximation of the second kind (source code)

= Best approximation of the second kind

A reduced fraction $p/q$ is a <best approximation of the second kind> to a <real number> $\alpha$ if $|q\alpha-p|\le|b\alpha-a|$ for every competing fraction $a/b$ with $0<b\le q$. It minimizes the error after multiplication by the denominator; this differs from <best rational approximation> of the first kind, which minimizes $|\alpha-p/q|$.

For the <simple continued fraction> of an <irrational number>, the <continued fraction convergents> $p_n/q_n$ with $n\ge1$ have this property. The initial convergent $p_0/q_0=a_0/1$ needs an exception when the fractional part of $\alpha$ exceeds $1/2$, since then $(a_0+1)/1$ is closer. For example, if $\alpha=\sqrt3$, the initial convergent $1/1$ is beaten by $2/1$. The next convergent is $2/1$, and the subsequent <continued fraction convergents> have the usual best-approximation property.