Square Root Trick

86 Views Asked by At

$\sqrt{\mathbf{X}} \approx \frac{\mathbf{X}+\mathbf{Y}}{2 \sqrt{\mathbf{Y}}}$

And $|\sqrt{\mathbf{X}} -\frac{\mathbf{X}+\mathbf{Y}}{2 \sqrt{\mathbf{Y}}}| \le 10^{-1}$

$Y=$ The Nearest number have root

For example :

$\sqrt{23}=\frac{23+25}{2 \sqrt{25}}=4.8$ , $\sqrt{50}=\frac{50+49}{2 \sqrt{49}}=7.071$

Is this true above approximate?

2

There are 2 best solutions below

3
On

Yes: this is the Taylor approximation of the square root, in the following sense. I will only cover the case $Y \le X$; the other is completely symmetric.

Let $X= n^2+k$ with $k\le n$. Then $Y=n^2$ so that

$$ \frac{X+Y}{2\sqrt{Y}} = \frac{2 n^2+k}{2n} = n+ \frac{k}{2n}$$

On the other side, note that for small $x$ you have $\sqrt{1+x} \approx 1+\frac{x}{2}$, by the Taylor expansion around zero.

Now we have that

$$\sqrt{n^2+k}= n\sqrt{1+(k/n^2) }\approx n(1+ (k/2n^2)) = n+ \frac{k}{2n}$$

As above. About the error, we can use the Lagrange reminder and get that there exist a $0\le \xi \le k/n^2$ so that

$$ | X - \frac{X+Y}{2\sqrt{Y}} | = n \frac{| f''(\xi) |(k/n^2)^2 }{2! }$$

Where $f(x) =\sqrt{1+x}$. You can see that the second derivative is $ -(1/4) (1+x) ^{-3/2}$ , which is maximum in absolute value where $x=0$ and it is $1/4$. In this way you get that the above remainder is at most $$ \frac{k^2}{8n^3}\le \frac{1}{8n}$$

That is, it gets better and better as $X$ grows, surely $\le 1/10$ for $X\ge 4$.

0
On

With $Y=n^2$, $n^2-n<X\le n^2+n$, you can directly apply the binomial identities to get $$ \left|\sqrt{X}-\frac{n^2+X}{2n}\right|=\frac{(\sqrt{X}-n)^2}{2n}=\frac{(X-n^2)^2}{2n(\sqrt{X}+n)^2}\\ \le\frac{n^2}{2n(X+n^2+2n\sqrt{X})}\le\frac{n}{2((n^2-n)+n^2+2n(n-1))}=\frac1{2(4n-3)} $$ For $n\ge 2$ this is indeed smaller than $\frac1{10}$.

Note that this approximation is the first step of the Babylonian-Heron-Newton method for the square root $w_{k+1}=\frac12(w_k+\frac{X}{w_k})$ starting from $w_0=n$.