# Square root

In mathematics, the principal square root of a non-negative real number [itex]x\,\![itex] is denoted [itex]\sqrt x[itex] and represents the non-negative real number whose square (the result of multiplying the number by itself) is [itex]x\,\![itex].

For example, [itex]\sqrt 9 = 3[itex] since 32 = 3 × 3 = 9.

This example suggests how square roots can arise when solving quadratic equations such as [itex]x^2=9[itex] or, more generally, [itex]ax^2+bx+c=0.[itex]

There are two solutions to the square root of a non-zero number. For a positive real number, the two square roots are the principle square root and the negative square root. For negative real numbers, the concept of imaginary and complex numbers has been developed to provide a mathematical framework to deal with the results.

Square roots of positive integers are often irrational numbers, i.e., numbers not expressible as a quotient of two integers. For example, [itex]\sqrt 2[itex] cannot be written exactly as m/n, where n and m are integers. Nonetheless, it is exactly the length of the diagonal of a square with side length 1.

The discovery that [itex]\sqrt 2[itex] is irrational is attributed to Hippasus, a disciple of Pythagoras.

The square root symbol (√) was first used during the 16th century. It has been suggested that it originated as an altered form of lowercase r, representing the Latin radix (meaning "root").

 Contents

## Properties

• The principal square root function [itex]\sqrt{x}[itex] is a function which maps the non-negative real domain R+∪{0} into the non-negative real codomain R+∪{0}.
• The principal square root function [itex]\sqrt{x}[itex] always returns a single unique value.
• There are only two solutions to the equation [itex]x = \sqrt{x}[itex] The solution set is { 0,1 }.
• To obtain both roots of a positive number, take the value given by the principal square root function as the first root (root1) and obtain the second root (root2) by subtracting the first root from zero (ie root2 = 0 - root1).
• The following important properties of the square root functions are valid for all positive real numbers [itex]x[itex] and [itex]y[itex]:
[itex]\sqrt{xy} = \sqrt x \sqrt y \qquad \Rightarrow \qquad \sqrt{100\,y} \, = \, 10 \cdot \sqrt y [itex]
[itex]\sqrt{\frac{x}{y}} = \frac{\sqrt{x}}{\sqrt{y}} \qquad \Rightarrow \qquad \sqrt{\left ( \frac{x}{100}\right ) } = \frac{\sqrt{x}}{10} [itex]
[itex]\sqrt{x^2} = \left|x\right|[itex] for every real number [itex]x[itex] (see absolute value)
[itex]\sqrt x = x^{1/2} [itex]
• Suppose that [itex]x[itex] and [itex]a[itex] are reals, and that [itex]x^2 = a[itex], and we want to find [itex]x[itex]. A common mistake is to "take the square root" and deduce that [itex]x = \sqrt a[itex]. This is incorrect, because the principal square root of [itex]x^2[itex] is not [itex]x[itex], but the absolute value [itex]\left| x \right|[itex], one of our above rules. Thus, all we can conclude is that [itex]\left| x \right| = \sqrt a[itex], or equivalently [itex]x = \pm\sqrt a[itex].
[itex]\sqrt x - \sqrt y = \frac{x-y}{\sqrt x + \sqrt y}[itex]
It is valid for all non-negative numbers [itex]x[itex] and [itex]y[itex] which are not both zero.
• The function [itex]f(x) = \sqrt x[itex] has the following graph, made up of half a parabola lying on its side:

• The function is continuous for all non-negative [itex]x[itex], and differentiable for all positive [itex]x[itex] (it is not differentiable for [itex]x=0[itex] since the slope of the tangent there is ). Its derivative is given by
[itex]f'(x) = \frac{1}{2\sqrt x}[itex]
[itex]\sqrt{x+1}=1 +

\sum_{n=1}^\infty { (-1)^{n+1} (2n-2)! \over n! (n-1)! 2^{2n-1} }x^n[itex]

[itex] = 1 + \frac{1}{2}x - \frac{1}{8}x^2 + \frac{1}{16} x^3 - \frac{5}{128} x^4 + \dots[itex]
for [itex]\left| x \right| < 1[itex].

## Common errors involving equations with the principal square root function

1. Not recognising [itex]x^{1/2}[itex] as the principal square root of [itex]x[itex] in a squaring step followed by principal square root step.
[itex]-1 = -1^1 = -1^{2/2} = (-1^2)^{1/2} = 1^{1/2} = 1\,\![itex]

In details we have:
[itex]-1=-1^1\,\![itex]
[itex]-1^1=-1^{2/2}\,\![itex]
This is because [itex]-1^{2/2}=-1\,\![itex] and [itex]\sqrt{-1^2}=\sqrt{1}[itex] so
[itex]-1\ne\sqrt{1}[itex]
The error comes in taking the principal square root of a square of −1.

2. Not taking into account false root(s) when squaring equations with the principal square root function

[itex]x - 1 = \sqrt{x}\,\![itex]
[itex]x^2 - 2x + 1 = x\,\![itex] squaring both sides which introduces the false root x=0.38197
[itex]x^2 - 3x + 1 = 0\,\![itex] move x from the right hand side to the left hand side
Using the quadratic equation formula, we get the solutions
[itex]x=2.618[itex] or [itex]x=0.38197[itex]

But when we substitute back [itex]x=0.38197[itex]
[itex]0.38197 - 1 = \sqrt{0.38197}[itex]
[itex]-0.61803 = 0.61803[itex] Error!

## Computing square roots

### Calculators

Pocket calculators typically implement good routines to compute the exponential function and the natural logarithm, and then compute the square root of [itex]x[itex] using the identity

