I am learning to solve cubic equation by Cardano's method

I am learning to solve cubic equation by cardano's method from here and what are saying only gives one root I can't seem to work these equations Q1 $$x^3-15x=126$$, Q2. $$x^3+3x^2+21x+38=0$$ so any other question some give only one root other start to give imaginary answer just how can i calculate that? any suggestion or book reference would be nice. Also are there different types of equation in Cardano's method

• The two equations you included in your question has only 1 real root and 2 imaginary roots. Once you have a real root, you can divide it into a quadratic equation and solve for the imaginary roots. Dec 22 '18 at 9:29
• Thank you so much So the formula i am using is correct and applies to all. Dec 22 '18 at 9:34
• Also see my answer to math.stackexchange.com/q/2838797. Dec 22 '18 at 9:39

In my opinion, the most "linear" (i.e. easier to convert into a general algorithm) is that proposed in this thesis by A. Cauli.

I am reporting here the basic steps: for a full analysis please refer to the cited thesis, which is written in Italian, but should not be difficult to grasp the math .

Starting with the general cubic $$x^{\,3} + a\,x^{\,2} + b\,x + c = 0$$ the first step is to reduce it to a "depressed cubic" $$\left\{ \matrix{ x = y - a/3 \hfill \cr p = b - {{a^{\,2} } \over 3}\quad \hfill \cr q = c - {{ab} \over 3} + {{2a^{\,3} } \over {27}} \hfill \cr} \right.\quad \Rightarrow \quad y^{\,3} + p\,y + q = 0$$

Then we can do a first check about the type of solutions, according to $$\Delta = {{q^{\,2} } \over 4} + {{p^{\,3} } \over {27}}\quad \Rightarrow \quad \left\{ {\matrix{ {x_{\,1} < x_{\,2} < x_{\,3} \; \in \mathbb R} & {\left| {\;\Delta < 0} \right.} \cr {x_{\,1} \le x_{\,2} = x_{\,3} \; \in \mathbb R} & {\left| {\;\Delta = 0} \right.} \cr \matrix{ x_{\,1} \in \mathbb R \hfill \cr x_{\,2} = \tilde x_{\,3} \in \mathbb C \hfill \cr} & {\left| {\;0 < \Delta } \right.} \cr } } \right.$$

Independently from the check, put $$u = \root {3\,} \of { - {q \over 2} + \sqrt {{{q^{\,2} } \over 4} + {{p^{\,3} } \over {27}}} } \quad v = - {p \over {3\,u}}\quad \omega = e^{\,i\,{{2\pi } \over 3}}$$ where in the expression for $$u$$ you can choose whichever sign for the square root and whichever one of the three solutions for the cubic root.

Therefrom the three solutions of the depressed cubic are given by $$y_{\,1} = u + v\quad y_{\,2} = \omega \,u + {1 \over \omega }v\quad y_{\,3} = {1 \over \omega }\,u + \omega \,v$$ and those of the general cubic just follow by deducting $$a/3$$.

If you know a real root $$r$$ of a cubic equation, let

$$x^3+ax^2+bx+c=0,$$ you can use long division to "remove" it.

$$\frac{x^3+ax^2+bx+c}{x-r}=x^2+(r+a)x+(r^2+ar+b)+\frac{r^3+ar^2+br+c}{x-r}.$$

As $$r$$ is a root, this reduces to

$$x^2+(r+a)x+(r^2+ar+b)=0.$$