Factoring polynomials of degree 3 or higher is significantly harder than factoring quadratics. Short of applying (the famously complicated) cubic formula, your best bet for cubics is to either:
* Spot a simply way to break it down to allow obvious factoring, OR
* Apply the rational root theorem and *hope* it has rational roots.
# By Inspection
If you're really lucky, you'll spot this early. But I wouldn't rely on it at all. Because of how factors multiply out, if this polynomial has "nice" linear factors (a big if) then one of them will have a leading coefficient of 2 and the others will have coefficients of 1. With that in mind, we can try to 'chunk' our coefficients into sums/differences of a multiple of 2 and another number. So, let's look at our coefficients:
* 2x^(3) \+ 3x^(2) \+ 0x - 1
* (2)x^(3) \+ (4 - 1)x^(2) \+ (2 - 2)x + (-1)
* (2x^(3) \+ 4x^(2) \+ 2x) - (x^(2) \+ 2x + 1)
* 2x(x^(2) \+ 2x + 1) - (x^(2) \+ 2x + 1)
* (2x - 1)(x^(2) \+ 2x + 1)
I think that's really hard to spot and think of. And oftentimes the polynomial just won't factor nicely. So you're better off learning the next method, but sometimes you can grab a quick win by just playing with the coefficients a bit.
# Rational Roots
If a polynomial with integer coefficients has rational roots then the numerator of each root will divide the constant term and the denominators will divide the leading coefficient. So, in our case, we really don't have much to check. The rational roots can only have numerators +1 or -1 (as these are the only integers that divide -1) and they can only have denominators +2, +1 (the negatives also divide 2 but seeing as we're talking about fractions here, we've already accounted for those by including negative numerators). That's it. We don't have too much to check. There are only really 4 possible rational roots it could have.
Also note that if a rational root of a polynomial with integer coefficients is written p/q then it corresponds to a linear factor (qx - p). Now, let's see if we can verify a rational root:
1. If (1/1) is a rational root then p(1) = 0. But 2(1^(3)) + 3(1^(2)) - 1 = 4, so that's not a root.
2. If (1/2) is a rational root then p(1/2) = 0. 2(1/8) + 3(1/4) - 1 = 1/4 + 3/4 - 1 = 0. So 1/2 is a root! That corresponds to a factor of (2x-1), so let's try to factor that out:
We'll factor out the (2x-1) by equating coefficients. We get:
>2x^(3) \+ 3x^(2) \+ 0x - 1 = (2x-1)(ax^(2) \+ bx + c)
>2x^(3) \+ 3x^(2) \+ 0x - 1 = (2ax^(3) \+ (2b-a)x^(2) \+ (2c-b) - c
So, immediately we see:
1. 2 = 2a, so a = 1.
2. 2b - a = 3, so b = 2.
3. \-1 = -c, so c = 1.
>2x^(3) \+ 3x^(2) \- 1 = (2x-1)(x^(2) \+ 2x + 1)
We could try to continue to search for roots like we did, and we'd find them, but the remaining factor is a quadratic (which we can factorize more easily than a cubic) and also it's very clearly a perfect square. So the final step is:
>2x^(3) \+ 3x^(2) \- 1 = (2x-1)(x+1)^(2)