Math Help Forum: Newton's method

  1. #1
    Junior Member
    Joined
    Jan 2010
    Posts
    30

    Newton's method

    Use Newton's method to approximate to within 10^-4, the value of x that produces the point on the graph of y = 1/x that is closest to (2, 1).

    I tried setting p0 = 2 and using the algorithm p_{n} = p_{n-1} - f(p_{n-1})/f'(p_{n-1}) where f(x) = 1/x and f'(x) = -1/x^2 but the number is actually increasing? It goes 4, 8, 16, 32, ...

    I'm not sure what I'm doing wrong here.
    Follow Math Help Forum on Facebook and Google+

  2. Welcome to Math Help Forum - Click here to Register

    Welcome to the largest Math Help Forum, a free community dedicated to math help and math discussions.

    We welcome everyone and the community is free to join so register today and become part of our math family!

  3. #2
    MHF Contributor
    Joined
    Dec 2009
    Posts
    3,120
    Quote Originally Posted by Makall View Post
    Use Newton's method to approximate to within 10^-4, the value of x that produces the point on the graph of y = 1/x that is closest to (2, 1).

    I tried setting p0 = 2 and using the algorithm p_{n} = p_{n-1} - f(p_{n-1})/f'(p_{n-1}) where f(x) = 1/x and f'(x) = -1/x^2 but the number is actually increasing? It goes 4, 8, 16, 32, ...

    I'm not sure what I'm doing wrong here.
    Hi Makall,

    You could develop a function for the distance from (2,1) to points on the graph.
    Then differentiate that function, setting it equal to zero to find the value of x
    producing that minimum distance.

    A distance equation is

    d^2=(x-2)^2+(y-1)^2=x^2-4x+4+y^2-2y+1

    Now substitute y=\frac{1}{x}

    to get

    d^2=x^2-4x+5+-2x^{-1}+x^{-2}

    Differentiate this, set it equal to zero and use Newton's method to find the root near x=2.
    Attached Thumbnails Attached Thumbnails Newton's method-1-x.jpg  
    Follow Math Help Forum on Facebook and Google+

  4. #3
    Junior Member
    Joined
    Jan 2010
    Posts
    30
    So I got this f = {\left(x - 2\right)}^2 + {\left(\frac{1}{x} - 1\right)}^2 and differentiated it to get this f' = 2\, x + \frac{2}{x^2} - \frac{2}{x^3} - 4

    Then I used this equation x = x - \frac{{\left(x - 2\right)}^2 + {\left(\frac{1}{x} -  1\right)}^2}{2\, x + \frac{2}{x^2} - \frac{2}{x^3} - 4}

    Used initial value as 2 and got these numbers.

    x = 2
    >> for i=1:10, x = x - ((x - 2)^2 + (1/x - 1)^2)/(2*x + 2/x^2 - 2/x^3 - 4), end
    x = 1
    x = 1.500000000000000
    x = 2.013157894736842
    x = 1.090411751549197
    x = 1.587061684245663
    x = 2.164611788880735
    x = 1.598178106645094
    x = 2.188802634131807
    x = 1.641701289644409
    x = 2.300866462141473

    The solution says p0 = 2, p2 = 1.866760 and the point is (1.866760, 0.535687). The number seems to be alternating so I'm not sure what's wrong with it.
    Follow Math Help Forum on Facebook and Google+

  5. #4
    MHF Contributor
    Joined
    Dec 2009
    Posts
    3,120
    Hi Makall,

    to get the distance, you need to take the square root of the square of the distance,
    differentiate that, equate to zero,
    find the value of x using Newton's method that causes the derivative to be zero.
    Follow Math Help Forum on Facebook and Google+

  6. #5
    MHF Contributor
    Joined
    Dec 2009
    Posts
    3,120
    d^2=x^2-4x+5-\frac{2}{x}+\frac{1}{x^2}

    d=\sqrt{x^2-4x+5-\frac{2}{x}+\frac{1}{x^2}}

    To find the co-ordinate x at the minimum distance from (2,1)
    differentiate d with respect to x and equate to zero
    (finds x at the minimum value of the curve of d).

    d'=\frac{1}{2}\left(x^2-4x+5-\frac{2}{x}+\frac{1}{x^2}\right)^{-\frac{1}{2}}\left(2x-4+\frac{2}{x^2}-\frac{2}{x^3}\right)

    =\frac{x-2+\frac{1}{x^2}-\frac{1}{x^3}}{\sqrt{x^2-4x+5-\frac{2}{x}+\frac{1}{x^2}}}

    This =0 when the numerator =0

    We need to find x for which

    x-2+\frac{1}{x^2}-\frac{1}{x^3}=0

    g(x)=x^4-2x^3+x-1=0

    We use Newton's method to find the root of this near x=2.

    g'(x)=4x^3-6x^2+1

    X_{n+1}=X_n-\frac{g(X_n)}{g'(X_n)}

    Taking x=2 as the initial estimate, X_n

    X_{n+1}=2-\frac{16-16+2-1}{32-24+1}=2-\frac{1}{9}
    Attached Thumbnails Attached Thumbnails Newton's method-d.jpg   Newton's method-g-x-.jpg  
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Newton's Method
    Posted in the Calculus Forum
    Replies: 1
    Last Post: December 6th, 2009, 03:10 PM
  2. Newton's method
    Posted in the Advanced Math Topics Forum
    Replies: 0
    Last Post: October 17th, 2009, 12:46 PM
  3. Newton's Method
    Posted in the Calculus Forum
    Replies: 1
    Last Post: October 15th, 2009, 08:03 PM
  4. Newton's Method help!!
    Posted in the Calculus Forum
    Replies: 0
    Last Post: October 29th, 2008, 05:27 PM
  5. Newton's Method
    Posted in the Calculus Forum
    Replies: 7
    Last Post: December 12th, 2007, 08:53 AM

/mathhelpforum @mathhelpforum