Given a cubic polynomial with real coefficients of the form $f(x) = Ax^3 + Bx^2 + Cx + D$ $(A \neq 0)$ I am trying to determine what the necessary conditions of the coefficients are so that $f(x)$ has exactly three distinct real roots. I am wondering if there is a way to change variables to simplify this problem and am looking for some clever ideas on this matter or on other ways to obtain these conditions.
-
1You might try to write $Ax^3+Bx^2+Cx+D=A(x-p)(x-q)(x-r)$ and solve the resulting system on the coefficients, keeping in mind that when solving, $p, q, r$ are distinct – David P Aug 12 '15 at 02:01
-
2You could check the entry for "Cubic function" on Wikipedia. In particular the sections "The nature of the roots" and "Reduction to a depressed cubic." – sharding4 Aug 12 '15 at 02:11
3 Answers
Suppose that (including multiplicity) the roots of $$f(x) = A x^3 + B x^2 + C x + D,$$ $A \neq 0$, are $r_1, r_2, r_3$. Consider the quantity $$\Delta(f) := A^4 (r_3 - r_2)^2 (r_1 - r_3)^2 (r_2 - r_1)^2,$$ called the (polynomial) discriminant of $f$.
If $r_1, r_2, r_3$ are all real and pairwise distinct, then we see that $\Delta(f) > 0$. On the other hand, if $f$ has a repeated root, then $\Delta(f) = 0$, and if $f$ has one real root and two nonreal (necessarily conjugate) roots, substituting gives $\Delta(f) < 0$. (The coefficient $A^4$ is unnecessary for $\Delta$ to enjoy these properties, but among other things, its inclusion makes the below formula nicer.)
These three cases exhaust all of the possibilities, so we conclude:
$$\color{#bf0000}{\fbox{A cubic polynomial $f$ has three distinct, real roots iff $\Delta(f) > 0$.}}$$
The above definition of $\Delta$ is not immediately practical, since explicit formulas for the roots of a general cubic polynomial are unwieldy. On the other hand, with some work (say, by expanding and using Newton's Identities and Vieta's Formulas) we can write $\Delta(f)$ as a homogeneous quartic expression in the coefficients $A, B, C, D$: $$\Delta(f) = -27 A^2 D^2 + 18 ABCD - 4 A C^3 - 4 B^3 D + B^2 C^2.$$ This formula gives a computationally practical answer to the question:
$$ \bbox[0.5mm,border: 1px solid #bf0000]{ \color{#bf0000}{ \begin{array}{c} \textrm{A cubic polynomial} \\ f(x) = A x^3 + B x^2 + C x + D \\ \textrm{has three distinct, real roots iff} \\ -27 A^2 D^2 + 18 ABCD - 4 A C^3 - 4 B^3 D + B^2 C^2 > 0 \textrm{.} \end{array} } } $$
It's apparent that one can generalize the notion of discriminant to polynomials $p$ of any degree $> 1$, producing an expression homogeneous of degree $2(\deg p - 1)$ in the polynomial coefficients. In each case, up to a constant that depends on the degree and the leading coefficient of $f$, $\Delta(f)$ is equal to the resultant $R(f, f')$ of $f$ and its derivative.
By making a suitable real, affine change of variables $x \rightsquigarrow y = a x + b$, by the way, one can transform any given real cubic polynomial to the so-called depressed form $$\tilde{f}(y) = y^3 + P y + Q .$$ such transformations do not change the number of real roots or the multiplicities of roots. For a cubic polynomial in this reduced form the discriminant takes the simpler and well-known form $$\Delta(\tilde f) = -4 P^3 - 27 Q^2.$$

- 99,363
-
Actually, does this answer the question? The question wanted conditions for three distinct real roots and this is a condition for three distinct complex roots! – Caleb Stanford Aug 06 '16 at 20:38
-
3@6005 You're quite right, thanks! Fortunately, the character of the roots is encoded in the sign of $D(f)$, and I've modified my answer to indicate how. – Travis Willse Aug 09 '16 at 10:09
By solving $f'(x)=0$, you can find out the two turning points of the cubic. Suppose the solutions are $x_1$ and $x_2$. In fact, we have $$ x_{1,2} = \frac{-B \pm \sqrt{B^2-3AC}}{3A} $$
If $B^2-3AC <0$, then $x_1$ and $x_2$ are imaginary, so there are no turning points, and the cubic has only one real root.
If $x_1$ and $x_2$ are real, the cubic has three distinct roots iff $f(x_1)$ and $f(x_2)$ are non-zero and have opposite sign. Or, in short, as the comment says, iff $f(x_1)f(x_2) < 0$.
There are numerous tolerance issues and corner cases to worry about, but that's the basic idea.
Edit: Following up on the comment above, the Wikipedia page says that the nature of the roots can be determined by examining the discriminant: $$ \Delta = 18ABCD - 4B^3D + B^2C^2 -4AC^3 - 27A^2D^2 $$ The cubic has three distinct real roots iff $\Delta > 0$. This is a nice tidy criterion, but my discussion above may still be useful because it provides some geometric insight.

- 43,483
- 3
- 61
- 122
-
2Very nice solution here...I think your condition is: : $f(x'_1)\cdot f(x'_2) < 0$, where $x'_1$, $x'_2$ are the roots of the derivative $f'$ ( if the roots are complex conjugate, the product is $>0$). But this expression equals in fact the discriminant. – orangeskid Nov 06 '20 at 07:15
-
Thank you for the answer. This is how I think as well. However, I have made up a question and can't really solve it in an efficient way. $f(x) = x^3 + 3x^2 + ax + 5$, I would like to find the interval $a$ lies over so that the equation have $3$ distinct real roots. I checked it using desmos and the answer is $a < -9$ if I'm not mistaken. – Lars Smith Mar 07 '21 at 01:22
-
What I have done is $f'(x) = 3x^2 + 6x + a \implies a < 3,\space\space x_i = -1\pm\sqrt{1-\frac{a}{3}}$. I think I should find the values for which $f(x_1)f(x_2) < 0$, but plugging in $x_i$ and checking for cases (I don't really know if it will be done like this) seems really tiring and like that's not the way. Could you please help me solve this question? – Lars Smith Mar 07 '21 at 01:23
-
Try using the discriminant $\Delta$ mentioned near the end of my answer. – bubba Mar 07 '21 at 07:45
-
-
@bubba thank you. Do you think there might be another way other than using the cubic discriminant? Because when I made up the question I really thought it was an easy one, like solving for the largest interval that $a$ could lie over for $x^3+3x^2+ax+b$, where $b$ is a real number $\left(a<3\right)$. I would actually be pretty surprised if there isn't a more convenient way to do this. Thanks again. – Lars Smith Mar 07 '21 at 12:31
For simplicity assume $A>0$ (you can easily get analogous conditions for $A<0)$. Then the first turning point will be a maximum and the second one will be a minimum. Then the 3 distinct roots:
(i) the least root should be earlier than the point where maximum is attained
(ii) the middle root should be between the maximum and the minimum
(iii) the largest root would be bigger than the minimum.
This translates to maximum should be attained at a negative number, minimum at a positive number. You can now express the above statement into a condition on the coefficients of $f'x$.

- 19,504