Completing the square with a coefficient in front of x^2

I’m comfortable completing the square when the x^2 coefficient is 1, but I get mixed up when there’s a number in front. For example, trying to write 2x^2 + 8x + 5 in vertex form: I factor 2 to get 2(x^2 + 4x) + 5. Then I add 4 inside to make a square. What I don’t trust is how to adjust the constant outside so the expression stays the same. Do I subtract 4 or 8, and why?

Similar issue with 3x^2 – 12x + 7: factoring gives 3(x^2 – 4x) + 7, then I want to add 4 inside. Some solutions seem to subtract 12 outside, others add and subtract 4 inside the parentheses and then distribute later. I’m not seeing a consistent rule, and I lose track of the bookkeeping.

Is there a clean, general way to think about the compensation step when the leading coefficient is not 1, especially when b is odd and fractions show up? A short checklist or a small worked example that highlights the exact quantity to add or subtract would help me fix the habit.

4 Responses

  1. The clean rule is: after you factor out the leading coefficient a, anything you add inside the parentheses is really being multiplied by a, so you must subtract a times that amount outside to keep the value the same. It’s like putting a pebble on one side of a see‑saw that has a lever arm of length a; the “weight” you’ve added isn’t just the pebble, it’s a times the pebble, so you compensate with that same weighted amount. In symbols for ax^2 + bx + c: factor a to get a(x^2 + (b/a)x) + c, then add (b/2a)^2 inside, and subtract a·(b/2a)^2 = b^2/(4a) outside. That turns the inside into a perfect square: a(x + b/(2a))^2 + c − b^2/(4a).

    Now your examples fall into place. For 2x^2 + 8x + 5: factor 2 → 2(x^2 + 4x) + 5. Half of 4 is 2; square is 4. Add 4 inside and subtract 2·4 = 8 outside: 2[(x + 2)^2] + 5 − 8 = 2(x + 2)^2 − 3. For 3x^2 − 12x + 7: factor 3 → 3(x^2 − 4x) + 7. Half of −4 is −2; square is 4. Add 4 inside and subtract 3·4 = 12 outside: 3[(x − 2)^2] + 7 − 12 = 3(x − 2)^2 − 5. That’s why it’s subtract 8 in the first case and subtract 12 in the second-the outside coefficient scales the compensation.

    If b is odd, fractions just mean the same rule with tidier bookkeeping. Quick checklist:
    – Factor a: a(x^2 + (b/a)x) + c.
    – Add (b/2a)^2 inside; subtract b^2/(4a) outside.
    – Rewrite as a(x + b/(2a))^2 + c − b^2/(4a).
    Tiny example: 2x^2 + 5x + 1 → 2(x^2 + (5/2)x) + 1. Half of 5/2 is 5/4; square is 25/16. Add 25/16 inside and subtract 2·25/16 = 25/8 outside: 2(x + 5/4)^2 + 1 − 25/8 = 2(x + 5/4)^2 − 17/8. Same dance, just with fractional shoes.

  2. Great question! The clean rule is: after you factor out the leading coefficient a, whatever number t you add inside the parentheses gets multiplied by a, so you must subtract a·t outside to keep the value the same. Here’s the pattern for ax^2 + bx + c: factor a to get a(x^2 + (b/a)x) + c, then take h = b/(2a), so x^2 + (b/a)x = (x + h)^2 − h^2. That means ax^2 + bx + c = a(x + h)^2 + c − a·h^2. The “compensation” is exactly a·h^2, which is a times the square you added. Worked example: 2x^2 + 8x + 5 = 2(x^2 + 4x) + 5. Half of 4 is 2, square is 4, so add and subtract 4 inside the bracket: 2[(x^2 + 4x + 4) − 4] + 5 = 2(x + 2)^2 − 8 + 5 = 2(x + 2)^2 − 3. Notice we subtracted 8, not 4, because the added 4 sits inside a factor of 2. Your other example works the same way: 3x^2 − 12x + 7 = 3(x − 2)^2 − 5. Fractions? Same rule: for 2x^2 + 7x − 1, h = 7/4, so 2x^2 + 7x − 1 = 2(x + 7/4)^2 − 2·(7/4)^2 − 1 = 2(x + 7/4)^2 − 49/8 − 1. In short: complete the square with h = b/(2a), and subtract the compensation a·h^2 outside.

  3. Short version: anything you add inside the parentheses gets multiplied by the number you factored out. So if you have a(x^2 + (b/a)x) + c and you add k inside to complete the square, you must subtract a·k outside to keep it equal. The k you add is always “half the x‑coefficient (inside) squared.” That gives the one-line formula: ax^2 + bx + c = a(x + b/(2a))^2 + (c − b^2/(4a)). Mental checklist: factor a; half it, square it, add inside; subtract a times that square outside.

    Examples. 2x^2 + 8x + 5 = 2(x^2 + 4x) + 5. Half of 4 is 2, square is 4. Add 4 inside, subtract 2·4 = 8 outside: 2(x^2 + 4x + 4) + 5 − 8 = 2(x + 2)^2 − 3. Next, 3x^2 − 12x + 7 = 3(x^2 − 4x) + 7. Half of −4 is −2, square is 4. Add 4 inside, subtract 3·4 = 12 outside: 3(x^2 − 4x + 4) + 7 − 12 = 3(x − 2)^2 − 5. Fractions? Same rule. For 5x^2 + 7x + 1: 5(x^2 + (7/5)x) + 1; half of 7/5 is 7/10, square is 49/100; subtract 5·(49/100) = 49/20 outside: 5(x + 7/10)^2 − 29/20.

  4. I used to trip over this too! The part that got me was “I added 4 inside, so do I subtract 4 or 8 outside?” The clean way to think about it is: whatever you add inside the parentheses gets multiplied by the leading coefficient a, so you have to subtract that same total amount outside.

    Here’s the general picture for ax^2 + bx + c.

    – Factor out a from the x^2 and x terms: a(x^2 + (b/a)x) + c.
    – Inside the parentheses, take half of the x-coefficient (which is b/a), then square it. That is (b/(2a))^2.
    – Add and subtract that number inside the parentheses. Because of the outside a, you’ve actually added a × (b/(2a))^2 to the whole expression, so you must subtract exactly a × (b/(2a))^2 outside to keep it equal.
    – Final result (vertex form): a(x + b/(2a))^2 + c − b^2/(4a).

    So the “compensation amount” is always b^2/(4a), and the square you build is (x + b/(2a))^2. If b is odd, you’ll just get fractions, but it’s the same rule.

    Let’s do your examples, carefully showing the “bookkeeping.”

    Example 1: 2x^2 + 8x + 5
    – Factor 2: 2(x^2 + 4x) + 5.
    – Half of 4 is 2; square is 4. So inside we want x^2 + 4x + 4 = (x + 2)^2.
    – Write: 2[(x^2 + 4x + 4) − 4] + 5 = 2(x + 2)^2 − 2·4 + 5 = 2(x + 2)^2 − 8 + 5.
    – Final: 2(x + 2)^2 − 3.

    Notice the “compensation” is 2·4 = 8, not 4. We added 4 inside the parentheses, but there’s a 2 outside multiplying it.

    Example 2: 3x^2 − 12x + 7
    – Factor 3: 3(x^2 − 4x) + 7.
    – Half of −4 is −2; square is 4. So inside: x^2 − 4x + 4 = (x − 2)^2.
    – Write: 3[(x^2 − 4x + 4) − 4] + 7 = 3(x − 2)^2 − 3·4 + 7.
    – Final: 3(x − 2)^2 − 12 + 7 = 3(x − 2)^2 − 5.

    Again, the outside adjustment is 3·4 = 12, not 4.

    A simple example with an odd b (so fractions appear): 2x^2 + 5x − 3
    – Factor 2: 2(x^2 + (5/2)x) − 3.
    – Half of 5/2 is 5/4; square is 25/16.
    – Add and subtract inside: 2[(x + 5/4)^2 − 25/16] − 3.
    – Distribute the 2 over the subtraction: 2(x + 5/4)^2 − 50/16 − 3 = 2(x + 5/4)^2 − 25/8 − 3.
    – Combine constants: −25/8 − 3 = −25/8 − 24/8 = −49/8.
    – Final: 2(x + 5/4)^2 − 49/8.

    Quick checklist (the “don’t-lose-track” version):
    – Start: ax^2 + bx + c with a ≠ 0.
    – Factor a from x^2 and x: a(x^2 + (b/a)x) + c.
    – Take half of the inside x-coefficient: b/(2a). Square it: (b/(2a))^2.
    – Add and subtract that inside the parentheses. The amount you effectively added to the whole expression is a × (b/(2a))^2 = b^2/(4a), so subtract b^2/(4a) outside.
    – Wrap it up: a(x + b/(2a))^2 + c − b^2/(4a).

    If you like a one-line memory hook: compensation amount = a × (half of the inside x-coefficient)^2. That’s the whole “do I subtract 4 or 8?” question in a nutshell.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Our Community

Ready to make maths more enjoyable, accessible, and fun? Join a friendly community where you can explore puzzles, ask questions, track your progress, and learn at your own pace.

By becoming a member, you unlock:

  • Access to all community puzzles
  • The Forum for asking and answering questions
  • Your personal dashboard with points & achievements
  • A supportive space built for every level of learner
  • New features and updates as the Hub grows