# How to Calculate a Square Root by Hand Техника

In the days before calculators, students and professors alike had to calculate square roots by hand. Several different methods have evolved for tackling this daunting process, some giving a rough approximation, others giving an exact value. To learn how to find a number’s square root using only simple operations, please see Step 1 below to get started.

#### Understanding the Process

1. Consider the number you are calculating the square root of as the area S of a square. Because a square’s area is L2 where L is the length of one of its sides, therefore, by trying to find the square root of your number, you are trying to calculate the length L of the side of that square.

2. Specify letter variables for each digit of your answer. Assign the variable A as the first digit of L (the square root we are trying to calculate). B will be its second digit, C its third, and so on.

3. Specify letter variables for each «chunk» of your starting number. Assign the variable Sato the first pair of digits in S (your starting value), Sb the second pair of digits, etc.

4. Understand this method’s connection to long division. This method of finding a square root is essentially a long division problem that divides your starting number by its square root, thus giving its square root as an answer. Just like in a long division problem, in which you are only interested by the next one digit at a time, here, you are interested by the next two digits at a time (which correspond to the next digit at a time for the square root).

5. Find the biggest number whose square is less than or equal to Sa. The first digit A in our answer is then the biggest integer where the square does not exceed Sa (meaning A so that A² ≤ Sa < (A+1)²). In our example, Sa = 7, and 2² ≤ 7 < 3², so A = 2.

• Note that, for instance, if you wanted to divide 88962 by 7 via long division, the first step would be similar: you would be looking at the first digit of 88962 (8) and you would want the biggest digit that, when multiplied by 7, is lower than or equal to 8. Essentially, you’re finding d so that 7×d ≤ 8 < 7×(d+1). In this case, d would be equal to 1.
6. Visualize the square whose area you are beginning to solve. Your answer, the square root of your starting number, is L, which describes the length of a square with area S (your starting number). Your values for A,B,C, represent the digits in the value L. Another way of saying this is that, for a two-digit answer, 10A + B = L, while for a three-digit answer, 100A +10B + C = L, and so on.

• In our example, (10A+B)² = L2 = S = 100A² + 2×10A×B + B². Remember that 10A+B represents our answer L with B in the units position and A in the tens position. For instance, with A=1 and B=2, 10A+B is simply the number 12. (10A+B)² is the area of the whole square, while 100A² the area of the biggest square inside, is the area of the smallest square, and 10A×B is the area of each of the two remaining rectangles. By performing this long, convoluted process, we find the area of the entire square by adding up the areas of the squares and rectangles inside it.
7. Subtract A² from Sa. Drop one pair (Sb) of digits from S. Sa Sb is nearly the total area of the square, which you just subtracted the area of the bigger internal square from. The remainder is can be though of as the number N1, which we obtained in step 4 (N1 =380 in our example). N1 is equal to 2×10A×B + B² (area of the two rectangles plus area of the small square).

8. Look for N1 = 2×10A×B + B², also written as N1 = (2×10A + B) × B. In our example, you already know N1 (380) and A (2), so you need to find B. B is most likely not going to be an integer, so you must actually find the biggest integer B so that (2×10A + B) × B ≤ N1. So, you have: N1 < (2×10A + (B+1)) × (B+1).)

9. Solve. To solve this equation, multiply A by 2, shift it in the position of the tens (which is equivalent to multiplying by 10), place B in the position of the units, and multiply the resulting number by B. In other words, solve (2×10A + B) × B. This is exactly what you do when you write «N_×_=» (with N=2×A) in the bottom right quadrant in step 4. In step 5, you find the biggest integer B that fits on the underscore so that (2×10A + B) × B ≤ N1.

10. Subtract the area (2×10A + B) × B from the total area. This gives you the area S-(10A+B)² not yet accounted for (and which will be used to calculate the next digits in a similar fashion).

11. • Is 28 a perfect number? Yes. A «perfect» number is a positive integer which is the sum of all of its positive divisors (except itself). Thus, 28 = 1 + 2 + 4 + 7 + 14.

• What is the square root of 0.000121? .011. If you are calculating it by hand, here’s what to do: 121’s sqrt is 11. To get .000121, you simply find an amount of 0’s after the decimal point and the number 11 afterwards. Then multiply by itself. .011*.011= .000121.

• Can I write the cube root of x as (1/x)^1/3? No, it’s (x)^1/3.

200 characters left

• This method works for any base, not just in base 10 (decimal).

• In the example, 1.73 can be considered to be a «remainder» : 780.14 = 27.9² + 1.73.

• Moving the decimal point by an increment of two digits in a number (factor of 100), moves the decimal point by increments of one digit in its square root (factor of 10).

• Be sure to separate the digits into pairs from the decimal point. Separating 79,520,789,182.47897 as «79 52 07 89 18 2.4 78 97″ will yield a useless number.

Thanks to all authors for creating a page that has been read 2,566,706 times.

• Use this online calculator to easily calculate the square root of a given number, including fractions. Quick and easy square root finder.

## What is a square root?

The square root of a number answers the question «what number can I multiply by itself to get this number?». It is the reverse of the exponentiation operation with an exponent of 2, so if r2 = x, then we say that «r is the root of x». Finding the root of a number has a special notation called the radical symbol: √. Usually the radical spans over the entire equation for which the root is to be found. It is called a «square» root since multiplying a number by itself is called «squaring» as it is how one finds the area of a square.

For every positive number there are two square roots — one positive and one negative. For example, the square root of 4 is 2, but also -2, since -2 x -2 = 4. The negative root is always equal in value to the positive one, but opposite in sign. You can see examples in the table of common roots below. Most often when talking about «the root of» some number, people refer to the Principal Square Root which is always the positive root. This is the number our square root calculator outputs as well.

In geometrical terms, the square root function maps the area of a square onto its side length. The function √x is continuous for all nonnegative x and differentiable for all positive x.

