Rational and irrational numbers

In summary: That's the part where we use the condition that the difference between the square of the rational number and 7 is less than 10^-6. That means that the difference is < 1/1000000, so the square is < 1/1000000 + 7. Thus the square is < 1000007, so the rational number is < sqrt(1000007).I think the general idea of these posts is that we can get the required number by taking, say, the 1,000,000th root of 7. Now, let's use the decimal representation of a number for a moment, and let's say we want to find the closest rational number to 0.
  • #1
Curieuse
51
1

Homework Statement


Determine a positive rational number whose square differs from 7 by less than 0.000001 (10^(-6))

Homework Equations


-

The Attempt at a Solution


Let p/q be the required rational number.

So,
7> (p/q)^(2) > 7-(0.000001)
⇒ √(7) > p/q > √(7-.000001)
⇒√(7) q> p > √(7-.000001)q

I can't see where I'm going with this. T.T

p and q are both integers, so the root quantity should be an integer for the answer
Like p=q(√some perfect square that lies between 7 and 6.999999)

Is this the way i am supposed to worth this out? Also how can i find such a perfect square??
Please help! Thanks!
 
Physics news on Phys.org
  • #2
Curieuse said:

Homework Statement


Determine a positive rational number whose square differs from 7 by less than 0.000001 (10^(-6))

Homework Equations


-

The Attempt at a Solution


Let p/q be the required rational number.

So,
7> (p/q)^(2) > 7-(0.000001)
⇒ √(7) > p/q > √(7-.000001)
⇒√(7) q> p > √(7-.000001)q

I can't see where I'm going with this. T.T

p and q are both integers, so the root quantity should be an integer for the answer
Like p=q(√some perfect square that lies between 7 and 6.999999)

Is this the way i am supposed to worth this out? Also how can i find such a perfect square??
Please help! Thanks!
Isn't it possible that (p/q)2 is slightly larger than 7? -- like: 7 + .000001 > (p/q)2 > 7 - .000001

It's difficult to tell what method you're supposed to use. What sort of course is this for?
 
  • #3
SammyS said:
Isn't it possible that (p/q)2 is slightly larger than 7?

Oh yes! So,
√(7+.000001) q> p > √(7-.000001)q

SammyS said:
It's difficult to tell what method you're supposed to use. What sort of course is this for?

It's from the schaums theory and problems of advanced calculus- that I'm using to redo single var. And learn multi var.
This question is in the preliminaries and I'm stumped already! :cry:
 
  • #4
Curieuse said:
Oh yes! So,
√(7+.000001) q> p > √(7-.000001)q
It's from the schaums theory and problems of advanced calculus- that I'm using to redo single var. And learn multi var.
This question is in the preliminaries and I'm stumped already! :cry:
Are you allowed to use derivatives?
 
  • Like
Likes Curieuse
  • #5
SammyS said:
Are you allowed to use derivatives?
Well, it's just self study so i think i can! But how do i use derivatives here?
 
  • #6
The standard way is to determine the denominator first. Since the maximum difference is 0.000001, q2>1/0.000001=1000000 (which means that q>1000).
Now find a nominator p1 such that p1/q2≥7. You will find a value for p1 that most certainly is not a square. Now adjust q upwards and look for a matching p...
 
  • #7
I wouldn't worry about "numerator" and "denominator". Use the fact that any terminating decimal is a rational number.

Now, [itex]\sqrt{7}= 2.6457513110645905905016157536393...[/itex]. Just cut that off to an appropriate number of decimal places.
 
  • #8
HallsofIvy said:
I wouldn't worry about "numerator" and "denominator". Use the fact that any terminating decimal is a rational number.

Now, [itex]\sqrt{7}= 2.6457513110645905905016157536393...[/itex]. Just cut that off to an appropriate number of decimal places.

Well, thanks for this! I was blinded by all the algebra! It's so simple! T.T
But i still want to know the algebraic way of doing this!

Svein said:
q2>1/0.000001=1000000

Why is q > 10^6 ? Are we just choosing an arbitrary denominator and arriving at the numerator from applying the conditions?
I should be missing something here!
 
  • #9
Piggy-backing on other answers:

## \sqrt 7## is a Real number, and, as a decimal, it is the LUB of a certain expression 2.645...

