☧

Mike’s Variation of Loh’s Quadratic Method

Michael Kaarhus

06:18 Wednesday, Apr. 28, AD 2021 GMT

Simpler script edited on May 31, 2021

Shangri-La

In October of 2019, Po-Shen Loh, PhD, published a paper on an axiomatic, yet intuitive method of solving quadratic equations. I developed a variation that I like better.

My variation, like Loh’s method, is computationally simple and algebraic. I use one simple quadratic and two formulæ simpler than the quadratic formula. Like Loh’s method, my variation is axiomatic and programmable. There is no trial-and-error factoring. My CALC scripts for my variation are in Appendix 1.

To benefit from this article, readers need to know algebra and the order of algebraic operations. Those that are new to quadratic equations can also benefit, if they first read Appendix 2, An Introduction to Quadratics.

Mike’s Variation of Loh’s Method

I classify quadratic equations and the resulting parabolas into six, unofficial types:

`The archetype, y = x`

^{2}

*a*= 1.*b*= 0.*c*= 0`The`

*a-type*, y = ax^{2}

*a*≠ 0.*b*= 0.*c*= 0`The`

*b-type*, y = ax^{2}+ bx

*a*≠ 0.*b*≠ 0.*c*= 0`The`

*c-type*, y = ax^{2}+ c

*a*≠ 0.*b*= 0.*c*≠ 0`The`

*bc-type*, y = ax^{2}+ bx + c

*a*≠ 0.*b*≠ 0.*c*≠ 0`The`

*c-type twin*of a bc-type, y_{2}= x_{2}^{2}+ k

*a*≠ 0.*b*= 0.

*k*= the y-coordinate of a bc-type’s vertex

The above are my classifications, not official ones, but I refer to them here. In this part of the article, we work only with bc-type parabolas, their c-type twins and the equations for them. I cover b-types and c-types in Appendix 2.

**Example 1:** Solve y = x^{2} + 7x + 12

0 = x^{2}+ 7x + 12

My first impulse is to try Loh’s method of factoring: Make a = 1 if it is not already, then find numbers that add to *−b*, which in this case is −7, and multiply to *c*, which in this case is 12.

In this case, factoring works. There are only two integers that are factors of 12, that add to −7 and multiply to 12: x = −3 and x = −4. And we are done, except to check the results.

Checking:

0 = (−3)^{2}+ 7(−3) + 12.

0 = 9 −21 + 12

0 = −21 + 21

0 = (−4)^{2}+ 7(−4) + 12.

0 = 16 −28 + 12

0 = −28 + 28

I also use Loh’s idea to get the average of the roots before you know what the roots are.

Using my variation, we obtain the first parabola’s c-type twin and the twin’s roots. We sum those roots with the x-coordinate of the vertex of the first parabola. And we are done, except to check our work.

In graphs here, the bc-type parabola is green. The c-type twin is red. Let’s start with the same quadratic, as we already know its roots:

**Example 1 (cont.)** Solve 0 = x^{2} + 7x + 12

To check my work, I check to see if the roots add to the right number. However, knowing what the roots are supposed to add to can get a little confusing if a ≠ 1. Here is why: y and −y have identical roots, which will add to the same number. That means we can multiply both sides by −1 if we want, and the roots stay the same. However, the signs of the x terms of y and −y are opposite. The outcome is as follows:

- The roots add to −b/a, if the sign of the x
^{2}term is positive. - The roots add to b/a, if the sign of the x
^{2}term is negative. - The roots add to −b in the special case where a = 1. We intentionally make a = 1, in order to cause the roots to add to −b.

Making a = 1 may require two steps, and they are the first two steps of my variation.

The first step is to flip the parabola right-side up if it is upside down. This one’s equation is: y = x^{2} + 7x + 12. *a* is positive, so it is already right-side up. If *a* is negative, multiply both sides by −1. This step is not absolutely necessary. My variation works if you leave the parabola upside down, but you have to do the arithmetic more carefully when working with a negative *a*. Also, the roots will add as noted above.

The second step is to divide through by *a* if a ≠ 1. In this case, a = 1. We are fine. This step is also not absolutely necessary. My variation works if you leave a ≠ 1. However, you would then have to plug *a* into h = −b/2a and k = c −b^{2}/4a. And a non-1 *a* would be there when you would calculate the roots of the c-type parabola. And the roots will add as noted above.

The third step is to calculate the vertex. It is conventionally known as, (h, k). There are two parts to this step. First, get the axis of symmetry. That gives us the x-coordinate of the vertex: h = −(b/2a). I prove that below and plug in values. Second, get the y-coordinate.

I developed a formula for the y-coordinate, but had trouble proving it. I still have not found the proof stated explicitly anywhere except here. I found the expression, c − b^{2}/4a, in a college algebra textbook from 1997. They were only trying to derive a formula for the x-coordinate of the vertex. They also happened to derive one for its y-coordinate, but they apparently weren’t interested in it!

