# Solution for approximating square roots?

I just saw a post on instagram which said that

$$\sqrt{x}\approx \frac{x+y}{2\sqrt{y}}$$

I tried it out on a few values, and surprisingly, it came within 1 decimal point of the actual answer. Is there a reason for this or is it coincidental?

y is the closest perfect square to x

• What is $y$?.... – Shubham Johri Mar 2 at 14:16
• observe $x+y-2\sqrt{xy} = (\sqrt{x} - \sqrt{y})^2$ and thus the error is very small if y is close to x – Aditya Dwivedi Mar 2 at 14:17
• @ShubhamJohri y is the closest perfect square, probably should add that in – Brien Lim Mar 4 at 15:15

## 4 Answers

This is because, for $$x\approx y$$:

$$\sqrt{xy}\approx \frac{x+y}{2}$$

This is a consequence of the AM-GM Inequality, which states that:

$$\frac{x+y}{2}\geq\sqrt{xy}$$

For all $$x, y\geq 0$$, with equality occurring if and only if $$x=y$$.

• so does this means that it'll only work for relatively small values, and the bigger the number, the more inaccurate the answer will be? – Brien Lim Mar 4 at 15:19

Using Taylor series around $$y=x$$ (assuming them to be positive), we have $$\sqrt{x\,y}=x+\frac{y-x}{2}-\frac{(y-x)^2}{8 x}+\frac{(y-x)^3}{16 x^2}+O\left((y-x)^4\right)$$ and,sice it is an alternating series, you can build a lot of ineaqualities.

Google AM–GM inequality.

If we square any real number $$z$$, which can be expressed as a difference of two other real numbers $$x$$ and $$y$$, the result is always greater or equal $$0$$, this means $$\color{blue}{z^2 \geq 0}$$, assume $$z = x-y$$, it follows $$\color{blue}{z^2} = (x-y)^2 = x^2 \color{red}{-2xy} + y^2 = x^2 \color{red}{+ 2xy} + y^2 \color{red}{- 4xy} =(x+y)^2-4xy\color{blue}{\geq 0}$$

$$\Rightarrow (x+y)^2-4xy\geq 0 \Leftrightarrow(x+y)^2\geq 4xy \Rightarrow x+y \geq \sqrt{4xy} \Leftrightarrow \frac{x+y}{2\sqrt{y}} \geq \sqrt{x}$$

The result is:

$$\sqrt{x} \leq \frac{x+y}{2\sqrt{y}}$$

If $$x = y$$, then

$$\sqrt{x} =\frac{x+y}{2\sqrt{y}}$$

Example: $$\sqrt{4} =\frac{4+4}{2\sqrt{4}} = 2$$

Your approximation is for lower disadvantages, there's a better approximation for the Square root function, check here for it's derivation $$\sqrt{x} \approx \frac{ x+k^2+k}{2k+1}$$ Say $$k^2+k = y$$, $$k^2+k-y = 0$$ $$k = \frac{ -1 \pm \sqrt{1+4y} }{2}$$ $$\sqrt{x} = \approx \frac{x+y}{2k+1}$$ $$2k+1 = \sqrt{1+4y}$$ $$2k+1 = 2\sqrt{y+\frac{1}{4}}$$ $$2k+1 \approx 2\sqrt{y}$$ $$\sqrt{x} = \approx \frac{ x+y}{2\sqrt{y}}$$