TExcelTAD
Home › Algebra › The Square Root Method

The Square Root Method

When a quadratic equation has no xx term, such as 3x2=483x^2 = 48, or is already written as a square equal to a number, such as (x−2)2=9(x - 2)^2 = 9, the fastest solution is to take the square root of both sides. The only thing to remember is that a positive number has two square roots, one positive and one negative.

The basic rule

If x2=k and k>0, then x=k or x=−k, written x=±k.If x2=0, then x=0.If x2=k and k<0, there is no real solution.\begin{aligned} &\text{If } x^2 = k \text{ and } k > 0, \text{ then } x = \sqrt{k} \text{ or } x = -\sqrt{k}, \text{ written } x = \pm\sqrt{k}. \\ &\text{If } x^2 = 0, \text{ then } x = 0. \\ &\text{If } x^2 = k \text{ and } k < 0, \text{ there is no real solution.} \end{aligned}

k\sqrt{k} on its own means the non-negative root (Square Roots), so 9=3\sqrt{9} = 3, not ±3\pm 3. The ±\pm comes from the equation: both 32=93^2 = 9 and (−3)2=9(-3)^2 = 9.

Isolate the square first

3x2−48=03x2=48add 48x2=16divide by 3x=±42x2+5=192x2=14x2=7x=±7≈±2.6458x2+9=0x2=−9no real number squares to a negative: no real solution\begin{aligned} &3x^2 - 48 = 0 \\ &3x^2 = 48 && \text{add 48} \\ &x^2 = 16 && \text{divide by 3} \\ &x = \pm 4 \\[1ex] &2x^2 + 5 = 19 \\ &2x^2 = 14 \\ &x^2 = 7 \\ &x = \pm\sqrt{7} \approx \pm 2.6458 \\[1ex] &x^2 + 9 = 0 \\ &x^2 = -9 && \text{no real number squares to a negative: no real solution} \end{aligned}

(The last equation has the complex solutions x=±3ix = \pm 3i; see The Discriminant and Complex Roots.)

Note: Do not take the square root term by term. x2+9=25x^2 + 9 = 25 does not give x+3=5x + 3 = 5. Isolate x2x^2 first: x2=16x^2 = 16, x=±4x = \pm 4.

A squared binomial

If the equation is (x−h)2=k(x - h)^2 = k, take the root of both sides and then solve the two linear equations:

(x−2)2=9x−2=±3x=2+3=5orx=2−3=−1(2x+1)2=52x+1=±5x=−1±52≈0.618 or −1.618\begin{aligned} &(x - 2)^2 = 9 \\ &x - 2 = \pm 3 \\ &x = 2 + 3 = 5 \quad\text{or}\quad x = 2 - 3 = -1 \\[1ex] &(2x + 1)^2 = 5 \\ &2x + 1 = \pm\sqrt{5} \\ &x = \frac{-1 \pm \sqrt{5}}{2} \approx 0.618 \text{ or } -1.618 \end{aligned}

This is the last step of completing the square, which turns any quadratic into this form. It is also why the quadratic formula has a ±\pm.

Simplify the radical when you can (Simplifying Radicals): x2=50x^2 = 50 gives x=±50=±52x = \pm\sqrt{50} = \pm 5\sqrt{2}.

In Python

math.sqrt returns the non-negative root, so the code adds the minus version itself. For whole numbers, math.isqrt gives an exact integer square root and lets you tell whether the answer is a whole number:

python · try it yourself
import math

def solve_square(a, c):
    """Solve a·x² + c = 0."""
    k = -c / a
    if k < 0:
        return []
    if k == 0:
        return [0.0]
    r = math.sqrt(k)
    return [-r, r]

print(solve_square(3, -48))
print([round(x, 4) for x in solve_square(2, -14)])
print(solve_square(1, 9))

for n in [16, 50, 1_000_000_007 ** 2]:
    r = math.isqrt(n)
    print(n, "perfect square" if r * r == n else "not a perfect square", r)
[-4.0, 4.0]
[-2.6458, 2.6458]
[]
16 perfect square 4
50 not a perfect square 7
1000000014000000049 perfect square 1000000007

math.isqrt works on integers of any size without rounding, which math.sqrt (a float) cannot do for numbers beyond about 2532^{53}.

SymPy gives exact, simplified roots:

python · try it yourself
import sympy as sp

x = sp.symbols("x")
print(sp.solve(sp.Eq(x**2, 50), x))
print(sp.solve(sp.Eq((2*x + 1)**2, 5), x))
print(sp.solve(x**2 + 9, x))
[-5*sqrt(2), 5*sqrt(2)]
[-1/2 + sqrt(5)/2, -sqrt(5)/2 - 1/2]
[-3*I, 3*I]