I am interested in it. I prove my formula by doing a suggested exercise from the same textbook: convert the *general form* for a quadratic equation into *standard form*:

**Theorem 1:** c − b^{2}/4a is the y-coordinate of the vertex of a parabola whose coefficients are *a, b* and *c*.

Proof 1:

y = ax^{2}+ bx + c. (general form)

y = a(x^{2}+ bx/a) + c. (starting to complete the square)

y = a(x^{2}+ bx/a + b^{2}/4a^{2}− b^{2}/4a^{2}) + c

y = a(x^{2}+ bx/a + b^{2}/4a^{2}) − ab^{2}/4a^{2}+ c

y = a(x + b/2a)^{2}+ c − b^{2}/4a. (Completed the square)

h = −b/2a

k = c − b^{2}/4a

y = a(x − h)^{2}+ k

standard form. (h, k) is the vertex, ∎

If I lost anyone on the third line, to complete the square, you place (b/2a)^{2} into the parentheses.

(b/2a)^{2}= b^{2}/4a^{2}

Since we are arbitrarily adding that quantity, we must also subtract it. Hence the − b^{2}/4a^{2} in the same parentheses.

In the fourth line, we multiplied − b^{2}/4a^{2} by a, removing it from the parentheses. That is where the − ab^{2}/4a^{2} outside the parentheses comes from.

In the fifth line, we factored a(x^{2} + bx/a + b^{2}/4a^{2}) to a(x + b/2a)^{2}. And we simplified − ab^{2}/4a^{2} to − b^{2}/4a

The above proves my formula for the x-coordinate of the vertex. And we can express the vertex as:

Vertex = (h, k)

= (−b/2a, c −b^{2}/4a)

**Example 1 (cont.)** Solve 0 = x^{2} + 7x + 12

Calculate the vertex:

h = −b/2a

= −7/2

k = c − b^{2}/4a

= 12 − 49/4

= 48/4 − 49/4

= −1/4

Vertex = (−7/2, −1/4)

The fourth step is to get and solve the c-type twin. The twin is identical to the bc-type, and has the same vertical shift, but its axis of symmetry is the y-axis.

I call the equation for c-type twin y_{2}. To obtain it, just set y_{2} equal to the sum of ax_{2}^{2} and the y-coordinate of the bc-type’s vertex. Simple! However, mathematicians expect proofs of such things:

**Theorem 2:** To obtain the c-type twin, y_{2}, of a bc-type parabola, set y_{2} equal to the sum of ax_{2}^{2} and the y-coordinate, k, of the vertex of the bc-type: y_{2} = ax_{2}^{2} + k

**Proof 2:** To demonstrate this theorem, we begin with the equations in steps 5 and 6 of the above proof, wherein we had just completed the square:

y = a(x + b/2a)^{2}+ c − b^{2}/4a

h = −b/2a

To keep these two parabolas distinct, I refer to the vertex of y_{2} as, (h_{2}, k), and to the *x* of y_{2} as x_{2}. The subscript 2 signifies that the variable belongs to the second parabola. y_{2} must be identical to y, except that the x-coordinate of the vertex of y_{2} must be zero. To make it zero, I add h (that is, the additive inverse of b/2a), to the quantity in the parentheses in the above equation for y. Since it will now be y_{2}, that is what I call it:

y_{2}= a(x_{2}+ b/2a − b/2a)^{2}+ c − b^{2}/4a

y_{2}= a(x_{2}− 0)^{2}+ c − b^{2}/4a

h_{2}= 0

k = c − b^{2}/4a. This is the same k as in y.

(h_{2}, k) is the vertex of y_{2}

y_{2}= ax_{2}^{2}+ c − b^{2}/4a

Substituting,

y_{2}= ax_{2}^{2}+ k ∎

The standard form already does most of the work of translating parabolas for us. The quantity h can be thought of as a horizontal slider, and the quantity k as a vertical slider. By adjusting h and k, you can translate the vertex of a parabola to any desired point, without changing its shape.

**Example 1 (cont.)** Solve 0 = x^{2} + 7x + 12

It is easy to solve the twin, because the *b* coefficient of its equation is zero. As usual, we set y_{2} = 0 and solve for x:

0 = x_{2}^{2}− 1/4

x_{2}^{2}= 1/4

x_{2}= ±(1/4)^{1/2}

x_{2}= ±1/2

The fifth step is to sum the x-coordinate of of the vertex of the bc-type parabola with each root of the twin, separately. The shapes of the two parabolas are identical, and the twin parabola is centered on zero. Therefore, the two roots of the twin are the exact numbers to sum with the x-coordinate of the vertex of the bc-type parabola, to get its roots. Again, the x-coordinate of the bc-type’s vertex is h = −b/2a. In this case, h = −7/2. Sum each of the twin’s roots with that, and we have solved the bc-type parabola:

