Last time, we looked at the standard algebraic methods to factor a quadratic trinomial. Those methods all involve some amount of guessing and checking, especially when the numbers involved are large; and they only work when there are binomial factors with integer coefficients. These are the methods a teacher usually expects you to use. But if you simply have to factor one as part of a larger problem, and the factors are not obvious, you can bring out the power tools! These are the last resort (or first resort?) methods that are guaranteed to work.
Factoring without guessing
In this 2002 question, a good student wants to get past the time-consuming trial and error, and just get to the answer:
Factoring Quadratics Without Guessing Hi. My name is Chris and I am a seventh grader, but I love math and like to learn on my own. I have already learned basic trigonometry, logs, etc... I am now learning how to solve quadratic equations. I found out how to, but I am still wondering how to do one thing. It is part of the factoring. I will use the example x^2 + 5x + 6 = 0. My dad taught me that you find two factors of the 6 that add up to the 5 in 5x. In this case it can be 2 and 3. He told me to then make it into (x + 3)(x + 2) = 0. What I am wondering is if there is any way to find two factors of 6 (or whatever number it is) that add up to 5 (or the other number) without using guess and check. If there is no way to do that, then how do you factor it when the two factors are not whole numbers? I would love to know this.
This is an easy example of the basic case; but it’s easy to imagine the numbers being larger, making guessing harder. We might say that the method is not scalable.
Guess and check can be more efficient than it seems
Doctor Ian answered, starting with why guessing often isn’t so bad:
Hi Chris, In fact, guess and check is the most straightforward way to proceed if you have reason to believe that the roots are integers, and what makes it reasonable is that there usually aren't all that many possible guesses! This is because for any given integer, there are a limited number of ways to multiply two other integers to get it. For example, consider something like x^2 + 13x - 68 If you break 68 into prime factors, 68 = 2 * 2 * 17 it becomes clear that the _only_ possible ways to factor -68 are -1 * 68 1 * -68 -2 * 34 2 * -34 -4 * 17 4 * -17 and only one of these pairs of factors can add up to 13. So it's guess and check, but when done correctly, it's a very _educated_ kind of guess and check.
As you can easily see, the numbers we want are \(-4\) and \(17\), so we have \((x-4)(x+17)\). It’s not quite so easy if we have, say, \(30x^2-11x-30\), where we need factors of \(-900\) whose sum is \(-11\). (Try it!)
Completing the square
But there _is_ a way of avoiding guess and check, called 'completing the square', which makes use of two very common patterns: 1. (x + a)^2 = x^2 + 2ax + a^2 2. (x + a)(x - a) = x^2 - a^2 You're going to be seeing a lot of these as you continue on in math, so you may as well take this opportunity to become friends with them. :^D
We’ve discussed this method in the context of equations, here, and have used it in other ways elsewhere. Here we’ll be using it to factor an expression, which looks just a little different.
The two formulas listed are called “perfect square trinomial”, which is the square we’ll be “completing”, by finding the appropriate constant term to turn the first two terms into a square, and “difference of squares”, where we’ll use the square we made.
But note that his example is the easy case where the coefficient of x is 1; we’ll revisit this later to extend it.
How do we use them? First, we complete the square by adding the square of half the coefficient of x to both sides of the equation. Using your example equation,
x^2 + 5x + 6 = 0
x^2 + 5x + (5/2)^2 + 6 = (5/2)^2
(x + (5/2))^2 + 6 = 25/4
Now we subtract it from both sides to get
(x + (5/2))^2 + 6 - 25/4 = 0
(x + (5/2))^2 + 24/4 - 25/4 = 0
(x + (5/2))^2 - 1/4 = 0
And since 1/4 is a square (of 1/2), we can use our second pattern:
(x + (5/2))^2 - 1/4 = 0
[(x + 5/2) + 1/2][(x + 5/2) - 1/2] = 0
[x + 3][x + 2] = 0
It has a certain elegance, doesn't it? But as you can see, the numbers can get a little hairy, which is why people tend to prefer the guess and check method. It offers fewer chances for making silly mistakes.
Here we obtained a difference of two squares, the first being our completed square, and the other a constant. If the latter had not been “minus a square”, then factorization would be impossible.
If the goal were to solve the equation, we could have used a square root to find the zeroes: $$\left(x+\frac{5}{2}\right)^2=\frac{1}{4}\\x+\frac{5}{2}=\pm\sqrt{\frac{1}{4}}=\pm\frac{1}{2}\\x=-\frac{5}{2}\pm\frac{1}{2}=-2,-3$$ This could be used in the way we’ll see in the next section, to obtain factors. Here, we are getting factors more directly.
Alternative style
When I complete the square of an expression like this one, I don’t write an equation, but just manipulate the expression as it stands: $$x^2+5x+6\\\left(x^2+5x\color{Red}{+\frac{25}{4}} \right)+6\color{Red}{-\frac{25}{4}}\\\left(x+\color{Red}{\frac{5}{2}}\right)^2+\frac{24}{4}-\frac{25}{4}\\\left(x+\frac{5}{2}\right)^2-\frac{1}{4}$$
There I added and subtracted the square of half the linear coefficient, \(\left(\frac{5}{2}\right)^2=\frac{25}{4}\). Now we factor this as a difference of squares: $$\left(x+\frac{5}{2}\right)^2-\left(\frac{1}{2}\right)^2\\\left(x+\frac{5}{2}+\frac{1}{2}\right)\left(x+\frac{5}{2}-\frac{1}{2}\right)\\\left(x+3\right)\left(x+2\right)$$
As I mentioned, this procedure applies only when the leading coefficient is 1; we’ll do it for a more general example later.
Quadratic formula
But the quickest way to factor a quadratic equation is to use the quadratic formula. Again, using your example,
x^2 + 5x + 6 = 0
the quadratic formula says that the roots are
-b ± sqrt(b^2 - 4ac)
x = -------------------- here a=1, b=5, c=6
2a
-5 ± sqrt(5^2 - 4*1*6)
= ----------------------
2*1
-5 ± sqrt(25 - 24)
= ------------------
2
-5 ± 1
= ------
2
= -4/2, -6/2
= -2, -3
This tells us that the original equation is zero when x = -2 or when x = -3; so
x^2 + 5x + 6 = (x + 2)(x + 3)
Note that you have to be careful with signs when using this method! It's easy to get them mixed up.
The downside of this method is that, somewhat like the slip-and-slide method, there is no way to catch an error in the middle of the work (and sign errors are easy to make almost everywhere!). Because all the algebra has already been done, being hidden in the formula, it’s practically magic. So it’s really important to check your final answer. (Of course, it isn’t really magic – the formula is one we know is true, because we’ve seen it derived mathematically.)
The quadratic formula is by far the fastest way to factor a quadratic equation, and it has the advantage that it works even when the roots aren't integers. In practice, I'll usually give factoring about 5-10 seconds, and if I don't get it immediately, I'll go right to the quadratic formula. And when the initial coefficient is anything other than 1, e.g., 3x^2 - 2x + 15 I won't even _try_ factoring, because the number of possibilities goes up so fast that I get a headache just thinking about it.
I’d try factoring for this one (by the ac method, because there aren’t really too many factors to consider), but if I didn’t quickly find the right pair of factors, I’d move on.
For completeness, let’s look at an example where it turns out that we can’t factor over the integers, namely that last example, \(3x^2-2x+15\):
$$x=\frac{2\pm\sqrt{(-2)^2-4(3)(15)}}{2(3)}=\frac{2\pm\sqrt{-176}}{6}=\frac{2\pm4i\sqrt{11}}{6}=\frac{1\pm2i\sqrt{11}}{3}$$
So the factors are $$3\left(x-\frac{1+2i\sqrt{11}}{3}\right)\left(x-\frac{1-2i\sqrt{11}}{3}\right)=\frac{1}{3}\left(3x-1-2i\sqrt{11}\right)\left(3x-1+2i\sqrt{11}\right)$$
Of course, if our goal was to factor over the integers, as soon as we saw that \(\sqrt{-176}\), we’d stop and say it can’t be done. That amounts to doing the following first:
Using the discriminant
Note that you can use the 'discriminant', sqrt(b^2 - 4ac) to quickly predict whether you're going to end up with something neat, or something messy. As we saw, for x^2 + 5x + 6, you get sqrt(5^2 - 4(1)(6)) = sqrt(25 - 24) = 1 which is pretty tame. For x^2 + 13x - 68, we get sqrt(13^2 - 4(1)(-68)) = sqrt(169 + 272) = 21 which is also pretty tame. For x^2 + 13x + 13, we get sqrt(13^2 - 4(1)(13)) = sqrt(169 - 52) = sqrt(117) which is somewhat ugly. And for x^2 + 13x + 68, we get sqrt(13^2 - 4(1)(68)) = sqrt(169 - 272) = sqrt(-103) which means that the roots are complex instead of real.
We Math Doctors often check the discriminant when we’re given a factoring problem, just to avoid wasting time on a problem that can’t be factored by the usual methods. If it isn’t a perfect square, we’ll use the quadratic formula – and we’ll have done half the work already!
How to complete the square in any trinomial
For ideas on completing the square when the leading coefficient is not 1, see this from 1997:
Factoring Trinomials - Difference of Two Squares I am learning to factor a perfectly square trinomial, and a quadratic trinomial. Can you show me how I would factor the common things in this? Especially in the difference of squares, using an example problem (because I don't want you to do my homework, because then I wouldn't learn anything) and maybe just go through it step by step? If you could, it would really help. Thanks.
Matt has the right attitude, though it isn’t quite clear what he needs. A difference of squares is not a trinomial, so he may mean binomials, or may have been taught a method for factoring trinomials that involves the difference of squares. (We touched on perfect-square trinomials last time.)
Doctor Rob answered with both:
If you are given an expression you can recognize as the difference of two squares, you can factor it, because u^2 - v^2 = (u - v)(u + v). You can verify this by multiplying out the right side using either the Distributive Law or FOIL. The terms involving uv cancel each other. Example: Factor 16y^6 - z^2/9. Recognize that 16y^6 = (4y^3)^2, and z^2/9 = (z/3)^2, so this is the difference of two squares. Thus it must factor, and 16y^6 - z^2/9 = (4y^3 - z/3)(4y^3 + z/3). (Here we were using u = 4y^3 and v = z/3.)
If you are given a quadratic binomial, you can only factor it if it is a difference of squares, like $$4x^2-9=(2x+3)(2x-3),$$ or if it has a common factor, like $$4x^2-9x=x(4x-9).$$
Next let's learn how to "complete the square." This means taking a quadratic trinomial ax^2 + bx + c and rewriting it in the form (Ax + B)^2 + C. If you expand this last form, you will get A^2x^2 + 2ABx + (B^2 + C). If this is to equal ax^2 + bx + c, you must have the following three equations: A^2 = a, 2AB = b, B^2 + C = c. Solving for A, B, and C, we get: A = Sqrt[a], B = b/(2Sqrt[a]), C = c - b^2/(4a) = (4ac - b^2)/(4a).
Let’s check that this really works. $$(Ax+B)^2+C=\left(\sqrt{a}\;x+\frac{b}{2\sqrt{a}}\right)^2+\left(c-\frac{b^2}{4a}\right)\\=\left(\sqrt{a}\;x\right)^2+2\sqrt{a}\;x\frac{b}{2\sqrt{a}}+\left(\frac{b}{2\sqrt{a}}\right)^2+\left(c-\frac{b^2}{4a}\right)=ax^2+bx+c$$
But we won’t be memorizing this as a formula; rather, we’ll use it as a procedure in this form:
$$A=\color{Red}{\sqrt{a}}\\B=\frac{b}{2\sqrt{a}}=\color{Red}{\frac{b}{2A}}\\C=c-\frac{b^2}{4a}=\color{Red}{c-B^2}$$
Each number is obtained from the one before it.
Example: Complete the square in 9x^2 + 6x - 8: a = 9, b = 6, c = -8, A = Sqrt[a] = Sqrt[9] = 3, B = b/(2A) = 6/(2*3) = 1, C = c - B^2 = -8 - 1^2 = -9. Thus 9x^2 + 6x - 8 = (3x + 1)^2 - 9.
If I were teaching this method, say for \(4x^2+6x+5\), I might say that we take the square root of 4 and write $$(2x+\_)^2+\_,$$ then divide 6 by twice that 2 to get \(\frac{6}{4}=\frac{3}{2}\) and write $$\left(2x+\frac{3}{2}\right)^2+\_,$$ and then subtract the square of that fraction, \(\frac{9}{4}\), from the 5 to get \(\frac{0}{4}-\frac{9}{4}=\frac{11}{4}\). So the result is $$\left(2x+\frac{3}{2}\right)^2+\frac{11}{4}.$$
But clearly, as we’ll see below, this method needs to be modified when the leading coefficient is not a square, so I’ll hold off on examining it more closely.
Using it to factor a trinomial
If C turns out to be 0, then you are done! The factorization is (Ax+B)^2, and the original polynomial was a perfect square trinomial.
So, sometimes, completing the square is all you need; but that’s rare.
Now we are ready to factor quadratic trinomials. Here are the steps: 1. Complete the square. 2. Use the difference of squares formula to factor that expression. 3. Simplify. To factor 9x^2 + 6x - 8, complete the square as above, getting (3x + 1)^2 - 9 = (3x + 1)^2 - 3^2. This is the difference of squares, so it factors as [(3x+1) - 3][(3x+1) + 3] = (3x - 2)(3x + 4).
It was easy to complete the square there, as I mentioned above, because the leading term, 9, was a square; and it also helps that the other term ended up as 9, again a square. On the other hand, note that if it had been a sum of squares, we’d know right now that it can’t be factored over the real numbers; any factors would involve imaginary numbers.
When it doesn’t start with a square
That was an easy one, because a = 9 was a square already. Let's do one where it is not a square: 6z^2 + 13z - 5. One way to go is to multiply and divide by 6 to make the coefficient of z^2 a square:
6z^2 + 13z - 5 = (36z^2 + 78z - 30)/6,
= [(6z + 13/2)^2 - 289/4]/6,
= [(6z + 13/2)^2 - (17/2)^2]/6,
= [(6z+13/2) - 17/2)][(6z+13/2) + 17/2)]/6,
= (6z - 2)(6z + 15)/6,
= (3z - 1)(2z + 5).
This is much like an alternative method he taught for equations in Completing the Square for Quadratic Equations. (I’ll borrow an extra idea from there for a final tweak.)
Let’s try this on a particularly hard example from last time:
To factor \(21x^2-23x-20\), we can multiply and divide by 21 to make the leading term a square, $$21x^2-23x-20=\frac{441x^2-483x-420}{21}$$
Now we follow the method, using the square root of 441 (21), and dividing the middle term by twice that (\(\frac{-483}{42}=-\frac{23}{2}\)), and subtracting the square of the result from \(-420\) (\(-420-\left(-\frac{23}{2}\right)^2=-\frac{1680}{4}-\frac{529}{4}=\frac{2209}{4}\)) to get $$\frac{\left(21x-\frac{23}{2}\right)^2-\frac{2209}{4}}{21}\\=\frac{\left(21x-\frac{23}{2}\right)^2-\left( \frac{47}{2}\right)^2}{21}\\=\frac{\left(21x-\frac{23}{2}+\frac{47}{2}\right)\left(21x-\frac{23}{2}-\frac{47}{2}\right)}{21}\\=\frac{\left(21x+12\right)\left(21x-35\right)}{21}\\=\frac{\left(21x+12\right)}{3}\frac{\left(21x-35\right)}{7}\\=\left(7x+4\right)\left(3x-5\right)$$
That took a lot of work with big numbers and fractions – but no guessing!
We can avoid the fractions by multiplying and dividing not by 21, but by 4 times that, so we get an even square:
$$21x^2-23x-20=\frac{1764x^2-1932x-1680}{84}\\=\frac{\left(42x^2-23\right)^2-1680-529}{84}\\=\frac{\left(42x^2-23\right)^2-47^2}{84}\\=\frac{\left(42x+24\right)\left(42x-70\right)}{84}\\=\frac{6\left(7x+4\right)\cdot14\left(3x-5\right)}{84}\\=\left(7x+4\right)\left(3x-5\right)$$
A more traditional way
Another way to go is to factor out the 6 from all terms and complete the square that way:
6z^2 + 13z - 5
= 6[z^2 + (13/6)z - 5/6],
= 6[(z + 13/12)^2 - 289/144],
= 6[(z + 13/12)^2 - (17/12)^2],
= 6(z + 13/12 - 17/12)(z + 13/12 + 17/12),
= 6[(z - 4/12)(z + 30/12),
= 6(z - 1/3)(z + 5/2),
= (3z - 1)(2*z + 5).
This amounts to reducing the problem to Doctor Ian’s case, with leading coefficient 1. Again, doing our problem, we start with \(21x^2-23x-20=21\left(x^2-\frac{23}{21}x-\frac{20}{21}\right)\). We divide the middle term by 2, and subtract the square of the result from the last term: $$21\left(\left(x-\frac{23}{42}\right)^2-\frac{20}{21}-\frac{23^2}{42^2}\right)=21\left(\left(x-\frac{23}{42}\right)^2-\frac{2209}{1764}\right)\\=21\left(\left(x-\frac{23}{42}\right)^2-\left(\frac{47}{42}\right)^2\right)=21\left(x-\frac{23}{42}+\frac{47}{42}\right)\left(x-\frac{23}{42}-\frac{47}{42}\right)\\=21\left(x+\frac{24}{42}\right)\left(x-\frac{70}{42}\right)=21\left(x+\frac{4}{7}\right)\left(x-\frac{5}{3}\right)\\=7\left(x+\frac{4}{7}\right)3\left(x-\frac{5}{3}\right)=(7x+4)(3x-5)$$
We’re back to lots of fractions. Is trial and error starting to look good?
Harder examples with the quadratic formula
The first answer above gave only a simple example of using the quadratic formula. For a harder one, here is a question from 2004:
Factoring Trinomials in Quadratic Equations I'm stuck on this question: 15x^2 - 16x - 7 = 0 My book teaches me two methods to factor quadratic equations: guess and check, and grouping. I can't decide which method to use.
Shoaib has learned our trial-and-error and ac-grouping methods. Which to use? Doctor Greenie suggested yet another method:
Hello, Shoaib - Factoring trinomials is a very interesting process because there are many different ways that people approach it and think about it. Many students find a method that works for them and stick with it, but finding that method may involve trying out lots of different ways. I'm going to show you a couple of ways you may not have seen before, and hopefully one of them will help you. One way that ALWAYS works is to use the quadratic formula, as explained very nicely on the following page in the Dr. Math archives: Quadratic Trinomials http://mathforum.org/library/drmath/view/52902.html This page also shows an alternative method for performing the factorization.
This was a very early question (1995), where Doctor Ken showed what we’ll be doing here, and Doctor Ethan showed trial-and-error.
Using the method involving the quadratic formula on your example, we have 15x^2 - 16x - 7 = 0 x = [16 ± sqrt(16^2 - 4(15)(-7))]/30 x = [16 ± sqrt(676)]/30 x = [16 ± 26]/30 x = 42/30 = 7/5 or x = -10/30 = -1/3
Technically, since Shoaib’s goal is to solve the equation, not primarily to factor, this is all he needs. But if the goal were to factor …
Any quadratic equation can be written as \(ax^2+bx+c=a(x-p)(x-q)\) where p and q are the two roots. So we can work backward:
Then we reconstruct the [factored] quadratic equation from which we obtained these roots: 15(x - (7/5))(x + (1/3)) = 0 5(x - (7/5)) * 3(x + (1/3)) = 0 (5x - 7)(3x + 1) = 0 So the factorization of the original quadratic expression is 15x^2 - 16x - 7 = (5x - 7)(3x + 1)
Then he showed the ac-grouping method, and also slip-and-slide, which I’ll omit.
Let’s try this method for our hard problem from above, \(21x^2-23x-20\). The roots of \(21x^2-23x-20=0\) are $$x=\frac{23\pm\sqrt{23^2-4(21)(-20)}}{2(21)}=\frac{23\pm\sqrt{2209}}{42}=\frac{23\pm47}{42}=\frac{70}{42}=\frac{5}{3}\text{ or }-\frac{24}{42}=\frac{4}{7}$$
So the factorization is $$21\left(x-\frac{5}{3}\right)\left(x+\frac{4}{7}\right)=3\left(x-\frac{5}{3}\right)\cdot7\left(x+\frac{4}{7}\right)=(3x-5)(7x+4)$$
That was easy!
A silly word problem?
A textbook my students use includes this “challenge problem” in the chapter on solving quadratic equations by factoring:
The product of two numbers is \(-63\). Determine the numbers if their sum is \(-2\).
We can solve this by calling the first number \(x\), so that the other is \(-2-x\). Then the product tells us that \(x(-2-x)=-63\), so that \(x^2+2x-63=0\). The first step in solving this by factoring is
Find two numbers whose product is \(-63\), and whose sum is \(2\).
We’re back at (almost) the original word problem! So why bother with algebra? We can just solve the question directly, listing factors of \(63\) and finding that the difference of \(9\) and \(7\) is \(2\), so the answer is \(7\) and \(-9\).
If we’ve learned the quadratic formula, however, we can say, $$x=\frac{-2\pm\sqrt{2^2-4(-63)}}{2}=\frac{-2\pm16}{2}=7\text{ or }-9.$$ Those are the two numbers. And, in fact, $$(x-7)(x+9)=x^2+2x-63.$$
Now, what if the problem used bigger numbers?
The sum of two numbers is 65, and their product is 966. What are the numbers?
Then \(x(65-x)=966\), so that \(x^2-65x+966=0\). Again, factoring will amount to answering the original question using time-consuming trial and error.
This time, $$x=\frac{65\pm\sqrt{65^2-4(966)}}{2}=\frac{65\pm19}{2}=23\text{ or }42.$$ We’ve solved it with no trial and error.
So the quadratic formula is far more powerful than factoring, when it’s needed.
