3 Answers
3

I think "trial and error" is probably referring to the Rational Roots Test. To use it, try all fractions of the form $\pm \frac{p}{q}$ where $p$ is a factor of the constant term and $q$ is a factor of the highest degree term.

In your example, we would evaluate each of the following in the function and see if any of them are roots: $\pm \frac{1}{1}, \pm \frac{1}{2}, \pm \frac{2}{1}, \pm \frac{2}{2}, \pm\frac{4}{1}, \pm \frac{4}{2}$. (Several of these are redundant, but I include them just so you can see how the list is formed.)

Note that the vast majority of numbers in this list are not roots. All the Rational Roots Test claims is that if there is a rational root of your function, then it will appear somewhere on the list. Most of the numbers on the list are not roots, however.

@Austin Mohr, see update 2, did I make a careless mistake? I also tried the rest of the possible factors but none seem to equate to 0, ... perhaps I made some careless mistakes?
–
Jiew MengSep 4 '11 at 3:48

@jiewmeng You've not made a mistake. The Rational Roots Test can be stated like this: If there is a rational root, it will appear somewhere on this list. Most of the numbers on the list, however, are meaningless. They certainly can't all be roots (a cubic only has 3 roots, after all). The rational roots test just gives you a relatively short list of possibilities to check.
–
Austin MohrSep 4 '11 at 4:00

@Austin Mohr, maybe you misunderstood me, I tried all possible roots and none seem to equate to 0, at least in Ubuntu's calculator ... manually working worked ... still looking why 2(−0.5)^3−9(−0.5)^2+3(−0.5)+4 in Ubuntu gives -18.75 while manually working as shown by @Arturo Magidin gives 0 (I also verified it manually)
–
Jiew MengSep 4 '11 at 4:05

Of course there is :-) A technique for solving cubics has been known since the 16th century.

Let's start with $x^3+ax+b=0$, which is your case. We'll see later that it's always possible to eliminate the $x^2$ term, so this is in fact the only case we really need to worry about.

The trick is to make the problem initially look harder by setting $x=p+q$. Instead of a single variable we now have two; we hope to use the extra freedom to gain something, and we shall.

Substituting, we get

$(p+q)^3+a(p+q)+b=0$

or

$p^3+3p^2q+3pq^2+q^3+a(p+q)+b=0$

and now we observe that $3p^2q+3pq^2$ can be rearranged:

$p^3+q^3+3pq(p+q)+a(p+q)+b=0$

and finally, we observe the two terms with a common $p+q$:

$p^3+q^3+(3pq+a)(p+q)=0$.

This seems about as bad as where we started - however, we have this extra degree of freedom: we can force $3pq+a$ to be 0. If we do that, by setting $q = -\frac{a}{3p}$, we get

$p^3 - \frac{a^3}{27p^3} + b = 0$

and we're basically done: renaming $p^3$ as $z$, this is a quadratic equation in $z$. Solve it, determine $p$, calculate $q$, and the solution to the original equation is $x=p+q$ (of course there could be multiple solutions).

All of this can be recast as explicit equations for the solution, but I never remember those; the only way I can remember this is by recalling the $x=p+q$ trick.

Finally, if you have

$x^3+ax^2+bx+c=0$

you can make a simple linear change of variables $x=y+r$, whereby this becomes

$y^3+(3r+a)y^2+\ldots=0$

so choosing $r = -a/3$ makes the $y^2$ term vanish. Solve for $y$ as before and remember the shift $x=y-a/3$ to get the solution for the original equation.

In light of the "update", it might be a good time to include the reduction to the form without a quadratic term $$$$ :)
–
The Chaz 2.0Sep 4 '11 at 3:26

This is what I do in the last paragraph, right?
–
Alon AmitSep 4 '11 at 3:52

1

There's a nice geometric interpretation of the "depression" of a cubic: by Vieta, we know that the mean of the three roots is $-a/3$, so performing the translation implied by the depression corresponds to shifting the roots such that the shape formed by the three roots in the complex plane is "centered" on the origin.
–
Guess who it is.Sep 4 '11 at 5:40

For the general cubic equation (1) with real coefficients, the general
formula for the roots, in terms of the coefficients, is as follows if
$(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3=-27 a^2 \Delta>0$, i.e. if there are
two non real roots:

However, this formula is wrong if the operand of the square root is
negative or if the coefficients belong to a field which is not
contained in the field of the real numbers: When this operand is real
and positive, the cubic roots are real and well defined. In the other
case, the square root is not real and one has to choose, once for all
a determination for it, for example the one with positive imaginary
part. For extracting the cubic roots we have also to choose a
determination for the cubic roots, and this gives nine possible values
for the first root of an equation which has only three roots.

A correct solution may be obtained by remarking that the proof of
above formula shows that the product of the two cubic roots is
rational. This gives the following formula in which $\sqrt{ }$ or
$\sqrt[3]{ }$ stand for any determination of the square or cubic root,
if $b^2-3ac \mbox{ } \neq \mbox{ } 0$.

If $Q = 0$ and $b^2-3ac \mbox{ } \neq \mbox{ } 0$, above expression for
the roots is correct but misleading, hiding the fact that no radical
is needed to represent the roots. In fact, in this case, there is a
double root

In view of the extraordinary length of the quotation, it could well be suggested that you simply link that page, and then explain what you want to express??Per chance, I am making some unconscious mistake, but I really see no reason to post such a long quotation, instead of one simple link(as you already did), without the content; in any case, what is the link for??
–
awllowerSep 4 '11 at 9:24

3

@awllower: it's a standard practice in Stack Exchange to quote the most important bits of the source site due to the possibility of link rot (although with a popular article in Wikipedia, the chance of that happening is probably closer to nil). The link was there since I originally intended for a (much) shorter quote, but ended up converting the whole section.
–
Lie RyanSep 4 '11 at 9:51

Thanks for your explanation!! I see the reason now, and also appreciate your good answer.
–
awllowerSep 4 '11 at 10:12