A16-QuadraticFormulaDiscrim.mws

High School Modules > Algebra by Gregory A. Moore

     The Quadratic Formula & Discriminant

The derivation and use of the quadratic formula and discriminat.

[Directions : Execute the Code Resource section first. Although there will be no output immediately, these definitions are used later in this worksheet.]

 

0. Code

>    restart;

>    Quadratic  :=  proc( expr )
   local a, b, c, soln, k;
   a := coeff(expr,x,2); b := coeff(expr,x,1);  c := coeff(expr,x,0);
   printf("\t\t\t\t  Quadratic Equation : \t%A = 0\n",expr);
   printf("\t\t\t\t  Coefficients :\t\t\t\t\t\t\t\ta=%d\t\t\t b=%d\t\t\t c=%d\n",
                  a,b,c);
   soln := [solve( expr = 0, x)];
   if(nops(soln) = 1)
      then printf("\t\t\t\t  Solution : %A\n\n",soln[1]);
            soln[1];
      else printf("\t\t\t\t  Solutions :\t\t\t\t\t\t\t\t\t\t\t%A\t\t%A\n\n",
                 soln[1],soln[2]);
             soln[1],soln[2];
   fi;
 end proc:

>    Discriminant  :=  proc( expr )
   local a, b, c, soln, k, D;
   a := coeff(expr,x,2); b := coeff(expr,x,1);  c := coeff(expr,x,0);
   printf("\t\t\t\t  Quadratic Equation : \t%A = 0\n",expr);
   printf("\t\t\t\t  Coefficients :\t\t\t\t\t\t\t\ta=%d\t\t\t b=%d\t\t\t c=%d\n",
                  a,b,c);
   D := b*b - 4*a*c;
   printf("\t\t\t\t  Discriminant =\t\t\t\t\t\t\t\t%d\n",D);
   
   if( D > 0)
      then printf("\t\t\t\t  There are two distinct real roots.\n\n");
           
      else if( D < 0)
           then printf("\t\t\t\t  There are two distinct complex roots.\n\n");
           else printf("\t\t\t\t  There is one real root. This quadratic expression is a perfect square.\n\n");
   fi;fi;
   if( D = floor(sqrt(D))^2)
      then
      printf("\t\t\t\t  This expression is factorable. \n\n"); print( factor(expr));
      else
      printf("\t\t\t\t  This expression is NOT factorable. \n\n");
   fi;
   print( solve( expr, x) );
 end proc:

>   

>    CompleteStepsMore := proc(EQ)  
           #ONLY for case when leading coef­ 1 <<DUPLICATE of other worksheet>>
  local EQ2,EQ3,A,B,C,b, lt, sg, subEQ, rEQ,g ;
  

  use RealDomain in

  print(`Original Equation :`); print(EQ);
  subEQ := sort(op(1,EQ)-op(2,EQ), x);
  A := coeff(subEQ,x,2); B := coeff(subEQ,x,1); C := coeff(subEQ,x,0);
  g := A;
  if( B <> 0 ) then g := gcd( g, B); fi;
  if( C <> 0 ) then g := gcd( g, C); fi;
  
  EQ3 := (subEQ - C)/g = - C/g;  
  
  lt := coeff((subEQ/g),x,2);
  if(lt=1) then CompleteSteps(EQ3);
  else
    
    print(`\n1. Factor out any commong terms, and `,
          `put x terms on left, number term on right :`);
    print(EQ3); print(` `);
    A := A/g;  sg := A/abs(A);
    if( sg = -1) then
      EQ3 := -lhs(EQ3) = -rhs(EQ3);
      print(`(If the coefficient of x^2 is negative,`,
            ` multiply both sides by -1)`);
      print(EQ3); print(` `);
    fi;

    lt := abs(A);
    subEQ := lhs(EQ3)/lt;  rEQ := rhs(EQ3);
    print(`Factor the leading coefficient from the left side`);
  print(cat(lt,`(`,subEQ,`) = `, rEQ));

  b := coeff( subEQ, x);
  print(`\n2. Take half of the x coefficient`,b,
         ` and square it to get `, (b/2)^2);
  print(`..then MULTIPLY it by leading coefficient factor`,lt,
        ` and add to both sides :`);
  
  subEQ := subEQ + (b/2)^2;     
  print(cat(
         lt,`(`,subEQ,`) = `,rEQ,` + `,lt,`*`,(b/2)^2, `)`
           ));
  rEQ := rEQ + lt*(b/2)^2;

  EQ2 := lt*subEQ = rEQ;

  print(` `);
  print(` `); print(`\n3. Take the square root of each side (with +/-)`);
  EQ2 := factor(lhs(EQ2)) = rhs(EQ2);     print(EQ2);

  
  EQ3 := sqrt(lhs(%)) = sqrt(rhs(%));
  lt:= op(1, lhs(EQ3));     rEQ := rhs(EQ3);
  subEQ := op(1, op(2, lhs(EQ2)));
  
  print(` `); print(`\n4. Now solve the two linear equations :`);
  print(cat(      lt,`(`, subEQ ,`) = `, rEQ      ));
  print(cat(      lt,`(`, convert(subEQ, string) ,`) = `, -rEQ      ));
  print(` `);
  print( lt*subEQ = rEQ);
  print( lt*subEQ = -rEQ);
  print(` `);

  
  print(x = {solve(EQ2, x)});
  fi;
