edit, tldr: it seems like the question is interpreted as "for which combinations of a and f is there a solution to the expression"? I'm only interested in "for which combinations of a and f is the wolfram formula wrong". When the wolfram formula takes square roots of negative numbers or divides by zero, I consider it still correct if there was no solution anyway. But it has divisions by zero for b=0 and f=-1, while there should be solutions then. Does that also hold for some nonzero values of b?

For my hobby computer science project, I need to solve $x$ for $x^4+bx^3+f=0$. ($x, b, f\in \mathbb{R}$). I put the formula in wolfram alpha:


and implemented the resulting four formula's from that page in Java. This works pretty well, for random values of $a$ and $f$ it always generates a good approximation of the solution set. However, for the "non-random" input {$b=0, f=-1$}, the wolfram formula (and hence my program) fail. It should have two solutions, $x=1$ and $x=-1$, but it gives none. I took a close look at the formula. Each of the four solutions has the same part $\frac{b^3}{\psi}$ (note the 3). When substituting $b=0$ and $f=-1$ into $\psi$, you'll get the formula here (removing the 4 and the square root):


Indeed, $\psi=0$ and $\frac{b^3}{\psi}$ is a division by zero.

  1. Is the solution given by wolfram wrong (1st link)?
  2. I can easily solve this in my program by checking if $b=0$. But is that enough or are there other combinations of $b$ and $f$ where this formula goes wrong?
  • $\begingroup$ There could be "casus irreducibilis" effects, where complex cube roots of real numbers should be used in some parts of the formula. The quartic is not solvable using only real cube roots. $\endgroup$ – zyx Jun 4 '16 at 0:50
  • $\begingroup$ @zyx, do you still support this point of view after Eric's answer? Afaik quartics are the highest polynomials still solvable using only reals. Also it's about a division by zero, not roots. $\endgroup$ – Albert Hendriks Jun 4 '16 at 1:15
  • $\begingroup$ Cubics are not solvable in "real radicals" (therefore the casus irreducibilis when solving them using complex radicals, in fact this occurs when all three roots of the cubic are real). There are several choices of the roots in the expression that evaluated to 0, some other choices would make it nonzero, and the question is whether any of the other choices would also give the correct answer for the root. The formula is too complicated for me to check this, but I am suggesting that it is one possibility. It is not contradicted (or supported) by Eric's answer. $\endgroup$ – zyx Jun 4 '16 at 4:05
  • $\begingroup$ The math gets a bit hard for me here. Are you referring to this interpretation of cube root: wolframalpha.com/input/?i=x%5E(1%2F3) ? In java, Math.cbrt uses this interpretation: wolframalpha.com/input/?i=cbrt(x) , so that wouldn't be a problem for me then I suppose. $\endgroup$ – Albert Hendriks Jun 4 '16 at 9:33

The formulas given by Wolfram Alpha are not wrong, they're "generic". (Which is a very specific form of wrong which means "only wrong on a set so small that you shouldn't ever care if you're picking random numbers, but always contains the point your boss randomly asks about". Okay. Not really, but some days...)

The not generic versions can be generated via Mathematica's Reduce[] function because Reduce[], unlike Solve[] and Integrate[], does not give generic solutions.

  Reduce[x^4 + b x^3 + f == 0, x, Reals],
  TransformationFunctions -> {Automatic, ToRadicals}

(*  (b < 0 && (
      (f == 0 && (x == Root[b #1^3 + #1^4 &, 1] || x == Root[b #1^3 + #1^4 &, 4])) || 
      ((0 < f < (27 b^4)/256 || f < 0) && (x == 0 || 
                                           x == -b )))) || 
    (x == Root[f + b #1^3 + #1^4 &, 1] && (27 b^4 == 256 f || (b >= 0 && 256 f < 27 b^4))) || 
    (x == Root[f + b #1^3 + #1^4 &, 2] && b >= 0 && 256 f < 27 b^4)

It turns out the behaviour you notice requires $f = 0$ and $b < 0$. You already have the Root[] expressions for the other cases from Wolfram Alpha. The conditional ladder/tree shown above may not be optimal.

  • $\begingroup$ More precisely: "correct except possibly on a set of zero measure". ;) $\endgroup$ – J. M. is a poor mathematician Jun 4 '16 at 0:49
  • 1
    $\begingroup$ @J.M. : Well, yeah, but how is that funny? $\endgroup$ – Eric Towers Jun 4 '16 at 16:57
  • $\begingroup$ It's just added precision; I certainly didn't object to your take. $\endgroup$ – J. M. is a poor mathematician Jun 4 '16 at 16:58

Let $g(x)=x^4+bx^3+f$, in case $b=0$ and $f\in \mathbb{R}$, we always have a complex zeros for $g$. Simply, putting $f=\pm A^4$, then $x^4+ A^4=(x^2+A^2i)(x^2-A^2i)$ and $ x^4- A^4=(x^2-A^2 )(x^2+A^2)$.

In case $b\ne0$, it is possible to have real roots for $g$, e.g., let $f>0$ and let $b=-2-2f$
define $g$ on $[0,1]$, then $g(0)=f>0$ and $f(1)=1+b+f=1-2-2f+f=-1-f<0$, so by intermediate value Theorem there exists $c\in [0,1]$ s.t. $f(c)=0$.

  • $\begingroup$ I'm only interested in real solutions (edited the question). I don't understand, for b=0 (and f=-1) there are certainly non-complex solutions: x=-1 and x=1? $\endgroup$ – Albert Hendriks Jun 4 '16 at 0:03

There's a real root if and only if $256f \leq 27b^4$. I derived this inequality from the derivative to locate the local minimums.

The case is trivial if $b = 0$, so assume $b \neq 0$. Check that the end behavior of the function $g(x) = x^4 + bx^3 + f$ satisfies $g(x) \rightarrow \infty$ as $x \rightarrow \pm \infty$. Thus, there is no guarantee that there exists a real root. Consider the derivative, that is $g'(x) = 4x^3 + 3bx^2 = x^2(4x + 3b)$. It must be the case that $x = 0$ is an inflection point and $x = \frac{-3b}{4}$ is a local minimum since $g''\big(\frac{-3b}{4}\big) = \frac{9b^2}{4}$. Therefore, the function attains a real root if and only if $g\big(\frac{-3b}{4}\big) = f - \frac{27b^4}{256}$ is non-positive.

  • $\begingroup$ Huh? What if $f<=0$? $\endgroup$ – Oscar Lanzi Jun 3 '16 at 23:43
  • 1
    $\begingroup$ If $f \leq 0$, then there must be a real root. One root if $256f = 27b^4$; two roots if $256f < 27b^4$; and no roots if $256f > 27b^4$. $\endgroup$ – Steven Harding Jun 3 '16 at 23:45
  • $\begingroup$ @StevenHarding: would you post your derivation $\endgroup$ – mwomath Jun 3 '16 at 23:59

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.