Computing as many digits as possible of $\sqrt{2}$ with a pen and a paper in 5 minutes

398 Views Asked by At

You have to compute as many digits as possible of $\sqrt{2}$ with a pen and a paper (an eraser if you're lucky...) in 5 minutes.

What will you do? What is your justification for doing it?

The question background is algorithm efficiency and ease to perform associated computations manually.

5

There are 5 best solutions below

1
On BEST ANSWER

I would go with the following approach: for first, estimate how many digit I am able to get from the integer division between two large integer numbers in about three minutes. I am not so fast, so I estimate to be able to divide two $16$-digits numbers. Then I recall that $3+2\sqrt{2}$ is a unit in $\mathbb{Z}[\sqrt{2}]$ and compute $(3+2\sqrt{2})^{2^{m}}$ through repeat squaring:

$$ (3,2)\to(17,12)\to(577,408)\to (665857,470832)\to (886731088897,627013566048) $$ by mapping $(a,b)$, that represents $a+b\sqrt{2}$, into $((a+b)(a+2b)-3ab,2ab)$. Numbers have grown big, so I stop before I get something I am not able to handle. I have computed a convergent of the continued fraction of $\sqrt{2}$, so I know in advance that: $$\left|\sqrt{2}-\frac{886731088897}{627013566048}\right|\leq\frac{1}{627013566048^2}.$$ Then I divide $886731088897$ by $627013566048$ and get: $$ \sqrt{2} = 1.414213562373095\ldots .$$

1
On

Given five minutes, I would spend 4 minutes calculating as many elements of the series

$$\sqrt{1+x} = 1+\frac12 x -\frac18 x^2 + \frac1{16} x^3 - \frac5{128}x^4 +\frac{7}{256}x^5 - \frac{21}{1024} x^6\dots$$

Then, after $4$ minutes, I would take the number $x$ I have and square it. If I got less than $2$, I would then increase the 10-th digit of $x$ and square the number again, to see if the first $10$ digits are correct. If they are, I would check if the 11th digit is correct and so on until I found just where the mistakes start to happen.

Why this second step? Well, If I don't perform it, I don't know for sure if any of the digits is correct. However, since I know that, for example, $$1.414^2<2<1.415^2$$

I can say that $1.414 < \sqrt 2 < 1.415$ meaning that at least the first two digits are correct.

4
On

I would do a few steps of Newton's method for finding the reciprocal of the square root of $a$ using $f(x)=\dfrac{1}{x^2}-a$, with $a=2$ of course, which has the advantage that the Newton iteration does not need a division: $$ x_{n+1} = \frac{x_{n}(3-ax_n^2)}{2} $$ Multiply the last result by $a$ to get $\sqrt a$.

Starting with $x_0=1$, six steps gives you 11 correct decimals. Of course, this depends on how many decimals you use in the intermediate steps...

Perhaps bisection would work better since the steps are much simpler, but it will require about 20 steps to get 6 or 7 decimals. Boring but doable.

1
On

The Scaffold Method for Square Root is described here and part of the example below is shown there. For pencil and paper, this would be my algorithm of choice. It is about as complicated as long division. This is the method that is often used for square root on an abacus. $$ \begin{array}{rl} &\,\,\,\ 1.\hphantom{0}4\,\hphantom{0}1\,\hphantom{0}4\,\hphantom{0}2\,\hphantom{0}1\,\hphantom{0}3\,\hphantom{0}5\,\hphantom{0}6\\ &\sqrt{2.00\,00\,00\,00\,00\,00\,00\,00}\\ 1\times1\to&\,\,\ \ \underline{1.}\\ &\,\,\ \ 1.00\\ \color{#C00000}{2}4\times4\to&\,\,\ \ \hphantom{1.}\underline{96}\\ &\,\,\ \ \hphantom{1.0}4\,00\\ \color{#C00000}{28}1\times1\to&\,\,\ \ \hphantom{1.0}\underline{2\,81}\\ &\,\,\ \ \hphantom{1.0}1\,19\,00\\ \color{#C00000}{282}4\times4\to&\,\,\ \ \hphantom{1.0}\underline{1\,12\,96}\\ &\,\,\ \ \hphantom{1.00\,0}6\,04\,00\\ \color{#C00000}{2828}2\times2\to&\,\,\ \ \hphantom{1.00\,0}\underline{5\,65\,64}\\ &\,\,\ \ \hphantom{1.00\,00\,}38\,36\,00\\ \color{#C00000}{28284}1\times1\to&\,\,\ \ \hphantom{1.00\,00\,}\underline{28\,28\,41}\\ &\,\,\ \ \hphantom{1.00\,00\,}10\,07\,59\,00\\ \color{#C00000}{282842}3\times3\to&\,\,\ \ \hphantom{1.00\,00\,0}\underline{8\,48\,52\,69}\\ &\,\,\ \ \hphantom{1.00\,00\,0}1\,59\,06\,31\,00\\ \color{#C00000}{2828426}5\times5\to&\,\,\ \ \hphantom{1.00\,00\,0}\underline{1\,41\,42\,13\,25}\\ &\,\,\ \ \hphantom{1.00\,00\,00}\,17\,64\,17\,75\,00\\ \color{#C00000}{28284270}6\times6\to&\,\,\ \ \hphantom{1.00\,00\,00}\,\underline{16\,97\,05\,62\,36}\\ &\,\,\ \ \hphantom{1.00\,00\,00\,00}\,67\,12\,12\,64\\ \end{array} $$ The red part is twice the square root computed so far. Then append the next digit and multiply the whole thing by the next digit. The whole idea behind this algorithm is that $$ \underbrace{(a+b)^2-a^2}_{\begin{array}{c}\text{amount that adding}\\\text{$b$ as the next digit}\\\text{increases the square}\end{array}}=\underbrace{(\color{#C00000}{2a}+b)b}_{\begin{array}{c}\text{amount to decrease}\\\text{the remainder}\end{array}} $$ where $a$ is ten times the square root computed so far (because we appended the next two digits of the square to the remainder) and $b$ is the next digit.

Note that $2-1.41421356^2=0.0000000067121264$, which is the current remainder.

0
On

Consider the binomial series

$$\begin{align*} (1-x)^{\frac12}&=1-\frac12x-\frac{\frac12\frac12}{2!}x^2-\frac{\frac12\frac12\frac32}{3!}x^3+\cdots\\ &=1-\frac x2\left(1+\frac12\frac x2\left(1+\frac33\frac x2\left(1+\frac54\frac x2(1+\cdots)\right)\right)\right) \end{align*}$$

Substituting $x=\frac1{50}$ now gives a series which gives roughly 2 decimal digits per term (initially at least), and is really fast to compute by hand:

$$\begin{array}{rl} 1-\frac7{10}\sqrt2=&0.0100000000000\\ +&\phantom{0.00}00500000000\\ +&\phantom{0.0000}005000000\\ +&\phantom{0.000000}0062500\\ +&\phantom{0.00000000}00875\\ +&\phantom{0.0000000000}013125\\ =&0.0100505063388(3) \end{array}$$

The error is easy to bound as a geometric progression with ratio $\frac1{50}$, ie. at most $\frac1{49}$ of the final added term.

Thus

$$\begin{array}{rl} 7\sqrt2&=9.899494936612(3)\\ \sqrt2&=1.414213562373(1) \end{array}$$

which is accurate to the last (12th) digit.

The fact that this method is so well-adapted to computation by hand is largely a coincidence, because $\frac75$ is a convergent in the continued fraction of $\sqrt2$, giving us $7^2\approx\frac{100}2$. I have yet to find a variation that gives, say, $\sqrt3$ to 12 digits with a comparable amount of work.