[itex]\sqrt{x} = e^{\frac{1}{2}\ln x}[itex]

The same identity is exploited when computing square roots with logarithm tables or slide rules.

### Babylonian method

A commonly used algorithm for approximating [itex]\sqrt r[itex] is known as the "Babylonian method" and is based on Newton's method. It proceeds as follows:

1. start with an arbitrary positive start value [itex]x[itex] (the closer to the root the better)
2. replace [itex]x[itex] by the average of [itex]x[itex] and r/x
3. go to 2

This is a quadratically convergent algorithm, which means that the number of correct digits of [itex]r[itex] roughly doubles with each step.

This could be represented as

[itex]x_{n+1} = 0.5 (x_n + \frac{r}{x_n})[itex]

where [itex]\lim_{n \to \infty} x_n = \sqrt r.[itex]

This algorithm works equally well in the p-adic numbers, but cannot be used to identify real square roots with p-adic square roots; it is easy, for example, to construct a sequence of rational numbers by this method which converges to [itex]+3[itex] in the reals, but to [itex]-3[itex] in the 2-adics.

### Simple approximation

The simple approximation is rather simple and can be highly inaccurate. The amount of inaccuracy for this approximation is dependent on the value of the expression d/2N , the larger the value of this expression, the more inaccurate the value of the approximated result.

#### Construction

If N > 0 and d > 0 then

[itex] N^2 \quad < \quad N^2 + d \quad < \quad N^2 + 2\left( N \right) \left( \frac{d}{N} \right) + \left( \frac{d}{N} \right)^2[itex]

So the solution for [itex]\sqrt{N^2 + d}[itex] must be between [itex](N)[itex] and [itex]( N + \frac{d}{N})[itex]

[itex]\sqrt{N^2 + d} \, \approx \, average ( N , N + \frac{d}{N} ) [itex]
[itex]\sqrt{N^2 + d} \, \approx \, \frac{1}{2} \left( N + N + \frac{d}{N} \right) [itex]

Thus

[itex]\sqrt{N^2 + d} \, \approx \, N + \frac{d}{2\,N} [itex]

### Bakhshali approximation

The Bakhshali square root approximation is a mathematical method for finding an approximation to a square root which was described in an ancient manuscript by the name of "The Bakhshali Manuscript" because it was discovered in 1881 near the village of Bakhshali (or Bakhshalai) in the Yusufzai subdivision of the Peshawar district (now part of Pakistan). The manuscript was made out of the leaves of birch bark tree and was written in Sarada script.

The Bakhshali square root approximation is just the simple approximation applied twice.

Let [itex]P \,=\, \frac{d}{2 N}[itex]

Let [itex]A = N + P[itex]

[itex]\sqrt{N^2 + d} \approx A - \frac{P^2}{2 A} [itex]

When expanded, the equation becomes

[itex]\sqrt{N^2 + d} \approx N + \frac{d}{2\,N} - \frac{d^2}{8\,N^3 + 4\,N\,d}[itex]

#### Bakhshali approximation example

Find [itex]\sqrt{9.2345}[itex]

Using [itex]N=3 \qquad and \qquad d = 9.2345 - 3^2 = 0.2345 [itex]
[itex]\sqrt{3^2 + d} \approx 3 + \frac{d}{6} - \frac{d^2}{216 + 12\,d}[itex]
[itex]\sqrt{3^2 + 0.2345} \approx 3 + \frac{0.2345}{6} - \frac{0.2345^2}{216 + 12 \cdot 0.2345}[itex]
[itex]\sqrt{3^2 + 0.2345} \approx 3 + 0.039083 - \frac{0.055}{216 + 2.814}[itex]
[itex]\sqrt{3^2 + 0.2345} \approx 3 + 0.039083 - 0.000251[itex]
[itex]\sqrt{3^2 + 0.2345} \approx 3.038832[itex]

### An exact "long-division like" algorithm

This method, while much slower than the Babylonian method, has the advantage that it is exact: if the given number has a square root whose decimal representation terminates, then the algorithm terminates and produces the correct square root after finitely many steps. It can thus be used to check whether a given integer is a square number.

Write the number in decimal and divide it into pairs of digits starting from the decimal point. The numbers are laid out similar to the long division algorithm and the final square root will appear above the original number.

For each iteration:

1. Bring down the most significant pair of digits not yet used and append them to any remainder. This is the current value referred to in steps 2 and 3.
2. If [itex]s[itex] denotes the part of the result found so far, determine the greatest digit [itex]x[itex] that does not make [itex]y = x(20s + x)[itex] exceed the current value. Place the new digit [itex]x[itex] on the quotient line.
3. Subtract [itex]y[itex] from the current value to form a new remainder.
4. If the remainder is zero and there are no more digits to bring down the algorithm has terminated. Otherwise continue with step 1.

Example: What is the square root of 152.2756?

           1  2. 3  4
|  01 52.27 56                              1    The digit 1 is a solution digit
x         01                   1(20*0+1)=1        +1
00 52                                    22   The digit 2 is a solution digit
2x        00 44                2(20*1+2)=44       + 2
08 27                                 243  The digit 3 is a solution digit
24x          07 29             3(20*12+3)=729     +  3
98 56                              2464 The digit 4 is a solution digit
246x            98 56          4(20*123+4)=9856       4
00 00          Algorithm terminates: answer is 12.34


Although demonstrated here for base 10 numbers, the procedure works for any base, including base 2. In the description above, 20 means double the number base used, in the case of binary this would really be 100. The algorithm is in fact much easier to perform in base 2, as in every step only the two digits 0 and 1 have to be tested. See Shifting nth-root algorithm.

