Sunday, March 2, 2008

On how to solve a cubic equation.

In this post i will be explaining how to solve a cubic equation. While the quadratic formula was known to the babylonians since ancient times and should be easily derived by a good elementary algebra student (if you can't you can most probably stop reading..), the cubic equation has been considerably more difficult to crack.

At this point some of you might be wondering, "wait, haven't we already learnt how to solve a cubic equation in amaths? All you have to do is to guess one root and then divide the cubic by the guessed root and solve the resulting quadratic equation." Aha heres where the problem lies in this method.
1) You're guessing one root. which is cheating. You might as well guess all three roots and say "solved".
2) In effect you're actually only solving a quadratic.
3) Try guessing the roots to the cubic 61x³-5x²-3271x+305 . They are approximately equal to -7.328338841 , 7.317060569 , 0.0932454851!

And for those of you who rely on a calculator or computer to solve cubics without any idea of whats going on, congrats for having the understanding level of a primary school kid.

And thus i think it is worthwhile knowing the method to solve general cubics.

We start with the equation x³+px+r=0
(later i will show how every cubic can be reduced to this form)
then we make the substitution x=u+v

(u+v)³+p(u+v)+r=0
u³+v³+3uv(u+v)+p(u+v)+r = 0
u³+v³+3uv(u+v) = -p(u+v)-r

it is easy to see that the equation would be solved if
u³+v³=-r and
3uv=-p

from the second equation, u=-p/3v
substituting this into the first equation,
-p³/(27v³) +v³ = -r
-p³/27 +v^6 = -rv³
this is in fact a quadratic equation in v³

(v³)² + rv³ - p³/27 = 0
which is solvable for v³ by using the quadratic formula
v³ = (-r+sqrt(r²+4p³/27))/2
v= cuberoot(-r+sqrt(r²+4p³/27))/2

doing the same for u,
u= cuberoot (-r-sqrt(r²+4p³/27))/2

(*note that when you solve for u and v you get the same expression,namely
cuberoot (-r+-sqrt(r²+4p³/27))/2
but it can be shown that one must be the positive root and the other must be the negative one.)

now the only thing left to do is to add u and v together to get x!
x= cuberoot (-r-sqrt(r²+4p³/27))/2 + cuberoot (-r-sqrt(r²+4p³/27))/2

note that the other two roots of the cubic are formally found by computing the imaginary cuberoots of (-r-sqrt(r²+4p³/27))/2 and (-r-sqrt(r²+4p³/27))/2 but we can easily navigate round that. Now that we know one root, we can just divide the original cubic by this root and solve the resulting quadratic(yes, the amaths method, though if you know how to find the imaginary roots its much easier...)

and thats how to solve a cubic equation XD
Don't you feel smarter already?

1 comment:

Oddy said...

WOW. I can't get a thing. Damn it. HAHA.