## How calculate a square root

1. Start with a guess (b). If a is between two perfect squares, a good guess would be a number between those squares.
2. Divide a by b: e = a / b. If the estimate e is an integer, stop. Also stop if the estimate has achieved the desired level of decimal precision.
3. Get a new guess b1 by averaging the result of step #2 e and the initial guess b: b1 = (e + b) / 2
4. Go to step #2 using b1 in place of b

For example, to find the square root of 30 with a precision of three numbers after the decimal point:

Step 1: a = 30 is between 25 and 36, which have roots of 5 and 6 respectively. Let us start with b = 5.5.
Step 2: e = a / b = 30 / 5.5 = 5.45(45). Since b is not equal to e (5.500 ≠ 5.454), continue calculation.
Step 3: b1 = (5.45 + 5.5) / 2 = 5.47727(27)
Step 4: e = 30 / 5.47727 = 5.477178. Since b1 = e = 5.477 within three position after the decimal point, stop the square root-finding algorithm with a result of √30 = 5.47727(27).

Checking the outcome against the square root calculator output of 5.477226 reveals that the algorithm resulted in a correct solution. While the above process can be fairly tedious especially with larger roots, but will help you find the square root of any number with the desired decimal precision.

## Properties and practical application of square roots

Square roots appear frequently in mathematics, geometry and physics. For example, many physical forces measured in quantities or intensities diminish inversely proportional to the square root of the distance. So, gravity between two objects 4 meters apart will be 1/√4 relative to their gravity at 0 meters. The same is true for radar energy waves, radio waves, light and magnetic radiation in general, and sound waves in gases. It is usually referred to as the «inverse-square law».

The square root is key in probability theory and statistics where it defines the fundamental concept of standard deviation. Plotting the results from the square root function, as calculated using this square root calculator, on a graph reveals that it has the shape of half a parabola.

## Commonly used square roots

Table of commonly encountered square roots:

The calculations were performed using this calculator.

## Does the calculator support fractions?

Yes, simply enter the fraction as a decimal number (use dot as a separator) and you will get the corresponding root. For example, to compute the square root of 1/4 simply enter 0.25 in the number field, press «Calculate» and you will get 0.50 as ouput. If you are having difficulty converting a fraction to a decimal number, you will find our fraction to decimal converter handy.

## Math. sqrt()

The `math` module from the standard library has a `sqrt` function to calculate the square root of a number. It takes any type that can be converted to `float` (which includes `int`) as an argument and returns a `float`.

``````>>> import math
>>> math.sqrt(9)
3.0
``````

## Fractional exponent

The power operator (`**`) or the built-in `pow()` function can also be used to calculate a square root. Mathematically speaking, the square root of `a` equals `a` to the power of `1/2`.

The power operator requires numeric types and matches the conversion rules for binary arithmetic operators, so in this case it will return either a `float` or a `complex` number.

``````>>> 9 ** (1/2)
3.0
>>> 9 ** .5  # Same thing
3.0
>>> 2 ** .5
1.4142135623730951
``````

(Note: in Python 2, `1/2` is truncated to `0`, so you have to force floating point arithmetic with `1.0/2` or similar. See Why does Python give the «wrong» answer for square root?)

This method can be generalized to nth root, though fractions that can’t be exactly represented as a `float` (like 1/3 or any denominator that’s not a power of 2) may cause some inaccuracy:

``````>>> 8 ** (1/3)
2.0
>>> 125 ** (1/3)
4.999999999999999
``````

## Edge cases

### Negative and complex

Exponentiation works with negative numbers and complex numbers, though the results have some slight inaccuracy:

``````>>> (-25) ** .5  # Should be 5j
(3.061616997868383e-16+5j)
>>> 8j ** .5  # Should be 2+2j
(2.0000000000000004+2j)
``````

Note the parentheses on `-25`! Otherwise it’s parsed as `-(25**.5)` because exponentiation is more tightly binding than unary negation.

Meanwhile, `math` is only built for floats, so for `x<0`, `math.sqrt(x)` will raise `ValueError: math domain error` and for complex `x`, it’ll raise `TypeError: can't convert complex to float`. Instead, you can use `cmath.sqrt(x)`, which is more more accurate than exponentiation (and will likely be faster too):

``````>>> import cmath
>>> cmath.sqrt(-25)
5j
>>> cmath.sqrt(8j)
(2+2j)
``````

### Precision

Both options involve an implicit conversion to `float`, so floating point precision is a factor. For example:

``````>>> n = 10**30
>>> x = n**2
>>> root = x**.5
>>> n == root
False
>>> n - root  # how far off are they?
0.0
>>> int(root) - n  # how far off is the float from the int?
19884624838656
``````

Very large numbers might not even fit in a float and you’ll get `OverflowError: int too large to convert to float`. See Python sqrt limit for very large numbers?

### Other types

Let’s look at `Decimal` for example:

Exponentiation fails unless the exponent is also `Decimal`:

``````>>> decimal.Decimal('9') ** .5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
>>> decimal.Decimal('9') ** decimal.Decimal('.5')
Decimal('3.000000000000000000000000000')
``````

Meanwhile, `math` and `cmath` will silently convert their arguments to `float` and `complex` respectively, which could mean loss of precision.

`decimal` also has its own `.sqrt()`. See also calculating n-th roots using Python 3’s decimal module

## SymPy

Depending on your goal, it might be a good idea to delay the calculation of square roots for as long as possible. SymPy might help.

SymPy is a Python library for symbolic mathematics.

``````import sympy
sympy.sqrt(2)
# => sqrt(2)
``````

This doesn’t seem very useful at first.

``````sympy.sqrt(8) / sympy.sqrt(27)
# => 2*sqrt(6)/9
``````

Also, no precision is lost. (√2)² is still an integer:

``````s = sympy.sqrt(2)
s**2
# => 2
type(s**2)
#=> <class 'sympy.core.numbers.Integer'>
``````

