Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm looking to solve the following cubic equation for x:

$\beta\, x^3 - \gamma \,x = c$. I have plugged in some sample values ($\beta = 2$, $\gamma = 5$ and $c = 2$). When I try to solve this equation using mathematica's Solve[] function, I get one real root and 2 complex roots. However, I have tried plotting the equation for these values, and can clearly see there should be 3 real roots. How can I obtain them. I am sure the roots are real, but mathematica gives me back complex roots.


share|improve this question
Try Solve[2 x^3 - 5 x == 2, x] // N // Chop... If you want it in symbolic/exact form, do Simplify[x /. Solve[2 x^3 - 5 x == 2, x] // ComplexExpand] (I'm sure this has been asked before and probably answered by Artes) –  rm -rf Feb 2 '13 at 0:43
For the record, x/.Solve[2 x^3 - 5 x == 2, x] gives three REAL roots, which are expressed in terms of radicals and (of necessity) use the imaginary unit sqrt(-1). That is not the same thing as having two complex roots. –  Daniel Lichtblau Feb 4 '13 at 16:10
I'm too late the hero, but: read up on casus irreducibilis. –  J. M. May 7 '13 at 20:11

2 Answers 2

up vote 1 down vote accepted

Your original equation is in the form of a "depressed cubic" $x^3-(\gamma/\beta)x-c/\beta=0$. When the discriminant, $4 \beta \gamma^3 - 27 c^2 \beta^2$, is positive, the equation has three real roots. In this case, the roots may be written as follows:

$2\sqrt{-p/3}~{\rm Cos}[\frac{1}{3}{\rm ArcCos}[3q \sqrt{-3/p}~/~(2p)]-2\pi k/3]$,

where $p=-\gamma/\beta<0$, $q=-c/\beta$, and $k=0,1,2$. No complex square roots required.

share|improve this answer
Let p[x_] := β x^3 - γ x - c. Reduce[ Discriminant[ p[x], x] > 0, { β, γ, c}] yields (β < 0 && γ < 0 && -((2 Sqrt[ γ^3/β])/(3 Sqrt[3])) < c < ( 2 Sqrt[ γ^3/β])/(3 Sqrt[3])) || (β > 0 && γ > 0 && -((2 Sqrt[γ^3/β])/(3 Sqrt[3])) < c < (2 Sqrt[γ^3/β])/(3 Sqrt[3])). While Discriminant[p[x] /. {β -> 2, γ -> 5, c -> 2}, x] yields 568. –  Artes Feb 2 '13 at 18:29

The 3 roots only appear to be imaginary. If you enter N[Chop[sol]], you will see that the results are all real. If you are just looking for the values, then the function NSolve would be more appropriate here. The closed form solutions for the cubic contain nested square roots. This is why the solution has complex numbers.

share|improve this answer
ComplexExpand@ToRadicals@Table[Root[-2 - 5 #1 + 2 #1^3 &, k], {k, 3}] –  Artes Feb 2 '13 at 1:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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