end use;
end proc:

>   

1. Derivation of the Formula


You might recall that we can solve any quadratic equation by completing the square.

>    CompleteStepsMore( 3*x^2 + 30*x + 1 = 0);

`Original Equation :`

3*x^2+30*x+1 = 0

`\n1. Factor out any commong terms, and `, `put x terms on left, number term on right :`
`\n1. Factor out any commong terms, and `, `put x terms on left, number term on right :`

3*x^2+30*x = -1

` `

`Factor the leading coefficient from the left side`

`3(` || (x^2+10*x) || `) = ` || (-1)

`\n2. Take half of the x coefficient`, 10, ` and square it to get `, 25
`\n2. Take half of the x coefficient`, 10, ` and square it to get `, 25

`..then MULTIPLY it by leading coefficient factor`, 3, ` and add to both sides :`

`3(` || (x^2+10*x+25) || `) = ` || (-1) || ` + ` || 3 || `*` || 25 || `)`

` `

` `

`\n3. Take the square root of each side (with +/-)`
`\n3. Take the square root of each side (with +/-)`

3*(x+5)^2 = 74

` `

`\n4. Now solve the two linear equations :`
`\n4. Now solve the two linear equations :`

`` || (3^(1/2)) || `(` || (x+5) || `) = ` || (74^(1/2))