x = −7/2 − 1/2. x = −7/2 + 1/2

x = −8/2. x = −6/2

x = −4. x = −3

The sixth and final step is to check the results. x = −4. x = −3 are the same roots that we obtained earlier by factoring. That’s a good enough check for this example. In subsequent examples, our check will be to make sure that the roots add to −b and multiply to c.

Here’s a quadratic that we can’t easily factor:

0 = x^{2}+ 7x + 9

What numbers add to −7 and multiply to 9? The only integral factors of 9 are {−3, −1, 1 and 3}. No two of them add to −7. We need a formula, because the roots of this quadratic are not integers.

At this point, we could fall back to *old reliable*, the quadratic formula. But my variation is just as reliable.

**Example 2:** Solve 0 = x^{2} + 7x + 9

First and second steps: is the parabola right-side up? Yes, because *a* > 0. Is *a* = 1? Yes.

Third step: calculate the vertex. First the x-coordinate:

h = −b/2a

h = −7/2

Then the y-coordinate:

k = c − b^{2}/4a

k = 9 −7^{2}/4

k = 36/4 −49/4

k = −13/4

The vertex is (−7/2, −13/4).

Fourth step: get the equation and roots of the c-type twin. Set y_{2} equal to the sum of x_{2}^{2} and the y-coordinate of the vertex, keeping its sign as the operator:

y_{2}= x_{2}^{2}− 13/4

0 = x_{2}^{2}− 13/4

x_{2}^{2}= 13/4

x_{2}= ±13^{1/2}/2

Fifth step: get the roots of the bc-type: Sum each root of the twin, ±13^{1/2}/2, with the x-coordinate of the vertex of the bc-type parabola. That x-coordinate in this case is −7/2:

x = −7/2 − 13^{1/2}/2

x = −7/2 + 13^{1/2}/2

x = (−7 − 13^{1/2}) / 2

x = (−7 + 13^{1/2}) / 2

x ≈ −5.302776. x ≈ −1.697224

Sixth step: Check the results. The roots must add to −b, and multiply to c. In this case, −b = −7. c = 9. Checking the approximate results:

−5.302776 − 1.697224 = −7

−5.302776 · −1.697224 = 8.999999

Checking the exact results:

(−7 − 13^{1/2}) / 2 + (−7 + 13^{1/2}) / 2

= (−7 − 13^{1/2}− 7 + 13^{1/2}) / 2

= −14/2

= −7

(−7 − 13^{1/2}) / 2 · (−7 + 13^{1/2}) / 2

= (49 − 13) / 4. (Diff. of squares)

= 9

And we have our coefficients, −b = −7. c = 9. That’s it! Our quadratic is solved and its roots are verified!

If a < 0, multiply through by −1. If a ≠ 1, divide both sides by *a*. For instance,

0 = −3x^{2}+ 9x + 33

0 = 3x^{2}− 9x − 33

0 = x^{2}− 3x − 11

And proceed as above:

**Example 3:** Solve 0 = x^{2} − 3x − 11

Calculate the vertex:

h = − b/2a

= −1 · −3/2

= 3/2

k = c − b^{2}/4a

= −11 − 3^{2}/4

= −44/4 − 9/4

= −53/4

Get and solve the c-type twin:

y_{2}= x_{2}^{2}− 53/4

0 = x_{2}^{2}− 53/4

x_{2}^{2}= 53/4

x_{2}= ±(53/4)^{1/2}

= ±53^{1/2}/2

Sum the twin's roots with the x-coordinate of the vertex of the bc-type parabola:

x = the sums of −b/2a and the two roots of x_{2}.

x = 3/2 − (53^{1/2}/2)

x = 3/2 + (53^{1/2}/2)

x = (3 − 53^{1/2}) / 2

x = (3 + 53^{1/2}) / 2

x ≈ −2.140055. x ≈ 5.140055

Check the results:

−2.140055 + 5.140055 = 3

−2.140055 · 5.140055 = −11.000000

It’s good: the roots add to −*b*, and multiply to *c*.

Now let’s try one with no real roots: y = x^{2} + 2x + 6 :

**Example 4:** Solve 0 = x^{2} + 2x + 6

Calculate the vertex:

h = − b/2a

h = −2/2

= −1

k = c − b^{2}/4a

= 6 − 2^{2}/4

= 6 − 1

= 5

Get and solve the c-type twin:

y_{2}= x_{2}^{2}+ 5

0 = x_{2}^{2}+ 5

x_{2}^{2}= −5

x_{2}= i · ±5^{1/2}

Sum the twin's roots with the x-coordinate of the vertex of the bc-type parabola:

x = −1 − i·5^{1/2}

x = −1 + i·5^{1/2}

x ≈ −1 − 2.236068·i

x ≈ −1 + 2.236068·i

Check the results:

−1 − 2.236068·i − 1 + 2.236068·i ≈ −2

(−1 − 2.236068·i) · (−1 + 2.236068·i) ≈ 6

