Defining Quadratic Equations
A quadratic equation is an equation of degree 2: the variable appears squared, and no higher power appears. Quadratics describe anything that speeds up or slows down at a steady rate, from a thrown ball to the area of a growing square. This lesson defines the standard form, explains what a solution (a root) is, and gives an overview of the five ways to solve one, each covered in its own lesson.
Standard form
A quadratic equation in standard form is
is the coefficient of the quadratic term, of the linear term, and is the constant term. If were 0, the term would vanish and the equation would be linear, which is why is part of the definition. and may be 0.
| Equation | Standard form | |||
|---|---|---|---|---|
| already | 1 | −5 | 6 | |
| 3 | 0 | −12 | ||
| 1 | −7 | 0 | ||
| 1 | −1 | −10 | ||
| , or | 2 | 1 | −5 |
To get standard form, expand any products (Multiplying Polynomials), move every term to one side, and combine like terms. Multiplying the whole equation by −1 to make positive is allowed and often convenient.
Note: is not quadratic (degree 3), and is not a polynomial equation at all. An equation is quadratic only if, in standard form, the highest power is exactly 2.
Roots
A solution or root of is a number that makes the equation true. To check a candidate, substitute it:
A quadratic has at most two roots. Graphically, the roots are where the parabola crosses the x-axis. A parabola can cross it twice, touch it once, or miss it entirely, so there are three cases: two real roots, one repeated root, or no real roots (the roots are then complex numbers, see The Discriminant and Complex Roots).
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 5, 200)
plt.figure(figsize=(6, 4))
for (a, b, c), label in [((1, -5, 6), "x² − 5x + 6: two roots"),
((1, -4, 4), "x² − 4x + 4: one root"),
((1, -3, 4), "x² − 3x + 4: no real root")]:
plt.plot(x, a * x**2 + b * x + c, label=label)
plt.axhline(0, color="black", linewidth=0.8)
plt.ylim(-2, 8)
plt.legend()
plt.title("Roots are where the parabola meets the x-axis")
plt.show()
print("plotted three parabolas: two, one and zero x-intercepts")plotted three parabolas: two, one and zero x-intercepts
Five ways to solve
| Method | Best when | Lesson |
|---|---|---|
| factoring | the trinomial factors nicely over the integers | Solving by Factoring |
| square root method | there is no term () or it is | The Square Root Method |
| completing the square | you want the vertex form, or to derive the formula | Completing the Square |
| quadratic formula | always works | The Quadratic Formula |
| graphing | estimating, or seeing the shape | Solving Quadratics by Graphing |
SymPy can solve any quadratic exactly, which is handy for checking:
import sympy as sp
x = sp.symbols("x")
print(sp.expand((x + 2)*(x - 3) - 4)) # standard form of (x+2)(x−3) = 4
print(sp.solve(x**2 - 5*x + 6, x))
print(sp.solve(sp.Eq((x + 2)*(x - 3), 4), x))
print(sp.solve(x**2 - 3*x + 4, x))x**2 - x - 10
[2, 3]
[1/2 - sqrt(41)/2, 1/2 + sqrt(41)/2]
[3/2 - sqrt(7)*I/2, 3/2 + sqrt(7)*I/2]
SymPy writes the imaginary unit as I. The last equation has no real roots, so its roots are complex.
In software: when does it hit the ground?
The height of an object thrown straight up, ignoring air resistance, is
with starting height , launch speed and . Asking "when is the height 0?" gives a quadratic equation in . A game uses exactly this to predict where a grenade lands or when a jumping character touches the floor (see Collision Timing with Quadratics and game physics integration).
import sympy as sp
t = sp.symbols("t")
h0, v0, g = 2, 12, sp.Rational(981, 100) # metres, m/s, m/s²
h = h0 + v0*t - g*t**2/2
print("standard form:", sp.expand(h), "= 0")
roots = sp.solve(h, t)
for r in roots:
print("t =", round(float(r), 3), "s")
print("lands at t ≈", round(float(max(roots)), 3), "s (the negative root is before the throw)")standard form: -981*t**2/200 + 12*t + 2 = 0
t = -0.157 s
t = 2.603 s
lands at t ≈ 2.603 s (the negative root is before the throw)
Both roots are valid algebra, but only the positive one is physically meaningful. Choosing the right root is a normal part of applying quadratics.
Exercises
Exercise 1: Is it quadratic?
Which are quadratic equations? (a) (b) (c) (d)
Answer
(a), (c) and (d). (b) is linear.
Solution
Exercise 2: Standard form
Write in standard form and give , , .
Answer
: , , .
Solution
Exercise 3: Check roots
Which of , and are roots of ?
Answer
and .
Solution
from fractions import Fraction as F
for x in [F(-2), F(1, 3), F(3)]:
print(x, 3*x**2 + 5*x - 2)-2 0
1/3 0
3 40
Exercise 4: Write the equation
A rectangle is 3 m longer than it is wide and has area . Write a quadratic equation for the width in standard form and find by testing whole numbers.
Answer
; m (the other root, −8, is not a length).
Solution
Test yourself
In , written as with , what are ?
- 3, 2, −7
- −3, 2, 7
- 3, −2, 7
- 7, −3, 2
How many real roots can a quadratic equation have?
- Exactly 2
- 0, 1 or 2
- Any number
- At least 1
Why must in ?
- Otherwise there are no roots
- Otherwise the roots are complex
- Otherwise the equation is linear, not quadratic
- Because the formula divides by