`` || (3^(1/2)) || `(` || (

` `

3^(1/2)*(x+5) = 74^(1/2)

3^(1/2)*(x+5) = -74^(1/2)

` `

x = {-5+1/3*222^(1/2), -5-1/3*222^(1/2)}


Each of those problems is a bit long, and we seem to be doing the same steps over and over each time. Is there a way to 'cut to the chase' and get the result of that method faster? What if we did for a general quadratic polynomial with letters instead of numbers.

>    CompleteStepsMore( a*x^2 + b*x + c = 0);

`Original Equation :`

a*x^2+b*x+c = 0

`\n1. Factor out any commong terms, and `, `put x terms on left, number term on right :`
`\n1. Factor out any commong terms, and `, `put x terms on left, number term on right :`

a*x^2+b*x = -c

` `

`Factor the leading coefficient from the left side`

`` || (abs(a)) || `(` || ((a*x^2+b*x)/abs(a)) || `) = ` || (-c)

`\n2. Take half of the x coefficient`, b/abs(a), ` and square it to get `, 1/4*b^2/abs(a)^2
`\n2. Take half of the x coefficient`, b/abs(a), ` and square it to get `, 1/4*b^2/abs(a)^2

`..then MULTIPLY it by leading coefficient factor`, abs(a), ` and add to both sides :`

`` || (abs(a)) || `(` || ((a*x^2+b*x)/abs(a)+1/4*b^2/abs(a)^2) || `) = ` || (-c) || ` + ` || (abs(a)) || `*` || (1/4*b^2/abs(a)^2) || `)`

` `

` `

`\n3. Take the square root of each side (with +/-)`
`\n3. Take the square root of each side (with +/-)`

1/4*1/abs(a)*(4*x^2*abs(a)*a+4*x*abs(a)*b+b^2) = -c+1/4*1/abs(a)*b^2

` `

`\n4. Now solve the two linear equations :`
`\n4. Now solve the two linear equations :`

`` || (1/2) || `(` || (abs(a)) || `) = ` || (1/2*(-4*c+1/abs(a)*b^2)^(1/2))

`` || (1/2) || `(` || (

` `

1/2*abs(a) = 1/2*(-4*c+1/abs(a)*b^2)^(1/2)

1/2*abs(a) = -1/2*(-4*c+1/abs(a)*b^2)^(1/2)

` `

x = {1/2/a*(-b+(b^2-4*a*c)^(1/2)), 1/2/a*(-b-(b^2-4*a*c)^(1/2))}



We get the formula above. This is called the Quadratic Formula. It is usually written a little differently in texts, as a single fraction with a 2a in the denomiator and a "plus-or-minus" in front of the squareroot to accomodate both cases at once. It gives us a quick way of solving any quadratic formula.

>    solve( a*x^2 + b*x + c = 0, x);

1/2/a*(-b+(b^2-4*a*c)^(1/2)), 1/2/a*(-b-(b^2-4*a*c)^(1/2))

2. Solving Problems


 Here is that formula.

>    QuadForm := solve( a*x^2 + b*x + c = 0, x);

QuadForm := 1/2/a*(-b+(b^2-4*a*c)^(1/2)), 1/2/a*(-b-(b^2-4*a*c)^(1/2))



Here is an example.

>    QuadEq := x^2 + 9*x + 20 = 0;

QuadEq := x^2+9*x+20 = 0


Now lets substitute for a, b, and c - the coefficients of x^2, x, and the constant term. Note that x^2 means 1*x^2.

>    subs( { a = 1, b = 9, c = 20}, {QuadForm });

{-5, -4}


We can check our answer using Maple's solve command - and in this case, it factors.

>    solve( QuadEq, x);
factor( lhs(QuadEq) );

-4, -5

(x+5)*(x+4)

>    3*x^2 + 7*x + 4 ;
simplify(  subs(     { a = coeff(%,x,2) , b = coeff(%,x,1),
                       c = coeff(%,x,0)    }, {QuadForm } ));

3*x^2+7*x+4

{-1, -4/3}


Here is a little procesdure that identifies the coefficients and finds the solutions

>    Quadratic( 5*x^2 + 7*x + 4);

				  Quadratic Equation : 	5*x^2+7*x+4 = 0

				  Coefficients :								a=5			 b=7			 c=4

				  Solutions :											-7/10+1/10*I*31^(1/2)		-7/10-1/10*I*31^(1/2)

-7/10+1/10*I*31^(1/2), -7/10-1/10*I*31^(1/2)

>    Quadratic( 6*x^2 - 216 );

				  Quadratic Equation : 	6*x^2-216 = 0

				  Coefficients :								a=6			 b=0			 c=-216

				  Solutions :											6		-6

6, -6

>    Quadratic( x^2 + 7*x );

				  Quadratic Equation : 	x^2+7*x = 0

				  Coefficients :								a=1			 b=7			 c=0

				  Solutions :											0		-7

0, -7

>    Quadratic( x^2  + 12 );

				  Quadratic Equation : 	x^2+12 = 0

				  Coefficients :								a=1			 b=0			 c=12

				  Solutions :											2*I*3^(1/2)		-2*I*3^(1/2)

2*I*3^(1/2), -2*I*3^(1/2)


 

3. The Discriminant


The expression D =
b^2-4*a*c  is called the discriminant  for a quadratic equation. You may recognize it as the quanitity under the radical sign in the quadratic formula.

>     solve( a*x^2 + b*x + c = 0, x);

1/2/a*(-b+(b^2-4*a*c)^(1/2)), 1/2/a*(-b-(b^2-4*a*c)^(1/2))


We can thus express the quadratic formula in this form :

>    Discr :=  b^2 -4*a*c;

Discr := b^2-4*a*c

>    x1 = (1/(2*a))*(-b + sqrt(Discr) );
x2 = (1/(2*a))*(-b - sqrt(Discr) );

x1 = 1/2/a*(-b+(b^2-4*a*c)^(1/2))

x2 = 1/2/a*(-b-(b^2-4*a*c)^(1/2))



The discriminant tells us about the number and quality of roots of the equation. There are three possibilities :
         
1 . D is positive          the equation has two   real , but distint solutions
         2 . D is zero                the equation has   one real  solution
         
3 . D is negative          the equation has two   complex   solutions

Lets look at examples of each case :

>    Discriminant( x^2 + 3*x + 1);

				  Quadratic Equation : 	x^2+3*x+1 = 0

				  Coefficients :								a=1			 b=3			 c=1

				  Discriminant =								5

				  There are two distinct real roots.

				  This expression is NOT factorable. 

-3/2+1/2*5^(1/2), -3/2-1/2*5^(1/2)

>    Discriminant( x^2 + 2*x + 1);

				  Quadratic Equation : 	x^2+2*x+1 = 0

				  Coefficients :								a=1			 b=2			 c=1

				  Discriminant =								0

				  There is one real root. This quadratic expression is a perfect square.

				  This expression is factorable. 

(x+1)^2

-1, -1

>    Discriminant( x^2 + 1*x + 1);

				  Quadratic Equation : 	x^2+x+1 = 0

				  Coefficients :								a=1			 b=1			 c=1

				  Discriminant =								-3

				  There are two distinct complex roots.

				  This expression is NOT factorable. 

-1/2+1/2*I*3^(1/2), -1/2-1/2*I*3^(1/2)

>    Discriminant( x^2 + 102*x + 1);

				  Quadratic Equation : 	x^2+102*x+1 = 0

				  Coefficients :								a=1			 b=102			 c=1

				  Discriminant =								10400

				  There are two distinct real roots.

				  This expression is NOT factorable. 

-51+10*26^(1/2), -51-10*26^(1/2)


The advantage to using the discriminant is that you can tell if there are real solutions or not simply by looking at the discriminant, instead of going through all of the work to solve the quadratic formula.

The discriminant also tells us about the number of x intercepts for a graph. There are three possibilities :
         
1 . D is positive          the equation has two   x intercepts
         2 . D is zero                the equation has   one x intercept
         
3 . D is negative          the equation has no    x intercepts

Lets see graphs of these three cases we looked at above.

>    plot( x^2 + x - 5 , x = -6..6);

[Maple Plot]

>    plot( 8*x^2 + 40*x + 50 , x = -6..3, y = -5..100);

[Maple Plot]

>    plot( x^2 + x + 2 , x = -4..3, y = 0..10);

[Maple Plot]

4. Factorability

 
The discriminant also tells us another thing. A quadratic expression is factorable if, and only if the discriminant is a perfect square.

>    Discriminant( (x+31)*(5*x-7) );

				  Quadratic Equation : 	(x+31)*(5*x-7) = 0

				  Coefficients :								a=5			 b=148			 c=-217

				  Discriminant =								26244

				  There are two distinct real roots.

				  This expression is factorable. 

(x+31)*(5*x-7)

7/5, -31

>    sqrt( 26244);

162


But just adding one makes this expression unfactorable

>    Discriminant( (x+31)*(5*x-7) + 1 );

				  Quadratic Equation : 	(x+31)*(5*x-7)+1 = 0

				  Coefficients :								a=5			 b=148			 c=-216

				  Discriminant =								26224

				  There are two distinct real roots.

				  This expression is NOT factorable. 

-74/5+2/5*1639^(1/2), -74/5-2/5*1639^(1/2)

>    sqrt( 26224);

4*1639^(1/2)


Try it for yourself. Any time you start with a factorable quadratic expression, the discriminant will be a perfect square.

>    Discriminant( 8*x^2+62*x+117 );

				  Quadratic Equation : 	8*x^2+62*x+117 = 0

				  Coefficients :								a=8			 b=62			 c=117

				  Discriminant =								100

				  There are two distinct real roots.

				  This expression is factorable. 

(2*x+9)*(4*x+13)

-13/4, -9/2

>    sqrt( 100);

10

>    Discriminant(102*x^2+145*x-408);

				  Quadratic Equation : 	102*x^2+145*x-408 = 0

				  Coefficients :								a=102			 b=145			 c=-408

				  Discriminant =								187489

				  There are two distinct real roots.

				  This expression is factorable. 

(6*x+17)*(17*x-24)

24/17, -17/6

>    sqrt(187489);

433

5. Step by Step Method - Doing it by hand


Here are steps you can use to solve these problems by hand :
         
1 . Read a, b, and c
         
2 . Find the discriminant
         
3 . Take the squareroot of the discriminant
     
    4 . Form the two fractions

This method is slightly shorter and less prone to errors than simply plugging into the formula.

Example 5.1 :   5*x^2-8 = 0  .

>    #1 Read a, b, and c
    a:= 1;   b:= 0;  c:= -8;
#2 Find the discriminate
    Discr :=  b^2 -4*a*c;
#3 Take the ssquareroot of the discriminant
    SqrtD := sqrt( Discr );
#4 Form the fractions
    x = (1/(2*a))*(-b + SqrtD ), (1/(2*a))*(-b - SqrtD );

a := 1

b := 0

c := -8

Discr := 32

SqrtD := 4*2^(1/2)

x = 2*2^(1/2), -2*2^(1/2)


Example 5.2 :     5*x^2+7*x-2 = 0  .

>    #1 Read a, b, and c
    a:= 5;   b:= 7;  c:= -2;
#2 Find the discriminate
    Discr :=  b^2 -4*a*c;
#3 Take the ssquareroot of the discriminant
    SqrtD := sqrt( Discr );
#4 Form the fractions
    x = (1/(2*a))*(-b + SqrtD ), (1/(2*a))*(-b - SqrtD );

a := 5

b := 7

c := -2

Discr := 89

SqrtD := 89^(1/2)

x = -7/10+1/10*89^(1/2), -7/10-1/10*89^(1/2)


Example 5.3 :   12*x^2+24*x+6 = 0  .

>    #1 Read a, b, and c
    a:= 12;   b:= 24;  c:= 6;
#2 Find the discriminate
    Discr :=  b^2 -4*a*c;
#3 Take the ssquareroot of the discriminant
    SqrtD := sqrt( Discr );
#4 Form the fractions
    x = (1/(2*a))*(-b + SqrtD ), (1/(2*a))*(-b - SqrtD );

a := 12

b := 24

c := 6

Discr := 288

SqrtD := 12*2^(1/2)

x = -1+1/2*2^(1/2), -1-1/2*2^(1/2)

>   


         © 2002 Waterloo Maple Inc