The roots add to −*b*, and multiply to *c*.

Finally, let’s solve an upside down parabola with real roots:

**Example 5:** Solve 0 = −x^{2} + 4x + 14

Calculate the vertex:

h = − b/2a

h = −4/−2

= 2

k = c − b^{2}/4a

= 14 − 4^{2}/−4

= 14 + 4

= 18

Get and solve the c-type twin. When I first published this, I neglected to make *a* visible again in the formula, did a false calculation and didn’t catch it for ten days! Because *a* is negative, it changes the calculation a little:

y_{2}= ax_{2}^{2}+ 18

0 = −(x_{2}^{2}) + 18

Add x_{2}^{2}to both sides:

x_{2}^{2}= 18

x_{2}= ±18^{1/2}

Sum the twin's roots with x-coordinate of the vertex of the bc-type parabola:

x = 2 − 18^{1/2}

x = 2 + 18^{1/2}

x ≈ −2.242640687

x ≈ 6.242640687

Check the results:

−2.242640687 + 6.242640687 = 4

= b

2.242640687 · 6.242640687 = 13.999999999

≈ 14

The roots add to *b*, and multiply to *c*. The roots do not add to *−b*, because we left the x^{2} term negative. I wrote about the cause of this little phenomenon in Example 1. Working with negative *a* takes a little getting used to, but my variation of Loh’s method handles it fine.

Appendix 1: Calc Scripts

The scripts below are not guaranteed to operate safely on your machine. Use at your own risk. Users of either of these scripts agree that Michael Kaarhus will not be held liable for any damages that it may cause to their operating system and/or machine.

The scripts below are experimental and not guaranteed to return accurate or desired results.

The scripts below are Copyright ©2021 Michael Kaarhus. They are for personal use only. I do not grant permission to sell them or bundle them for sale.

The scripts below are apcalc scripts. apcalc is available for Linux OS, and for OSX 10.8. One nice thing about apcalc is that its `sqrt()`

function returns both real and imaginary roots. To use my script,

- Install apcalc
- Copy a script from your browser window, paste and save it as a plain text file. Give it a filename with a
`.cal`

extension, for instance,`u-name-it.cal`

- Edit the first line, replacing
`[path to calc]`

with the path to your apcalc app. In the path, it is called`calc`

, not apcalc. The`-q -f`

need follow. - Make the
`.cal`

file executable. - In a terminal window, change to the folder that the script is in. To run it, type,
`./u-name-it.cal`

and press return.

I provide two scripts here. The first works on a full-featured OS, wherein the CALC `prompt()`

command works, and numbers in CALC lists stay numbers.

The second is simpler, but a little less convenient. It works on a partly-featured OS, wherein `prompt()`

does not work. You have to manually edit the simpler script to change coefficients *a, b* or *c*. The simpler script does not use a list.

For CALC on a full-featured OS:

`#![path to calc] -q -f`

/* Mike's Variation of Loh's Quadratic Method
This script is not guaranteed to operate safely on your machine.

Use at your own risk. By using this script, users agree that

Michael Kaarhus will not be held liable for any damages that it

may cause to their operating system and/or machine.

This script is experimental and is not guaranteed to return

accurate or desired results.

This script is Copyright (c) 2021 Michael Kaarhus. It is for

personal use only. I do not grant permission to sell it or

bundle it for sale.

These legal notices must be included whenever this script is

shared. */

define chek(re) {

local fi, eps=1e-21;

if (re == "q" || re == "Q") closit();

fi = eval(re);

if (!isnum(fi)) {

print "\n That is not a number. Exiting.";

closit();

}

return fi;

}

define openit() {

local cfnt=list(), git, te;

print "\n Mike's Variation of Loh's Quadratic Method\n";

print " Enter coefficients a, b, and c for ax^2 + bx + c\n";

print " Enter coefficients as numbers, expressions or builtin",;

print "functions,";

print " for instance, 4.25, -5/7, sqrt(3)/2 or 2*pi()\n";

print " To quit, enter q or Q or press ctrl-c\n";

git = prompt(" Enter the coefficient of x^2: ");

te=chek(git);

if (te == 0) {

print "\n Error: a =", te: ". Must be non-zero. Exiting\n";

closit();

}

append(cfnt, te);

print "\n Enter the coefficient of x";

git = prompt(" If it is 0, enter 0: ");

te=chek(git);

append(cfnt, te);

print "\n Enter the constant c";

git = prompt(" If it is 0, enter 0: ");

te=chek(git);

append(cfnt, te);

print;

tld(cfnt);

}

define closit() {

print " Program ending normally\n\n";

quit

}