Now, consider the sequence:

## a_1:= |2.645 ^2 -7| ##
## a_2:= | 26.4575131^2 - 700| ##
## a_3:=| 264. 575131106^2 - 70000| ##
...
## a_n :=| 264575... - 7(10^n)| ##
This sequence converges to 0 because ## \sqrt 7 ## is the lub of the decimal expansion 2.64575...

By completeness of the Reals, the Cauchy sequence 2.64575131... converges to what we call
## \sqrt 7 ##, which is then the LUB of the sequence. This means we can get as close as we want, by definition/properties of the LUB, so that , as Ivy said, by going far-enough into the sequence.
 
Last edited:
  • #10
Approximating an irrational number using a rational fraction can be done by using Continued Fractions. With each term the reconstructed fraction becomes more accurate. It is then a matter of checking whether the error < 1e-6 or to continue with more terms.
12th term - error is 1.7e-6... not quite good enough
13th term - error is 2.4e-7... OK
I do not want to show the fraction in case this is homework. The numerator and denominator are both below 10,000.
The problem statement does not specify whether the answer should be the smallest (numerator & denominator) fraction just below the error threshold but closest to it, or some arbitrarily very accurate number. Simply converting an N-decimal-digit number into the fraction,
e.g. (sqrt(7) * 10^N) / 10^N
as Hallsofivy suggested may be the quickest and most intuitive method.
 
Last edited:
  • #11
Curieuse said:
Well, it's just self study so i think i can! But how do i use derivatives here?
Does your book cover Newton's method in this section ?
 
  • #12
Here is a Link to the Wikipedia entry for Newton's Method for finding roots to equations.

Let ##\displaystyle \ f(x) = x^2-7 \ .\ ## Your problem now boils down to finding a value of ##\ x\ ## such that ##\ |f(x)|<10^{-6} \ .##

Start with some rational number for ##\ x\ ## whose square is pretty close to 7. Two or three iterations should give a good result.

You can even work this out to get ##\ x\ ## in the form ##\displaystyle \ \frac{p}{q} \ .\ ##
 
Last edited:
  • Like
Likes Curieuse
  • #13
Curieuse said:
Well, it's just self study so i think i can! But how do i use derivatives here?
A common way to determine numerical approximations to ##\sqrt{u}## for real ##u > 0## is to apply Newton's method to fine the root of ##0 = f(x) \equiv x^2 - u##. That does, indeed, use derivatives. It applies the formula
[tex] x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}, [/tex]
to get the next approximation ##x_{n+1}## from the current approximation ##x_n##. For the simple case of ##f = x^2 - u## it gives
[tex] x_{n+1} = \frac{1}{2} \left( x_n + \frac{u}{x_n} \right) [/tex]
 
  • Like
Likes Curieuse and SammyS
  • #14
Using what Ray has in the above post:

If you start with a rational number for your initial "guess", then the subsequent values will also be rational.
 
  • #15
Curieuse said:
Why is q > 10^6 ? Are we just choosing an arbitrary denominator and arriving at the numerator from applying the conditions? I should be missing something here!
Well, I was quoting a part of the standard proof for the theorem "Between two different real numbers there is a rational".
 
  • #16
Curieuse said:
HallsofIvy said:
I wouldn't worry about "numerator" and "denominator". Use the fact that any terminating decimal is a rational number.

Now, [itex]\sqrt{7}= 2.6457513110645905905016157536393...[/itex]. Just cut that off to an appropriate number of decimal places.
Well, thanks for this! I was blinded by all the algebra! It's so simple! T.T
But i still want to know the algebraic way of doing this!
I looked at some edition of Schaum's Advanced Calculus. Seems the author may not have been looking any deeper than what HallsofIvy has suggested.

However, if you want something employing a bit of algebra and basic Calculus:

Using Newton's method, as Ray suggested, I used a spreadsheet to find a few rationals that work.

Starting with ##\displaystyle \ x_0=\frac{8}{3} \,,\ ## the second iteration gives: ##\displaystyle \ x_2=\frac{32257}{12192} \ ## with the square of that being
7.0000000067 .