### Rough estimation

Many of the methods used for finding the square root of a number requires an initial seed value which should ideally be close to the actual value of the square root. One way of obtaining a very rough estimate of the value of the square root is as follows.

Provided that r » 1

Steps

1. Take the integer part of the number r. Z = int(r)
2. Count the number of digits in Z. Let D be the number of digits.
3. Calculate the value of 3D.
4. The rough estimate is half the value obtained in step 3. E = (3D) / 2

Example

 r Z D 3 ^ D Estimate (E) Actual Value of √r 723.47 723 3 27 13.5 26.89 5396.37 5396 4 81 40.5 73.45 24956.41 24956 5 243 121.5 157.96 789345.464 789345 6 729 364.5 888.45

### More accurate rough estimation

Similar to the rough estimation procedure above. This version is slightly more accurate because it also uses the additional information provided by the first digit of the number r. The steps are almost the same as the one for previous rough estimate. This estimate can be taken one extra step further by applying the Bakhshali square root approximation.

Provided that r » 1

Steps

1. Take the integer part of the number r. Z = int(r)
2. Count the number of digits in Z. Let D be the number of digits.
3. Calculate the value of 3.16D. Note: 3.16 ≈ √10
4. The estimate is the value obtain in step 3 multiple by an adjustment factor based on the first (left most) digit of the number n. E = ADJ * 3.16D
5. Applying the Bakhshali square root approximation to the estimate E.
[itex]c = r - E^2[itex]
[itex]P = \frac{c}{2 E}[itex]
[itex]A = E + P[itex]
[itex]B = A - \frac{P^2}{2 A}[itex]

Table of ADJ

 First Digit 1 2 3 4 5 6 7 8 9 ADJ 0.32 0.45 0.55 0.63 0.71 0.78 0.84 0.9 0.95

Example

 r Z D 3.16 ^ D ADJ Estimate (E) Bakhshali (B) Actual Value of √r 723.47 723 3 31.55 0.84 26.50 26.89 26.89 5396.37 5396 4 99.71 0.71 70.79 73.46 73.45 24956.41 24956 5 315.09 0.45 141.79 157.98 157.96 789345.464 789345 6 995.7 0.84 836.37 888.45 888.45

### Inverse square root approximation

There is an algorithmn for finding the inverse square root [itex]\left( \frac{1}{\sqrt{r}}\right )[itex] very quickly.

Because [itex]\sqrt{r} = r \times \left ( \frac{1}{\sqrt{r}} \right )[itex], if we know the value of the inverse square root, we can easily get the value for the square root.

#### Steps for Inverse square root approximation

Step 1 Start the initial value [itex]X_0[itex] an approximate value of the inverse square root which is accurate to 2 significant digits.

[itex]X_0 = \left( \frac{1}{\sqrt{r}} \right )_\mbox{approx}[itex]

Step 2 Calculate the next iteration with the following algorithmn.

[itex]X_{n+1} = X_n \, \left( \frac{15}{8} - Y \, \left ( \frac{5}{4} - \frac{3}{8} \, Y \right ) \right )[itex] where [itex]Y = r \, X_n^2 [itex]

Step 3 Finally obtain the value of [itex]\sqrt{r}[itex] with

[itex]\sqrt{r} = r \, X_{\infty}[itex]

Because [itex]X_{\infty}[itex] is the inverse square root of r.

#### Properties

• The greatest weakness of this algorithmn is that it is not stable. The initial value [itex]X_0[itex] must be near the actual value for the algorithmn to converge correctly. If the initial value isn't closer enough, the algorithmn will diverge away from the actual value.
• However when the algorithmn converges, it converges very very quickly. You can get an result with 20 digits of accuracy with just 6 iterations.

### Square roots using Newton iteration

Basic Newton iteration finds a single root of a function [itex]f(x)[itex] given a sufficiently precise approximation to the root. The nature of which root will be given based on an approximation is dependent on the Newton fractal which we will not discuss here any further. The basic iteration is given by:

[itex]x_{n+1} = x_n - {f(x_n) \over f^\prime(x_n)}[itex].

There are two widely used functions [itex]f(x)[itex] and [itex]g(x)[itex] used to find the square root of a number denoted by "z".

#### First method

The first method finds the square root of "z"

[itex]f(x) = x^2 - z \,[itex]

Note that both [itex]\sqrt{z}[itex] and [itex]- \sqrt{z}[itex] are roots of the function [itex]f(x)[itex]. ie [itex]f( \sqrt{z} ) = 0[itex].

The first derivative of [itex]f(x)[itex] is [itex]f^\prime(x) = 2 x[itex]

Thus iteration for [itex]x_{n+1}[itex] is derived where:

[itex]x_0 = 1 \,\,\,[itex]        and

 [itex]x_{n+1}\,\![itex] [itex]= x_n - {f(x_n) \over f^\prime(x_n)}[itex] [itex]= x_n - {(x_n^2 - z) \over 2 x_n}[itex] [itex]= x_n - \frac {x_n}{2} + \frac {z}{2 \,\,\, x_n} [itex] [itex]= \frac {x_n}{2} + \frac {z}{2 \,\,\, x_n}[itex].

#### Second method

The second method finds the reciprocal of the square root of "z".

[itex]g(x) = \frac{1}{x^{2}} - z[itex].

The two roots to [itex]g(x)[itex] are [itex]\frac{1}{\sqrt{z}}[itex] and [itex]\frac{-1}{\sqrt{z}}[itex].

