0

I'm currently trying to calculate zeros of a cubic function using the Cardano formula

I somehow miscalculated really bad and I suspect that I've done a really cheap beginners mistake. I searched but I wasn't able to find my mistake

I only get 2 results with instead of 3 and the values are also off
I know that the cardanian formula isn't very exact especially when you round some values- which I did.

Cardano's method requires the reduced function
(sorry if this i not the correct term but I don't know the correct english name)

I tried to solve this very simple cubic function:
$ 2x^3 + 4x^2 - 2x - 4 $

reduced function:

$ z^3 - pz + q = 0$
$ z^3 - - 2 \frac{1}{3}z + \frac{-20}{27} = 0$

This is cardanos method:

\begin{equation} z=\sqrt[3]{-\frac q 2+\sqrt{(\frac q 2)^2+\frac{p^3}{27}}}+\sqrt[3]{-\frac q 2-\sqrt{(\frac q 2)^2+\frac{p^3}{27}}} \end{equation}

and I just put my values in and tried calculating it

\begin{equation*}z=\sqrt[3]{-\frac{\frac{-20}{27}} 2+\sqrt{\left(\frac{\frac{-20}{27}} 2\right)^2+\frac{\left(-2\frac 1 3\right)^3}{27}}}+\sqrt[3]{-\frac{\frac{-20}{27}} 2-\sqrt{\left(\frac{\frac{-20}{27}} 2\right)^2+\frac{\left(-2\frac 1 3\right)^3}{27}}}\end{equation*}\begin{equation*}z=\sqrt[3]{\frac{10}{27}+\sqrt{\left(\frac{-10}{27}\right)^2+\frac{-343}{729}}}+\sqrt[3]{\frac{10}{27}-\sqrt{\left(\frac{-10}{27}\right)^2+\frac{-343}{729}}}\end{equation*}\begin{equation*}z=\sqrt[3]{\frac{10}{27}+\sqrt{\frac{-1} 3}}+\sqrt[3]{\frac{10}{27}-\sqrt{\frac{-1} 3}}\end{equation*}\begin{equation*}z=\sqrt[3]{\frac{10}{27}+(\pm 0,5774)}+\sqrt[3]{\frac{10}{27}-(\pm 0,5774)}\end{equation*}


These are the two possible solutions:

\begin{equation*}z_1=\sqrt[3]{\frac{10}{27}+0,5774}+\sqrt[3]{\frac{10}{27}-0,5774}\end{equation*}\begin{equation*}z_1=\sqrt[3]{0,98226}+\sqrt[3]{-0,59152}\end{equation*}\begin{equation*}z_1=0,99405-0,83944\end{equation*}\begin{equation*}z_1=1,8335\end{equation*}

\begin{equation*}z_2=\sqrt[3]{\frac{10}{27}-0,5774}+\sqrt[3]{\frac{10}{27}+0,5774}\end{equation*}\begin{equation*}z_2=\sqrt[3]{-0,59152}+\sqrt[3]{0,98226}\end{equation*}\begin{equation*}z_2=0,83944-0,99405\end{equation*}\begin{equation*}z_2=-0.15461\end{equation*}

I used this online calculator to calculate the zeros but got a totally diffrent valus that my cardanos method results. The calculator says that the graph has 3 zero points at $-2$,$-1$ and $1$.
I think I've made a very embarrassing mistake somewhere.

I know that cardanos method isn't very useful from todays perspective but I need to turn in an work on thus very soon and I'm pretty much done except with these example calculations.

I hope you guys are able to help me :)

