| home | contents | previous | next page | send comment | send link | add bookmark |

6.3. Quadratic equations

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:

ax2 + bx + c = 0, a ≠ 0
There are three fundamental methods for solving quadratic equations:

Factor and apply the zero-factor property

For two factors, p and q, the product p×q = 0 only if p = 0 or q = 0. For example, the quadratic:

x2 - 3x + 2 = 0 
Can be factored into:
(x - 1)(x - 2) = 0
Using the zero-factor property, we get the solution set {1, 2}.

Complete the square and apply the square root property

An equation in the form y2 = s has two solutions: y = ±√s. A quadratic equation may be transformed into the form:

x2 + dx = f
Adding the quantity d2/4 to both sides of the equation results in:
x2 + dx + d2/4 = f + d2/4
The left hand side is a perfect square, so we can write:
(x + d/2)2 = f + d2/4
Then, application of the square root property gives:
             __________
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

Apply the quadratic formula

The quadratic formula can be derived from the canonical quadratic equation by completing the square. Let:

ax2 + bx + c = 0
Rewrite as:
x2 + (b/a)x = -c/a
Next, complete the square:
x2 + (b/a)x + (b/2a)2 = -c/a +  (b/2a)2
Then we get:
(x + b/2a)2 = -c/a + b2/4a2 = (b2 - 4ac)/4a2 
Applying the square root property gives:
              _________
      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.
b² - 4ac     solutions
  > 0        2 real
  = 0        l real
  < 0        2 complex
Example, solve:
x2 - 6x + 25 = 0
The value of the discriminant is:
(-6)2 - 4×1×25 = 36 - 100 = -64
Then there are 2 complex solutions:
          _____
     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


| home | contents | previous | next page | send comment | send link | add bookmark |

Copyright © 2005, Stephen R. Schmitt