In comparison, floats and Decimals would return a number which is very close to 2 but not equal to 2:

``````(2**0.5)**2
# => 2.0000000000000004

from decimal import Decimal
(Decimal('2')**Decimal('0.5'))**Decimal('2')
# => Decimal('1.999999999999999999999999999')
``````

Sympy also understands more complex examples like the Gaussian integral:

``````from sympy import Symbol, integrate, pi, sqrt, exp, oo
x = Symbol('x')
integrate(exp(-x**2), (x, -oo, oo))
# => sqrt(pi)
integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
# => True
``````
``````sympy.N(sympy.sqrt(2), 1_000_000)
# => 1.4142135623730950488016...........2044193016904841204
`````` answered Jan 21, 2022 at 14:38 Eric Duminil

## NumPy

``````>>> import numpy as np
>>> np.sqrt(25)
5.0
>>> np.sqrt([2, 3, 4])
array([1.41421356, 1.73205081, 2.        ])
``````

### Negative

For negative reals, it’ll return `nan`, so `np.emath.sqrt()` is available for that case.

``````>>> a = np.array([4, -1, np.inf])
>>> np.sqrt(a)
<stdin>:1: RuntimeWarning: invalid value encountered in sqrt
array([ 2., nan, inf])
>>> np.emath.sqrt(a)
array([ 2.+0.j,  0.+1.j, inf+0.j])
``````

Another option, of course, is to convert to complex first:

``````>>> a = a.astype(complex)
>>> np.sqrt(a)
array([ 2.+0.j,  0.+1.j, inf+0.j])
``````

## Newton’s method

Most simple and accurate way to compute square root is Newton’s method.

You have a number which you want to compute its square root (`num`) and you have a guess of its square root (`estimate`). Estimate can be any number bigger than 0, but a number that makes sense shortens the recursive call depth significantly.

``````new_estimate = (estimate + num/estimate) / 2
``````

This line computes a more accurate estimate with those 2 parameters. You can pass `new_estimate` value to the function and compute another `new_estimate` which is more accurate than the previous one or you can make a recursive function definition like this.

``````def newtons_method(num, estimate):
# Computing a new_estimate
new_estimate = (estimate + num/estimate) / 2
print(new_estimate)
# Base Case: Comparing our estimate with built-in functions value
if new_estimate == math.sqrt(num):
return True
else:
return newtons_method(num, new_estimate)
``````

For example we need to find 30’s square root. We know that the result is between 5 and 6.

``````newtons_method(30,5)
``````

number is 30 and estimate is 5. The result from each recursive calls are:

``````5.5
5.477272727272727
5.4772255752546215
5.477225575051661
``````

The last result is the most accurate computation of the square root of number. It is the same value as the built-in function `math.sqrt()`.

This answer was originally posted by gunesevitan, but is now deleted.

Python’s `fractions` module and its class, `Fraction`, implement arithmetic with rational numbers. The `Fraction` class doesn’t implement a square root operation, because most square roots are irrational numbers. However, it can be used to approximate a square root with arbitrary accuracy, because a `Fraction`‘s numerator and denominator are arbitrary-precision integers.

``````from fractions import Fraction

def sqrt(x, n):
x = x if isinstance(x, Fraction) else Fraction(x)
upper = x + 1
for i in range(0, n):
upper = (upper + x/upper) / 2
lower = x / upper
if lower > upper:
raise ValueError("Sanity check failed")
return (lower, upper)
``````

See the reference below for details on this operation’s implementation. It also shows how to implement other operations with upper and lower bounds (although there is apparently at least one error with the `log` operation there).

• Daumas, M., Lester, D., Muñoz, C., «Verified Real Number Calculations: A Library for Interval Arithmetic», arXiv:0708.3721 [cs.MS], 2007.

Alternatively, using Python’s `math.isqrt`, we can calculate a square root to arbitrary precision:

• Square root of `i` within 1/2n of the correct value, where `i` is an integer:`Fraction(math.isqrt(i * 2**(n*2)), 2**n)`.
• Square root of `i` within 1/10n of the correct value, where `i` is an integer:`Fraction(math.isqrt(i * 10**(n*2)), 10**n)`.
• Square root of `x` within 1/2n of the correct value, where `x` is a multiple of 1/2n:`Fraction(math.isqrt(x * 2**(n)), 2**n)`.
• Square root of `x` within 1/10n of the correct value, where `x` is a multiple of 1/10n:`Fraction(math.isqrt(x * 10**(n)), 10**n)`.

In the foregoing, `i` or `x` must be 0 or greater.

answered Jan 21, 2022 at 19:45 Peter O.

Disclaimer: this is for a more specialised use-case. This method might not be practical in all circumstances.

• can find integer values (i.e. which integer is the root?)
• no need to convert to float, so better precision (can be done that well too)

I personally implemented this one for a crypto CTF challenge (RSA cube root attack),where I needed a precise integer value.

The general idea can be extended to any other root.

``````def int_squareroot(d: int) -> tuple[int, bool]:
"""Try calculating integer squareroot and return if it's exact"""
left, right = 1, (d+1)//2
while left<right-1:
x = (left+right)//2
if x**2 > d:
left, right = left, x
else:
left, right = x, right
return left, left**2==d
``````

## EDIT

### Overcoming the issues and limits of this method/implementation:

For smaller numbers, you can just use all the other methods from other answers. They generally use floats, which might be a loss of precision, but for small integers that should mean no problem at all. All of those methods that use floats have the same (or nearly the same) limit from this.

If you still want to use this method and get float results, it should be trivial to convert this to use floats too. Note that that will reintroduce precision loss, this method’s unique benefit over the others, and in that case you can also just use any of the other answers. I think the newton’s method version converges a bit faster, but I’m not sure.