define tld(ipa) {

local a, b, c, af, bf, cf, xv, yv, xz, x1, x2, mb, px,

eps=1e-21, sox='+', soc='+', sfx='+', sfc='+';

a=ipa[[0]];

b=ipa[[1]];

c=ipa[[2]];

af=a;

bf=b;

cf=c;

print " The coefficients are:\n a =", a, " b =", b, " c =", c;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Vertex = (": xv: ",", yv: ")\n";

if (yv > 0 && a > 0) {

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

print , af:"x^2", sfx, bf:"x", sfc, cf, " has imaginary",;

print "roots.\n";

}

if (yv < 0 && a < 0) {

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

print , af:"x^2", sfx, bf:"x", sfc, cf, " has imaginary",;

print "roots.\n";

}

if (a < 0) {

a*=-1; b*=-1; c*=-1;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Changed coefficients to:\n a =", a, " b =", b,;

print " c =", c;

print " New vertex = (": xv: ",", yv: ")\n";

}

if (a != 1) {

b/=a; c/=a; a=1;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Changed coefficients to:\n a =", a, " b =", b,;

print " c =", c;

print " New vertex = (": xv: ",", yv: ")\n";

}

/* The sign of yv must toggle, because we mult. both sides of

0 = x^2 - yv by -1 to get x^2 = yv

*/

yv*=-1;

xz=sqrt(yv, eps, 0);

x1=xv - xz;

x2=xv + xz;

mb=-1 * b;

print " Checking results:";

if (x1 + x2 == mb) {print " Check add roots go";}

if (x1 + x2 != mb) {

print " Check add roots no-go";

print , x1, "and", x2, "do not add to", mb, "Exiting\n";

closit()

}

px=x1 * x2;

if (abs(px - c) < 10^(-17)) {

print " Check multiply roots go\n";

}

if (abs(px - c) >= 10^(-17)) {

print " Check multiply roots no-go";

print , x1, "and", x2, "multiply to\n", px, "not", c,;

print "Exiting\n";

closit()

}

x1=round(x1, 17);

x2=round(x2, 17);

af=round(af, 17);

bf=round(bf, 17);

cf=round(cf, 17);

b=round(b, 17);

c=round(c, 17);

if (b < 0) {sox=''}

if (c < 0) {soc=''}

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

if (af != a) {

print , af: "x^2", sfx, bf:"x", sfc, cf,;

print " has the same roots as,";

}

print " x^2", sox, b:"x", soc, c, " The roots are:\n";

print " x =", x1;

if (x1 != x2) {print " x =", x2}

print;

closit()

}

openit();

Simpler script for CALC on a partly-featured OS:

`#![path to calc] -q -f`

/* Mike's Variation of Loh's Quadratic Method
This script is not guaranteed to operate safely on your machine.

Use at your own risk. By using this script, users agree that

Michael Kaarhus will not be held liable for any damages that it

may cause to their operating system and/or machine.

This script is experimental and is not guaranteed to return

accurate or desired results.

This script is Copyright (c) 2021 Michael Kaarhus. It is for

personal use only. I do not grant permission to sell it or

bundle it for sale.

These legal notices must be included whenever this script is

shared. */

define tld() {

local a, b, c, af, bf, cf, xv, yv, xz, x1, x2, mb, px, sox='+',

soc='+', sfx='+', sfc='+', eps=1e-21;

/* Edit the script here to enter coefficients a, b, and c for

ax^2 + bx + c

Enter coefficients as numbers, expressions or builtin CALC

functions in single quotes: */

a='(23-2)/7';

b='(1+sqrt(5))/2';

c='(1-sqrt(5))/2';

/* No editing past here */

a=chek(a);

if (a == 0) {

print "\n Error: a =", a: ". Must be non-zero. Exiting\n";

closit();

}

b=chek(b);

c=chek(c);

af=a;

bf=b;

cf=c;

print " The coefficients are:\n a =", a, " b =", b, " c =", c;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Vertex = (": xv: ",", yv: ")\n";

if (yv > 0 && a > 0) {

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

print , af:"x^2", sfx, bf:"x", sfc, cf, " has imaginary",;

print "roots.\n";

}

if (yv < 0 && a < 0) {

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

print , af:"x^2", sfx, bf:"x", sfc, cf, " has imaginary",;

print "roots.\n";

}

if (a < 0) {

a*=-1; b*=-1; c*=-1;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Changed coefficients to:\n a =", a, " b =", b,;

print " c =", c;

print " New vertex = (": xv: ",", yv: ")\n";

}

if (a != 1) {

b/=a; c/=a; a=1;

xv=-1 * b/(2*a);

yv=c - b^2/(4*a);

print " Changed coefficients to:\n a =", a, " b =", b,;

print " c =", c;

print " New vertex = (": xv: ",", yv: ")\n";

}

/* The sign of yv must toggle, because we mult. both sides of

0 = x^2 - yv by -1 to get x^2 = yv

*/

yv*=-1;

xz=sqrt(yv, eps, 0);

x1=xv - xz;

x2=xv + xz;

mb=-1 * b;

print " Checking results:";

if (x1 + x2 == mb) {print " Check add roots go";}

if (x1 + x2 != mb) {

print " Check add roots no-go";

print , x1, "and", x2, "do not add to", mb, "Exiting\n";

closit()

}

px=x1 * x2;

if (abs(px - c) < 10^(-18)) {

print " Check multiply roots go\n";

}

if (abs(px - c) >= 10^(-18)) {

print " Check multiply roots no-go";

print , x1, "and", x2, "multiply to\n", px, "not", c,;

print "Exiting\n";

closit()

}

x1=round(x1, 18);

x2=round(x2, 18);

af=round(af, 18);

bf=round(bf, 18);

cf=round(cf, 18);

b=round(b, 18);

c=round(c, 18);

if (b < 0) {sox=''}

if (c < 0) {soc=''}

if (bf < 0) {sfx=''}

if (cf < 0) {sfc=''}

if (af != a) {

print , af: "x^2", sfx, bf:"x", sfc, cf,;

print " has the same roots as,";

}

print " x^2", sox, b:"x", soc, c: " The roots are:\n";

print " x =", x1;

if (x1 != x2) {print " x =", x2}

print;

closit()

}

