A “new” general formula for the quadratic equation?

Maybe the question is very trivial in a sense. So, it doesn’t work for anyone. A few years ago, when I was a seventh-grade student, I had found a quadratic formula for myself. Unfortunately, I didn’t have the chance to show it to my teacher at that time and later I saw that it was “trivial”. I saw this formula again by chance while mixing my old notebooks. I wonder if this simple formula is used somewhere.

The original method

Let’s remember the original method first:

\color{#c00}{ax^2+bx+c=0, ~~\text {}~a\neq 0} \\ 4a^2 x^2+4abx+4ac =0 \\ 4a^2 x^2+4abx=-4ac \\ 4a^2 x^2+4abx+b^2=b^2-4ac \\ \left(2ax+b \right)^2 =b^2-4ac \\ 2ax+b= \pm \sqrt{b^2-4ac} \\ x_{1,2}= \dfrac{\pm\sqrt{b^2-4ac} -b}{2a} \\ \bbox[5px,border:2px solid #C0A000] {x_{1,2}=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}}

In fact, the “meat” of this method is as follows:

\color{#c00}{{ax^2+bx+c=0, ~~\text {}~a\neq 0}}\\x^2+\dfrac{b}{a}x+ \dfrac{c}{a}=0 \\\left (x+ \dfrac{b}{2a} \right)^2- \left (\dfrac{b}{2a} \right)^2+\dfrac{c}{a}=0 \\ \left (x+ \dfrac{b}{2a} \right)^2=\dfrac{b^2}{4a^2}-\dfrac {c}{a} \\ \left (x+ \dfrac{b}{2a} \right)^2=\dfrac{b^2-4ac}{4a^2} \\ x+ \dfrac{b}{2a}= \dfrac{\pm\sqrt{b^2-4ac}}{2a} \\ \bbox[5px,border:2px solid #C0A000] {x_{1,2}=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}}

Construction of the general formula

Now, we know that if one of the roots for ax^2+bx+c=0 is x = 0, then our equation is equivalent to ax^2 + bx = 0. No special formula is required to solve the last equation.

In this sense, I am setting off by accepting that x \neq0.

\color{#c00}{ax^2+bx+c=0, ~~\text {}~a\neq 0} \\ a+\dfrac {b}{x} +\dfrac{c}{x^2}=0 \\ \dfrac{c}{x^2}+\dfrac {b}{x} +a=0 \\ \dfrac{4c^2}{x^2}+\dfrac{4bc}{x}+4ac=0 \\ \dfrac{4c^2}{x^2}+\dfrac{4bc}{x}=-4ac \\ \dfrac{4c^2}{x^2}+\dfrac{4bc}{x}+b^2=b^2-4ac\\ \left( \dfrac {2c}{x}+b \right)^2=b^2-4ac \\ \dfrac {2c}{x}+b= \pm\sqrt{b^2-4ac} \\ \dfrac {2c}{x}=-b\pm\sqrt{b^2-4ac} \\ \color{#c00}{\bbox[5px,border:2px solid #C0A000]{x_{1,2}= \dfrac{2c}{-b\pm\sqrt{b^2-4ac}}}}

Proof of the general formula

Let’s rewrite the well-known general formula as follows:

\dfrac{-b\color{red}{\pm}\sqrt{b^2-4ac}}{2a}=\dfrac{-b\color{red}{\mp}\sqrt{b^2-4ac}}{2a}

If we accept c\neq0, then we have:


\dfrac{2c}{-b\color{blue}{\pm}\sqrt{b^2-4ac}}=\dfrac{-b\color{red}{\mp}\sqrt{b^2-4ac}}{2a}\\
\begin{align}
\Longleftrightarrow \left(-b\color{blue}{\pm}\sqrt{b^2-4ac}\right) \times \left(-b\color{red}{\mp}\sqrt{b^2-4ac}\right) &=4ac\\
\Longleftrightarrow -\left(b\color{blue}{\mp}\sqrt{b^2-4ac}\right) \times \left( -\left(b\color{red}{\pm}\sqrt{b^2-4ac}\right)\right)&=4ac\\
\Longleftrightarrow \left(b\color{blue}{\mp}\sqrt{b^2-4ac}\right) \times \left(b\color{red}{\pm}\sqrt{b^2-4ac}\right)&=4ac\\
\Longleftrightarrow b^2-\left(b^2-4ac\right)&=4ac\\
\Longleftrightarrow 4ac&=4ac
. \end{align}

Insufficient point of the formula

Since we have accepted x \neq 0 before, this formula cannot work completely for c = 0.

If c=0, then we have:

x_1=\dfrac {0}{-2b}=0 which imply, one of the roots is correct.

x_2=\dfrac {0}{0}=\text{undefined} which imply, the second root is incorrect.

Curious points of the formula

These are interesting points for an untutored person like me. On the other hand, they are trivial.

If the \Delta \left(\text{Discriminant}\right) is zero, then there is exactly one real root, sometimes called a repeated or double root.

\Delta=b^2-4ac ~ or ~ D=b^2-4ac ~ and ~ D=0, then we have :

From the formula ~ \color{blue}{x_{1,2}=\dfrac{-b\pm\sqrt{D}}{2a}},

\color{blue}{x}=x_1=x_2=\dfrac{-b}{2a}=\color{blue}{-\dfrac{b}{2a}}

From the formula ~ \color{#c00}{x_{1,2}= \dfrac{2c}{-b\pm\sqrt{D}}},

\color{#c00}{x}=x_1=x_2=\dfrac{-2c}{b}=\color{#c00}{-\dfrac{2c}{b}}

which both are equal.

\begin{align} \color{blue}{x}=x_1=x_2=\color{blue}{-\dfrac{b}{2a}} \color{black}{=} \color{#c00}{-\dfrac{2c}{b}}\Longrightarrow b^2=4ac \Longrightarrow b^2-4ac=0.\end{align}

The original formula does not work for a = 0. However, the alternative formula also works when a = 0. The important point is that we should be careful not to make the denominator zero. In other words,

If a=0 and b>0 then we write:

x=\dfrac{2c}{-b-\sqrt{b^2}}=-\dfrac {c}{b}

If a=0 and b<0 then we write:

x=\dfrac{2c}{-b+\sqrt{b^2}}=-\dfrac {c}{b}

My question

Maybe in some special cases, can this formula be more useful than its own alternative? (I assume the formula I found here is correct.)

Answer

This is a very useful formula for when you want to accurately find the roots of a quadratic equation in which a might be very small using finite precision arithmetic (e.g. on a computer). It's something I have used occasionally in programming. Sometimes it is called the "Citardauq formula" since it's sort of the quadratic formula, but backwards.

When a is really small and b is positive, the formula
\frac{-b +\sqrt{b^2 - 4ac}}{2a}
might involve adding -b and \sqrt{b^2-4ac} which is about b - meaning that most of the significant figures cancel with each other - this causes a loss of significance in a floating point calculation (bad). Worse, then you go and divide this small result by 2a which means that if you were using a fixed point calculation, you've now suffered a loss of significance - either way, you could end up keeping track of lots of digits in the intermediate values and still get an inaccurate answer. Plus, this gives the impression that the exact value a matters a ton since we divided by it, but if b is really large and a really small, the root of the quadratic closer to 0 might not depend very much on a - the quadratic would basically be linear near 0 - despite what this formula suggests. (Of course, this formula accurately depicts the other root: if a is small, its exact value does massively influence where the further root is).

On the other hand, the equivalent value
\frac{2c}{-b - \sqrt{b^2 - 4ac}}
likely suffers from neither problem: the value of \sqrt{b^2-4ac} is not cancelling with -b but rather adding to it, which does cause an undue loss of precision - and we are probably not dividing two small numbers, unless c and b were both small. Note that you can mix and match these formulas, noting that the + case of one is the - case of the other for the \pm term. This form also makes what happens in the limiting case where a goes to 0 clear - it just decays to \frac{c}{-b} - and sometimes the root of a quadratic that you care about is mostly determined by this linear term anyways (e.g. if you wanted to know when a ball thrown quickly at the ceiling would hit it - the other formula references this time off of when the ball would reach its apex, which may be long after it would reach the ceiling. This formula respects that the answer is just "a bit longer than if there were no gravity").

As a result of numerical stability, it tends to not be unreasonable to list the roots of a quadratic with b>0 as:
\frac{2c}{-b - \sqrt{b^2 - 4ac}} \text{ and }\frac{-b -\sqrt{b^2 - 4ac}}{2a}
since these forms avoid the loss of precision that happens when adding a term near b to -b. For negative b, you would want to flip the signs of the added radical to avoid the cancellation. This is also sort of cute because it makes the fact that the product of the roots is \frac{c}a more obvious, whereas the usual formula emphasizes that their sum is \frac{-b}a.

It's worthy of note that you can also derive this formula by starting with
ax^2+bx+c=0
dividing by x^2 to get
a+b(1/x)+c(1/x)^2 = 0
which is a quadratic in 1/x. Solving for 1/x using the usual formula and then reciprocating that gives the formula you list. Generally, if you exchange the order of the coefficients in a polynomial, you reciprocate its roots, which is an often useful abstract fact.

Attribution
Source : Link , Question Author : lone student , Answer Author : Milo Brandt

Leave a Comment