# Best rational approximations to a ratio of three numbers $x:y:z$

If I have a ratio of two positive real numbers $$x:y,$$ then I can find the "best" rational approximations to it by writing it as a continued fraction (e.g. by repeatedly removing the integer part and taking the reciprocal of the remainder) $$\frac xy=a_0+\frac1{a_1+\frac1{a_2+\ddots}},\rlap{\qquad\text{a_i integer}}$$ and then I can cut it off after any of the $$a_i$$ to form a rational approximation like $$\frac xy\approx a_0+\frac1{a_1}=\frac pq,\rlap{\qquad\text{p,q integer}}$$

and this is a "best small" approximation in the sense that any closer rational approximation $$\frac{p'}{q'}$$ with $$\left|\frac{p'}{q'}-\frac xy\right|<\left|\frac pq-\frac xy\right|$$ has $$p'\ge p$$ and $$q'\ge q$$. (At least one of those will be strict for a distinct ratio.) This process doesn't produce all the best small approximations, but a modification does.

Recently, I wanted to approximate a ratio of three numbers like $$13780:8992:3364$$, instead of just two. I realized I didn't know how, hence this question.

We should define what a "best small" approximation is in this 3D context. To tell how well $$p:q$$ approximates $$x:y$$, we just computed $$|\frac pq-\frac xy|$$. To generalize this to $$p:q:r$$ and $$x:y:z$$, I think we should follow this answer. We treat them as vectors in 3D space and normalize them onto the unit sphere. Then we can find the distance between these projections. (For the 2D case I don't think this definition gives the same numbers, but I think it gives the same ordering.) Then $$p:q:r$$ is a best small approximation to $$x:y:z$$ if any closer approximation $$p':q':r'$$ has $$p'\ge p,q'\ge q,r'\ge r$$. (Comments welcome on the suitability of this definition.)

In my one-off case I did it somewhat ad hoc by dividing out the smallest part of the ratio to get $$4+\frac1{10+\ddots}:2+\frac1{2+\frac1{4+\ddots}}:1$$, truncating at the first and second positions respectively to get $$4:2+\frac12:1,$$ and then multiplying by the common denominator to $$8:5:2.$$ By enumerating all smaller ratios I find this is a best small approximation, but my process doesn't appear general. E.g. if I instead truncate to $$4.1:2.5:1$$ and then multiply to $$41:25:10$$, I find it is actually worse than the smaller (best small) approximation $$37:24:9$$. Is there/what is a general process for finding best small approximations to a ratio of three (or more) numbers? (Other than just enumerating all small ratios and taking the best ones.)

I think what you are looking for comes under the heading simultaneous diophantine approximation. The basic theorem under this heading is the simultaneous version of the Dirichlet's approximation theorem, which says, given real numbers $$\alpha_1,\dots,\alpha_d$$ and a natural number $$N$$ there are integers $$p_1,\dots,p_d$$ and $$q$$, $$1\le q\le N$$ such that $$\left|\alpha_i-{p_i\over q}\right|\le{1\over qN^{1/d}}$$ In your case, the real numbers are $$x/z$$ and $$y/z$$, and the approximating fractions are $$p/r$$ and $$q/r$$.