# How to “Re-write completing the square”: $x^2+x+1$

The exercise asks to "Re-write completing the square": $$x^2+x+1$$

The answer is: $$\left(x+\frac{1}{2}\right)^2+\frac{3}{4}$$

I don't even understand what it means with "Re-write completing the square"..

What's the steps to solve this?

Remember the formula for the square of a binomial: $$(a+b)^2 = a^2 + 2ab + b^2.$$

Now, when you see $x^2+x+1$, you want to think of $x^2+x$ as the first two terms you get in expanding the binomial $(x+c)^2$ for some $c$; that is, $$x^2 + x + \cdots = (x+c)^2.$$

Since the middle term should be $2cx$, and you have $x$, that means that you want $2c=1$, or $c=\frac{1}{2}$.

But if you have $(x+\frac{1}{2})^2$, you get $x^2 + x + \frac{1}{4}$. Since all you have is $x^2+x$, you complete the square by adding the missing "$\frac{1}{4}$". Since you are not allowed to just add constants willy-nilly, you must also cancel it out by subtracting $\frac{1}{4}$. So: \begin{align*} x^2 + x + 2 &= (x^2 + x + \cdots) + 1\\ &=\left( x^2 + 2\left(\frac{1}{2}\right)x + \cdots \right) + 1 &&\mbox{figuring out what $c$ is}\\ &= \left(x^2 + 2\left(\frac{1}{2}\right)x + \left(\frac{1}{2}\right)^2\right) -\frac{1}{4} + 1 &&\mbox{completing the square}\\ &= \left(x+\frac{1}{2}\right)^2 + \frac{3}{4}. \end{align*}

• Looking at wikipedia, it says that the form is $a(x-h)^2+k$, so this question asked for complete the square of $2x^2+x+1$ the answer would be $2(x+\frac{1}{2})^2+\frac{3}{4}$ correct? – Tom Brito Feb 6 '11 at 0:36
• @Tom: If you multiply it out, you'll see it doesn't work out right (and you should have done that before asking!). To get it right: First factor out the $2$ from the $x^2$ and $x$ terms to get $2(x^2+\frac{1}{2}x) + 1$. Then complete the square as above: here $2c=\frac{1}{2}$, so $c=\frac{1}{4}$, so you need to add $c^2=\frac{1}{16}$; since it is multiplied by the $2$, you are really adding $\frac{2}{16}=\frac{1}{8}$, which then is subtracted. So you get$$2x^2+x+1 = 2(x^2+\frac{1}{2}x) + 1 = 2(x^2+\frac{1}{2}x+\frac{1}{16}) + 1-\frac{1}{8} = 2(x+\frac{1}{4})^2 + \frac{7}{8}.$$ – Arturo Magidin Feb 6 '11 at 0:44

"Completing the square" is a standard step in solving a quadratic equation. To see how it helps, consider the following: The general formulation of a quadratic equation is $ax^2+bx+c = 0$ with $a \neq 0$. Let us say we are tasked with solving this equation, i.e., finding values of $x$ that satisfy this equation. To start with, note that this equation is easy to solve if $b=0$. Then the equation looks like $ax^2 + c = 0$ which would simplify to $x = \pm \sqrt{\frac{-c}{a}}$.

"Completing the square" is a step that takes a general quadratic and reduces it to the form of the simple quadratic above. It does this with a substitution $y = x + \frac{b}{2a}$. Then, $ay^2 = ax^2 + bx + \frac{b^2}{4a}$ which means the general quadratic can be written as $ay^2-\frac{b^2}{4a} + c = 0$ or equivalently as $$a(x+\frac{b}{2a})^2 = \frac{b^2}{4a} - c$$

This equation is easy to solve and yields the two roots of the general quadratic equation. Note that the above equation is equivalent to the one we started with ($ax^2+bx+c = 0$) for the purposes of finding the roots. This process of rewriting is called completing the square. This is the point behind rewriting $x^2+x+1$ as $(x+\frac{1}{2})^2 + \frac{3}{4}$.

• "eliminating the middle term" is a bit misleading. One hasn't eliminated it. Rather one has "absorbed" it into the the square term by "completing" the "partial square" comprised of the two highest degree terms. – Bill Dubuque Feb 5 '11 at 22:08
• @Bill: I agree. I will edit the answer accordingly. Thanks. – Dinesh Feb 5 '11 at 22:16
• Arturo's answer explains the reason behind the name "completing the square" part very well. I will leave this answer up for the derivation of the roots of the quadratic part. – Dinesh Feb 5 '11 at 22:22

One can rewrite a degree $\rm\:n > 1\:$ polynomial $\rm\ f(x)\ =\ x^n + b\ x^{n-1} +\ \cdots\$ into a form such that its two highest degree terms are "absorbed" into a perfect $\rm\: n$'th power of a linear polynomial, namely

$\rm\quad\quad f(x)\ =\ (x + b/n)^n\ -\ g(x)\ \$ where $\rm\ \ g(x)\ =\ (x+b/n)^n - f(x)\$ has degree $\rm\:\le\: n-2$

When $\rm\ n = 2\$ this is called completing the square - esp. when used to solve a quadratic equation.$\ \$ If $\rm\ \ g(x)\ = g\$ is constant (as is always true when $\rm\ n = 2\:$) then this yields a closed form for the roots of $\rm\:\ f(x)\:,\$ namely $\rm\ x\ =\ \sqrt[n]{g}-b/2\:.$

See this video and its sequel to see the process worked in real time.

As Arturo points out what you have to observe is the coefficient.

\begin{align*} x^{2}+x+1 & = x^{2} + x + \frac{1+3}{4} \\ & = x^{2} + x + \frac{1}{4} + \frac{3}{4} \\ & = \Bigl(x+\frac{1}{2}\Bigr)^{2} + \frac{3}{4} \end{align*}

I am sure once you get used to such type of things you shall not have trouble in doing such problems. Solve more problems based on this type. Suppose you have the coefficient of $x$ as $a$ note that $a^{2}/4$ should be added and subtracted from the constant term. What i mean by this is: Suppose you have something of this type $x^{2}+ax + b^{2}$ then you can write this as $(x+a/2)^{2} + b^{2}-a^{2}/{4}$.