I also looked at lots of starting numbers with two digit denominators. It's pretty easy to find candidates simply using a scientific calculator. A few of these gave a satisfactory result in a single iteration of Newton's method. Several others gave results in one iteration which were just slightly too large.

The satisfactory rational I found with the smallest denominator (and numerator) was ##\displaystyle \ \frac{13451}{ 5084} \ ## which had a starting value of ##\displaystyle \ x_0=\frac{82}{31} \ ##.
 
  • #17
Why not just try the rational sequence 2, 2.6, 2.64, 2.645 , etc. Adjust the terms so that the square is less than 7.

More specifically:
1) Find the greatest integer a so that ##a^2 < 7 ##
2) Find the greatest integer ##a_1 ## so that ## (a.a_1)^2 < 7##
...
n-1) Find the greatest integer ##a_n## so that ##(a.a_0...a_n)^2 < 7##.

Edit: The sequence we get is a monotone increasing, bounded (Cauchy) sequence that is bounded
above, so it must have a LUB.

Edit: I don't mean to be argumentative, it is just that the problem comes from a book on properties of the Real numbers, and this approach uses the LUB property of Reals.
 
Last edited:
  • #18
WWGD said:
Why not just try the rational sequence 2, 2.6, 2.64, 2.645 , etc. Adjust the terms so that the square is less than 7.
...

Edit: The sequence we get is a monotone increasing, bounded (Cauchy) sequence that is bounded
above, so it must have a LUB.

Edit: I don't mean to be argumentative, it is just that the problem comes from a book on properties of the Real numbers, and this approach uses the LUB property of Reals.
There are many possible approaches to this problem. Your suggested approach has merit, but so do other approaches.

There's nothing wrong with considering the increasing sequence you suggest based on the idea of the LUB (least upper bound). We could just as well look at the similar sequence based on the GLB (greatest lower bound), in which x2>7 . Furthermore, we're looking for some rational number which fulfills some specific condition. Why limit the denominator to be some power of 10? For that matter, why limit ourselves to a base ten representation?

Yes, the problem apparently comes from a book on properties of the Real numbers so an approach based on properties of Reals might be in order.

However, the problem is stated in the OP only with reference to rational numbers, and the initial attempt is exclusively with rational numbers constructed as the ratio of integers. That's largely what led me to consider a method to get a solution explicitly of that form.
 
  • #19
Svein said:
The standard way is to determine the denominator first. Since the maximum difference is 0.000001, q2>1/0.000001=1000000 (which means that q>1000).

I now see why you took denominator squared to be less than the allowed error! It comes from continuous fractions, if I am not wrong. Also the fraction is simply to large to work with. As Scientific 601 said, the error is within limits only in the 13th term. Is there any way of doing this faster?

WWGD said:
Now, consider the sequence:
## a_1:= |2.645 ^2 -7| ##
## a_2:= | 26.4575131^2 - 700| ##
## a_3:=| 264. 575131106^2 - 70000| ##
...
## a_n :=| 264575... - 7(10^n)| ##
This sequence converges to 0 because ## \sqrt 7 ## is the lub of the decimal expansion 2.64575...

By completeness of the Reals, the Cauchy sequence 2.64575131... converges to what we call
## \sqrt 7 ##, which is then the LUB of the sequence. This means we can get as close as we want, by definition/properties of the LUB, so that , as Ivy said, by going far-enough into the sequence.

Why don't we take the sequence

## a_1:= |2.645 ^2 -7| ##
## a_2:= | 2.64575131^2- 7| ##
## a_3:=| 2.64575131106^2 - 7| ##
...
## a_n :=| 2.64575... ^2- 7| ##

This would also converge to 0 right? And this is basically a proof for halls ofivy's method right?

WWGD said:
Why not just try the rational sequence 2, 2.6, 2.64, 2.645 , etc. Adjust the terms so that the square is less than 7.

More specifically:
1) Find the greatest integer a so that ##a^2 < 7 ##
2) Find the greatest integer ##a_1 ## so that ## (a.a_1)^2 < 7##
...
n-1) Find the greatest integer ##a_n## so that ##(a.a_0...a_n)^2 < 7##.

I saw this method was used by the instructor in OSU's calc 1 course, involves computation though!