The derivative of [itex]g(x)[itex] is [itex]g^\prime(x) = -2 x^{-3}[itex].

Thus iteration for [itex]x_{n+1}[itex] is derived where:

[itex]x_0 = 0.5[itex]        and

 [itex]x_{n+1} \,\! [itex] [itex]= x_n - {g(x_n) \over g^\prime(x_n)}[itex] [itex]= x_n - {x_n^{-2} - z \over -2 x_n^{-3}}[itex] [itex]= x_n - (-1/2) {x_n^3} (x^{-2} - z)[itex] [itex]= x_n + (1/2) (x_n - z x_n^3)[itex] [itex]= \frac{ 3 x_n - z x_n^3 }{2}[itex] [itex]= 1.5 \, x_n - 0.5 \, z x_n^3 = 0.5 \, x_n \,\, ( 3 - z x_n^2 )[itex].

#### Example

Find the [itex]\sqrt{7}[itex] using both methods.

[itex]z = 7 \,[itex] Because we are looking for the square root of 7
[itex]f(x)\,[itex] [itex]g(x)\,[itex]
[itex]x_0\,[itex] [itex]1\,[itex] [itex]x_0\,[itex] [itex]0.5\,[itex]
[itex]x_1\,[itex] [itex]\frac{1}{2} + \frac{7}{2 \times 1} = 4 [itex] [itex]x_1\,[itex] [itex]0.5 \times 0.5 \,\, ( 3 - 7 (0.5)^2 ) = 0.312 [itex] [itex]\frac{1}{x_1}= 3.2\,[itex]
[itex]x_2\,[itex] [itex]\frac{4}{2} + \frac{7}{2 \times 4} = 2.875 [itex] [itex]x_2\,[itex] [itex]0.5 \times 0.312 \,\, ( 3 - 7 (0.312)^2 ) = 0.362 [itex] [itex]\frac{1}{x_2}= 2.762\,[itex]
[itex]x_3\,[itex] [itex]\frac{2.875}{2} + \frac{7}{2 \times 2.875} = 2.654 [itex] [itex]x_3\,[itex] [itex]0.5 \times 0.362 \,\, ( 3 - 7 (0.362)^2 ) = 0.376 [itex] [itex]\frac{1}{x_3}= 2.652\,[itex]
[itex]x_4\,[itex] [itex]\frac{2.654}{2} + \frac{7}{2 \times 2.654} = 2.645 [itex] [itex]x_4\,[itex] [itex]0.5 \times 0.376 \,\, ( 3 - 7 (0.376)^2 ) = 0.378 [itex] [itex]\frac{1}{x_4}= 2.645\,[itex]
[itex]\sqrt{7} \approx 2.645[itex] [itex]\sqrt{7} \approx 2.645[itex]

#### Comparison

The iteration for [itex]f(x)[itex] involves a division which is more time consuming than a multiplication in computer integer arithmetic. The iteration for [itex]g(x)[itex] involves no division and is thus recommended for large integers z.

This iteration using "g" involves only a squaring and two multiplications, as opposed to a division in the case of f. In practical implementations of large integer square roots, the iteration involving g is faster for large integers z since division is at best [itex]O(M(n))[itex], a constant times the time function of multiplication. The constant term is almost always 3 or more, meaning that a single division can almost never be faster than 3 multiplications.

### Pell's equation

Pell's equation yields a method for finding rational approximations of square roots of integers.

### Finding square roots using mental arithmetic

Based on Pell's equation there is a method to calculate square roots simply by subtracting odd numbers.

27 - 1 = 26
26 - 3 = 23
23 - 5 = 18
18 - 7 = 11
11 - 9 = 2


Five steps have been taken and thus the integer part of the square root of 27 is 5. We do not proceed any further because the sixth subtraction would give a negative answer.

Now take the rest (2) and multiply it by 100 to get the starting number for the next step. Take the answer we have already got (5) and multiply it by 20, then add 1 to get the first odd number we subtract by. This gives us 2 × 100 = 200 as the starting number and 5 × 20 + 1 = 101 as the first odd number. Subtract the successive odd numbers, 103, 105, etc. until we get to a step where the next subtraction would result in a negative number. So,

200 - 101 = 99


and 99 is less than 103 so this is the place to stop and since we only took one step we get that the next digit is 1.

For the next step the starting number will be 99 × 100 = 9900 and the answer we have already got is 51 so the first odd number will be 51 × 20 + 1 = 1021

9900 - 1021 = 8879
8879 - 1023 = 7856
7856 - 1025 = 6831
6831 - 1027 = 5804
5804 - 1029 = 4775
4775 - 1031 = 3744
3744 - 1033 = 2711
2711 - 1035 = 1676
1676 - 1037 = 639


We took nine steps so the next digit is 9.

Continuing with this procedure, the next starting number will be 639 × 100 = 63900 and the first odd number will be 519 × 20 + 1 = 10381

63900 - 10381 = 53519
53519 - 10383 = 43136
43136 - 10385 = 32751
32751 - 10387 = 22364
22364 - 10389 = 11975
11975 - 10391 = 1584


We took six steps so the next digit is 6.

The result gives us 5.196 as an approximation of the square root of 27.

### Finding square roots using basic arithmetic

If you have access to a calculator capable of addition, subtraction, multiplication and division then the following method can be used to find the square root of a number.

Find [itex]\sqrt{r}[itex]

The starting values are

[itex]D_0 = 9[itex]
[itex]A_0 = A_{base} + D_0 \, (D_0 - 1)[itex]
[itex]B_0 = B_{base} + 2 \, (D_0 - 1) [itex]

