A quadratic is a non-linear polynomial equation in a single variable where at least one term contains the variable raised to the power 2. That is, it is a 2nd degree polynomial. A quadratic equation has the canonical or standard form:
There are three fundamental methods for solving quadratic equations:ax2 + bx + c = 0, a ≠ 0
For two factors, p and q, the product p×q = 0 only if p = 0 or q = 0. For example, the quadratic:
Can be factored into:x2 - 3x + 2 = 0
Using the zero-factor property, we get the solution set {1, 2}.(x - 1)(x - 2) = 0
An equation in the form y2 = s has two solutions: y = ±√s. A quadratic equation may be transformed into the form:
Adding the quantity d2/4 to both sides of the equation results in:x2 + dx = f
The left hand side is a perfect square, so we can write:x2 + dx + d2/4 = f + d2/4
Then, application of the square root property gives:(x + d/2)2 = f + d2/4
__________
x + d/2 = ± √ f + d2/4
__________
x = -d/2 ± √ f + d2/4
Example:
x2 + 8x - 9 = 0 x2 + 8x = 9 x2 + 8x + 16 = 9 + 16 (x + 4)2 = 25 x + 4 = ±5 x = -4 ± 5 = 1 or -9
The quadratic formula can be derived from the canonical quadratic equation by completing the square. Let:
Rewrite as:ax2 + bx + c = 0
Next, complete the square:x2 + (b/a)x = -c/a
Then we get:x2 + (b/a)x + (b/2a)2 = -c/a + (b/2a)2
Applying the square root property gives:(x + b/2a)2 = -c/a + b2/4a2 = (b2 - 4ac)/4a2
_________
b ±√ b2 - 4ac
x + ———— = —————————————
2a 2a
The solution is the quadratic formula:
_________
-b ± √ b2 - 4ac
x = —————————————————
2a
The factor (b2 - 4ac) in the quadratic formula is known as the
discriminant. The value of the discriminant determines the number and type of
solutions as shown in the table below.
Example, solve:b² - 4ac solutions > 0 2 real = 0 l real < 0 2 complex
The value of the discriminant is:x2 - 6x + 25 = 0
Then there are 2 complex solutions:(-6)2 - 4×1×25 = 36 - 100 = -64
_____
6 ± √ -64
x = ———————————— = 3 ± 4i
2
When the coefficients of the quadratic equation are real numbers and if the discriminant is negative, there will
be a pair of complex conjugate solutions for the variable.
Below is a procedure written in the Zeno programming language to compute and print the solutions to a quadratic equation having real coefficients.
procedure quadratic(a, b, c : real)
var dsc : real := b*b - 4*a*c
var r, z, x1, x2 : real
if dsc < 0 then
r := -b/(2*a)
z := sqrt(-dsc)/(2*a)
put "{", r:6:12, " + ", z:6:12, "i, "...
put r:6:12, " - ", z:6:12, "}"
elsif dsc > 0 then
r := -b/(2*a)
z := sqrt(dsc)/(2*a)
x1 := r + z
x2 := r - z
put "{", x1:6:12, ", ", x2:6:12, "}"
else
r := -b/(2*a)
put "{", r:6:12, "}"
end if
end procedure