I'm trying to get the Newtons method in place now! It seems the least computational.
Again thanks everyone for all the inputs! :D
 
  • #20
scientific601 said:
Approximating an irrational number using a rational fraction can be done by using Continued Fractions. With each term the reconstructed fraction becomes more accurate. It is then a matter of checking whether the error < 1e-6 or to continue with more terms.
12th term - error is 1.7e-6... not quite good enough
13th term - error is 2.4e-7... OK
I do not want to show the fraction in case this is homework. The numerator and denominator are both below 10,000.

Is it by trial and error that we get the fraction that we write the continued fraction for? I tried with 2.6457514 and got 2+1/1+1/1+1/1+1/4+1/1+1/1+1/1+1/4+1/1+/1+1/1+1/4+1/1+87791/159294
I realized the quotients were repeating and this stopped.
I should solve for each and get the series 2, 3, 3/2, 5/2 , 8/3 , 37/14... Until 1/q^2 is less than 10^(-7)??

Is there a more efficient way of choosing the starting fraction?
 
  • #21
Curieuse said:
Well, thanks for this! I was blinded by all the algebra! It's so simple! T.T
But i still want to know the algebraic way of doing this!

From an algebraic standpoint, you could set up and solve continued fractions to find [itex]\sqrt{7}[/itex] to the desired degree of precision.
 
  • #22
Ray Vickson said:
A common way to determine numerical approximations to ##\sqrt{u}## for real ##u > 0## is to apply Newton's method to fine the root of ##0 = f(x) \equiv x^2 - u##. That does, indeed, use derivatives. It applies the formula
[tex] x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}, [/tex]
to get the next approximation ##x_{n+1}## from the current approximation ##x_n##. For the simple case of ##f = x^2 - u## it gives
[tex] x_{n+1} = \frac{1}{2} \left( x_n + \frac{u}{x_n} \right) [/tex]
Thanks ray! This method rocks totally! I'm so happy i learned this! It's ingenious!:oldbiggrin:
:oldlaugh:
 
  • #23
Ray Vickson said:
A common way to determine numerical approximations to u√\sqrt{u} for real u>0u > 0 is to apply Newton's method to fine the root of 0=f(x)≡x2−u0 = f(x) \equiv x^2 - u. That does, indeed, use derivatives. It applies the formula
xn+1=xnf(xn)f′(xn),​
x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)},
to get the next approximation xn+1x_{n+1} from the current approximation xnx_n. For the simple case of f=x2−uf = x^2 - u it gives
xn+1=12(xn+uxn)​
If you really want to find rationals, rewrite the formula slightly:
We want to find the square root of a expressed as p/q. Assume that you have found pn and qn. Then [itex] p_{n+1}=p_{n}^{2}+a\cdot q_{n}^{2}[/itex] and [itex] q_{n+1}=2\cdot q_{n}\cdot p_{n}[/itex].

Now, the choice of p1 and q1 is not critical, but different choices give different answers down the road. It is possible to start with p1 = 1 and q1 = 1, but there are better choices.

Another thing: both pn and qn grow very large very fast, so be on the lookout for a possible reduction of the fraction.
 
  • Like
Likes Curieuse
  • #24
I would start with a more accurate fraction than the one you tried... no sense introducing another error such that the continued fraction converges, with its own error, on something that's off to begin with.

But you want a more algebraic solution instead of trial and error.
The first intuitive method I came up with was to use as many decimals as required from ##\sqrt{7}##
2.645751311064591 (result from Apple Calculator)
Try 6 digits: 2.645751 - squaring it differs from 7 by 1.6e-6. Error too large.
Try 7 digits: 2.6457513 - squaring it differs from 7 by 5.85e-8 which is below 1e-6.
So the rational number is simply 26457513 / 10000000.

Somehow this answer feels like it's too primitive to be acceptable. It may depend on which level of mathematical sophistication you are expected to demonstrate.
 
  • #25
scientific601 said:
I would start with a more accurate fraction than the one you tried... no sense introducing another error such that the continued fraction converges, with its own error, on something that's off to begin with.