In software

  • Time to fall. An object dropped from rest falls d=12gt2d = \frac{1}{2}gt^2, so the time to fall a height dd is t=2d/gt = \sqrt{2d/g}. Only the positive root is a time. A game uses this to time a falling-platform sound or to decide whether a character can survive a drop.
  • Circle and sphere tests. A point (x,y)(x, y) is on a circle of radius rr around the origin when x2+y2=r2x^2 + y^2 = r^2. Given xx, the square root method gives the two yy values ±r2−x2\pm\sqrt{r^2 - x^2}, which is how code draws a circle one column at a time.
  • Skip the root. To compare distances, compare squared distances: dx2+dy2<r2dx^2 + dy^2 < r^2 is the same test as dx2+dy2<r\sqrt{dx^2 + dy^2} < r (both sides are non-negative) and avoids a sqrt call in a hot loop. Collision code does this everywhere (collision geometry).
python · try it yourself
import math

g = 9.81
for d in [1.0, 5.0, 20.0]:
    print(f"fall {d:4.1f} m takes {math.sqrt(2 * d / g):.3f} s")

r = 5
print("circle points at x = 3:", (3, math.sqrt(r*r - 3*3)), (3, -math.sqrt(r*r - 3*3)))
dx, dy = 3.0, 4.5
print("inside radius 5?", dx*dx + dy*dy < r*r)
fall  1.0 m takes 0.452 s
fall  5.0 m takes 1.010 s
fall 20.0 m takes 2.019 s
circle points at x = 3: (3, 4.0) (3, -4.0)
inside radius 5? False

Exercises

Exercise 1: Isolate and solve

Solve 5x2−80=05x^2 - 80 = 0.

Answer

x=±4x = \pm 4

Solution

5x2=805x^2 = 80, x2=16x^2 = 16, x=±4x = \pm 4.

Exercise 2: Irrational roots

Solve 4x2=274x^2 = 27 and simplify the radical.

Answer

x=±332≈±2.598x = \pm\frac{3\sqrt{3}}{2} \approx \pm 2.598

Solution
x2=274x=±274=±332\begin{aligned} x^2 &= \frac{27}{4} \\ x &= \pm\frac{\sqrt{27}}{\sqrt{4}} = \pm\frac{3\sqrt{3}}{2} \end{aligned}

Exercise 3: Squared binomial

Solve (x+4)2−7=18(x + 4)^2 - 7 = 18.

Answer

x=1x = 1 or x=−9x = -9

Solution
(x+4)2=25x+4=±5x=1 or x=−9\begin{aligned} &(x + 4)^2 = 25 \\ &x + 4 = \pm 5 \\ &x = 1 \text{ or } x = -9 \end{aligned}

Exercise 4: No real solution?

Which of these have real solutions? (a) x2+3=0x^2 + 3 = 0 (b) (x−1)2=0(x - 1)^2 = 0 (c) −2x2+8=0-2x^2 + 8 = 0

Answer

(b) has one solution x=1x = 1; (c) has x=±2x = \pm 2; (a) has none.

Solution
(a)x2=−3<0no real solution(b)x−1=0x=1 (double root)(c)x2=4x=±2\begin{aligned} &\text{(a)}\quad x^2 = -3 < 0 && \text{no real solution} \\ &\text{(b)}\quad x - 1 = 0 && x = 1 \text{ (double root)} \\ &\text{(c)}\quad x^2 = 4 && x = \pm 2 \end{aligned}

Exercise 5: How high was the drop?

A dropped phone hits the floor after 0.55 s. Use d=12gt2d = \frac{1}{2}gt^2 with g=9.81g = 9.81 to find the height, then solve back for tt from that height in code to check.

Answer

About 1.484 m.

Solution
python · try it yourself
import math

g, t = 9.81, 0.55
d = 0.5 * g * t * t
print("height:", round(d, 4), "m")
print("time back from height:", round(math.sqrt(2 * d / g), 4), "s")
height: 1.4838 m
time back from height: 0.55 s

Test yourself

Solve x2=121x^2 = 121.

  1. x=11x = 11
  2. x=−11x = -11
  3. x=±11x = \pm 11
  4. x=±60.5x = \pm 60.5

What is the first step to solve 7+2x2=397 + 2x^2 = 39?

  1. Take the square root of both sides
  2. Subtract 7 from both sides
  3. Divide by 2x2x
  4. Factor 39

Solve (x−3)2=16(x - 3)^2 = 16.

  1. x=7x = 7 or x=−1x = -1
  2. x=7x = 7 only
  3. x=±4x = \pm 4
  4. x=19x = 19 or x=−13x = -13