1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rational and irrational numbers

  1. Jun 24, 2015 #1
    1. The problem statement, all variables and given/known data
    Determine a positive rational number whose square differs from 7 by less than 0.000001 (10^(-6))

    2. Relevant equations
    -

    3. 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!
     
  2. jcsd
  3. Jun 24, 2015 #2

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    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?
     
  4. Jun 24, 2015 #3
    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:
     
  5. Jun 24, 2015 #4

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Are you allowed to use derivatives?
     
  6. Jun 24, 2015 #5
    Well, it's just self study so i think i can! But how do i use derivatives here?
     
  7. Jun 24, 2015 #6

    Svein

    User Avatar
    Science Advisor

    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...
     
  8. Jun 24, 2015 #7

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
     
  9. Jun 24, 2015 #8
    Well, thanks for this! I was blinded by all the algebra! It's so simple! T.T
    But i still wanna know the algebraic way of doing this!

    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!
     
  10. Jun 24, 2015 #9

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    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: Jun 24, 2015
  11. Jun 24, 2015 #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: Jun 24, 2015
  12. Jun 24, 2015 #11

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Does your book cover Newton's method in this section ?
     
  13. Jun 24, 2015 #12

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    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: Jun 27, 2015
  14. Jun 24, 2015 #13

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper


    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]
     
  15. Jun 24, 2015 #14

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  16. Jun 24, 2015 #15

    Svein

    User Avatar
    Science Advisor

    Well, I was quoting a part of the standard proof for the theorem "Between two different real numbers there is a rational".
     
  17. Jun 27, 2015 #16

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    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} \ ##.
     
  18. Jun 27, 2015 #17

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    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: Jun 27, 2015
  19. Jun 27, 2015 #18

    SammyS

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  20. Jun 28, 2015 #19
    I now see why you took denominator squared to be less than the allowed error! It comes from continuous fractions, if im 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?

    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?

    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
     
  21. Jun 28, 2015 #20
    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 realised 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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Rational and irrational numbers
Loading...