# Finding All 3 Roots of a Cubic

I'm trying to find all real roots of a cubic. I wanted to use Cardando's Method but I'm not sure I'm correctly understanding how to obtain all 3 roots given the depressed cubic: $$t^3 + pt + q = 0$$

What I'm understanding is that unless $q = 0$ and $p \neq 0$ there are at most 2 roots?

Generally these two roots should be obtained by finding the $u$ and $v$ from $t = u + v$ and then:

• The first root of $t$ is: $u(\frac{-1 + i\sqrt 3}{2}) + v(\frac{-1 - i\sqrt 3}{2})$
• And the second root of $t$ is: $u(\frac{-1 - i\sqrt 3}{2}) + v(\frac{-1 + i\sqrt 3}{2})$

So a couple questions here. How do we know there are only 2 roots in these cases, and where did those two magic coefficients come from that I'm multiplying $u$ and $v$ by?

• There are always $3$ roots, not necessarily real, counting multiplicities. By the way, it Cardanos method. – Bernard Nov 18 '15 at 12:54
• @Bernard That's the reason for my concern. I don't know how to get the third root out using Cardano's method. – Jonathan Mee Nov 18 '15 at 12:57
• $u+v$ is the third root! And the magic coefficients are the solutions to $x^3 = 1$, easily obtained by factoring $x^3-1$ as $(x-1)(x^2+x+1)$ and solving $x^2+x+1=0$ – user141452 Nov 18 '15 at 12:59
• Cardano's method works smoothly only if there is one real root only. If you have $3$ real roots, you have to express them as expressions in complex numbers. – Bernard Nov 18 '15 at 13:03
• A classical method in case of three real roots is a trigonnometric one, setting $x=A\cos\theta,\enspace A>0,\ 0\le \theta\le \pi$, and playing with the identity: $\;\cos 3\theta=4\cos^3\theta-3\cos\theta$, in order to obtain a trgonometric equation in the form $\;\cos3\theta=\alpha$. – Bernard Nov 18 '15 at 13:26

When a cubic equation has $3$ real roots, Cardano's formulae require square roots of the negative discriminant of an auxiliary quadratic equation – it is even for this case what is now known as complex numbers were invented.
So it is better to use a trigonometric method: set $x=A\cos\theta, \enspace A>0$. The equation $x^3+px+q=0$ becomes $$A^3\cos^3\theta+pA\cos\theta+q=0$$ Now remember the formula $\;\cos3\theta=4\cos^3\theta-3\cos\theta$, and choose $A$ so that $A^3\cos^3\theta+pA\cos\theta$ is proportional to this formula, i. e. $$\frac{A^3}4=\frac{pA}{-3}\iff A^2=-\frac{4p}3\iff A=2\sqrt{-\frac p3}$$ (since we want to have $A>0$). This results in the trigonometric equation: $$-\frac{2p}3\sqrt{-\frac p3}(4\cos^3\theta-3\cos\theta)+q=-\frac{2p}3\sqrt{-\frac p3}\cos3\theta+q=0,$$ whence $\;\cos3\theta=…$