Completing the square, leading coefficient not one
The squared term has a number in front of it. How do you complete a square that does not start with a plain x^2?
Where you are 12 in Quadratics
When you reach for it
Completing the square works on x^2 + bx: take half of b, square it, add it, and the expression becomes (x + \tfrac{b}{2})^2. Now try the same move on
Half of 12 is 6, and 6^2 = 36, but 2x^2 + 12x + 36 is not a perfect square. The trouble is at the front. Every square of the form (x + k)^2 multiplies out to begin with x^2, exactly one of it. An expression that begins with 2x^2 cannot match that pattern however you choose the constant.
So one step comes first: make the coefficient of x^2 equal to 1, and then complete the square exactly as before. That step is the whole of this lesson, together with the care it needs, because the way you remove the 2 depends on whether you are working with an equation or with an expression.
Almost every quadratic you meet in the wild has a leading coefficient other than one: the height of a thrown ball, h = -5t^2 + 20t + 2; the area of a fenced pen, A = -2w^2 + 20w; the general quadratic ax^2 + bx + c itself. So this is the version of the method that gets used most.
The procedure
In an equation, divide both sides by the leading coefficient. Dividing both sides of an equation by the same number that is not zero gives an equation with exactly the same solutions, because the step can be undone by multiplying back. Every term on both sides gets divided, not only the x^2 term:
Now the leading coefficient is 1 and the method you already have takes over. Half of 6 is 3, and 3^2 = 9. Add 9 to both sides, write the left side as a square, and take square roots with both signs:
So x = -3 + 4 = 1 or x = -3 - 4 = -7.
Check. 2(1)^2 + 12(1) = 2 + 12 = 14, and 2(-7)^2 + 12(-7) = 98 - 84 = 14.
It helps to see what the division did. 2x^2 + 12x is two copies of x^2 + 6x, and each copy is the familiar square with a corner missing.
Two missing corners of 9 need 18 to fill, not 9. Indeed 2x^2 + 12x + 18 = 2(x^2 + 6x + 9) = 2(x + 3)^2, so adding 18 to both sides of the original equation gives 2(x + 3)^2 = 32, which is (x + 3)^2 = 16 again. Dividing first is the same calculation done in a tidier order: it deals with one copy instead of two.
In an expression, factor the leading coefficient out of the x terms. An expression has no second side, so dividing it by 2 would change its value: 2x^2 + 12x + 5 and \displaystyle x^2 + 6x + \frac{5}{2} are different expressions, as x = 0 shows (5 against \displaystyle \frac{5}{2}). Factoring changes the look without changing the value:
Inside the brackets the leading coefficient is 1. Complete the square there by adding and subtracting 9, which adds nothing:
The -9 leaves the brackets as -18, because everything inside the brackets is multiplied by 2. These are the same two corners as in the picture.
The general result. Doing the same with letters, factor a out of ax^2 + bx to get \displaystyle a\left(x^2 + \frac{b}{a}x\right). Half of \displaystyle \frac{b}{a} is \displaystyle \frac{b}{2a}, whose square is \displaystyle \frac{b^2}{4a^2}. Add and subtract that inside the brackets; the subtracted piece comes out multiplied by a, as \displaystyle \frac{b^2}{4a}. So for any a \ne 0,
You do not need to memorize this. It is only a record of what the two moves always produce.
Worked examples
A leading coefficient that divides every term
Solve 3x^2 - 18x + 6 = 0 by completing the square.
SolutionEvery coefficient is a multiple of 3, so dividing both sides by 3 leaves whole numbers. The right side stays 0, since 0 \div 3 = 0:
Move the constant across, then add \displaystyle \left(\frac{-6}{2}\right)^2 = 9 to both sides:
Check \displaystyle x = 3 + \sqrt{7} in the divided equation: \displaystyle x^2 = 16 + 6\sqrt{7} and \displaystyle -6x = -18 - 6\sqrt{7}, so x^2 - 6x + 2 = 16 - 18 + 2 = 0. The other root works the same way with the signs of \displaystyle \sqrt{7} reversed.
Dividing makes fractions
Solve 2x^2 - 5x = 3.
SolutionHere 2 does not divide 5, so dividing both sides by 2 brings in fractions. That is expected and changes nothing about the method:
Half of \displaystyle -\frac{5}{2} is \displaystyle -\frac{5}{4}, and \displaystyle \left(-\frac{5}{4}\right)^2 = \frac{25}{16}. Write \displaystyle \frac{3}{2} as \displaystyle \frac{24}{16} so the right side can be added:
So \displaystyle x = \frac{5}{4} + \frac{7}{4} = 3 or \displaystyle x = \frac{5}{4} - \frac{7}{4} = -\frac{1}{2}.
Check. 2(3)^2 - 5(3) = 18 - 15 = 3, and \displaystyle 2\left(-\frac{1}{2}\right)^2 - 5\left(-\frac{1}{2}\right) = \frac{1}{2} + \frac{5}{2} = 3.
Radical answers over a common denominator
Solve 3x^2 + 4x - 2 = 0.
SolutionMove the constant, then divide both sides by 3:
Half of \displaystyle \frac{4}{3} is \displaystyle \frac{2}{3}, and \displaystyle \left(\frac{2}{3}\right)^2 = \frac{4}{9}. With \displaystyle \frac{2}{3} = \frac{6}{9}:
The square root of \displaystyle \frac{10}{9} splits as \displaystyle \sqrt{10} over \displaystyle \sqrt{9} = 3, which is why both solutions end up over the same denominator as \displaystyle \frac{2}{3}.
A negative leading coefficient
Solve -2x^2 + 8x + 3 = 0.
SolutionThe leading coefficient is -2, and it is -2 that has to go, not 2. Dividing every term by -2 flips every sign:
Taking square roots, \displaystyle x - 2 = \pm\sqrt{\frac{11}{2}}. To tidy the radical, write \displaystyle \frac{11}{2} = \frac{22}{4}, so \displaystyle \sqrt{\frac{11}{2}} = \frac{\sqrt{22}}{2}. Then
Had you divided by +2 instead, the x^2 term would have been -x^2, and -x^2 + 4x is still not of the form x^2 + bx.
When the square comes out negative
Solve 4x^2 + 4x + 5 = 0.
SolutionDivide by 4 and move the constant:
The coefficient of x is 1; half of it is \displaystyle \frac{1}{2}, and its square is \displaystyle \frac{1}{4}:
No real number squares to -1, so there are no real solutions. Over the complex numbers, i^2 = -1, so \displaystyle x + \frac{1}{2} = \pm i and
Check \displaystyle x = -\frac{1}{2} + i: \displaystyle x^2 = \frac{1}{4} - i + i^2 = -\frac{3}{4} - i, so 4x^2 + 4x + 5 = (-3 - 4i) + (-2 + 4i) + 5 = 0.
Rewriting an expression to find the vertex
Write 2x^2 - 12x + 13 in the form a(x - h)^2 + k, and find its smallest value.
SolutionThis is an expression, so do not divide. Factor 2 out of the two x terms and leave the 13 where it is:
Inside the brackets, half of -6 is -3, and (-3)^2 = 9. Add and subtract 9 inside, then bring the -9 out. It comes out as 2 \cdot (-9) = -18:
A square is never negative, and multiplying by the positive 2 keeps it so, so 2(x - 3)^2 \ge 0, with equality only at x = 3. The expression is therefore never less than -5 and equals -5 at x = 3. On the graph, (3, -5) is the vertex of y = 2x^2 - 12x + 13.
Check at x = 0: the original gives 13, and 2(0 - 3)^2 - 5 = 18 - 5 = 13.
The highest point of a throw
A ball is thrown upward, and its height in meters t seconds later is modeled by h = -5t^2 + 20t + 2. How high does it go, and when?
SolutionThe question asks for the largest value of an expression, which is what the completed square shows. Factor -5 out of the two t terms:
Half of -4 is -2, and (-2)^2 = 4. Add and subtract 4 inside the brackets. The -4 comes out multiplied by -5, which makes it +20:
Now (t - 2)^2 \ge 0, and multiplying by -5 turns that round: -5(t - 2)^2 \le 0. So h is never more than 22, and it equals 22 exactly when t = 2. The ball reaches its highest point, 22 meters, after 2 seconds.
Check. h(2) = -5(4) + 40 + 2 = 22.
With a negative leading coefficient the completed square gives a highest value, where a positive one gave a lowest. The sign of a decides which.
Boundaries
The leading coefficient must not be zero. If a = 0 there is no x^2 term, nothing to square, and dividing by a is not allowed. The equation is linear and is solved directly.
Divide an equation; factor an expression. Dividing both sides keeps an equation’s solutions. Dividing an expression changes its value, so there the leading coefficient is factored out, and whatever is subtracted inside the brackets comes out multiplied by it.
Factor from the x terms; the constant may stay outside. In 2x^2 - 12x + 13 only the first two terms need to be inside the brackets. Factoring the constant in too, as \displaystyle 2\left(x^2 - 6x + \frac{13}{2}\right), also works; it only moves where the fractions appear.
The sign of a decides lowest or highest. a(x - h)^2 + k is at least k when a > 0 and at most k when a < 0.
Fractions are part of the route, not a sign of error. Whenever a does not divide b, halving \displaystyle \frac{b}{a} produces fractions. There is a route that avoids them, multiplying through by 4a first; Exercise 25 shows it.
Where this goes next
Run this lesson on ax^2 + bx + c = 0 with letters in place of numbers and the result is the quadratic formula: after dividing by a and completing the square, \displaystyle \left(x + \frac{b}{2a}\right)^2 = \frac{b^2 - 4ac}{4a^2}, and the numerator on the right is the discriminant, which decides, as in Example 5, whether the square roots are real.
Rewriting a quadratic as a(x - h)^2 + k is converting to vertex form, and reading off the largest or smallest value, as in Examples 6 and 7, is the maximum or minimum of a quadratic.
The factoring move matters again for conics. In 4x^2 + 9y^2 - 16x + 18y = 11 you factor 4 from the x terms and 9 from the y terms, complete both squares, and reach 4(x - 2)^2 + 9(y + 1)^2 = 36, the standard equation of an ellipse.
And in calculus, completing the square in an integral turns \displaystyle \int \frac{dx}{2x^2 + 4x + 10} into a standard form in exactly this way.
Exercises
The leading coefficient divides every term
Solve by completing the square.
- 2x^2 + 8x - 10 = 0
- 3y^2 - 12y = 36
- 5x^2 + 30x + 20 = 0
- 4m^2 - 8m - 12 = 8
Divide, then work with fractions
Solve by completing the square.
- 2x^2 + 3x = 2
- 3x^2 - 2x = 8
- 2x^2 - 6x + 1 = 0
- 4x^2 + 4x - 1 = 0
- 3p^2 + 5p - 1 = 0
- 5x^2 = 2x + 1
Negative leading coefficients, and the square’s other outcomes
Solve by completing the square. Where there are no real solutions, give the complex ones.
- -x^2 + 6x - 4 = 0
- -3x^2 + 6x + 5 = 0
- 2x^2 + 4x + 7 = 0
- 9x^2 - 12x + 4 = 0
- (2x + 1)(x - 3) = 4
Rewrite the expression
Write each expression in the form a(x - h)^2 + k.
- 2x^2 + 8x + 3
- 3x^2 - 6x + 10
- -x^2 + 10x - 16
- 2x^2 - 6x + 5
- Find the largest value of -4x^2 + 24x - 11 and the x at which it occurs.
- A 20 meter fence makes three sides of a rectangular pen against a wall: two sides of width w and one of length 20 - 2w. Its area is A = -2w^2 + 20w. Find the largest possible area and the width that gives it.
Reasoning
- Explain why you may divide both sides of 5x^2 - 10x = 15 by 5, but may not divide 5x^2 - 10x + 15 by 5 when rewriting it in vertex form.
- Use an area picture to explain why 3x^2 + 12x needs 12 added to become three times a perfect square, and not 36.
- Use \displaystyle ax^2 + bx + c = a\left(x + \frac{b}{2a}\right)^2 + c - \frac{b^2}{4a} to explain why the vertex of y = ax^2 + bx + c lies on the line \displaystyle x = -\frac{b}{2a}, and when it is a highest point rather than a lowest.
- Multiply both sides of 2x^2 - 5x = 3 by 8 and add 25 to both sides. Show that the left side becomes (4x - 5)^2, solve, and explain why multiplying ax^2 + bx = -c by 4a and adding b^2 always makes a perfect square.
Answers
- x = 1 or x = -5. Divide by 2: x^2 + 4x = 5. Add 4: (x + 2)^2 = 9, so x + 2 = \pm 3.
- y = 6 or y = -2. Divide by 3: y^2 - 4y = 12. Add 4: (y - 2)^2 = 16.
- \displaystyle x = -3 \pm \sqrt{5}. Divide by 5: x^2 + 6x = -4. Add 9: (x + 3)^2 = 5.
- \displaystyle m = 1 \pm \sqrt{6}. Divide by 4: m^2 - 2m - 3 = 2, so m^2 - 2m = 5. Add 1: (m - 1)^2 = 6.
- \displaystyle x = \frac{1}{2} or x = -2. Divide by 2: \displaystyle x^2 + \frac{3}{2}x = 1. Add \displaystyle \frac{9}{16}: \displaystyle \left(x + \frac{3}{4}\right)^2 = \frac{25}{16}, so \displaystyle x = -\frac{3}{4} \pm \frac{5}{4}.
- x = 2 or \displaystyle x = -\frac{4}{3}. Divide by 3: \displaystyle x^2 - \frac{2}{3}x = \frac{8}{3}. Add \displaystyle \frac{1}{9}: \displaystyle \left(x - \frac{1}{3}\right)^2 = \frac{25}{9}, so \displaystyle x = \frac{1}{3} \pm \frac{5}{3}.
- \displaystyle x = \frac{3 \pm \sqrt{7}}{2}. \displaystyle x^2 - 3x = -\frac{1}{2}. Add \displaystyle \frac{9}{4}: \displaystyle \left(x - \frac{3}{2}\right)^2 = \frac{7}{4}.
- \displaystyle x = \frac{-1 \pm \sqrt{2}}{2}. \displaystyle x^2 + x = \frac{1}{4}. Add \displaystyle \frac{1}{4}: \displaystyle \left(x + \frac{1}{2}\right)^2 = \frac{1}{2}, and \displaystyle \sqrt{\frac{1}{2}} = \frac{\sqrt{2}}{2}.
- \displaystyle p = \frac{-5 \pm \sqrt{37}}{6}. \displaystyle p^2 + \frac{5}{3}p = \frac{1}{3}. Add \displaystyle \frac{25}{36}: \displaystyle \left(p + \frac{5}{6}\right)^2 = \frac{37}{36}.
- \displaystyle x = \frac{1 \pm \sqrt{6}}{5}. Rearrange and divide by 5: \displaystyle x^2 - \frac{2}{5}x = \frac{1}{5}. Add \displaystyle \frac{1}{25}: \displaystyle \left(x - \frac{1}{5}\right)^2 = \frac{6}{25}.
- \displaystyle x = 3 \pm \sqrt{5}. Divide by -1: x^2 - 6x + 4 = 0, so x^2 - 6x = -4. Add 9: (x - 3)^2 = 5.
- \displaystyle x = \frac{3 \pm 2\sqrt{6}}{3}. Divide by -3: \displaystyle x^2 - 2x - \frac{5}{3} = 0. Add 1 after moving the constant: \displaystyle (x - 1)^2 = \frac{8}{3}, and \displaystyle \sqrt{\frac{8}{3}} = \frac{\sqrt{24}}{3} = \frac{2\sqrt{6}}{3}.
- No real solutions; over the complex numbers, \displaystyle x = -1 \pm \frac{\sqrt{10}}{2}i. Divide by 2: \displaystyle x^2 + 2x = -\frac{7}{2}. Add 1: \displaystyle (x + 1)^2 = -\frac{5}{2}, and \displaystyle \sqrt{\frac{5}{2}} = \frac{\sqrt{10}}{2}.
- \displaystyle x = \frac{2}{3}, the only solution. Divide by 9: \displaystyle x^2 - \frac{4}{3}x = -\frac{4}{9}. Add \displaystyle \frac{4}{9}: \displaystyle \left(x - \frac{2}{3}\right)^2 = 0.
- \displaystyle x = \frac{7}{2} or x = -1. Expand: 2x^2 - 5x - 3 = 4, so 2x^2 - 5x = 7. Divide by 2 and add \displaystyle \frac{25}{16}: \displaystyle \left(x - \frac{5}{4}\right)^2 = \frac{81}{16}, so \displaystyle x = \frac{5}{4} \pm \frac{9}{4}.
- 2(x + 2)^2 - 5. 2(x^2 + 4x + 4 - 4) + 3 = 2(x + 2)^2 - 8 + 3.
- 3(x - 1)^2 + 7. 3(x^2 - 2x + 1 - 1) + 10 = 3(x - 1)^2 - 3 + 10.
- -(x - 5)^2 + 9. -(x^2 - 10x + 25 - 25) - 16 = -(x - 5)^2 + 25 - 16.
- \displaystyle 2\left(x - \frac{3}{2}\right)^2 + \frac{1}{2}. Half of -3 is \displaystyle -\frac{3}{2}, so add and subtract \displaystyle \frac{9}{4} inside: \displaystyle 2\left(x - \frac{3}{2}\right)^2 - \frac{9}{2} + 5.
- The largest value is 25, at x = 3. Factor out -4: -4(x^2 - 6x) - 11, which is -4(x - 3)^2 + 36 - 11 = -4(x - 3)^2 + 25, and -4(x - 3)^2 \le 0 with equality only at x = 3.
- The largest area is 50 square meters, at w = 5 (so the pen is 5 by 10). A = -2(w^2 - 10w + 25 - 25) = -2(w - 5)^2 + 50.
- Dividing both sides of an equation by 5 gives an equation with the same solutions. An expression has no second side, so dividing it by 5 makes a different expression, one fifth the size. Instead write 5x^2 - 10x + 15 = 5(x^2 - 2x) + 15, which is the same expression.
- 3x^2 + 12x = 3(x^2 + 4x) is three copies of x^2 + 4x. Each copy is an x by x square with two strips of width 2, missing a 2 by 2 corner of area 4. Three corners take 3 \cdot 4 = 12, and 3x^2 + 12x + 12 = 3(x + 2)^2. Adding 36, half of 12 squared, treats the three copies as one square, which they are not.
- The term \displaystyle a\left(x + \frac{b}{2a}\right)^2 is 0 at \displaystyle x = -\frac{b}{2a} and has the sign of a everywhere else, so y takes its extreme value \displaystyle c - \frac{b^2}{4a} there and nowhere else, which puts the vertex on the line \displaystyle x = -\frac{b}{2a}. If a > 0 that term is never negative, so the vertex is the lowest point; if a < 0 it is never positive, so the vertex is the highest.
- x = 3 or \displaystyle x = -\frac{1}{2}, as in Example 2. Multiplying by 8 gives 16x^2 - 40x = 24; adding 25 gives 16x^2 - 40x + 25 = 49, which is (4x - 5)^2 = 49, so 4x - 5 = \pm 7. In general 4a(ax^2 + bx) + b^2 = 4a^2x^2 + 4abx + b^2 = (2ax + b)^2, since 2ax squared is 4a^2x^2 and twice 2ax times b is 4abx.