But you want a more algebraic solution instead of trial and error.
The first intuitive method I came up with was to use as many decimals as required from ##\sqrt{7}##
2.645751311064591 (result from Apple Calculator)
Try 6 digits: 2.645751 - squaring it differs from 7 by 1.6e-6. Error too large.
Try 7 digits: 2.6457513 - squaring it differs from 7 by 5.85e-8 which is below 1e-6.
So the rational number is simply 26457513 / 10000000.

Somehow this answer feels like it's too primitive to be acceptable. It may depend on which level of mathematical sophistication you are expected to demonstrate.
This was what I suggested in post #7!
 
  • Like
Likes Curieuse
  • #26
scientific601 said:
The first intuitive method I came up with was to use as many decimals as required from 7√\sqrt{7}
2.645751311064591 (result from Apple Calculator)
What would you do if you did not have a calculator handy?
 
  • Like
Likes Curieuse
  • #27
Svein said:
If you really want to find rationals, rewrite the formula slightly:
We want to find the square root of a expressed as p/q. Assume that you have found pn and qn. Then [itex] p_{n+1}=p_{n}^{2}+a\cdot q_{n}^{2}[/itex] and [itex] q_{n+1}=2\cdot q_{n}\cdot p_{n}[/itex].

Now, the choice of p1 and q1 is not critical, but different choices give different answers down the road. It is possible to start with p1 = 1 and q1 = 1, but there are better choices.

Another thing: both pn and qn grow very large very fast, so be on the lookout for a possible reduction of the fraction.

Yep! I tried this too! Started with 2/1.
By x4 i got 7e(-7) error!
When does this method not work? Like for non differentiable fns it won't, of course!
Any other things one should keep in mind when applying this?
 
  • #28
Svein said:
What would you do if you did not have a calculator handy?
In that case I'm afraid even Newton's iterative method would become too laborious. I suppose using long-hand square root calculation, combined with its squaring to double check deviation is the only alternative.
 
  • #29
Curieuse said:

Homework Statement


Determine a positive rational number whose square differs from 7 by less than 0.000001 (10^(-6))

This question could be rephrased as "use the method for finding square roots you were taught in school to find √7 to 6 decimal places"...
thus I started to answer, but it ran away a bit and I thought questions arising were interesting enough for a thread in general math.
https://www.physicsforums.com/threads/were-you-taught-square-root-extraction-at-school.821407/
 
  • Like
Likes Curieuse and SammyS
  • #30
scientific601 said:
In that case I'm afraid even Newton's iterative method would become too laborious. I suppose using long-hand square root calculation, combined with its squaring to double check deviation is the only alternative.
No but it wasn't that laborious, Newtons method! Just one tricky fraction at the end! o_O
 

What are rational and irrational numbers?

Rational numbers are numbers that can be expressed as a ratio of two integers, such as 1/2 or 3/4. Irrational numbers, on the other hand, cannot be expressed as a ratio of two integers and have an infinite number of non-repeating decimal places, such as pi or the square root of 2.

How can you tell if a number is rational or irrational?

A number is rational if it can be written as a fraction or ratio. If a number cannot be written as a fraction, it is irrational. One way to determine if a number is irrational is by using the decimal expansion - if the decimal places continue infinitely without repeating, the number is irrational.

What are some examples of rational and irrational numbers?

Examples of rational numbers include 1/2, 3/4, and 5/6. Examples of irrational numbers include pi (3.14159...) and the square root of 2 (1.41421...).

Can irrational numbers be written in any other form besides decimals?

Yes, irrational numbers can also be written in radical form, such as √2 for the square root of 2. However, this form is still considered an irrational number as it cannot be expressed as a ratio of two integers.

Why are irrational numbers important in mathematics?

Irrational numbers are important in mathematics because they allow us to represent quantities that cannot be expressed as a ratio of two integers. They also play a significant role in geometry and trigonometry, as well as in the study of limits and continuity in calculus.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
8
Views
925
  • Precalculus Mathematics Homework Help
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
12
Views
2K
  • Precalculus Mathematics Homework Help
Replies
5
Views
2K
  • Science and Math Textbooks
Replies
10
Views
2K
Replies
85
Views
4K
  • Precalculus Mathematics Homework Help
Replies
4
Views
2K
Replies
5
Views
2K
  • Precalculus Mathematics Homework Help
Replies
14
Views
3K
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
Back
Top