For larger numbers, where loss of precision with floats come into play, this method can give results closer to the actual answer (depending on how big is the input). If you want to work with non-integers in this range, you can use other types, for example fixed precision numbers in this method too.

## Edit 2, on other answers

Currently, and afaik, the only other answer that has similar or better precision for large numbers than this implementation is the one that suggest SymPy, by Eric Duminil. That version is also easier to use, and work for any kind of number, the only downside is that it requires SymPy. My implementation is free from any huge dependencies if that is what you are looking for.

answered Jan 21, 2022 at 17:12 Uncle Dino

### Arbitrary precision square root

This variation uses string manipulations to convert a string which represents a decimal floating-point number to an `int`, calls `math.isqrt` to do the actual square root extraction, and then formats the result as a decimal string. `math.isqrt` rounds down, so all produced digits are correct.

The input string, `num`, must use plain float format: ‘e’ notation is not supported. The `num` string can be a plain integer, and leading zeroes are ignored.

The `digits` argument specifies the number of decimal places in the result string, i.e., the number of digits after the decimal point.

``````from math import isqrt

def str_sqrt(num, digits):
""" Arbitrary precision square root

num arg must be a string
Return a string with `digits` after
the decimal point

Written by PM 2Ring 2022.01.26
"""

int_part , _, frac_part = num.partition('.')
num = int_part + frac_part

# Determine the required precision
width = 2 * digits - len(frac_part)

# Truncate or pad with zeroes
num = num[:width] if width < 0 else num + '0' * width
s = str(isqrt(int(num)))

if digits:
s = '0' * (1 + digits - len(s)) + s
s = f"{s[:-digits]}.{s[-digits:]}"
return s
``````

#### Test

``````print(str_sqrt("2.0", 30))
``````

#### Output

``````1.414213562373095048801688724209
``````

For small numbers of digits, it’s faster to use `decimal.Decimal.sqrt`. Around 32 digits or so, `str_sqrt` is roughly the same speed as `Decimal.sqrt`. But at 128 digits, `str_sqrt` is 2.2× faster than `Decimal.sqrt`, at 512 digits, it’s 4.3× faster, at 8192 digits, it’s 7.4× faster.

Here’s a live version running on the SageMathCell server.

answered Jan 25, 2022 at 14:39 PM 2Ring

## Find square-root of a number

``````while True:
num = int(input("Enter a number:\n>>"))
for i in range(2, num):
if num % i == 0:
if i*i == num:
print("Square root of", num, "==>", i)
break
else:
kd = (num**0.5)  # (num**(1/2))
print("Square root of", num, "==>", kd)
``````

Enter a number: 24
Square root of 24 ==> 4.898979485566356
Enter a number: 36
Square root of 36 ==> 6
Enter a number: 49
Square root of 49 ==> 7

## ✔ Output 💡 CLICK BELOW & SEE ✔   answered May 7, 2022 at 17:21 1. • For example, the square root of 1 is 1 because 1 multiplied by 1 equals 1 (1X1=1). However, the square root of 4 is 2 because 2 multiplied by 2 equals 4 (2X2=4). Think of the square root concept by imagining a tree. A tree grows from an acorn. Thus, it’s bigger than but related to the acorn, which was at its root. In the above example, 4 is the tree, and 2 is the acorn.
• Thus, the square root of 9 is 3 (3X3=9), of 16 is 4 (4X4=16), of 25 is 5 (5X5=25), of 36 is 6 (6X6=36), of 49 is 7 (7X7=49), or 64 is 8 (8X8=64), of 81 is 9 (9X9=81), and of 100 is 10 (10X10=100).
2. Use division to find the square root. To find the square root of a whole number, you could also divide the whole number by numbers until you get an answer that is the same as the number you used to divide the whole number.

• For example: 16 divided by 4 is 4. And 4 divided by 2 is 2, and so on. Thus, in those examples, 4 is the square root of 16, and 2 is the square root of 4.
• Perfect square roots do not have fractions or decimals because they involve whole numbers.
3. • N equals the number whose square root you are trying to find. It goes inside the check mark symbol.
• Thus, if you are trying to find the square root of 9, you should write a formula that puts the «N» (9) inside the check mark symbol (the «radical») and then present an equal sign and the 3. This means the “square root of 9 equals 3.”
1. Take a guess at it, and use the process of elimination. It’s tougher to figure out square roots of numbers that are not whole. But it’s possible.

• Let’s say you want to find the square root of 20. You know that 16 is a perfect square with a square root of 4 (4X4=16). Similarly, 25 has a square root of 5 (5X5=25), so the square root of 20 must fall in between 4 and 5.
• You could guess that 20’s square root is 4.5. Now, simply square 4.5 to check your guess. That means you multiply it by itself: 4.5X4.5. See if the answer is above or below 20. If the guess seems off, simply try another guess (maybe 4.6 or 4.4) and refine your guess until you hit 20.
• For example, 4.5X4.5 = 20.25, so logically you should try a smaller number, probably 4.4. 4.4X4.4 = 19.36. Thus, the square root of 20 must lie in between 4.5 and 4.4. How about 4.445X4.445. That’s 19.758. It’s closer. If you keep trying different numbers using this process, you will eventually get to 4.475X4.475 = 20.03. Rounding off, that’s 20.
2. • Then, divide your number by one of those square root numbers. Take the answer, and find the average of it and the number you divided by (average is just the sum of those two numbers divided by two). Then take the original number and divide it by the average you got. Finally, find the average of that answer with the first average you got.
• Sound complicated? It can be easiest to follow an example. For example, 10 lies in between the 2 perfect square numbers of 9 (3X3=9) and 16 (4X4=16). The square roots of those numbers are 3 and 4. So, divide 10 by the first number, 3. You will get 3.33. Now, average the 3 and 3.33 by adding them together and dividing them by 2. You will get 3.1667. Now take 10 divided by 3.1667. The answer is 3.1579. Now, average 3.1579 and 3.1667 by adding them together and dividing the sum you get by two. You will get 3.1623.
• Check your work by multiplying your answer (in this case 3.1623) by itself. Indeed, 3.1623 multiplied by 3.1623 equals 10.001.

