7

Is there any way to write the quadratic formula such that it works for $ac= 0$ without having to make it piecewise?

The traditional solution of $x = (-b \pm \sqrt{b^2 - 4ac}) / 2a$ breaks when $a = 0$, and the less-traditional solution of $x = 2c / (-b \pm \sqrt{b^2 - 4ac})$ breaks when $c = 0$... so I'm wondering if there is a formula that works for both cases.

My attempt was to make the formula "symmetric" with respect to $a$ and $c$ by substituting $$x = y \sqrt{c/a}$$ to get $$y^{+1} + y^{-1} = -b/\sqrt{ac} = 2 w$$

whose solution is

$$y = -w \pm \sqrt{w^2 - 4}$$

which is clearly symmetric with respect to $a$ and $c$, but which doesn't really seem to get me anywhere if $ac = 0$.

(If this is impossible, it'd be nice if I could get some kind of theoretical explanation for it instead of a plain "this is not possible".)

user541686
  • 13,772
  • 3
    I still don't get this line: "[...] breaks when $a=0$." Considering $a=0$ at all doesn't seem very sensible. – Daniel W. Farlow May 05 '15 at 07:30
  • 3
    @MagicMan: It's pretty sensible, I want a polynomial that gives me the right answer for all polynomials up to degree 2, and it seems strange to need a different formula for a sub-case of a general case. – user541686 May 05 '15 at 07:34
  • 3
    Why the close vote? This is a perfectly valid question. – Jair Taylor May 05 '15 at 07:41
  • 1
    @JairTaylor I voted to close as unclear what you're asking because...well, it's kind of unclear what is being asked. As Mark's answer points out, and what my comment addresses, considering $a=0$ gives you a linear equation, not a quadratic one, and hence any application of a "quadratic" formula seems nonsensical. It's not so much about the question's validity so much as it is not very clear what is being asked exactly. Maybe that will explain Mark's less than comprehensive answer (which, I presume, was the cause of the most recent edit). More detail needs to be added IMO. – Daniel W. Farlow May 05 '15 at 07:51
  • @Mehrdad Just to be clear, I don't want to be misunderstood--I don't have anything against your question at all. If other people find it easy to understand and sensible, then hopefully you will receive answers that suit your fancy. I just can't make sense of it (and maybe now Mark's answer will give you, more or less, an indication as to why). Anyhow, good luck! – Daniel W. Farlow May 05 '15 at 07:57
  • 4
    Well, what Mehrdad wants is a formula for solutions of arbitrary polynomials $ax^2 + bx + c$. That's not a ill-defined problem. – Jair Taylor May 05 '15 at 07:57

3 Answers3

8

I think you will always have a problem, because the "missing" solution for $a=0$ is a solution at infinity. You need two answers for the quadratic, and reducing this to the linear case will give an undefined expression representing the missing root.


Apologies, I had to get out before filling in the detail, but here is some more comment.

Taking the conventional quadratic formula with small $a$ and fixed $b,c$and examining the highest order terms, the two solutions become $-\frac {b}a$ and $-\frac cb$ plus lower order pieces.

So we have a large solution (sign depending on the sign of $a$ and which is the non-zero solution of $ax^2+bx=0$ - when $x$ is large $c$ becomes irrelevant) and a solution close to the solution of the linear equation $bx+c=0$ - where $x$ is small, the quadratic term is negligible.

Note that the second version of the solution with $c$ in the numerator has one solution which reduces to the form $\frac {2c}0$ when $a=0$, so it doesn't actually recover anything better.

To reduce a form which gives two solutions to the single solution for a linear equation requires some reduction of two solutions to one. They could become equal, but clearly that is not going to happen here (a quadratic with equal solutions is nothing like linear). Or they could disappear into a singularity or undefined space.

Mark Bennet
  • 100,194
1

Answering my own question, but I just realized this algorithm on Wikipedia works if we cheat a little and don't consider $\operatorname{sgn}(x) = |x| \div x$ a "piecewise" function:

$${\begin{aligned}x_{1}&={\frac {-b-\operatorname{sgn}(b)\,{\sqrt {b^{2}-4ac}}}{2a}}\\x_{2}&={\frac {2c}{-b-\operatorname{sgn}(b)\,{\sqrt {b^{2}-4ac}}}}\end{aligned}}$$

user541686
  • 13,772
  • The first of these does not work for $a=0$. So you get your solution to the linear equation by having one of the two expressions undefined. But that is what happens with the quadratic formula too. – Mark Bennet May 05 '15 at 08:55
  • 4
    @MarkBennet: It's not undefined, but infinity -- and as you pointed out, one of the roots is indeed infinity! – user541686 May 05 '15 at 09:04
  • This finds solutions in the extended real number line. What does sgn return if b is zero? – Yakk May 05 '15 at 14:20
  • 1
    @Yakk I think Wikipedia is trying to be too clever with notation (an unfortunate habit for mathematicians!) The point they were trying to make was that you know $x_1x_2 = c/a$. To avoid numerical cancellation you calculate the root $x_1$ with the largest modulus using the quadratic formula, taking the same sign for $-b$ and $\pm\sqrt{b^2 - 4ac}$, and then find $x_2 = c/(ax_1)$. If $b = 0$ both roots have the same modulus, so it doesn't matter which one you calculate first. – alephzero May 05 '15 at 14:55
  • @Yakk: The sign of zero is zero. – user541686 May 05 '15 at 17:10
  • @Mehrdad Then if b and c is zero, the above returns an indeterminate value for x2 -- 0/0. If b and a are zero, then the above returns an indeterminate value for x1 (again 0/0). Even in the extended reals, those don't work. – Yakk May 05 '15 at 17:42
  • @Yakk: If $b$ and $a$ are zero either there are no solutions or an infinite number of them, so I don't really care what happens, since I can't logically return any better answer than undefined. If $b$ and $c$ are zero then the only solution is $0$, which is exactly $x_1$, and consequently we indeed have all the roots. There is no other solution so it's not unreasonable for $x_2$ to be undefined. (But if you know of an elegant way to make it also return zero then feel free to go ahead and share; I don't have one, although I don't really find it necessary either.) – user541686 May 05 '15 at 18:00
0

$x=(−b±\sqrt{b^2−4ac})/2a ...(1)$

Take limit $a \rightarrow 0,$ apply L'Hospital rule and you should get

$x = -c/b$ (solution of $bx + c = 0$) and another solution of infinity (neglecting since not defined).

There should not be any problem in equation (1) for the case of $c = 0$.

To find a symmetric formula for $ac$, both $a$ and $c$ must have equal significance in the quadratic equation which is not the case, that's why it's not possible.

Bhaskar
  • 458