define openit() {

print "\n Mike's Variation of Loh's Quadratic Method\n";

print " Edit the script to enter coefficients a, b, and c for";

print " ax^2 + bx + c\n";

print " Enter coefficients as numbers, expressions or builtin";

print " CALC functions in single quotes.";

print " For instance, '4.25', '-5/7', 'sqrt(3)/2' or '2*pi()'\n";

tld();

}

define chek(re) {

local fi, eps=1e-21;

fi=eval(re);

if (!isnum(fi)) {

print "\n", re, "is not a number. Exiting.";

closit();

}

return fi;

}

define closit() {

print " Program ending normally\n\n";

quit

}

openit();

Appendix 2: An Introduction to Quadratics

The operations in algebra are: exponentiation and roots, multiplication and division, addition and subtraction. The *order of operations* tells us the order in which to do which kind of operation:

- Exponentiation and roots first,
- Then multiplication and division,
- Then addition and subtraction.

If you do operations in some other order, you can easily get incorrect results.

The largest exponent in a quadratic is 2. Every quadratic equation graphs as a parabola. The general form for a quadratic equation is,

y = ax^{2}+ bx + c

The letters *a, b* and *c* are standard variables for the *coefficients* of the quadratic. You need to understand that the actual coefficients can be negative, zero or positive; the plus sign in front of the *x* and the *constant* term are not necessarily the sign of *b* or *c*, respectively. Once we have actual coefficients, we substitute them in:

a = −3. b = −5. c = −4

y = −3x^{2}+ (−5)x + (−4)

To make it easier to read, mathematicians substitute the signs of the coefficients for the standard plus signs:

y = −3x^{2}− 5x − 4

You can also use fewer spaces:

y = −3x^{2}−5x −4

The space between the sign of a term and the term itself is to help us remember that the minus sign applies to the whole term, not only the first number or variable in the term. As far as calculators and computers go, however, that space is meaningless. Calculators are programmed to evaluate the term first, then, if there is a minus sign in front of it, multiply it by −1. I usually keep such spaces, because that is conventional. However, when you plug in values for all the coefficients and variables, all you have are operators, numerals and spaces, and too many spaces can make for more difficult reading. I find math easier when I delete spaces between the sign of the term and the term, and remember that the sign applies to the whole term.

If you plug in a negative value for *x*, then you need to use parentheses for the x of x^{2}.

For instance, let x = −4. The following would give a wrong evaluation: y = −3 · −4^{2} −5 · −4 −4. First do the exponentiation: y = −3 · −16 −5 · −4 −4, then the multiplication and division: y = 48 + 20 −4, then the addition and subtraction: y = 64.

We did the math *and* order of operations right, and still got a wrong evaluation. To do it right, put negative substitutions for the x of x^{2} in parentheses:

y = −3 · (−4)^{2} −5 · −4 −4. First do the exponentiation: y = −3 · 16 −5 · −4 −4, then the multiplication and division: y = −48 + 20 −4, then the addition and subtraction: y = −32.

With parentheses, we got the right answer. Here is the problem with the first try:

−3 · −4^{2}= −3 · −1 · 4^{2}

= 48. In other words,

−4^{2}is the negative of 4^{2}

However,

−3 · (−4)^{2}= −3 · 16

= −48. In other words,

(−4)^{2}is the square of −4

If *b* or *c* is 0, mathematicians make the entire term invisible. If *a* is 0, it’a right line, not a quadratic. Also, if *a, b* or *c* is ±1, we make the 1 invisible, and keep the sign visible. And if the exponent of x is 0, mathematicians remove that x and replace it with 1. If the exponent of x is 1, mathematicians make the 1 invisible. These are standard conventions that make equations easier to write and less cluttered. All invisible items are still functioning mathematically, as if they were visible.