• If I have a building that is 40 x 60 feet, how do you find out if it is square? There are two ways to do it: (1) If you can measure the inside diagonals (from a corner to its opposite corner), the diagonals of a perfect rectangle are equal to each other; (2) Get a magnetic compass and sight it along two adjacent sides. The two directions should be exactly 90° from each other.

• How do I calculate the square root without a calculator? Use a factor tree. For example, 625 = 5 x 125 = 5 x 5 x 25 = 5 x 5 x 5 x 5. Because there are 4 fives, and we are looking for the square root, (5 x 5)(5 x 5) = 625. Therefore the square root of 625 is 25.

• What is the smallest four-digit whole number divisible by 9 that has two even and two odd digits? The number 1089 is the answer. The way you work it out is 1008 is a 9 time table number. Then just add on nines starting at this number, and the first 9 times table number you get that has two even digits and odd digits is your answer.

200 characters left

• Memorizing the first few perfect squares is highly advisable:

• 02 = 0, 12 = 1, 32 = 9, 42 = 16, 52 = 25, 62 = 36, 72 = 49, 82 = 64, 92 = 81, 102 = 100,
• Eventually learn these: 112 = 121, 122 = 144, 132 169, 142 = 196, 152 = 225, 162 = 256, 172 = 289…
• More easy fun: 102 = 100, 202 = 400, 302 = 900, 402 = 1600, 502 = 2500, …

To find a square root of a number without a calculator, see if you can get to that whole number by squaring smaller numbers, or multiplying a smaller number by itself. If the number is a perfect square, you will get a whole number as the square root. Otherwise, try squaring numbers with a decimal until you get as close as possible to your original number. If you want to learn how to estimate the square root of imperfect squares, keep reading the article!

Thanks to all authors for creating a page that has been read 627,211 times.

You can multiply square roots, a type of radical expression, just as you might multiply whole numbers. Sometimes square roots have coefficients (an integer in front of the radical sign), but this only adds a step to the multiplication and does not change the process. The trickiest part of multiplying square roots is simplifying the expression to reach your final answer, but even this step is easy if you know your perfect squares.

1. 2. 3. 4. 1. Multiply the coefficients. A coefficient is a number in front of the radical sign. To do this, just ignore the radical sign and radicand, and multiply the two whole numbers. Place their product in front of the first radical sign.

2. 3. 4. ### Calculator, Practice Problems, and Answers

• We are not allowed to use a calculator, so how do I multiply a whole number by a square root? When you multiply a whole number by a square root, you just put the two together, with the whole number in front of the square root. For example, 2 * (square root of 3) = 2(square root of 3). If the square root has a whole number in front of it, multiply the whole numbers together. So 2 * 4(square root of 3) = 8(square root of 3).

• What is 2 root 3 times root 3? √3 times √3 equals 3. Two times that is 6.

• What is 4 divided by square root of 5? (4√5)/5. Since radicals are not supposed to be in the denominator, you multiply by √5/√5 to get (4√5)/5.

200 characters left

• Always remember your perfect squares because it will make the process much easier!

• All terms under the radicand are always positive, so you will not have to worry about sign rules when multiplying radicands.

## Things You’ll Need

• Pencil
• Paper
• Calculator

To multiply square roots, first multiply the radicands, or the numbers underneath the radical sign. If there are any coefficients in front of the radical sign, multiply them together as well. Finally, if the new radicand can be divided out by a perfect square, factor out this perfect square and simplify it. If you want to learn how to check your answers when you’re finished solving, keep reading the article!

Thanks to all authors for creating a page that has been read 1,431,880 times.

Square root calculation is used in finance, quadratic formula, standard deviation lengths and distance, and many more. With this blog, we will understand what is square root, the formula and symbol, and some solved examples.

Looking to Learn Math? Explore Wiingy’s Online Math Tutoring Services to learn from top mathematicians and experts.

## Square root

The square root of a value is a number when multiplied by itself gives the original number or the square root is the inverse of squaring the numbers. Which tells that both concepts are dependable on each other.

The square root of a number in the radical form is denoted as √ when they are in the exponential form they are denoted as the (number)1/2 or the (number) 0.5.

Let us take p and q. The square root of p = √q or p = q2 the number that is positive when positive or multiplied gives the exact number.
That is if we take the number 9 the square root of 9 is found by multiplying the number twice.
9 = 32 or √9 = 3, when the number three is multiplied it gives the number 9.

## Symbol of the square root

The square root symbol is denoted in a radical way. Let us say we have to express x in the square root then it is denoted as x. The symbol in radical form is also called radicant. Here x = any number.
The square root of 4 is expressed as √4

## The formula for finding the square root

The formula is simple x = √y or x = y2

## Rational and irrational numbers

Rational numbers are expressed as a fraction of the integer. That is they are simple fractions and p/q ≠0.
Let us take the number 121 as an example:
The square root of 121 = 11, when we divide the number 121/11 = 11 and not zero or a complicated fraction.
An irrational number leads to complicated fractions and is often difficult to solve. Any number that is not expressed as a fraction is called an irrational number.
The square root of 5 = 7.071 which cannot be further converted into a fraction and is also not equal to 0.

## Perfect square and not a perfect square

A perfect square number is one whose square roots give a whole number. The square root of 4 is 2, the square root of 400 is 20, etc.,
A not-perfect square number is one whose roots are not whole numbers but rather decimals.
The square root of 5 = 7.071

## What are the methods to find the square root of a number?

The numbers that end with 2,3, 7 0r 8 at the unit place are not perfect square numbers and are a little difficult to find. The numbers ending with 1,4,5,6 or 9 in the unit place are perfect square numbers and can be found easily using the prime factorization or the long division method.
The method to find the square root is