Now find new values for each variable

[itex]A_n = A_{base} + D_n \, ( D_n - 1 ) [itex]
[itex]B_n = B_{base} + 2 \, ( D_n - 1 ) [itex]
[itex]D_{n+1} = floor ( A_n \div B_n ) [itex]

We found a digit when the value of    [itex]D_n[itex]    is equal to the value of    [itex]floor ( A_n \div B_n )[itex]

After a new digit has been found.

New [itex]A_{base} = 100 \, ( A_n - B_n \times D_n ) [itex]
New [itex]B_{base} = SOLN \times 20 + 1 [itex]

The step are shown in the table below

Find [itex]\sqrt{27}[itex]
[itex]A_{base} = Z = 27 [itex] and [itex]B_{base} = 0 \times 20 + 1 = 1 [itex]
[itex]n[itex] [itex]D_n[itex] [itex]A_n[itex] [itex]B_n[itex] [itex]floor ( A_n \div B_n )[itex] Remarks SOLN
n=0 [itex]9[itex] [itex]27 + 9 \times 8 = 99[itex] [itex]1 + 2 \times 8 = 17[itex] [itex]5[itex]
n=1 [itex]5[itex] [itex]27 + 5 \times 4 = 47[itex] [itex]1 + 2 \times 4 = 9[itex] [itex]5[itex] STOP [itex]5[itex]
[itex]A_{base} = 100 \, (47 - 9 \times 5 ) = 200 [itex] and [itex]B_{base} = 5 \times 20 + 1 = 101 [itex]
n=0 [itex]9[itex] [itex]200 + 9 \times 8 = 272[itex] [itex]101 + 2 \times 8 = 117[itex] [itex]2[itex]
n=1 [itex]2[itex] [itex]200 + 2 \times 1 = 202[itex] [itex]101 + 2 \times 1 = 103[itex] [itex]1[itex]
n=2 [itex]1[itex] [itex]200 + 1 \times 0 = 200[itex] [itex]101 + 2 \times 0 = 101[itex] [itex]1[itex] STOP [itex]51[itex]
[itex]A_{base} = 100 \, (200 - 101 \times 1 ) = 9900 [itex] and [itex]B_{base} = 51 \times 20 + 1 = 1021 [itex]
n=0 [itex]9[itex] [itex]9900 + 9 \times 8 = 9972[itex] [itex]1021 + 2 \times 8 = 1037[itex] [itex]9[itex] STOP [itex]519[itex]
[itex]A_{base} = 100 \, (9972 - 1037 \times 9 ) = 63900 [itex] and [itex]B_{base} = 519 \times 20 + 1 = 10381 [itex]
n=0 [itex]9[itex] [itex]63900 + 9 \times 8 = 63972[itex] [itex]10381 + 2 \times 8 = 10397[itex] [itex]6[itex]
n=1 [itex]6[itex] [itex]63900 + 6 \times 5 = 63930[itex] [itex]10381 + 2 \times 5 = 10391[itex] [itex]6[itex] STOP [itex]5196[itex]
[itex]A_{base} = 100 \, (63930 - 10391 \times 6 ) = 158400 [itex] and [itex]B_{base} = 5196 \times 20 + 1 = 103921 [itex]
n=0 [itex]9[itex] [itex]158400 + 9 \times 8 = 158472[itex] [itex]103921 + 2 \times 8 = 103937[itex] [itex]1[itex]
n=1 [itex]1[itex] [itex]158400 + 1 \times 0 = 158400[itex] [itex]103921 + 2 \times 0 = 103921[itex] [itex]1[itex] STOP [itex]51961[itex]
[itex]\sqrt{27} \approx 5.1961 [itex]

### Continued fraction methods

Quadratic irrationals, that is numbers involving square roots in the form (a + √b)/c, have periodic continued fractions. This makes them easy to calculate recursively given the period. For example, to calculate √2, we make use of the fact that √2 − 1 = [0; 2, 2, 2, 2, 2, ...], and use the recurrence relation

an + 1 = 1/(2 + an) with a0 = 0

to obtain √2 − 1 to some specific precision specified through n levels of recurrence, and add 1 to the result to obtain √2.

#### Steps for finding continued fractions

Find [itex]\sqrt{r}[itex] using continued fractions

[itex]\sqrt{r} = N_0 + \frac{1}{N_1 + \frac{1}{N_2 + \frac{1}{N_3+\,\cdots}}} [itex]

thus

[itex]\sqrt{r} = N_0 + \frac{1}{X_0}[itex]
[itex]X_0 = N_1 + \frac{1}{X_1}[itex]
[itex]X_1 = N_2 + \frac{1}{X_2}[itex]
[itex]X_2 = N_3 + \frac{1}{X_3}[itex]

Step 0. We shall assume that r is not a perfect square. In other words:

[itex]\sqrt{r} = \sqrt{N_0^2 + d} \qquad \mbox{ and } \quad N_0 \in \mathbb{Z^+} \quad \mbox{ and } 0 < d < 1 [itex]

Step 1. Find [itex]N_0[itex] using some other method. The best method is [itex]N_0 = intsqrt(r)[itex] using some other algorithmn to determine the integer square root.

[itex]N_0 = intsqrt(r)[itex]

Step 2. Find the highest lower bound (L) and lowest upper bound (U) for [itex]\sqrt{r}[itex] where both (L) and (U) are integers.

Hence

Step 3. Write [itex]X_0[itex] in terms of [itex]\sqrt{r}[itex].

