Math Help - Newton's method

1. 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.

2. Originally Posted by Makall
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.

3. 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.

4. 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.

5. $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}$