• Prime factorization method
• Long division method
• Repeated subtraction method

## Prime factorization method

Prime factorization is one of the easiest methods to find the square root of any number. Let us take n as the prime number, by grouping the similar numbers we get n2, by multiplying the similar n2. The value we get is the square root of the number.
Let us take the number 144 as an example and solve them using the prime factorization method.
The prime factor of 144 = 12×12
By squaring them we get 122, since two is the only similar square we take the common one.
Here, the common square is 12.
Hence, the √144 = 12

## Long division method

• Step 1: Find the smallest integer that can divide the number.
• Step 2: Keep following the long division using divisor and dividend.
• Step 3: When the particular number of satisfaction is reached the quotient is the square root of the number.

Find the square root of 2

• Step 1: Find the smallest integer that can divide the number. 1 is the perfect root number that is smaller and closest to 2.
• Step 2: Keep following the long division using divisor and dividend.
• Step 3: When the particular number of satisfaction is reached the quotient is the square root of the number. Hence, the √2 = 1.4142

## Repeated subtraction method

The repeated subtraction method first subtracts the given number from the odd numbers until you get zero. The step in which zero is obtained is the square root of the number. It is a time-consuming and lengthy process.
Find the square root of 36 using the repeated subtraction method

1. 36-1 = 35
2. 35-3 = 32
3. 32-5 = 27
4. 27-7 = 20
5. 20-9 = 11
6. 11-11 = 0

We got zero in the sixth step. Hence,  √36 = 6.

## The square root of -1

Understanding the square root of minus values is simple. There is no real square root for the negative integers which are often referred to as imaginary roots. Why? Because what happens when you multiply two negative values is you get a positive number and not a negative one. Let’s say we need to find the square root of -1. We know the definition of square root, thus multiplying or squaring these values we get 1 and not a negative result.
-1 = (-1) (-1) = 1.
Therefore they are referred to as imaginary roots and are denoted as I.
Find the square root of -2
√-2 = 1.4142i

## Solved examples

Q1: Solve the equation √2a+9 = 5
A1: √2a+9 = 5
Let us take square on both sides
2a+9 = 52
2a+9 = 25
2a = 25-9
2a = 16
a = 16/2
a=8

Q2: Square root of 125 using the prime factorization method
A2: The prime factors of 125 = 5×5×5
√125 = 5×5
= 5 × 2.236
= 11.8

Q3: Square root of 12 using the long division method

A 3: √12 = 3.464

Q4: Find the square root of pi

A 4: √𝛑 = 1.77

Q5: Find the square root of 64 using the repeated subtraction method

1. 64-1 = 63
2. 63-3 = 60
3. 60 – 5 = 55
4. 55-7 = 48
5. 48 – 9 = 39
6. 39-11 = 28
7. 28-13 = 15
8. 15-15 = 0
9. √64 = 8

Looking to Learn Math? Explore Wiingy’s Online Math Tutoring Services to learn from top mathematicians and experts.

What is a square root?
The square root of a value is a number when multiplied by itself gives the original number or the square root is the inverse of squaring the numbers. Which tells that both concepts are dependable on each other

Give an example of a perfect square number.
The numbers that are perfect squares are 4,16 and 25 are some of the examples for perfect square numbers.

What are irrational numbers?
Any number that is not expressed as a fraction is called an irrational number.

What is the square root of -1?
We know the definition of square root, thus multiplying or squaring these values we get 1 and not a negative result.
-1 = (-1) (-1) = 1. The square root of -1 is i

The square root symbol is denoted as √ called a radicand.

What is the formula for square root?
The formula is simple x = y or x = y2

What is the square root of 100?
The square root of 100 is 10

Here is my full code:

``````#include <iostream>
using namespace std;

int main(){
int squareroot = 0;
int number;

cout << "enter a number sp that i can calculate its squareroot" << endl;

cin >> number;

while (squareroot * squareroot != number){

squareroot+=0.1;

}
cout << "the square root is" << squareroot << endl;
return 0;
}
``````

I know there must be a better way. Pls help. Looked through Google but don’t understand the complex programs there as I am still a beginner.

asked Oct 23, 2015 at 10:00 Aryan C

Below explanation is given for the integer square root calculation:

In number theory, the integer square root of a positive
integer n is the positive integer m which is the greatest integer less
than or equal to the square root of n

The approach your started is good but needs several correction to make it work:

1. you are working with `int` you want to add 1 to `squareroot` not 0.1

2. you want to stop your calculation when you `squareroot * squareroot` is equal or greater than `number`. Think about the case were the number is 26, you don’t have an integer that multiplies itself to 26.

3. in the case of number equal to 26, do you want to return 5 or 6? After your `while` loop the value of `squareroot` will be 6 so you might want to reverse it to 5 (if `squareroot * squareroot` is different than `number`)

Below the exemple:

``````#include <iostream>
using namespace std;

int main(){
int squareroot = 0;
int number;

cout << "enter a number sp that i can calculate its squareroot" << endl;

cin >> number;

while (squareroot * squareroot < number){
squareroot+=1;
}

if (squareroot * squareroot != number) --squareroot;

cout << "the square root is" << squareroot << endl;
return 0;
}
``````

Below a more efficient and elegant way of calculating the square root using binary search principle. O(log(n))

``````int mySqrt(int x) {
if (x==0) return 0;
int left = 1;
int right = x/2 + 1;
int res;

while (left <= right) {
int mid = left + ((right-left)/2);
if (mid<=x/mid){
left = mid+1;
res=mid;
}
else {
right=mid-1;
}
}

return res;
}
`````` answered Oct 23, 2015 at 10:03 This function uses Nested Intervals (untested) and you can define the accuracy:

``````#include <math.h>
#include <stdio.h>

