TExcelTAD
Home › Basic Math & Pre-Algebra › Square Roots

Square Roots

The square root of a number is the value that, multiplied by itself, gives that number: 49=7\sqrt{49} = 7 because 7×7=497 \times 7 = 49. Square roots undo squaring, and they appear whenever you turn an area back into a length, compute a distance, or measure spread in statistics.

Definition and vocabulary

x=rmeansr2=x  and  r≥0\sqrt{x} = r \quad \text{means} \quad r^2 = x \ \text{ and } \ r \ge 0

The symbol  \sqrt{\ } is the radical sign, and the number under it is the radicand. Every positive number has two numbers that square to it (72=497^2 = 49 and (−7)2=49(-7)^2 = 49), but  \sqrt{\ } always means the principal, non-negative one. When both are needed we write ±49=±7\pm\sqrt{49} = \pm 7.

Perfect squares

Numbers like 1, 4, 9, 16, 25 are perfect squares: their roots are whole numbers.

nn 1 2 3 4 5 6 7 8 9 10 11 12 15 20 25
n2n^2 1 4 9 16 25 36 49 64 81 100 121 144 225 400 625

The square root of any other whole number is irrational: its decimals go on forever without repeating. 2=1.41421356…\sqrt{2} = 1.41421356\ldots is the most famous example.

Estimating

You can bracket a root between two perfect squares. For 50\sqrt{50}: 49<50<6449 < 50 < 64, so 7<50<87 < \sqrt{50} < 8, and since 50 is very close to 49, 50\sqrt{50} is just over 7 (it is about 7.071).

A quick refinement: x≈a+x−a22a\sqrt{x} \approx a + \frac{x - a^2}{2a}, where a2a^2 is the nearest perfect square. For 50\sqrt{50}: 7+114≈7.0717 + \frac{1}{14} \approx 7.071. That is one step of Newton's method, which repeats the idea until the answer stops changing:

python · try it yourself
def newton_sqrt(x, steps=5):
    guess = x / 2
    for i in range(steps):
        guess = (guess + x / guess) / 2
        print(f"step {i + 1}: {guess:.10f}")
    return guess

newton_sqrt(50)
step 1: 13.5000000000
step 2: 8.6018518519
step 3: 7.2072768409
step 4: 7.0723549068
step 5: 7.0710679290

Each step averages the guess with x/guessx / \text{guess}: if the guess is too big, x/guessx / \text{guess} is too small, so their average is closer. The number of correct digits roughly doubles each step. Square-root routines in libraries and hardware use refinements like this.

Square roots in Python

python · try it yourself
import math

print(math.sqrt(49))
print(math.sqrt(50))
print(50 ** 0.5)
print(math.isqrt(50), "(integer square root, rounded down)")
print(math.sqrt(2) ** 2, "(not exactly 2: floating point)")

try:
    math.sqrt(-4)
except ValueError as e:
    print("math.sqrt(-4) ->", e)
import cmath
print("cmath.sqrt(-4) =", cmath.sqrt(-4))
7.0
7.0710678118654755
7.0710678118654755
7 (integer square root, rounded down)
2.0000000000000004 (not exactly 2: floating point)
math.sqrt(-4) -> math domain error
cmath.sqrt(-4) = 2j

Note: There is no real number whose square is negative, so math.sqrt(-4) fails. The cmath module (and the ** operator) instead return a complex number, 2j, where j stands for −1\sqrt{-1} in Python. Complex numbers are covered later in the calculus course; for now, keep radicands non-negative.

Use math.isqrt for exact integer work, such as checking whether a big number is a perfect square: math.isqrt(n) ** 2 == n.

Rules for square roots

For non-negative aa and bb:

