How do I derive root approximation functions?

401 Views Asked by At

I once saw a function for generating successively more-precise square root approximations, $f(x) = \frac{1}{2} ({x + \frac{S}{x}})$ where S is the square for which we are trying to calculate $\sqrt S$. And the function works really well, generating an approximation of $\sqrt 2 \approx f^3(1) = \frac{577}{408} \approx 1.414215$.

This fascinated me, so I tried extending the same logic to further radicals, starting with cube roots.

My first guess was $f_2(x) = \frac{1}{3} ({x + \frac{S}{x}})$, but when I tried an approximation for $\sqrt[3] 3$, I got $\sqrt[3] 3 \approx f_2^2(1) = \frac{43}{36} \approx 1.194444$, which is a far cry from $\sqrt[3] 3 \approx Google(\sqrt[3] 3) \approx 1.44225$.

How can I extend this logic for $n^{a\over b}$ where $ b > 2$? Was I accurate all-along and just needed more iterations? Or is the presence of $\frac{1}{2}$ in $f(x) $ and in $n^\frac{1}{2}$ a coincidence?

Disclaimer: I am not educated in calculus.

2

There are 2 best solutions below

2
On BEST ANSWER

Let me tell you how to differentiate a polynomial, multiply the exponent by the coefficint and reduce $1$ from the exponent.

For example, if $f(x)=5x^3+7$, then $f'(x)=15x^2$ [we multiplied $3$ by $5$ to get $15$, and we reduced $1$ from the exponent, it was $3$, then it became $2%$]. The $7$ just cancelled because it is a constant.

Another example, if $f(x)=x^5-8$, then $f'(x)=5x^4$ [we multipled 5 by the coefficient $1$ to get $5$, and we reduced 1 from the exponent, it was $5$, then it became $4$]. The $8$ is constant, so it is cancelled.


Now you want to approximate $^3\sqrt{3}$

This means you want to find a number, if you cube it you get $3$, therefore you want to solve the equation;

$x^3=3$ , moving all terms to the left we get $x^3-3=0$, denoting the left hand side by $f(x)$

You need to approximate the root of the equation $x^3-3=0$

Let $f(x)=x^3-3$, therefore $f'(x)=3x^2$ [as you know now]

Newtons methods for approximating root is:

$x_n=x_{n-1}-\frac{f(x_{n-1})}{f'(x_{n-1})}$, where $x_0$ is the initial guess,

Let $x_0=1.5$

$x_1=1.5-\frac{f(1.5)}{f'(1.5)}=1.5-\frac{1.5^3-3}{3\times1.5^2}=1.5-\frac{3.375-3}{3\times2.25}=1.5-\frac{0.375}{6.75}=1.44444$

Now you have $x_1=1.44444$, you can calculate $x_2$ in the same way;

$x_1=1.44444-\frac{f(1.44444)}{f'(1.44444)}=1.44444-\frac{1.44444^3-3}{3\times1.44444^2}=1.44444-\frac{3.01369-3}{3\times2.08641}=1.44444-\frac{0.01369}{6.25923}=1.44225$

Here it is a good approximation. if you see that it is not a good approximation, just find $x_3$ or $x_4$ or until you reach a good approximation.


Suppose you want to approximate $^7\sqrt{5}$ (the seventh root of five)

Then you want to find a number, if you raise it to the power $7$ you get $5$,

this means you want to solve the equation $x^7=5$ , moving terms to the left we get $x^7-5=0$

Now $f(x)=x^7-5$ and $f'(x)=7x^6$

Let the initial guess, $x_0=1.2$

So $x_1=1.2-\frac{f(1.2)}{f'(1.2)}=1.2-\frac{1.2^7-5}{7\times1.2^6}=1.26778$

Again, $x_2=1.26778-\frac{f(1.26778)}{f'(1.26778)}=1.26778-\frac{1.26778^7-5}{7\times1.26778^6}=1.2585$

Again, find $x_3,x_4,...$ unit you get a continent accuracy

0
On

Please see the link description at the very bottom

Let's first derive a formula for calculating square roots manually without calculus (and later for more general cases of various roots). Let's denote our numbers as follows $\,\sqrt{S}=x_1+a\,$ where $\,x_1\,$ is the first approximate value by our choice and $\,a\,$ is a tolerance (an error of approximation). Therefore, after squaring we obtain

$\,S=x_1^2+2\,x_1a+a^2.\,\,$ We choose $\,x_1\,$ to be much greater than $\,a\,$ so that we can cast away $\,a^2\,$ for the approximation:

$$\,S\approx x_1^2+2\,x_1a\,,\quad a\approx\frac{S-x_1^2}{2\,x_1}$$ As we previously denoted $\,\sqrt{S}=x_1+a\,$: $$\,\sqrt{S}=x_1+a\approx x_1+\frac{S-x_1^2}{2\,x_1}=\frac{2\,x_1^2+S-x_1}{2\,x_1}=\frac{x_1^2+S}{2\,x_1}\,$$ We use the same technique for each step ($a$ gets smaller and smaller), and at the step $\,n+1\,$ we get a more general expression for our formula:
$$\sqrt{S}\approx x_{n+1}=\frac{x_n^2+S}{2\,x_n}\quad or \quad \sqrt{S}\approx\frac{1}{2}\bigg(x_n+\frac{S}{x_n}\bigg)$$

Now let's derive such a formula for the cube root. $\,\sqrt[3]{S}=x_1+a\,$ where $\,x_1\,$ is the first approximate value by our own choice and $\,a\,$ is a tolerance (an error of approximation). By raising to the third power we obtain

$\,S=x_1^3+3\,x_1^2a+3\,x_1a^2+a^3.\,\,$ Again, we choose $\,x_1\,$ to be much greater than $\,a\,$ so that we can discard $\,a^2\,$ and $\,a^3\,$ for our approximation:

$$\,S\approx x_1^3+3\,x_1^2a\,,\quad a\approx\frac{S-x_1^3}{3\,x_1^2}$$ As we previously denoted $\,\sqrt[3]{S}=x_1+a\,$: $$\,\sqrt[3]{S}\approx x_2=x_1+a= x_1+\frac{S-x_1^3}{3\,x_1^2}=\frac{3\,x_1^3+S-x_1^3}{3\,x_1^2}=\frac{2\,x_1^3+S}{3\,x_1^2}\,$$ Similarly for $\,x_{n+1}\,$ we get $$\,\sqrt[3]{S}\approx x_{n+1}=x_n+\frac{S-x_n^3}{3\,x_n^2}=\frac{3\,x_n^3+S-x_n^3}{3\,x_n^2}=\frac{2\,x_n^3+S}{3\,x_n^2}\,$$ So, $$\,\sqrt[3]{S}\approx x_{n+1}=\frac{2\,x_n^3+S}{3\,x_n^2}\,$$ In the same way we can derive the formula for the $k$-th root of $S$: $$\,\sqrt[k]{S}\approx x_{n+1}=\frac{(k-1)\,x_n^k+S}{k\,x_n^{k-1}}\,$$

Unlike the general formula we have just derived, there's an even more general formula (Newton's binomial) for $(1+a)^x$ where $x$ is any fractional or negative number. For positive integer powers Newton's binomial is finite, otherwise it is an infinite series. Here is a link (please go back to the very top of this answer) illustrating a far more general case.

However, I want to express that it is important to be able to derive formulas and understand all underlying procedures and derivations rather than plugging in numbers and hoping they will fit by hook or by crook after some attempts.