double mySqrt(double r) {
double l=0, m;
do {
m = (l+r)/2;
if (m*m<2) {
l = m;
} else {
r = m;
}
}
while(fabs(m*m-2) > 1e-10);
return m;
}
``````

answered Oct 23, 2015 at 10:12 This function will calculate the floor of square root if A is not a perfect square.This function basically uses binary search.Two things you know beforehand is that square root of a number will be less or equal to that number and it will be greater or equal to 1. So we can apply binary search in that range.Below is my implementation.Let me know if you don’t understand anything in the code.Hope this helps.

``````int sqrt(int A) {
if(A<1)return 0;
if(A==1)return 1;

unsigned long long start,end,mid,i,val,lval;
start = 1;
end = A;
while(start<=end){
mid = start+(end-start)/2;
val = mid*mid;
lval = (mid-1)*(mid-1);

if(val == A)return mid;
else if(A>lval && A<val) return mid-1;
else if(val > A)end = mid;
else if(val < A)start = mid+1;
}
}
``````

answered Oct 23, 2015 at 10:06 The problem with your code, is that it only works if the square root of the number is exactly N*0.1, where N is an integer, meaning that if the answer is 1.4142 and not 1.400000000 exactly your code will fail. There are better ways , but they’re all more complicated and use numerical analysis to approximate the answer, the easiest of which is the Newton-Raphson method.

you can use the function below, this function uses the Newton–Raphson method to find the root, if you need more information about the Newton–Raphson method, check this wikipedia article. and if you need better accuracy — but worse performance- you can decrease ‘0.001’ to your likening,or increase it if you want better performance but less accuracy.

``````float mysqrt(float num)   {
float x = 1;

while(abs(x*x - num) >= 0.001 )
x = ((num/x) + x) / 2;

return x;

}
``````

if you don’t want to import `math.h` you can write your own `abs()`:

``````float abs(float f) {
if(f < 0)
f = -1*f;
return f;
}
``````

answered Oct 23, 2015 at 11:33 Square Root of a number, given that the number is a perfect square.

The complexity is log(n)

``````/**
* Calculate square root if the given number is a perfect square.
*
* Approach: Sum of n odd numbers is equals to the square root of n*n, given
* that n is a perfect square.
*
* @param number
* @return squareRoot
*/
public static int calculateSquareRoot(int number) {

int sum=1;
int count =1;
int squareRoot=1;
while(sum<number) {
count+=2;
sum+=count;
squareRoot++;
}
return squareRoot;
}
``````

answered Nov 1, 2019 at 5:46 ``````#include <iostream>
using namespace std;
int main()
{
double x = 1, average, s, r;
cout << "Squareroot a Number: ";
cin >> s;
r = s * 2;
for ( ; ; ) //for ; ; ; is to run the code forever until it breaks
{
average = (x + s / x) / 2;
if (x == average)
{
cout << "Answer is : " << average << endl;
return 0;
}
x = average;
}
}
``````

You can try my code 😀
the method that i used here is the Babylonian Squareroot Method
which you can find it here https://en.wikipedia.org/wiki/Methods_of_computing_square_roots

answered Mar 17, 2020 at 3:12 There’s more than one way to Python square roots. Learn 5 approaches to square roots in Python + some bonus advanced tricks.

After learning about 4 ways to square a number in Python, now it’s time to tackle the opposite operation — Python square roots. This article will teach you five distinct ways to take square roots in Python and will finish off with a bonus section on cube roots and square roots of Python lists.

Let’s get started by introducing the topic and addressing the potential issues you have to consider when calculating square roots in Python.

## Introduction to Python Square Roots

Put simply, the square root of a number is a value that returns the same number when multiplied by itself. It’s an inverse operation of squaring.

For example, 3 squared is 9, and a square root of 9 is 3 because 3 x 3 is 9. It’s a concept that’s somewhat difficult to explain in a sentence, but you get the idea as soon as you see it in action.

Before diving into different ways to take square roots in Python, let’s go over the sets of numbers for which you can and can’t take square roots.

### Square root of a positive number

Square roots only play well with positive numbers. For now, ignore the code that’s responsible for calculations and just focus on the results.

``````
b

# Square root of a positive number
a_sqrt  mathsqrt(a)
b_sqrt  mathsqrt(b)

print("Square root of a positive number")
``````

Here’s the output: Image 1 — Square root of a positive number (image by author)

So, 1×1 = 1, and 5×5 = 25 — that’s essentially how square roots work. But what if you were to take a square root of zero?

### Square root of zero

Now, zero is neither a prime nor composite number, so we can’t find its prime factorization. For this reason, a square root of zero is zero:

``````

# Square root of a zero
a_sqrt  mathsqrt(a)

print("Square root of a zero")
``````

Here’s the output: Image 2 — Square root of a zero (image by author)

Only one use case left, and that’s negative numbers.

### Square root of a negative number

There’s no way to calculate a square root of a negative number by using real numbers. Two negative numbers multiplied will always result in a positive number.

Nevertheless, let’s give it a shot:

``````
a

# Square root of a negative number
a_sqrt  mathsqrt(a)

print("Square root of a negative number")
``````

It results in an error: Image 3 — Square root of a negative number (image by author)

There are ways to calculate square roots of negative numbers, and that’s by writing them as a multiple of -1. For instance, -9 can be written as -1 x 9. The result would be 3i. Stepping into the realm of imaginary numbers is out of the scope for today, so I’ll stop here.

Next, let’s go over 5 ways to tackle Python square roots.

## Calculate Square Roots with the sqrt() Function

The first method is actually the one you’ve seen in the previous section. It relies on the `math.pow()` function to do the trick. This module ships with the default Python installation, so there’s no need to install any external libraries.

Below is a code snippet demonstrating how to take square roots in Python using this function:

``````
b
c
d
e

# Method #1 - math.sqrt() function
a_sqrt  mathsqrt(a)
b_sqrt  mathsqrt(b)
c_sqrt  mathsqrt(c)
d_sqrt  mathsqrt(d)
e_sqrt  mathsqrt(e)