a⋅b=a⋅b36⋅4=6⋅2=12a/b=a/b9/25=3/5a2=∣a∣(−5)2=25=5\begin{aligned} \sqrt{a \cdot b} &= \sqrt{a} \cdot \sqrt{b} && \sqrt{36 \cdot 4} = 6 \cdot 2 = 12 \\ \sqrt{a / b} &= \sqrt{a} / \sqrt{b} && \sqrt{9/25} = 3/5 \\ \sqrt{a^2} &= \lvert a \rvert && \sqrt{(-5)^2} = \sqrt{25} = 5 \end{aligned}

But a+b≠a+b\sqrt{a + b} \ne \sqrt{a} + \sqrt{b}: 9+16=25=5\sqrt{9 + 16} = \sqrt{25} = 5, not 3+4=73 + 4 = 7. The product rule is the basis of the next lesson, Simplifying Radicals.

In software

  • Distances: the length of a vector and the distance between two points both end with a square root (Pythagorean theorem). Game engines avoid it when they can by comparing squared distances.
  • Normalising vectors: dividing by the length x2+y2\sqrt{x^2 + y^2} gives a direction of length 1 (see length and normalize). The famous "fast inverse square root" hack from the game Quake III computed 1/x1/\sqrt{x} this way, with a bit trick plus one Newton step.
  • Statistics: the standard deviation is the square root of the variance, bringing squared units back to the original ones.
  • Algorithms: to test if nn is prime you only try divisors up to n\sqrt{n}, because any larger factor pairs with a smaller one.

Exercises

Exercise 1: Exact roots

Find 144\sqrt{144}, 0.25\sqrt{0.25}, 16/81\sqrt{16/81} and 106\sqrt{10^6}.

Answer

12, 0.5, 4/94/9, 1000.

Solution
144=12122=1440.25=0.50.52=0.2516/81=16/81=4/9106=103=1000halve the exponent: (103)2=106\begin{aligned} \sqrt{144} &= 12 && 12^2 = 144 \\ \sqrt{0.25} &= 0.5 && 0.5^2 = 0.25 \\ \sqrt{16/81} &= \sqrt{16} / \sqrt{81} = 4/9 \\ \sqrt{10^6} &= 10^3 = 1000 && \text{halve the exponent: } (10^3)^2 = 10^6 \end{aligned}

Exercise 2: Bracket

Between which two whole numbers is 90\sqrt{90}? Which one is it closer to?

Answer

Between 9 and 10, closer to 9 (90≈9.49\sqrt{90} \approx 9.49).

Solution

81<90<10081 < 90 < 100, so 9<90<109 < \sqrt{90} < 10. 90 is 9 above 81 and 10 below 100, so it is a little closer to 9; the estimate 9+9/18=9.59 + 9/18 = 9.5 is close to the true 9.487.

Exercise 3: Perfect square test

Write is_square(n) using math.isqrt and list the perfect squares among 120 … 200.

Answer

121, 144, 169, 196.

Solution
python · try it yourself
import math

def is_square(n):
    r = math.isqrt(n)
    return r * r == n

print([n for n in range(120, 201) if is_square(n)])
[121, 144, 169, 196]

Exercise 4: Room size

A square room has an area of 30 m230\ \text{m}^2. How long is each wall, to the nearest centimetre?

Answer

About 5.48 m.

Solution

Side=30\text{Side} = \sqrt{30}. Since 52=255^2 = 25 and 62=366^2 = 36, the side is between 5 and 6 m. 30≈5.4772\sqrt{30} \approx 5.4772, which rounds to 5.48 m.

python · try it yourself
import math
print(round(math.sqrt(30), 2))
5.48

Test yourself

What is 81\sqrt{81}?

  1. ±9\pm 9
  2. 9
  3. 40.5
  4. −9

Which is true?

  1. 9+16=7\sqrt{9 + 16} = 7
  2. 4⋅25=10\sqrt{4 \cdot 25} = 10
  3. −9=−3\sqrt{-9} = -3
  4. x2=x\sqrt{x^2} = x for every xx

70\sqrt{70} lies between which two whole numbers?

  1. 6 and 7
  2. 7 and 8
  3. 8 and 9
  4. 34 and 35