tags:

views:

369

answers:

5

How would I solve:

-x^3 - x - 4 = 0

You can't use quadratic, because it is to the 3rd power, right?

I know I it should come out to ~1.3788 but I'm not sure how I would derive that.

I started with:

f(x) = x + (4/(x^2 + 1)).

Solving for 0, moving the x over to the other side, multiplying by (x^2 + 1) on both sides, I end up with:

-x(x^2 + 1) = 4,

or

-x^3 - x - 4 = 0.

+2  A: 

It's a cubic function. You're correct, the quadratic formula does not apply.

You gave one root, but in general there are three.

How did you arrive at that single value? Trial and error? That's legitimate. You don't need to "derive" anything.

x^3 + a2*x^2 + a1*x + a0 = 0 can be written as (x-x1)*(x-x2)*(x-x3) = 0, where x1, x2, and x3 are the three roots. If you know that the root you cited is correct, you can divide it out and leave (x-x2)*(x-x3) = 0, which is a quadratic that you can apply the usual techniques to.

duffymo
I started with f(x) = x + (4/(x^2 + 1)). Solving for 0, moving the x over to the other side, multiplying by (x^2 + 1) on both sides, I end up with -x(x^2 + 1) = 4, or -x^3 - x - 4 = 0.
Right, so if you divide x^3+x+4 = 0 by (x+1.3788), you'll be left with x^2-1.3788*x+ 2.90109 = 0, which is a quadratic that yields to the usual techniques that you already know.
duffymo
And when I do that, I get the following complex conjugate roots: x2 = 0.68940 - i(3.11501) and x3 = 0.68940 + i(3.11501).
duffymo
+4  A: 

Finding roots of equations by using Newton's method or Fixed point iteration

Those methods are general and can be good for finding a solution numerically, but they can sometimes not converge, and some roots might be harder to find than others. If you want an "exact" expression for all the roots (in terms of radicals, etc.), you need to use Cardano's method (or similar).
ShreevatsaR
+4  A: 

Algebraically, you want to use Cardano's method:

http://www.math.ucdavis.edu/~kkreith/tutorials/sample.lesson/cardano.html

Using this method, it's about as easy to solve as the quadratic.

Actually, this is possibly clearer:

http://en.wikipedia.org/wiki/Cubic_function#Summary

Chris KL
Oops - sorry for stealing your thunder, @Zach
Chris KL
+2  A: 

Find a root by using newton iteration (see link below). Then divide the polynomial by (x-TheRootYouFound). The result will be a quadratic formula that you can plug into your quadratic root finder of your choice.

About Newton Iteration:

http://en.wikipedia.org/wiki/Newton%27s_method

About Polynomial Division

http://en.wikipedia.org/wiki/Polynomial_long_division

This article may be interesting for you as well. It covers more robust ways to solve your problem at the expense of some additional complexity.

http://en.wikipedia.org/wiki/Root-finding_algorithm

Nils Pipenbrinck
Not quite true - there is a closed form solution for most cubics.
Chris KL
yea - I've seen that and edited my post...
Nils Pipenbrinck
+1  A: 

This may not help from a programming viewpoint, but from a math perspective...

Note than in this particular cubic function you need to consider imaginary numbers, because when x = i then you have a denominator that is zero (in your original equation). Also, generally speaking you shouldn't multiply or divide by variables (adding and subtracting is fine though) when you move them to the other side of the equation because you'll generally forget of about the condition where the term you multiplied or divided by is zero. Those answers need to be excluded from the solution set.

x = i is an example of an excluded solution in the above cubic. You need to evaluate your excluded solutions before you manipulate the equation at all.

Bob Somers
Yes, I should point out that the Cardano method I mentioned above doesn't work for complex roots. I'm not sure that particular equation has them though.
Chris KL
Yes, this particular equation only has one real root, and no complex ones, but it's still important to include complex exclusions when you're dealing with cubics.
Bob Somers