[itex]X_0 = \frac{1}{\sqrt{r}-N_0} \times \frac{\sqrt{r}+N_0}{\sqrt{r}+N_0} = \frac{\sqrt{r}+N_0}{r-N_0^2} = \frac{\sqrt{r}+N_0}{d} = \frac{\sqrt{r}+M_0}{D_0} [itex]

[itex]\mbox { where } \quad M_0 = N_0 [itex]

and

[itex]\mbox { where } \quad D_0 = d [itex]

[itex]X_0 = \frac {\sqrt{r} + M_0 } {D_0}[itex]
[itex]\downarrow[itex]
[itex]\downarrow[itex]
[itex]X_{0 LowerBound} = \frac{\sqrt{r}+M_0}{D_0} = \frac{L+M_0}{D_0} = \frac{ N_0 + M_0 }{D_0} \qquad \mbox{ Calc the numeric value }[itex]

and

[itex]X_{0 UpperBound} = \frac{\sqrt{r}+M_0}{D_0} = \frac{U+M_0}{D_0} = \frac{ (N_0 + 1) + M_0 }{D_0} \qquad \mbox{ Calc the numeric value }[itex]

Step 4. Substitute [itex]X_0[itex] with [itex]N_1 + \frac{1}{X_1}[itex]

after substitution

Since [itex]\frac{1}{X_1}[itex] is less than one, we can determine [itex]N_1[itex] from the numeric values of [itex]X_{0 LowerBound}[itex] and [itex]X_{0 UpperBound}[itex] because [itex]N_1 \ \in \ \mathbb{Z^+}[itex] (ie. [itex]N_1[itex] is an integer). Determine the numeric value of [itex]N_1[itex].

Step 5. Once we know the value of [itex]N_1[itex], we can rework the equation for [itex]X_1[itex]

[itex]X_0 = N_1 + \frac{1}{X_1} \quad \longrightarrow \quad X_1 = \frac{1}{X_0 - N_1}[itex]

[itex]X_1 = \frac{1}{ \frac { \sqrt{r} + M_0 } { D_0 } - N_1 } = \frac{1}{ \frac { \sqrt{r} + M_0 - D_0 \, N_1 } { D_0 } } = \frac { D_0 } { \sqrt{r} + M_0 - D_0 \, N_1 } [itex]
[itex]X_1 = \frac { D_0 } { \sqrt{r} + ( M_0 - D_0 \, N_1 ) } \times \frac { \sqrt{r} - ( M_0 - D_0 \, N_1 ) } { \sqrt{r} - ( M_0 - D_0 \, N_1 ) } = \frac { D_0 ( \sqrt{r} - ( M_0 - D_0 \, N_1 ) ) } { r - ( M_0 - D_0 \, N_1 )^2 }[itex]
[itex]X_1 = \frac { \sqrt{r} - ( M_0 - D_0 \, N_1 ) } { \frac { r - ( M_0 - D_0 \, N_1 )^2 } { D_0 } } = \frac { \sqrt{r} + M_1 } { D_1 } [itex]

[itex]\mbox { where } \quad M_1 = - ( M_0 - D_0 \, N_1 ) [itex]

and

[itex]\mbox { where } \quad D_1 = \frac { r - ( M_0 - D_0 \, N_1 )^2 } { D_0 } [itex]

Step 6. Write [itex]X_1[itex] in terms of [itex]\sqrt{r}[itex].

[itex]X_1 = \frac {\sqrt{r} + M_1 } {D_1}[itex]
[itex]\downarrow[itex]
[itex]\downarrow[itex]
[itex]X_{1 LowerBound} = \frac{\sqrt{r}+M_1}{D_1} = \frac{L + M_1}{D_1} = \frac{ N_0 + M_1 }{D_1} \qquad \mbox{ Calc the numeric value }[itex]

and

[itex]X_{1 UpperBound} = \frac{\sqrt{r}+M_1}{D_1} = \frac{U + M_1}{D_1} = \frac{ (N_0 + 1) + M_1 }{D_1} \qquad \mbox{ Calc the numeric value }[itex]

Step 7. Substitute [itex]X_1[itex] with [itex]N_2 + \frac{1}{X_2}[itex]

after substitution

Since [itex]\frac{1}{X_2}[itex] is less than one, we can determine [itex]N_2[itex] from the numeric values of [itex]X_{1 LowerBound}[itex] and [itex]X_{1 UpperBound}[itex] because [itex]N_2 \ \in \ \mathbb{Z^+}[itex] (ie. [itex]N_2[itex] is an integer). Determine the numeric value of [itex]N_2[itex].

Step 8. Once we know the value of [itex]N_2[itex], we can rework the equation for [itex]X_2[itex]

[itex]X_1 = N_2 + \frac{1}{X_2} \quad \longrightarrow \quad X_2 = \frac{1}{X_1 - N_2}[itex]
[itex]X_2 = \frac{1}{ \frac { \sqrt{r} + M_1 } { D_1 } - N_2 } = \frac{1}{ \frac { \sqrt{r} + M_1 - D_1 \, N_2 } { D_1 } } = \frac { D_1 } { \sqrt{r} + M_1 - D_1 \, N_2 } [itex]
[itex]X_2 = \frac { D_1 } { \sqrt{r} + ( M_1 - D_1 \, N_2 ) } \times \frac { \sqrt{r} - ( M_1 - D_1 \, N_2 ) } { \sqrt{r} - ( M_1 - D_1 \, N_2 ) } = \frac { D_1 ( \sqrt{r} - ( M_1 - D_1 \, N_2 ) ) } { r - ( M_1 - D_1 \, N_2 )^2 }[itex]
[itex]X_2 = \frac { \sqrt{r} - ( M_1 - D_1 \, N_2 ) } { \frac { r - ( M_1 - D_1 \, N_2 )^2 } { D_1 } } = \frac { \sqrt{r} + M_2 } { D_2 } [itex]

