June 12, 2010

Stupid Factoring Trick

Filed under: Tricks of the Trade — Adam Glesser @ 5:06 am

After the up tick in hits from my last post, WordPress asked if I’d post something to decrease the load on their servers and so I bring to you the fourth installment of my widely panned series on mathematical shortcuts. Today’s topic:  Factoring.

Tricks of the Trade

(with Professor Glesser)

Quick: what do the following polynomials have in common?

5x^2 - 6x + 1

-3x^2 + 13x - 10

x^3 - 4x^2 + 2x + 1

If you said, in less than 10 seconds, that 1 is a root to all of them, you can probably stop reading now! I did it in less than 3 seconds, so I should stop reading, but given that I’m writing this, that would be problematic.

The trick isn’t really a trick. It is just plain obvious once you see it. If you plug x=1 into any of the polynomials, you are left with 0, so it is a root. But, if that is what you do, then you won’t see the trick. When you plug 1 in, the x parts simply vanish and you are left adding up the coefficients. For example, if you notice that 5 – 6 + 1 = 0, then you know immediately that 1 is a root. In fact, that is how I came up with all the examples: I made up all but the last coefficient psuedo-randomly and then made the last coefficient the opposite of the sum of the other coefficients!

Is that it?

No, there’s more. Already, we know that 5x^2 - 6x + 1 has x = 1 as a root, but we can also immediately find the other root. How? Let’s factor. Since 1 is a root, we know that x-1 is a divisor of 5x^2 -6x + 1 and so 5x^2 -6x +1 = (x-1)(px+q) = px^2 + (p-q)x - q. Equating coefficients, we get p = 5 and q = -1. In other words, the other root is -q/p = 1/5. Hmmm, that wasn’t so immediate; that took effort. Fine, lets start over with an arbitrary quadratic ax^2 + bx + c such that a + b + c = 0 (implying that 1 is a root). We can factor ax^2 + bx + c = (x-1)(px + q) = px^2 + (q-p)x - q and, equating coefficients, we get p = a and c = -q. Ah, hah! So under our assumptions, the roots are 1 and c/a.

If we go back to our second example from the beginning, we can now immediately see that the roots are 1 and \dfrac{-10}{-3} = \dfrac{10}{3}.

Pretty good. That it?

No way. If you start with a cubic whose coefficients sum to 0, then we can factor it as before:

ax^3 + bx^2 + cx + d = (x-1)(px^2 + qx + r) = px^3 + (q-p)x^2 + (r-q)x -r

from which we get p = a, r = -d and q = \dfrac{a+b-c-d}{2} (that last one takes more work than the others). This isn’t quite as nice as before (not even close, actually), but if you’re into obscure formulas, this might be your cup of tea.  Let me give another example of a cubic, though, that is a little more fun.

Consider 3x^3 - 8x^2 + 7x - 2. At this point, your x = 1 root detector should be screaming like my two-year old when he spots a caterpillar on the ground. But, if you quickly compute a - d + \dfrac{1}{2}(a+b-c-d), you also get 0. Meaning that x = 1 is a double root (i.e., (x-1)^2 divides 3x^3 - 8x^2 + 7x - 2). It also means that the third root is 3/2!

I know, I know: there’s more.

That’s right, Diane. Part of the reason this trick will work so often in math class is that textbook writers are lazy. Why make up problems with realistic roots when you can make them all have the same roots? Anecdotally, the three most common roots of polynomials in textbooks are 0,1,-1. Checking for 0 as a root is pretty straightforward and I’ve just shown you how to find 1 as a root; how about -1? It is only slightly more complicated.

Let’s start with our general quadratic again: ax^2 + bx + c. If we substitute -1 in for x, every even power of x will simply vanish, while the odd powers of x will negate the sign of the coefficient. That is, you get a - b + c. If this equals 0, then -1 is a root. For example, knowing that 4 - 7 + 3 = 0 implies that -1 is a root of 4x^2 + 7x + 3. As before, we can factor: ax^2 + bx + c = (x+1)(px + q) = px^2 +(q+p)x + q and so p =a and q = c. Thus, the other root is -c/a. This tells us that the other root of 4x^2 + 7x + 3 is -3/4.

As before, there is no reason to stop at quadratics. For a general cubic ax^3 + bx^2 + cx + d, you simply check whether -a +b -c + d = 0.

Put together, you now have a really good way to spot check whether the three most common (textbook) roots occur in a given polynomial.

Phew, we’re done.

Not quite. I have one last bit for the interested. My high school algebra teacher taught us the rational root test (do they still teach this in school?) which says that the rational roots of a polynomial of degree n (rational here means an integer divided by a non-zero integer and the degree of a polynomial is the highest power of x in the polynomial) of the form ax^n + \cdots + b (where I don’t care at all about the terms in the middle) are all of the form \dfrac{p}{q} where p divides b and q divides a. In the special case where a,b \in \{\pm 1\}, then there are only two possible rational roots: 1 and -1. So, if given

x^5 + 2x^4 - 5x^3 + 2x^2 + 4x - 1

we can immediately see by adding the coefficients that 1 is not a root and by negating the odd power coefficients and adding that -1 is not a root and so, by the rational root test, this quintic polynomial is irreducible (i.e., it can’t be factored¹).

For another cool factoring trick that I don’t use (because I only just learned it), but think I might try teaching is David Cox’s Bottom’s Up! method.

¹This means “can’t be factored over the rationals” which means that you can’t factor so that the coefficients of the factors are rational numbers. The polynomial x^2 - 5 can be factored as (x + \sqrt{5})(x-\sqrt{5}), but \pm \sqrt{5} are irrational numbers.



  1. The Bottoms Up method looks pretty cool!

    Comment by Allen Glesser — June 12, 2010 @ 10:09 am | Reply

  2. the “rational roots test” is indeed still out there
    in the textbooks and pre-calculus courses.
    very inappropriately in the case i know best.
    i wrote about it here:
    and *wish* it were widely panned.
    widely ignored though like almost
    all my stuff. i got a nice comment
    from one of my then-students though.

    Comment by vlorbik — June 17, 2010 @ 5:00 am | Reply

  3. Very nice article

    Comment by Duc Mai — July 1, 2010 @ 11:56 am | Reply

    • Thanks, Duc. I bet you can’t guess who gave me the idea 😉

      Comment by Adam Glesser — July 4, 2010 @ 8:06 pm | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: