Find the denominator n of the rational number n k ( k , n are both integers) such that ∣ ∣ 2 − n k ∣ ∣ is the smallest possible, out of all rational numbers with denominator less than 1 0 0 0 .
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.
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 − n k ∣ ∣ and not ∣ n 2 − k ∣ , one has to consider semiconvergents , not just convergents. For example, 1 7 2 4 approximates 2 slightly better than 1 2 1 7 , so if the bound for the denominator were 2 0 instead of 1 0 0 0 , the correct answer would have been 1 7 , not 1 2 , 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.
Recall that equation 1 + 2 + 2 + 2 + … 1 1 1 = 2 .
Hence, 2 + 2 + 2 + … 1 1 1 is the fractional part of 2 . Therefore, we should try to stack in as many 2 + … 1 in as possible to make the fraction close to 2 − 1 .
With this in mind, we calculate the value of 2 + 2 1 1 first, then substitute the value into 2 + x 1 . Then, we keep substitute the new value we obtained from the previous substitution in place of x in the equation until we obtain a denominator that is larger than 1000.
The last fraction result with denominator less than 1000 is 9 8 5 4 0 8 . hence, 9 8 5 4 0 8 + 1 is the closest to 2 with denominator less than 1000
The closest rational approximations to an irrational number are given by the truncations of its continued fraction.
2 = 1 + 2 + 2 + 2 + . . . 1 1 1
Truncating this fraction at successive points, one finds the following series of convergents:
1 , 2 3 , 5 7 , 1 2 1 7 , . . . 9 8 5 1 3 9 3 , 2 1 7 8 3 3 6 3 The last fraction on this list with denominator under 1000 is 985, the answer.
We want n k to be as close to the square root of 2 as possible. We know that the continued fraction: 1 + 2 + 2 + 2 + . . . 1 1 1 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.
The continued fraction representation of 2 is,
2 = 1 + 2 + 2 + 2 + . . . 1 1 1 1 ,
So in order to find the approximation of 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.
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 − n k ∣ ∣ and not ∣ n 2 − k ∣ , one has to consider semiconvergents , not just convergents. For example, 1 7 2 4 approximates 2 slightly better than 1 2 1 7 , so if the bound for the denominator were 2 0 instead of 1 0 0 0 , the correct answer would have been 1 7 , not 1 2 , 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
Note that 2 = 1 + 2 − 1 = 1 + 2 + 1 1 . Thus, we may substitute the value of the 2 back into the expression and get the continued fraction 2 = 1 + 2 + 2 + 2 + … 1 1 1 .
We can get successively better approximations of 2 by evaluating more terms of the continued fraction. For example, the simplest approximation would be 2 = 1 + 2 1 = 2 3 . Next, we get 2 = 1 + 2 + 1 1 = 3 4 , 2 = 1 + 2 + 2 1 1 = 5 7 , 2 = 1 + 2 + 2 + 1 1 1 = 7 1 0 , and so on. Therefore, the list of successively better approximations is 1 2 1 7 , 1 7 2 4 , 2 9 4 1 , 4 1 5 8 , 7 0 9 9 , 9 9 1 4 0 , 1 6 9 2 3 9 , 2 3 9 3 3 8 , 4 0 8 5 7 7 , 5 7 7 8 1 6 , 9 8 5 1 3 9 3 , 1 3 9 3 1 9 7 0 , 2 3 7 8 3 3 6 3 , and so on. The optimal choice under the constraints of the problem is 9 8 5 1 3 9 3 , so n = 9 8 5 .
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.
First, we rewrite 2 − n k , multiplying by the conjugate and clearing the denominators: ∣ ∣ ∣ ∣ 2 − n k ∣ ∣ ∣ ∣ = n 2 ( 2 + n k ) ∣ 2 n 2 − k 2 ∣ .
Note that for n k close to 2 , the denominator n 2 ( 2 + n k ) is close to 2 2 n 2 . We will look for a number n close to, but less than 1 0 0 0 , such that 2 n 2 − k 2 = ± 1 for some k .
Note that ( 1 + 2 ) ( 1 − 2 ) = − 1 . So for every positive integer m , if ( 1 + 2 ) m = k + n 2 , then ( 1 − 2 ) m = k − n 2 , and k 2 − 2 n 2 = ( k + n 2 ) ( k − n 2 ) = ( − 1 ) m .
One can easily calculate ( 1 + 2 ) 2 = 3 + 2 2 , ( 1 + 2 ) 4 = 1 7 + 1 2 2 , ( 1 + 2 ) 8 = 5 7 7 + 4 0 8 2 ; ( 1 + 2 ) 9 = 1 3 9 3 + 9 8 5 2 . This implies that for n = 9 8 5 and k = 1 3 9 3 the distance between 2 and n k is approximately 9 8 5 2 ( 2 2 ) 1 . Clearly, for another number n < 1 0 0 0 to give a better approximation, the numerator must be 1 .
Lemma. Suppose k and n are positive integers such that k 2 − 2 n 2 = ± 1 . Then k + n 2 = ( 1 + 2 ) m for some non-negative integer m .
Proof. This classical fact follows from the theory of Pell's equation, or the classification of units in real quadratic field Q [ 2 ] . Here is an elementary argument. Suppose ( k , n ) is a pair satisfying k 2 − 2 n 2 = ± 1 , such that k + n 2 is not a power of 1 + 2 and n is smallest possible. Note that the pair ( k 1 , n 1 ) = ( 2 n − k , k − n ) satisfies the same equation (it was obtained by multiplying k + n 2 by 2 − 1 = 1 + 2 1 ). Clearly, n > 1 , from which one can see that n < k < 2 n , so the new pair consists of positive numbers and has smaller n . By assumption, we must have k 1 + n 1 2 = ( 1 + 2 ) m , from which k + n 2 = ( 1 + 2 ) m + 1 , a contradiction.
To finish the problem, note that ( 1 + 2 ) 1 0 has n > 1 0 0 0 . Therefore, the answer is 9 8 5 .
The continued fraction of 2 is [ 1 ; 2 , 2 , 2 , … ] , and the convergents p n / q n of the continued fraction are the best rational approximations to 2 . We compute these using q 0 p 0 = 0 1 , q 1 p 1 = 1 1 , and the recurrence p n + 1 = 2 p n + p n − 1 , q n + 1 = 2 q n + q n − 1 . This yields the sequence of convergents
2 3 , 5 7 , 1 2 1 7 , 2 9 4 1 , 7 0 9 9 , 1 6 9 2 3 9 , 4 0 8 5 7 7 , 9 8 5 1 3 9 3 , ⋯
The last of these, with denominator 985, will be the best approximation with denominator up to 1000.
The continued fraction representation of the square root of two is 1 + 2 + 2 + 2 + ⋯ 1 1 1 . The successive approximations of this infinite fractions provide the "best" approximations of the square root of two, meaning that if n k is the approximation, ∣ ∣ 2 − n k ∣ ∣ is the smallest possible for all fractions with denominator less than or equal to n . We calculate the approximations until we reach 9 8 5 1 3 9 3 as an approximation, with approximations of higher denominator all having denominator greater than 1000 (the next is 2 3 7 8 3 3 6 3 ). The answer is therefore 985.
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
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 . If we change the number 2 in this problem to 5 and 1 0 0 0 to 1 0 , then the Bhaskara-Brouncker algorithm will seem to suggest that 4 9 is the "best" approximation of 5 for the denominators less than 1 0 , even though 9 2 0 is slightly better (check!).
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 . 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 . If we change the number 2 in this problem to 5 and 1 0 0 0 to 1 0 , then the Bhaskara-Brouncker algorithm will seem to suggest that 4 9 is the "best" approximation of 5 for the denominators less than 1 0 , even though 9 2 0 is slightly better (check!).
Problem Loading...
Note Loading...
Set Loading...
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.