# How to solve this cubic equation (where I must take the square root of a negative)?

I am trying to solve the following set of equations for $$L'$$ as described in this publication excerpt:

So basically, to re-write that, I have the following series of equations:

$$a=X/2$$

$$b=-(75X^2 + 147Y^2)/80$$

$$c = -9X^3/16$$

$$P = 2a^3−9ab+ 27c$$

$$Q = P^2 -4(a^2-3b)^3$$

$$w_1=−0.5 +\frac{i\sqrt{3}}{2}$$

$$w_2=−0.5 -\frac{i\sqrt{3}}{2}$$

Which lead to the following three possible solutions:

$$L'_1 = -\frac{1}{3} * [a+\sqrt[3]{0.5*(P+\sqrt{Q})} +\sqrt[3]{0.5*(P-\sqrt{Q})}]$$

$$L'_1 = -\frac{1}{3} * [a+w_2\sqrt[3]{0.5*(P+\sqrt{Q})} +w_1\sqrt[3]{0.5*(P-\sqrt{Q})}]$$

$$L'_1 = -\frac{1}{3} * [a+w_1\sqrt[3]{0.5*(P+\sqrt{Q})} +w_2\sqrt[3]{0.5*(P-\sqrt{Q})}]$$

I am now trying to solve $$L'$$, but I'm not actually sure how to do it.

My problem is for any input of $$X$$ or $$Y$$, $$P$$ I believe can end up positive or negative, but $$Q$$ is always a negative.

So let's say hypothetically $$P = 2$$ and $$Q = -3$$, then how do you solve:

$$\sqrt[3]{0.5*(P-\sqrt{Q})} = \sqrt[3]{1-0.5*i\sqrt{3}}$$

What would be the next step?

Basically, I don't know how to solve these equations if $$Q$$ is negative or if $$0.5*(P-\sqrt{Q})$$ is negative. I don't know much about complex math. I've used Euler's formula in other situations but I'm not sure here.

Any help? Thanks.

For this equation, I should strongly recommend to use the trigonometric method for three real roots since $$\Delta=6914880 \left(175 X^4 Y^2+230 X^2 Y^4+147 Y^6\right) >0 \quad \forall X,Y$$ $$p=-\frac{49}{240} \left(5 X^2+9 Y^2\right)\qquad\qquad q=\frac{49}{4320} X \left(27 Y^2-35 X^2\right)$$ which gives for the roots $$L'_{k}=-\frac X 6+\frac{7 \sqrt{5 X^2+9 Y^2}}{6 \sqrt{5}}\times$$ $$\cos \left(\frac{2 \pi k}{3}-\frac{1}{3} \cos ^{-1}\left(-\frac{\sqrt{5} X \left(27 Y^2-35 X^2\right)}{7 \left(5 X^2+9 Y^2\right)^{3/2}}\right)\right)$$ with $$k=0,1,2$$.

• Oh WOW Claude! If that works, that is far easier. I have just been working through all the Euler equations with complex numbers and endless atan, sin, cos, and i functions based on the first answer I received, which was starting to seem unsolvable and insanely complex. This is much simpler and mathematically less costly. I need to calculate this a lot so I can't afford so many esoteric functions. Now just to be clear, the cos and inverse cos functions here are radian based functions, right? I mean in C++ cos and inverse cos are radian based, so this should work smoothly, right? Thanks so much.
– mike
Nov 16, 2020 at 4:37
• Can you also explain if you have a moment what the first line means or where that came from? What's Δ or ∀X,Y represent? Where did 6914880 come from? Sorry if this is too stupid. The only math course I took in undergrad was "intro to stats". :) If it's too much bother don't worry. Thanks either way.
– mike
Nov 16, 2020 at 4:45
• @mike. I only know radians. For the remaining go to en.wikipedia.org/wiki/Cubic_equation and just follow the steps. Nov 16, 2020 at 4:54
• Thanks again Claude. Very appreciated.
– mike
Nov 16, 2020 at 5:02

In the next step, you want the cube root of the complex number $$z = 1-i\sqrt{3}/2$$. First express this number in the form $$z = re^{i\theta}$$ using Euler's identity. For a number $$z = a + i b$$ we have $$r = \sqrt{a^2 + b^2}$$ and $$\theta = \tan^{-1}(b/a)$$:

$$z = \sqrt{1^2 + (\sqrt{3}/2)^2} e^{i\tan^{-1}(-\sqrt{3}/2) + 2\pi i n} = \frac{1}{2}\sqrt{7}e^{i \tan^{-1}(\sqrt{3}/2) + i 2\pi n} .$$ Here $$n$$ is an arbitrary integer which accounts for the periodicity of $$e^{i x}$$.

Then you can take the cube root:

$$z^{1/3} = \frac{7^{1/6}}{2^{1/3}} e^{i \tan^{-1}(-\sqrt{3}/2)/3 + i 2 \pi n/3} = \frac{7^{1/6}}{2^{1/3}} \big[ \cos( \tan^{-1}(-\sqrt{3}/2)/3) + i \sin (\tan^{-1}(-\sqrt{3}/2)/3)\Big] e^{i 2 \pi n/3}$$

which you can simplify as desired. Notice it's multi-valued ($$n = 0, \pm 1, \dots$$). These different values are branches.

• Wow thanks okay. I didn't know about that relationship or those equations. I understand the principle roughly of what you were doing with $n$ but I will just be setting $n=0$ as I'm just looking for the simplest solution I believe.
– mike
Nov 16, 2020 at 2:24