x and y are variables that represent points (x, y) on 2-D Cartesian axes. Here we solve for certain x and y values. For instance, the simplest quadratic equation is,

y = x^{2}

That is the archetype parabola. Its vertex is the point (0, 0). If we included everything that mathematicians make invisible, its equation would look like this:

y = 1x^{2}+ 0x^{1}+ 0x^{0}

Every quadratic, even the simplest one, actually has five variables: y, x, a, b and c. And *x* comes in three varieties: x^{2}, x^{1} and x^{0}. Of those seven items, the only ones that mathematicians never make invisible are y and x^{2}. And mathematicians always make x^{0} invisible.

I refer to an upward-reaching parabola as *right-side up*, and a downward-reaching parabola as *upside down*. If the *a* coefficient is negative, the parabola is upside down. To flip an upside down parabola right-side up, multiply both sides of the quadratic by −1. That changes the signs of all the coefficients, with the result that the vertex is now on the other side of the x-axis, the same distance away as before, and the arms extend in the opposite direction. The arms still intersect the x-axis at the same points; the solutions to a flipped parabola are the same as those of its non-flipped version. You can use my variation to solve an upside down parabola as it is. However, there are fewer algebra rules to remember if you flip it first.

Also, if a > 1, divide all the terms by *a*.

y = −3x^{2}− 15x − 18

−y = 3x^{2}+ 15x + 18

−y/3 = x^{2}+ 5x + 6

The −y/3 on the left side is not a problem, because to solve a quadratic, we set the left side to 0:

0 = x^{2}+ 5x + 6

Dividing all terms by *a* makes the parabola wider by a factor of *a*, but also moves its vertex closer to the x-axis by a factor of *a*. The result is that the solutions to it stay the same, but since *a* is now 1, the calculations are simpler.

Solving a quadratic means getting *x* values that make the right side 0. As Loh pointed out, in the case where a = 1, the solutions add to −b and multiply to c. This article is not about factoring. However, factoring is the method of solving that most people try first. The above quadratic is an example of an easy one to factor: Get all the integral factors of *c*: {−3, −2, 2, 3}. If the solutions to, that is, the *roots* of the quadratic are integers, they are in that set. Then there is a divergence in how to proceed.

At school, they teach students to figure out which of those integers would add to *b* and multiply to *c*. In our example, find which ones would add to 5 and multiply to 6. The student then rewrites the equation and uses the *Zero Product Property* to find the roots.

Using Loh’s method, we figure out which of those integers would add to *−b* and multiply to *c*. In our example, find which ones would add to −5 and multiply to 6. We soon see that the solutions must be −3 and −2: −3 −2 = −5 and −3 · −2 = 6. And we are done; those numbers are the roots.

To check if they are right, plug them back into the equation and see if they make the right side 0:

0 = x^{2}+ 5x + 6

0 = (−3)^{2}+ (5 · −3) + 6

0 = 9 − 15 + 6

0 = (−2)^{2}+ (5 · −2) + 6

0 = 4 − 10 + 6

A minus sign in front of a variable can change its sign. For instance, `If c = −9, −3x`

, that is, ^{2} − c means −3x^{2} −(−9)`−3x`

.^{2} + 9

We are going to work with this quantity: c − b^{2}/4a. We need to understand what the minus sign does. For now, we will let a = 1 and make *a* invisible. We know that, whether *b* is positive or negative, b^{2}/4 is positive. You might think, then, that −b^{2}/4 is also positive. However, −b^{2}/4 actually means −1 · b^{2}/4. We made the 1 and the multiplication operator invisible; they are hiding there, and are going to multiply that term by minus one.

We can think of a minus sign, whether or not there is a space between it and the term to its right, as an operator that says to itself, “After this here term to my right is evaluated, I am going to multiply it by −1”. That’s its only job in life. Minus signs lead such easy lives that people readily forget that they’re going to do their job; they can become stumbling-blocks. −b^{2}/4 is always negative, even though the square of *b* is always positive.

To avoid ambiguity, if you want to square a negative number, for instance, −7, it is a good idea to write it, (−7)^{2}. In any computer or calculator, you must use parentheses, or it will return, −1 · 7^{2}, instead of (−7)^{2}. We do not put parentheses around the b in −b^{2}/4a, because the minus sign applies to the whole term, not only b. We could correctly write it, −(b^{2}/4a).

Now that we have replaced *a*, suppose that *a* is negative. Would −(b^{2}/4a) then be negative or positive?

It would be positive. The evaluation of everything inside the parentheses would be negative. Then the lowly minus sign multiplies it all by −1.

The *vertex* of a right-side up parabola is its lowest point; the parabola just goes upward from there, in two arms. Parabolas have bilateral symmetry: the two arms are symmetric about a central, vertical *axis of symmetry* that extends upward and downward from the vertex. The axis of symmetry is a right line with a simple equation: x_{s} = −b/2a, where *b* is the coefficient of x, and *a* is the coefficient of x^{2}. I used x_{s} to signify that this is a different *x* from the ones in our quadratics. We could put this quantity in parentheses, to make clear that the minus sign applies to the whole quantity: x_{s} = −(b/2a).