[itex]\mbox { where } \quad M_2 = - ( M_1 - D_1 \, N_2 ) [itex]

and

[itex]\mbox { where } \quad D_2 = \frac { r - ( M_1 - D_1 \, N_2 )^2 } { D_1 } [itex]

Step 9. Repeat step 6 , 7 and 8 .

The solution to a properly setup quadratic equation can be used to find [itex]\sqrt{r}[itex] where 1 < r < 100

 For square root of values greater than 100, use the following identity: [itex]\sqrt{105.3} = \sqrt{1.053} \times 10 [itex] For square root of values less than 1, use the following indentity: [itex]\sqrt{0.1053} = \sqrt{10.53} \,\div\, 10 [itex]

Using the equation [itex]\sqrt{r} \,=\, N + \frac{1}{X}[itex]      where [itex]X > 1[itex] and [itex]N \in \{1,2,3,4,5,6,7,8,9\}[itex]

[itex]\sqrt{r} \,=\, N + \frac{1}{X}[itex]
[itex]r \,=\, { \left( N + \frac{1}{X} \right ) }^2[itex]
[itex]r \,=\, N^2 + \frac{2\,N}{X} + \frac{1}{X^2}[itex]
[itex]0 \,=\, \left( N^2 - r \right) + \frac{2\,N}{X} + \frac{1}{X^2}[itex]
[itex]\left( N^2 - r \right) + \frac{2\,N}{X} + \frac{1}{X^2} \,=\, 0[itex]
[itex]\left( N^2 - r \right) \, X^2 + \left( 2\,N \right) X + 1 \,=\, 0[itex]

Solve for [itex]X[itex] using quadratic equation formula, choose the solution that satisfy the restriction [itex] X > 1 [itex].

Final solution is :

[itex]\sqrt{r} \,=\, N + \frac{1}{X}[itex]

The obvious problem is that we cannot evaluate the solutions to the quadratic equation without the usage of the square root function. However we can make the snake bite its own tail.

[itex]\left( N^2 - r \right) \, X^2 + \left( 2\,N \right) X + 1 \,=\, 0[itex]
Let [itex]r \, = \, N^2 + d [itex]
Thus [itex] d \, = \, r - N^2 [itex]
And [itex] - d \, = \, N^2 - r [itex]

So the quadratic equation becomes :

[itex]\left( - d \right) \, X^2 + \left( 2\,N \right) X + 1 \,=\, 0[itex]

Solving for X as far as possible brings

[itex] X \, = \, \frac{N + \sqrt{N^2 + d}}{d}[itex]

Reciprocal

[itex] \frac{1}{X} \, = \, \frac{d}{N + \sqrt{N^2 + d}}[itex]

So the final solution becomes

[itex]\sqrt{r} \,=\, N + \frac{1}{X}[itex]
[itex]\sqrt{r} \,=\, N + \frac{d}{N + \sqrt{N^2 + d}} [itex]
[itex]\sqrt{r} \,=\, N + \frac{d}{N + \sqrt{r}} [itex]

Lets go deeper by substituting √r on the right hand side with its own definition.

[itex]\sqrt{r} \,=\, N + \frac{d}{N + \left( N + \frac{d}{N + \sqrt{r}} \right) } [itex]

Renormalise

[itex]\sqrt{r} \,=\, N + \frac{d}{2 N + \frac{d}{N + \sqrt{r}} } [itex]

Deeper still

[itex]\sqrt{r} \,=\, N + \frac{d}{2 N + \frac{d}{2 N + \frac{d}{N + \sqrt{r}} } } [itex]

And so on and so forth

[itex]\sqrt{r} \,=\, N + \frac{d}{2 N + \frac{d}{2 N + \frac{d}{2 N + \frac{d}{N + \sqrt{r}} } } } [itex]

#### Example using the quadratic equation method

Find [itex]\sqrt{923.45}[itex]

Using identity [itex]\sqrt{923.45} \,=\, \sqrt{9.2345} \times 10 [itex]
First find [itex]\sqrt{9.2345}[itex].
[itex]\sqrt{r} \,=\, N + \frac{1}{X}[itex]
[itex]\sqrt{9.2345} \,=\, N + \frac{1}{X}[itex]

Hence [itex] N \,=\, 3 \,\! [itex] because [itex] \!\; 3^2 \; < \; 9.2345 \; < \; 4^2 [itex]

[itex]\left( N^2 - r \right) \, X^2 + \left( 2\,N \right) X + 1 \,=\, 0[itex]
[itex]\left( 3^2 - 9.2345 \right) \, X^2 + \left( 2 \, \cdot \, 3 \right) X + 1 \,=\, 0[itex]
[itex]-0.2345 \, X^2 + 6 \, X + 1 \,=\, 0[itex]

Using the quadratic equation formula, we get the two solutions. soln1 = - 0.165 or soln2 = 25.7519

Choose soln2 as it satisfy the restriction [itex] X > 1 [itex].

Hence [itex]X = 25.7519[itex]
[itex]\sqrt{9.2345} \,=\, 3 + \frac{1}{25.7519} \,=\, 3.03883[itex]

Alternatively