print("Method #1 - math.sqrt() function")
``````

And here are the results:

This is probably the one and only method you’ll need, but let’s take a look at some alternatives as well.

## Calculate Square Roots with the pow() Function

If squaring a number means raising it to the power of 2, then taking a square root is essentially raising it to the power of 0.5. That’s exactly the behavior you can implement with the `math.pow()` function. It takes two arguments — the number and the exponent.

Let’s take a look at a couple of examples:

``````
b
c
d
e

# Method #2 - math.pow() function
a_sqrt  mathpow(a, )
b_sqrt  mathpow(b, )
c_sqrt  mathpow(c, )
d_sqrt  mathpow(d, )
e_sqrt  mathpow(e, )

print("Method #2 - math.pow() function")
``````

The output is identical to what we had before:

Neat, but can we eliminate library usage altogether? Sure, here’s how.

## Python’s Exponent Operator (**) for Taking Square Roots

The same logic from the previous function applies here. You can raise a number to the power of 0.5 with Python’s exponent operator. It does the same as `math.pow(x, 0.5)`, but the syntax is shorter and doesn’t rely on any libraries.

Here’s how to use it in Python:

``````b
c
d
e

# Method #3 - Python exponent operator
a_sqrt  a
b_sqrt  b
c_sqrt  c
d_sqrt  d
e_sqrt  e

print("Method #3 - Python exponent operator")
``````

The results are once again identical, no surprises here:

Next, let’s take a look at taking square roots of numbers and arrays with Numpy.

## Numpy — Calculate the Root of a Number or an Array

Numpy is a go-to library for numerical computations in Python. It has a `sqrt()` function built-in, and you can use it to take square roots for both numbers and arrays.

Just keep in mind the return type — it will be `numpy.float64` for a single number and `numpy.ndarray` for the array. Each array element will be of type `numpy.float64`, of course:

`````` numpy  np

b
c
d
e

# Method #4 - Numpy square roots
a_sqrt  npsqrt(a)
b_sqrt  npsqrt(b)
c_sqrt  npsqrt(c)
d_sqrt  npsqrt(d)
e_sqrt  npsqrt(e)
arr_sqrt  npsqrt(arr)

print("Method #4 - Numpy square roots")
``````

Here’s the console output:

This is by far the most convenient method because it relies on a widely-used Python library, and the calculation procedure is the same regardless of the data type coming in.

## Cmath — Take Python Square Roots of Complex Numbers

Remember the story of square roots and negative numbers? Python’s `math` module raised an error but `cmath` is here to save the day. This module is used to work with complex numbers.

In the code snippet below, you’ll see square roots taken from positive integers, floats, complex numbers, and negative numbers:

``````
b
c  cmathpi
d  j
e

# Method #5 - Square roots of complex numbers
a_sqrt  cmathsqrt(a)
b_sqrt  cmathsqrt(b)
c_sqrt  cmathsqrt(c)
d_sqrt  cmathsqrt(d)
e_sqrt  cmathsqrt(e)

print("Method #5 - Square roots of complex numbers")
``````

There are no errors this time: Image 8 — Square roots of complex numbers (image by author)

I’ve never had a need to use this module, but it’s good to know it exists.

Next, let’s go over some more advanced usage examples of Python square roots.

## Bonus: Advanced Python Roots Topics

We’ll now shift gears and discuss a couple of more advanced topics. These include ways to calculate cube roots in Python, and take square roots of vanilla Python lists. Let’s start with the cube roots.

### Cube root in Python

If taking a square root means raising a number to the power of 0.5, then the cube root must be represented by the power of 0.333, or 1/3.

Here’s how to implement this logic in Python, without any external libraries:

``````b
c
d
e

# Bonus #1 - Cube roots
a_cbrt  a  ()
b_cbrt  b  ()
c_cbrt  c  ()
d_cbrt  d  ()
e_cbrt  e  ()

print("Bonus #1 - Cube roots")
``````

The results are printed below:

Numpy provides an easier way to take cube roots in Python. It has a `cbrt()` function built in, which stands for cube root. You can use it both on numbers and arrays, just as with square roots:

`````` numpy  np

b
c
d
e

# Bonus #1.2 - Cube roots with Numpy
a_cbrt  npcbrt(a)
b_cbrt  npcbrt(b)
c_cbrt  npcbrt(c)
d_cbrt  npcbrt(d)
e_cbrt  npcbrt(e)
arr_cbrt  npcbrt(arr)

print("Bonus #1.2 - Cube roots with Numpy")
``````

Let’s take a look at the results:

Yes, it’s that easy.

### Square root of a list in Python

There’s also an easy way to calculate the square root of Python lists, without Numpy. You can simply iterate over the list and take a square root of an individual list item:

``````

# Bonus #2 - Square root of a Python list
num  arr:

print("Bonus #2 - Square root of a Python list")
``````

Here’s the result: Image 11 — Square root of a list (1) (image by author)

Or, if you prefer a more Pythonic approach, there’s no reason not to use a list comprehension and simply the above calculation to a single line of code:

``````

# Bonus #2.2 - Square root of a Python list using list comprehension

print("Bonus #2.2 - Square root of a Python list using list comprehension")
``````

The output is identical: Image 12 — Square root of a list (2) (image by author)

And that’s how easy it is to take square roots in Python — for integers, floats, lists, and even complex numbers. Let’s make a short recap next.

## Conclusion

You now know 5 different ways to calculate Python square roots. In practice, you only need one, but it can’t hurt to know a couple of alternatives. You can use the built-in `math` module, opt for `numpy`, or use the exponent operator and avoid libraries altogether. All approaches work, and the choice is up to you.

### Stay connected

Дополнительно:  Не работает "Шифт" на клавиатуре: инструкция по устранению неполадок
Оцените статью 