We will also need the y-intercept, that is, the y-coordinate of the point where the parabola intersects the y-axis. The y-intercept is simply the *c* coefficient. If you see no *c* coefficient, remember, all the coefficients are there! If the *c* coefficient is invisible, it means that c = 0, and the y-intercept = 0.

To solve a quadratic means to find its *x-intercepts*, that is, that point or those points where the parabola intercepts the x-axis, if it does. Mathematicians refer to such a points as *zeros*, *roots* or *solutions*. The term *zero* is appropriate, because where the parabola crosses the x-axis, the *value* of the quadratic, its y-coordinate, is 0. A *zero* of a function is a point on the x-axis. The terms *root* and *solution* mean the same as *zero*, except that a *root* can have an imaginary part, whereas a *zero* is entirely real. If a parabola does not intercept the x-axis, then it has no *x-intercept*, no *zero*, no *real root* and no *real solution*. It has two, *imaginary* roots and solutions. I solve one quadratic here that has imaginary roots.

Every parabola intercepts the x-axis at two, one or zero places. Again, the simplest example is, y = x^{2}. It intercepts the x-axis at only one point, (0, 0). Its only solution is x = 0.

I refer to y = x^{2} as the *archetype* parabola. All other parabolas are variations of it. Here in the Introduction, we will consider two such variations. I call them *b-type* and *c-type* parabolas.

All parabolas have a non-zero *a* term. A c-type parabola also has a non-zero *c* term, but no *visible b* term. The *b* term is there, but its coefficient is 0, and mathematicians make it invisible. A c-type parabola is *vertically shifted* only:

y = x^{2}− 7. To solve, set y = 0:

0 = x^{2}− 7

x^{2}= 7

x = ±7^{1/2}

In the above example, the axis of symmetry is the y-axis, also known as the line x = 0. The two solutions, x = ±7^{1/2}, are equidistant from the line x = 0. The x-coordinate of the vertex is 0. In c-type parabolas, the y-coordinate of the vertex is *c*, in this case, −7. And the vertex in this case is (0, −7). In my variation, one calculates the *x* and *y* coordinates of the vertex. Mathematicians refer to them as, (h, k) In the main part of this article, I share the simplest ways that I know of to calculate (h, k).

A b-type parabola has a non-zero *b* term, but no *visible c* term. Again, the *c* term is there, but its coefficient is 0, so mathematicians make it invisible. A b-type parabola is *horizontally- and vertically-shifted*:

y = x^{2}− 7x. To solve it, set y = 0:

0 = x^{2}− 7x

b-type quadratics are still simple enough to solve using intuition. We just find values for x such that the right side equals 0. Intuition suggests setting x = 0:

y = x^{2}− 7x

To solve it, set y = 0 and x = 0:

0 = 0^{2}− 7·0

And we have one solution: x = 0. To find the other, it is only necessary to realize that,

0 = b^{2}− (b · b)

Set x to −b, and we get the other solution. In this case, −b = 7:

0 = 7^{2}− (7 · 7)

0 = 49 − 49

And the solutions to y = x^{2} − 7x are x = 0. x = 7.

The general solutions to y = x^{2} + bx are x = 0. x = −b.

In the above example, the axis of symmetry is x_{s} = 7/2. And the two solutions, x = 0, x = 7, are equidistant from that axis. Notice also that the *b* coefficient is −7. We calculate the axis of symmetry from it:

axis of symmetry x_{s}= −b/2a

Less ambiguously,

x_{s}= −(b/2a)

I prove the above in the main part of the article. In this example, *b* is −7 and *a* is 1. And the axis of symmetry is,

x_{s}= −1 · −7/2

x_{s}= 7/2

The vertex is on the axis of symmetry, which is a vertical line. That means that all *x* values on it, including the x-coordinate of the vertex, are −b/2a. The y-coordinate of the vertex is c −(b^{2}/4a). I actually derive it in the main part of this article.

If the *a* coefficient is positive, which it is in this case, we know that the parabola extends upward. If the vertex of a right-side up parabola is below the x-axis, we now know that the parabola necessarily crosses the x-axis at two points, meaning that the quadratic has two real roots. The same is true if the vertex of an upside down parabola is above the x-axis.

If the vertex of a right-side up parabola is above the x-axis, we know that the parabola does not cross the x-axis at all, meaning that the quadratic has no real roots. The same is true if the vertex of an upside down parabola is below the x-axis.

A bc-type parabola has non-zero *b* and *c* terms, and is shifted both vertically and horizontally. y = x^{2} + 7x + 12 is a bc-type, and is the first one that we solve in the main part.

Copyright © 2021 Michael Kaarhus. Personal use granted. All other rights reserved