Thanks for reading. Have a nice day

  • The particular error in your calculation is the step from the third to the fourth line. In $\sqrt{-1/3}$. You seem to have ignored the $-$ sign. – Ethan Bolker Nov 01 '15 at 13:29
  • May I suggest you avoid numbers written as $2 \frac{1}{3}$ and use $ \frac{7}{3}$ instead ? – Claude Leibovici Nov 01 '15 at 13:32
  • @ClaudeLeibovici yea you're right – BlueWizard Nov 01 '15 at 13:43
  • @EthanBolker We learned in school (or maybe i made another mistake there) that we don't get a clear result when taking the square of a negative number so we need to calculate with the positive solution and the possible negative solution $ \pm 0,5774 $. Moth positive and negative possibility are calculated in $z_1$ and $z_2$ – BlueWizard Nov 01 '15 at 13:47
  • $\sqrt{-1/3}$ is the square root of a negative number, not the square of a negative number. It is $\pm 0.577... \times i$, where $i$ is the square root of $-1$. – Ethan Bolker Nov 01 '15 at 13:51
  • Thanks for the great explanation! I know that imaginary numbers aren't part of the stuff you learn in school but I'm at the moment pretty amazed by them. We never did this $\pm0.577*i$ thing, we only did wrote the $\pm0.577$ while calculating negative roots. I want to know: Do I need to add the imaginary number? Is this correct math when I add the imaginary number and the leaving out of the $i$ was just preperation for later when we'll learn it to do right? I would love to know if I need to add it in every solution of a square root of an negative number – BlueWizard Nov 02 '15 at 16:43
  • See also an easy explanation here on dealing with cubics with three real roots. – Tito Piezas III Feb 25 '16 at 01:09

3 Answers3

1

Cardano's formula won't work here, as this equation has $3$ real roots. If you examine the way this formula is obtained, you'll see it comes down to finding two numbers when their product and sum are given. This is a typical problem of quadratic equations, and it has solutions if the discriminant of the quadratic equation is non-negative.

Now it happens that, when the cubic equation has $3$ real roots, this discriminant is negative,. The formula remains true, but you have to consider a real number has $3$ complex cubic roots, of which one is real. Actually this case was the reason for introducing complex numbers at the time.

In such a case, a trigonometric resolution is much more efficient. For your equation this isn't even necessary, as it is enough to do partial factorisations to find the roots: $$2x^3+4x^2-2x-4=2x(x^2-1)+4(x^2-1)=2(x-1)(x+1)(x+2).$$

Bernard
  • 175,478
  • The $2x$ factor in the last line should just be $2$, i.e. $2(x-1)(x+1)(x+2)$ – Cataline Nov 01 '15 at 13:29
  • Thanks for pointing the typo! – Bernard Nov 01 '15 at 13:32
  • I should have thought more about the problem I want to solve. I need to show my class how they could solve cubic functions with this forumla and then I just used the first numbers that came to my mind for creating an example solution. I'll use a cubic function that is easier to solve using cardanos method. I'll mark your answer as answered if I don't receive a better answer til then. – BlueWizard Nov 01 '15 at 13:51
  • Choose any cubic function that has only one (or a double) real root. The harder work is choosing sensible coefficients. – Bernard Nov 01 '15 at 14:02
1

Let $f(x) = x^3 + 2x^2 - x - 2$

Let $k = -2/3$

$$f(x) = f(y+k) = y^3 + f'(k)\;y + f(k) = y^3-{7\over3}y - {20\over27}$$

Make the polynomial fit form: $y^3+3py+2q$

$$(p,q) =\left({-7\over9}, {-10\over27} \right)\quad → D = p^3+ q^2 = {-1\over3}$$

We only calculate 1 term, the other to be derived.

$\alpha = \sqrt[3]{-q - \sqrt{D}}=\large \sqrt[3]{{10\over27}-\sqrt{{-1\over3}}} = -{2\over3}-{1 \over \sqrt3}i$
$\beta=\large{-p\over \alpha} = -{2\over3}+{1 \over \sqrt3}$
$\omega = \large e^{2\pi i \over 3} = -{1\over2}+{\sqrt3 \over 2}$

All $y$ roots must maintain the relation: $\;\alpha \beta = -p$

$$y\;roots = (\;\alpha + \beta,\; \alpha\,\omega + \beta/\omega,\; \alpha/\omega + \beta\,\omega\;)$$

$$x\;roots = \left({-4\over3}, {5\over3}, {-1\over3}\right) + k = (-2,1,-1)$$

albert chan
  • 2,114
0

Your mistake is when taking the square root of $-1/3$. This yields complex numbers, of which you need to take the cubic root.

For this particular equation, it is much easier to observe that $x=1$ is a root. Then by polynomial division,

$$2x^3+4x-2x-4=2(x-1)(x^2+3x+2).$$

The rest is elementary.