64
$\begingroup$

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.)

$\endgroup$
  • 12
    $\begingroup$ When $|b|\approx \sqrt{b^2-4ac}$, it may be numerically more stable to use your formula for one of the two solutions because subtracting two almost equal numbers loses precision and this difference in the numerator is turned into a sum (of nearly equal numbers) in the denominator with your formula $\endgroup$ – Hagen von Eitzen Apr 10 at 16:33
  • 1
    $\begingroup$ I recall implementing this formula for the roots of the quadratic formula in my graphic calculator in high school, as it saved one symbol in the BASIC code. Yes, I had a lot of time to kill in physics class. $\endgroup$ – Servaes Apr 10 at 18:34
  • 1
  • 4
    $\begingroup$ In your “proof of the general formula”, you are trying to prove something by deducing an obviously true statement from it (here $4ac=4ac$). This proof technique does not work. If it did, I could prove $1=2$ with this, because $1=2 ⇒ 0·1=0·2 ⇒ 0=0$. Your implications (⇒) have to point in the other direction. $\endgroup$ – Wrzlprmft Apr 11 at 10:20
  • 1
    $\begingroup$ See e.g. this discussion in Numerical Recipes for an explanation of how to properly use both forms of the quadratic equation. $\endgroup$ – J. M. isn't a mathematician Apr 12 at 1:40
62
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Doesn't the cancellation issue you mentioned come back if $b < 0$? Plus, in numerical applications where a quadratic equation with $4ac\ll b$ needs to be solved, I would probably just go for a series expansion rather than either of these formulas. Not to say that what you've written here isn't a useful answer, I just happen to think it has a bit less practical utility than you give it credit for. $\endgroup$ – David Z Apr 11 at 4:47
  • 4
    $\begingroup$ @DavidZ Oops, I fixed that in my answer - yes, if $b<0$ you'd want to flip the signs of things to avoid cancellation the other way. I suspect whether series are better depends on what "better" means for your application - these formulas are great if you need something simple to implement that avoids any obvious loss of precision (except possibly in $b^2-4ac$ - which causes instability in the true answers) and works well for all quadratics. Series are likely faster if you know $a$ is near $0$ and probably slightly more accurate. (Newton's method also might have a use sometimes) $\endgroup$ – Milo Brandt Apr 11 at 5:17
  • 3
    $\begingroup$ IIRC "citardauq" was a (lovely!) coinage of Andre Nicolas. $\endgroup$ – J. M. isn't a mathematician Apr 12 at 1:37
36
$\begingroup$

What's interesting here isn't your result, it's your technique.

Ask a typical algebra teacher, "What's important about the quadratic formula?", they'll probably say, "The fact that it lets you find the roots of a quadratic through a simple calculation."

Ask a mathematician the same question and she'll probably just say, "The discriminant". The discriminant shows up in higher math in all kinds of incredible ways, and the quadratic formula is the first place a student ever encounters it. For the expert, the really important information isn't the raw answers the formula provides but the structure of the elements within the formula.

Your formula gives a simple example of how the structure of a formula can provide a new (though elementary) insight. In the traditional version, the "a" in the denominator tells us that the formula only applies to quadratics with non-zero "a" values. Frankly, that's no insight at all. But your version, with c in the numerator, tells us instantly that if c=0, zero is a root of the equation. That's a useful fact. Granted, you can easily reach the same conclusion by factoring the original equation, but your formula makes it blindingly obvious.

What you've done is applied general technique that mathematicians (and especially physicist) use all the time. They massage equations in various ways until the form of the equation itself provides useful insights. Indeed, mathematicians don't usually spend much time "solving" equations - the important insights almost always come from manipulating equations until they reveal their deeper secrets.

| cite | improve this answer | |
$\endgroup$
  • 4
    $\begingroup$ The alternate formula result is as useful the original formula, but less commonly used. They are both important. Techniques and structure can be important and useful also. $\endgroup$ – Somos Apr 10 at 18:36
  • 18
    $\begingroup$ In view of the paragraph about the importance of the discriminant and the absence of the word "discriminant" from at some versions of the pre-college curriculum, it seems good to mention that, in the present situation, the discriminant is "the stuff inside the square root", namely $b^2-4ac$. $\endgroup$ – Andreas Blass Apr 10 at 18:51
17
$\begingroup$

Assuming neither $a$ nor $c$ are zero (so that $-b\pm\sqrt{b^2-4ac}$ does not equal $-b\pm|b|$, which could then be equal to zero), we can also obtain your formula by an “rationalization of the numerator” of the usual formula. E.g., $$\begin{align*} \frac{-b+\sqrt{b^2-4ac}}{2a} &= \left(\frac{-b+\sqrt{b^2-4ac}}{2a}\right)\left(\frac{-b-\sqrt{b^2-4ac}}{-b-\sqrt{b^2-4ac}}\right)\\ &= \frac{b^2 - (b^2-4ac)}{2a\left(-b-\sqrt{b^2-4ac}\right)} = \frac{4ac}{2a\left(-b-\sqrt{b^2-4ac}\right)} \\ &= \frac{2c}{-b-\sqrt{b^2-4ac}}. \end{align*}$$ And similarly, starting with the minus sign for the radical instead, we get $$\frac{2c}{-b+\sqrt{b^2-4ac}}.$$

This does not mean what you are doing is wrong; it’s correct (as noted by others already). I’m just pointing out that the expressions are in fact the same, provided $ac\neq 0$, which can be verified directly using the same basic algebra “trick” often used to get rid of a radical in a fraction, or when you prefer your radical in the denominator/numerator rather than the numerator/denominator.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ By "minus sign for the derivative" do you mean "minus sign in front of the discriminant"? $\endgroup$ – hkBst Apr 12 at 11:05
  • $\begingroup$ @hkBst: I meant “radical”. thank you. $\endgroup$ – Arturo Magidin Apr 12 at 19:11
2
$\begingroup$

As explained by @Milo, this formula is indeed taught in numerical analysis courses as it is recommended to avoid numerical cancellation. You use one form or the other based on the sign of $b$.

My point here is that the alternative formula is immediately derived from Vieta's relation

$$x_+x_-=\frac ca$$ or $$x_+x_-=\frac{-b+\sqrt{b^2-4ac}}{2a}\frac{2c}{-b+\sqrt{b^2-4ac}}.$$

(The $+$ at the denominator is not a typo.)

Another remark is that for $x\ne0$,

$$ax^2+bx+c=0\iff \frac c{x^2}+\frac bx+a=0$$

so that if you swap $a$ and $c$ and invert, you still get a root.

$$x_+=\frac{-b+\sqrt{b^2-4ac}}{2a}\to\frac{-b+\sqrt{b^2-4ca}}{2c}\to\frac{2c}{-b+\sqrt{b^2-4ca}}=x_-.$$

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.