[itex]\sqrt{r} \,=\, N + \frac{d}{2 N + \frac{d}{2 N + \frac{d}{N + \sqrt{r}} } } [itex]
[itex]\sqrt{9.2345} \,=\, 3 + \frac{0.2345}{6 + \frac{0.2345}{6 + \frac{0.2345}{3 + \sqrt{9.2345}} } } [itex]
[itex]\sqrt{9.2345} \,\approx\, 3 + \frac{0.2345}{6 + \frac{0.2345}{6 + \frac{0.2345}{3 + 3} } } [itex]
[itex]\sqrt{9.2345} \,\approx\, 3.03883 [itex]

And the final solution is

[itex]\sqrt{923.45} \,=\, \sqrt{9.2345} \times 10 \,=\, 30.3883[itex]

## Square roots of complex numbers

To every non-zero complex number z there exist precisely two numbers w such that w2 = z. The usual definition of √z is as follows: if z = r exp(iφ) is represented in polar coordinates with -π < φ ≤ π, then we set √z = √r exp(iφ/2). Thus defined, the square root function is holomorphic everywhere except on the non-positive real numbers (where it isn't even continuous). The above Taylor series for √(1+x) remains valid for complex numbers x with |x| < 1.

When the number is in rectangular form the following formula can be used:

[itex]\sqrt{x+iy} = \sqrt{\frac{\left|x+iy\right| + x}{2}} \pm i \sqrt{\frac{\left|x+iy\right| - x}{2}}[itex]

where the sign of the imaginary part of the root is the same as the sign of the imaginary part of the original number.

Note that because of the discontinuous nature of the square root function in the complex plane, the law √(zw) = √(z)√(w) is in general not true. Wrongly assuming this law underlies several faulty "proofs", for instance the following one showing that -1 = 1:

[itex]-1 = i \times i = \sqrt{-1} \times \sqrt{-1} = \sqrt{-1 \times -1} = \sqrt{1} = 1[itex]

The third equality cannot be justified. (See invalid proof.)

However the law can only be wrong up to a factor -1, √(zw) = ±√(z)√(w), is true for either ± as + or as - (but not both at the same time). Note that √(c2) = ±c, therefore √(a2b2) = ±ab and therefore √(zw) = ±√(z)√(w), using a = √(z) and b = √(w).

## Square roots of matrices and operators

If A is a positive definite matrix or operator, then there exists precisely one positive definite matrix or operator B with B2 = A; we then define √A = B.

More generally, to every normal matrix or operator A there exist normal operators B such that B2 = A. In general, there are several such operators B for every A and the square root function cannot be defined for normal operators in a satisfactory manner. Positive definite operators are akin to positive real numbers, and normal operators are akin to complex numbers.

## Infinitely nested square roots

Under certain condition infinitely nested radicals such as

[itex] x = \sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\cdots}}}} [itex]

represent rational numbers. This rational number can be found by realizing that x also appears under the radical sign, which gives the equation

[itex] x = \sqrt{2+x}. [itex]

If we solve this equation, we find that x = 2. More generally, we find that

[itex] \sqrt{n+\sqrt{n+\sqrt{n+\sqrt{n+\cdots}}}} = \frac{1 + \sqrt {1+4n}}{2}. [itex]

The same procedure also works to get

[itex] \sqrt{n-\sqrt{n-\sqrt{n-\sqrt{n-\cdots}}}} = \frac{-1 + \sqrt {1+4n}}{2}. [itex]

This method will give a rational [itex] x [itex] value for all values of [itex] n [itex] such that

[itex] {n} = {x^2} + {x}. [itex]

## Square roots of the first 20 positive integers

√ 1 = 1
√ 2 ≈ 1.4142135623 7309504880 1688724209 6980785696 7187537694 8073176679 7379907324 78462
√ 3 ≈ 1.7320508075 6887729352 7446341505 8723669428 0525381038 0628055806 9794519330 16909
√ 4 = 2
√ 5 ≈ 2.2360679774 9978969640 9173668731 2762354406 1835961152 5724270897 2454105209 25638
√ 6 ≈ 2.4494897427 8317809819 7284074705 8913919659 4748065667 0128432692 5672509603 77457
√ 7 ≈ 2.6457513110 6459059050 1615753639 2604257102 5918308245 0180368334 4592010688 23230
√ 8 ≈ 2.8284271247 4619009760 3377448419 3961571393 4375075389 6146353359 4759814649 56924
√ 9 = 3
√10 ≈ 3.1622776601 6837933199 8893544432 7185337195 5513932521 6826857504 8527925944 38639
√11 ≈ 3.3166247903 5539984911 4932736670 6866839270 8854558935 3597058682 1461164846 42609
√12 ≈ 3.4641016151 3775458705 4892683011 7447338856 1050762076 1256111613 9589038660 33818
√13 ≈ 3.6055512754 6398929311 9221267470 4959462512 9657384524 6212710453 0562271669 48293
√14 ≈ 3.7416573867 7394138558 3748732316 5493017560 1980777872 6946303745 4673200351 56307
√15 ≈ 3.8729833462 0741688517 9265399782 3996108329 2170529159 0826587573 7661134830 91937
√16 = 4
√17 ≈ 4.1231056256 1766054982 1409855974 0770251471 9922537362 0434398633 5730949543 46338
√18 ≈ 4.2426406871 1928514640 5066172629 0942357090 1562613084 4219530039 2139721974 35386
√19 ≈ 4.3588989435 4067355223 6981983859 6156591370 0392523244 4936890344 1381595573 28203
√20 ≈ 4.4721359549 9957939281 8347337462 5524708812 3671922305 1448541794 4908210418 51276

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy