Rationalizing Root 2

Find the denominator n n of the rational number k n \frac{k}{n} ( k , n k, n are both integers) such that 2 k n \left|\sqrt{2}-\frac{k}{n} \right| is the smallest possible, out of all rational numbers with denominator less than 1000. 1000.


The answer is 985.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

13 solutions

Graydon Hazenberg
May 20, 2014

The continued fraction expansion of square root of two is given by

1 + 1/(2 + 1/(2 + 1/(2 + 1/..........

If you truncate these, each successive truncation is the best possible rational approximation for sqrt(2) with a denominator less than or equal to this denominator. (This is a general property of continued fractions.) Doing this gives a series of approximations called the Pell numbers, which are (from http://oeis.org/A000129) the following:

1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, 8119/5741, 19601/13860, 47321/33461, 114243/80782, ...

Looking at the list, the biggest denominator less than 1000 is 985. The approximation is really, really close:

1393/985 = 1.414213198...... sqrt(2) = 1.414213562..... They are identical until the 7th decimal place.

This is also doable by solving Pell's equation:

a^2 - 2 b^2 = 1 for integer a and b; higher and higher values of a and b give increasingly accurate approximations.

This was the best of the proposed solutions, but it still falls short of a complete and rigorous argument.

While the continued fraction method can be used to find the best approximation, a little more than the truncation is involved. Namely, because we are looking for the smallest 2 k n \left|\sqrt{2}-\frac{k}{n} \right| and not n 2 k , |n\sqrt{2}-k |, one has to consider semiconvergents , not just convergents. For example, 24 17 \frac{24}{17} approximates 2 \sqrt{2} slightly better than 17 12 , \frac{17}{12}, so if the bound for the denominator were 20 20 instead of 1000 , 1000, the correct answer would have been 17 , 17, not 12 , 12, as the argument above suggests.

See this Wikipedia page for an explanation (without proof) of how the method of continued fractions should be adjusted to get all semiconvergents:

The Pell equation argument does work, but it is only mentioned in passing.

Other users referred to the Bhaskara-Brouncker Algorithm, which produces the same sequence of convergents, but not the semiconvergents.

Calvin Lin Staff - 7 years ago
Zhipeng Wang
May 20, 2014

Recall that equation 1 + 1 2 + 1 2 + 1 2 + = 2 1+\frac{1}{2+\frac{1}{2+\frac{1}{2+\ldots}}} =\sqrt{2} .

Hence, 1 2 + 1 2 + 1 2 + \frac{1}{2+\frac{1}{2+\frac{1}{2+\ldots}}} is the fractional part of 2 \sqrt{2} . Therefore, we should try to stack in as many 1 2 + \frac{1}{2+\ldots} in as possible to make the fraction close to 2 1 \sqrt{2}-1 .

With this in mind, we calculate the value of 1 2 + 1 2 \frac{1}{2+\frac{1}{2}} first, then substitute the value into 1 2 + x \frac{1}{2+x} . Then, we keep substitute the new value we obtained from the previous substitution in place of x x in the equation until we obtain a denominator that is larger than 1000.

The last fraction result with denominator less than 1000 is 408 985 \frac{408}{985} . hence, 408 985 + 1 \frac{408}{985}+1 is the closest to 2 \sqrt{2} with denominator less than 1000

Theory of continuous fractions is used without proper reference. While it is true that they provide the best approximations, this has to be at least stated precisely.

Calvin Lin Staff - 7 years ago
Dan Rubery
May 20, 2014

The closest rational approximations to an irrational number are given by the truncations of its continued fraction.

2 = 1 + 1 2 + 1 2 + 1 2 + . . . \sqrt{2} = 1 + \frac{1}{2+\frac{1}{2+\frac{1}{2+...}}}

Truncating this fraction at successive points, one finds the following series of convergents:

1 , 3 2 , 7 5 , 17 12 , . . . 1393 985 , 3363 2178 1, \frac{3}{2}, \frac{7}{5}, \frac{17}{12}, ... \frac{1393}{985}, \frac{3363}{2178} The last fraction on this list with denominator under 1000 is 985, the answer.

Besides the convergents listed above, there are also semiconvergents, like 10/7, which is a slightly better approximation than 7/5. (So if the denominators were bounded by 10 instead of 1000, the answer 5 would have been incorrect).

Calvin Lin Staff - 7 years ago
Matthew Torrance
May 20, 2014

We want k n \frac{k}{n} to be as close to the square root of 2 as possible. We know that the continued fraction: 1 + 1 2 + 1 2 + 1 2 + . . . 1+\frac{1}{2+\frac{1}{2+\frac{1}{2+...}}} is equal to the square root of 2, and by adding levels, we get that some approximations are: 1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/69, 577/408, 1393/985, and 3363/2378. So therefore, the closest approximation to the square root of 2 has a denominator less than 1000 has a denominator of 985.

It is far from obvious (though true in this case) that the approximations using the continued fractions are the best possible, in the strict sense of the question. This theory is non-trivial, see http://en.wikipedia.org/wiki/Continued fraction#Best rational_approximations for some details, without justification.

Calvin Lin Staff - 7 years ago
Allen Liu
May 20, 2014

The continued fraction representation of 2 \sqrt{2} is,

2 \sqrt{2} = 1 + 1 2 + 1 2 + 1 1 2 + . . . 1 + \frac {1}{2 + {\frac {1}{2 + \frac {1}{\frac {1}{2 + {...}}}}}} ,

So in order to find the approximation of 2 \sqrt{2} , we compute the successive convergents until the denominator is about to exceed 1000.

In this case, we find the largest n to be 985.

This is not truly justified.

Calvin Lin Staff - 7 years ago
Nome da Silva
May 20, 2014

The best approximations to the square root of 2 are the convergents of its continued fraction representation (you can also see it as searching for the square root of 2 in the Stern-Brocot tree). By doing the process successively, you get 1 / 1, 3 / 2, 7 / 5, 17 / 12, 41 / 29, 99 / 70, 239 / 169, 577 / 408, 1,393 / 985. Thus the answer is 985.

While the continued fraction method can be used to find the best approximation, a little more than the truncation is involved. Namely, because we are looking for the smallest 2 k n \left|\sqrt{2}-\frac{k}{n} \right| and not n 2 k , |n\sqrt{2}-k |, one has to consider semiconvergents , not just convergents. For example, 24 17 \frac{24}{17} approximates 2 \sqrt{2} slightly better than 17 12 , \frac{17}{12}, so if the bound for the denominator were 20 20 instead of 1000 , 1000, the correct answer would have been 17 , 17, not 12 , 12, as the argument above suggests.

See this Wikipedia page for an explanation (without proof) of how the method of continued fractions should be adjusted to get all semiconvergents:

http://en.wikipedia.org/wiki/Continued fraction#Best rational_approximations

Calvin Lin Staff - 7 years ago
Jason Zheng
May 20, 2014

Note that 2 = 1 + 2 1 = 1 + 1 2 + 1 \sqrt{2}=1+\sqrt{2}-1=1+\frac{1}{\sqrt{2}+1} . Thus, we may substitute the value of the 2 \sqrt{2} back into the expression and get the continued fraction 2 = 1 + 1 2 + 1 2 + 1 2 + \sqrt{2}=1+\frac{1}{2+\frac{1}{2+\frac{1}{2+\dots}}} .

We can get successively better approximations of 2 \sqrt{2} by evaluating more terms of the continued fraction. For example, the simplest approximation would be 2 = 1 + 1 2 = 3 2 \sqrt{2}=1+\frac{1}{2}=\frac{3}{2} . Next, we get 2 = 1 + 1 2 + 1 = 4 3 \sqrt{2}=1+\frac{1}{2+1}=\frac{4}{3} , 2 = 1 + 1 2 + 1 2 = 7 5 \sqrt{2}=1+\frac{1}{2+\frac{1}{2}}=\frac{7}{5} , 2 = 1 + 1 2 + 1 2 + 1 = 10 7 \sqrt{2}=1+\frac{1}{2+\frac{1}{2+1}}=\frac{10}{7} , and so on. Therefore, the list of successively better approximations is 17 12 \frac{17}{12} , 24 17 \frac{24}{17} , 41 29 \frac{41}{29} , 58 41 \frac{58}{41} , 99 70 \frac{99}{70} , 140 99 \frac{140}{99} , 239 169 \frac{239}{169} , 338 239 \frac{338}{239} , 577 408 \frac{577}{408} , 816 577 \frac{816}{577} , 1393 985 \frac{1393}{985} , 1970 1393 \frac{1970}{1393} , 3363 2378 \frac{3363}{2378} , and so on. The optimal choice under the constraints of the problem is 1393 985 \frac{1393}{985} , so n = 985 n=985 .

All solutions were marked wrong. They all claimed that "I know that continued fractions give the best rational approximation ". However, they did not explain what "best" meant, especially since we can get multiple continued fractions.

They ignored that we were looking at "denominator less than 1000", and merely seeked the largest denominator that was less than 1000, in which case the "optimal choose" may no longer be optimal (since it was optimal on a smaller domain.

Calvin Lin Staff - 7 years ago
Calvin Lin Staff
May 13, 2014

First, we rewrite 2 k n \sqrt{2}-\frac{k}{n} , multiplying by the conjugate and clearing the denominators: 2 k n = 2 n 2 k 2 n 2 ( 2 + k n ) . \left|\sqrt{2}-\frac{k}{n} \right|=\frac{|2n^2-k^2|}{n^2(\sqrt{2}+\frac{k}{n})}.

Note that for k n \frac{k}{n} close to 2 \sqrt{2} , the denominator n 2 ( 2 + k n ) n^2(\sqrt{2}+\frac{k}{n}) is close to 2 2 n 2 2\sqrt{2}n^2 . We will look for a number n n close to, but less than 1000 1000 , such that 2 n 2 k 2 = ± 1 2n^2-k^2 =\pm 1 for some k k .

Note that ( 1 + 2 ) ( 1 2 ) = 1. (1+\sqrt{2})(1-\sqrt{2}) = -1. So for every positive integer m m , if ( 1 + 2 ) m = k + n 2 , (1+\sqrt{2})^m=k+n\sqrt{2}, then ( 1 2 ) m = k n 2 , (1-\sqrt{2})^m=k-n\sqrt{2}, and k 2 2 n 2 = ( k + n 2 ) ( k n 2 ) = ( 1 ) m . k^2-2n^2=(k+n\sqrt{2})(k-n\sqrt{2})=(-1)^m.

One can easily calculate ( 1 + 2 ) 2 = 3 + 2 2 , (1+\sqrt{2})^2=3+2\sqrt{2}, ( 1 + 2 ) 4 = 17 + 12 2 , (1+\sqrt{2})^4=17+12\sqrt{2}, ( 1 + 2 ) 8 = 577 + 408 2 ; (1+\sqrt{2})^8=577+408\sqrt{2}; ( 1 + 2 ) 9 = 1393 + 985 2 (1+\sqrt{2})^9=1393+985\sqrt{2} . This implies that for n = 985 n=985 and k = 1393 k=1393 the distance between 2 \sqrt{2} and k n \frac{k}{n} is approximately 1 98 5 2 ( 2 2 ) \frac{1}{985^2(2\sqrt{2})} . Clearly, for another number n < 1000 n<1000 to give a better approximation, the numerator must be 1 1 .

Lemma. Suppose k k and n n are positive integers such that k 2 2 n 2 = ± 1. k^2-2n^2=\pm 1. Then k + n 2 = ( 1 + 2 ) m k+n\sqrt{2}=(1+\sqrt{2})^m for some non-negative integer m m .

Proof. This classical fact follows from the theory of Pell's equation, or the classification of units in real quadratic field Q [ 2 ] {\mathbb Q}[\sqrt{2}] . Here is an elementary argument. Suppose ( k , n ) (k,n) is a pair satisfying k 2 2 n 2 = ± 1 , k^2-2n^2=\pm 1, such that k + n 2 k+n\sqrt{2} is not a power of 1 + 2 1+\sqrt{2} and n n is smallest possible. Note that the pair ( k 1 , n 1 ) = ( 2 n k , k n ) (k_1,n_1)=(2n-k,k-n) satisfies the same equation (it was obtained by multiplying k + n 2 k+n\sqrt{2} by 2 1 = 1 1 + 2 \sqrt{2}-1=\frac{1}{1+\sqrt{2}} ). Clearly, n > 1 n>1 , from which one can see that n < k < 2 n n<k<2n , so the new pair consists of positive numbers and has smaller n n . By assumption, we must have k 1 + n 1 2 = ( 1 + 2 ) m , k_1+n_1\sqrt{2} = (1+\sqrt{2})^m, from which k + n 2 = ( 1 + 2 ) m + 1 k+n\sqrt{2}=(1+\sqrt{2})^{m+1} , a contradiction.

To finish the problem, note that ( 1 + 2 ) 10 (1+\sqrt{2})^{10} has n > 1000. n> 1000. Therefore, the answer is 985 985 .

Erick Wong
May 20, 2014

The continued fraction of 2 \sqrt{2} is [ 1 ; 2 , 2 , 2 , ] [1; 2, 2, 2, \ldots] , and the convergents p n / q n p_n/q_n of the continued fraction are the best rational approximations to 2 \sqrt{2} . We compute these using p 0 q 0 = 1 0 , p 1 q 1 = 1 1 \frac{p_0}{q_0} = \frac{1}{0}, \frac{p_1}{q_1} = \frac{1}{1} , and the recurrence p n + 1 = 2 p n + p n 1 , q n + 1 = 2 q n + q n 1 p_{n+1} = 2p_n + p_{n-1}, q_{n+1} = 2q_n + q_{n-1} . This yields the sequence of convergents

3 2 , 7 5 , 17 12 , 41 29 , 99 70 , 239 169 , 577 408 , 1393 985 , \frac{3}{2}, \frac{7}{5}, \frac{17}{12}, \frac{41}{29}, \frac{99}{70}, \frac{239}{169}, \frac{577}{408}, \frac{1393}{985}, \cdots

The last of these, with denominator 985, will be the best approximation with denominator up to 1000.

Ben Lowenstein
May 20, 2014

The continued fraction representation of the square root of two is 1 + 1 2 + 1 2 + 1 2 + 1+\frac1{2+\frac1{2+\frac1{2+\cdots}}} . The successive approximations of this infinite fractions provide the "best" approximations of the square root of two, meaning that if k n \frac{k}{n} is the approximation, 2 k n \left|\sqrt{2}-\frac{k}{n}\right| is the smallest possible for all fractions with denominator less than or equal to n n . We calculate the approximations until we reach 1393 985 \frac{1393}{985} as an approximation, with approximations of higher denominator all having denominator greater than 1000 (the next is 3363 2378 \frac{3363}{2378} ). The answer is therefore 985.

Silvio Sergio
May 20, 2014

I knew that continued fraction for x generates all of the best rational approximations for x. Continued fraction for \sqrt{2} is 1+\frac {1}{2+\frac {1}{2+\frac {1}{2+\ldots}}} The first convergents are: 1/1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408,1393/985

Snah A
May 20, 2014

http://www.mathpath.org/Algor/squareroot/algor.myformula.htm

Bhaskara-Brouncker algorithm converges to the corresponding square root, and some of the obtained approximations are the best possible, in some sense. However, this is not as simple as one may wish. For example, the cited page http://www.mathpath.org/Algor/squareroot/algor.myformula.htm provides approximations for 5 \sqrt{5} . If we change the number 2 2 in this problem to 5 5 and 1000 1000 to 10 10 , then the Bhaskara-Brouncker algorithm will seem to suggest that 9 4 \frac{9}{4} is the "best" approximation of 5 \sqrt{5} for the denominators less than 10 10 , even though 20 9 \frac{20}{9} is slightly better (check!).

Calvin Lin Staff - 7 years ago

Let Q be a non-square integer. The Bhaskara-Brouncker Algorithm gives successive approximations of $$\sqrt{Q}$$ as $$\frac{a i}{b i}$$, where $$a 0=b 0=1$$, and $$a i+1=a i+b iQ$$ $$b i+1=a i+b i$$

Now, setting $$x i=\frac{a i}{b i}$$, we get the formula for successive approximations to $$\sqrt{Q}:$$ $$x i+1=\frac{(x i+Q)}{(x i+1)}$$ with $$x_0=1$$.

Now, substituting the values with 2 and 1000, yield $$\frac{1393}{985}.$$ Hence, the denominator is 985.

Bhaskara-Brouncker Algorithm gives a sequence of rational approximations for 2 \sqrt{2} . It is not at all obvious (true for Q=2, but false in general) that these are the best approximations, in the precise sense of the question. I am also concerned with the phrase " substituting the values with 2 and 1000": while 2 will go for Q, 1000 does not stand for anything, unless some computer implementation is used.

Bhaskara-Brouncker algorithm converges to the corresponding square root, and some of the obtained approximations are the best possible, in some sense. However, this is not as simple as one may wish. For example, the page http://www.mathpath.org/Algor/squareroot/algor.myformula.htm provides approximations for 5 \sqrt{5} . If we change the number 2 2 in this problem to 5 5 and 1000 1000 to 10 10 , then the Bhaskara-Brouncker algorithm will seem to suggest that 9 4 \frac{9}{4} is the "best" approximation of 5 \sqrt{5} for the denominators less than 10 10 , even though 20 9 \frac{20}{9} is slightly better (check!).

Calvin Lin Staff - 7 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...