[RESOLVED] Cubic Polynomials
From reading the other threads this question appears simple.
Is there any other way to factorise a cubic polynomial than by using the factor theorem?
I ask this because the factor theorem can be quite a tedious method if the number isn't an integer. For example if the cubic polynomial i am trying to solve is P(x) = x³+x²-4x-4 then it wouldn't take long to figure out one of the factors.
P(1) = 1³+1²-(4x1)-4 = -6 ≠ 0
P(-1) = (-1)³+(-1)²-(4x-1)-4 = 0 Therefore (x+1) is a factor.
However if the cubic polynomial i am trying to solve is P(x) = 3x³-8x²-17x+14 it would take a long amount of time to find one of the factors.
P(1) ≠ 0
P(-1) ≠ 0
P(2) ≠ 0
P(-2) ≠ 0
P(7) ≠ 0
P(-7) ≠ 0
After a long period of time you would find that P(3/2) = 0 Therefore (3x-2) is a factor. Surely there is a much quicker way?
Re: [RESOLVED] Cubic Polynomials
Here's a much more elegant explanation of my previous post (<--- is a perfectionist).
Succinctly: Let x1 and x2 be the point(s) where P'(x) = 0, and let x1 <= x2 by choice. Check the three ranges (-inf, x1), (x1, x2), and (x2, inf) for roots using the above algorithm, as well as the points x1 and x2. You will always find all real roots in this manner.
Verbosely: from Calculus, we can calculate when the function changes direction [see previous post for details if interested]. A cubic polynomial does so exactly 2 times--perhaps, both of them are at the same point. Call these turning points x1, and x2, where x1 <= x2 by choice.
We know that roots have to occur in a range where the function goes from positive to negative (or negative to positive). The function can only cross the x-axis to make a root when it is negative and going positive, or when it's positive and going negative--that is, during times when the function is going in one direction already and happens to be on the wrong side of the axis.
Each cubic polynomial has (up to) three ranges, during which time it is moving in one particular direction: (-inf, x1), (x1, x2), and (x2, inf). Perhaps during part of this range, the function will be negative while increasing or positive while decreasing--who knows. The point is, the potential exists for a root to exist in one of those ranges--and only one root would exist. So, search those three ranges, and you'll come up with (up to) three roots.
More formally,
Case 1: There is a root in all three ranges (-inf, x1), (x1, x2), and (x2, inf). There must be only one root in all three ranges, since any more would violate the fact that a cubic polynomial can have at most 3 real roots. As such, the root finding algorithm will find all 3 roots*.
Case 2: There is a root in 1 of the above ranges. The algorithm will find the 1 root in the range that contains the root. The range containing the root can be determined by checking which range changes sign*.
Case 3: There is no root in the above ranges. Then, the root(s) must be at x1 or x2. So, check these values as roots, and you will determine all real roots by default. Note that x1 or x2 could be a double (or triple, in the case of x1=x2) root.
*The function never changes direction in a given range. So, given a range (r1, r2) from above...
-if P(r1) < P(r2), the function increases from r1 to r2, and any point r1 < r < r2 satisfies P(r1) < P(r) < P(r2)
-if P(r1) > P(r2), similarly P(r1) > P(r) > P(r2)
In either case, the function will only be positive or negative in a given range if it is positive or negative at the endpoints of the range. So, there is only a root in the range if there is a sign change at the endpoint of the range (this only applies for these specific ranges, which were chosen carefully for this purpose).