Is $22/7$ the closest to $\pi$, among fractions of denominator at most $50$? Is $22/7$ the closest to $\pi$, among fractions of denominator at most $50$?
I am currently studying continued fractions, while I know that for all denominators at most $Q_n$, $\frac{P_n}{Q_n}$ is the closed approximation. But what about the denominators between $Q_n$ and $Q_{n+1}$?
 A: It is straightforward to check each possible denominator one by one. The sequence of best approximations starts
$$3, \frac{13}{4}, \frac{16}{5}, \frac{19}{6}, \frac{22}{7}, \frac{179}{57}, \frac{201}{64}, \frac{223}{71}, \frac{245}{78}, \frac{267}{85}, \frac{289}{92}, \frac{311}{99}, \frac{333}{106}, \frac{355}{113}$$
See OEIS sequences A063673 and A063674.
A: (1). If $a,b,c,d\in \Bbb N$ with $|ad-bc|=1$ then $(ma+nc)/(mb+nd)$ is in lowest terms whenever $m,n\in \Bbb N$ with $\gcd(m,n)=1,$ and every rational between $a/b$ and $c/d$ is equal to $(ma+nc)/(mb+nd)$ for some co-prime $m,n \in \Bbb N.$
(2). Let $\delta=3+1/7 -\pi.$ We have $3+1/8 <\pi-\delta<\pi<
\pi+\delta=3+1/7.$
If $q\in \Bbb Q$ and $|\pi-q|<\delta$ then $1/8<q-3<1/7$ so by (1), for some $m,n \in \Bbb N$ with $\gcd(m,n)=1$ we have $1/7 -2\delta <q-3=(m+n)/(8m+7n).$
This implies $0<1/7 -(m+n)/(8m+7n)<2\delta$ and hence $7n>m(-8+1/14\delta).$ Since $1/14\delta>56,$ this implies $7n>48m\ge 48,$ so $n\ge 7.$
So by (1) the lowest-terms denominator for $q,$ which is  $8m+7n,$ is at least $8(1)+7(7)=57.$
BTW. $\pi-\delta<3+8/57<\pi.$
A: Yes, if you take finite approximations to $\pi$ using the continuous fraction expansion, $22/7$ appears and then $179/57$, the approximations constructed this way are best approximations for the denominators.
Niven and zuckermans an introduction to the  theory of numbers has a great chapter on continued fractions and Pell’s equation! It only uses basic number theory (Euclid’s algorithm, bezouts theorem) in the chapter so it is really accessible!
A: Yes, $22/7$ is the best.  You can check this by directly computing (as suggested in comments to your question) all ratios with numerator to $200$ and denominator up to $50$ (thus all ratios below $4$) using the short Julia script
pmax, qmax = 200, 50 
R = [p/q for p in 1:pmax, q in 1:qmax] # pmax by qmax matrix of ratios 
D = abs.(R .- π)  # distances to π
pbest = [argmin(D[:,q]) for q in 1:qmax]
Dbest = [D[pbest[q],q] for q in 1:qmax]
qallbest = argmin(Dbest)
pallbest = pbest[qallbest]
println("Best rational approx. p/q (for q≤$qmax) of π is = $pallbest / $qallbest = $(pallbest/qallbest).")

with output
Best rational approx. p/q (for q≤50) of π is = 22 / 7 = 3.142857142857143.

A: First we check with a simple script, is it even true. Now
Recall how we make a continous fraction: subtract the integer part, flip the fraction (or take $1/x$ for irrational $x$), repeat. By performing these steps on the supposed to be not true $\left|\pi-\frac{p}{q}\right|<\frac{22}{7}-\pi$ we may yield a contradiction.

There is no better approximation with $0<q\le 50$. Suppose there is, $\frac pq$: $\left|\pi-\frac pq\right|<\frac{22}{7}-\pi$
$$\pi-\frac{22}{7}<\pi-\frac pq<\frac{22}{7}-\pi$$
$$-\frac{22}{7}<-\frac pq<\frac{22}{7}-2\pi$$
$$\frac{22}{7}>\frac pq>-\frac{22}{7}+2\pi$$
$$\frac{22}{7}-3>\frac {p-3q}q>-\frac{22}{7}-3+2\pi$$
$$\frac{1}{7}>\frac {p-3q}q>\frac{14\pi-43}{7}$$
$$7<\frac q{p-3q}<\frac{7}{14\pi-43}$$
$$0<\frac {22q-7p}{p-3q}<\frac{308-98\pi}{14\pi-43}$$
$$\frac {p-3q}{22q-7p}>\frac{14\pi-43}{308-98\pi}\approx{7.9268}>7\Rightarrow$$
$$\frac {p-3q}{22q-7p}>7$$
$$\left(\frac{p}{q} - \frac{157}{50}\right) \left(\frac{p}{q} - \frac{22}{7}\right)<0$$
$$\frac{157}{50}<\frac{p}{q}<\frac{22}{7}$$
But $\frac{157}{50},\,\frac{22}{7}$ are neighbours in the Farey sequence of order $50$ ($157\cdot 7-50\cdot 22=-1$) which implies no such $\frac{p}{q}$ with $q\le 50$ exists, QED.
Btw, the lowest denominator $\frac{p}{q}$ such that $\frac{157}{50}<\frac{p}{q}<\frac{22}{7}$ is the mediant of $\frac{157}{50}$ and $\frac{22}{7}$: $\ \frac{157+22}{50+7}=
\frac{179}{57}$.
