Question in relation to completing the square In description of "completing the square" at http://www.purplemath.com/modules/sqrquad.htm the following is given : 

I'm having difficulty understanding the third part of the transformation.
Where is
$ -\frac{1}{4}$ derived from $-\frac{1}{2}$ ?
Why is $ -\frac {1}{4}$ squared to obtain $ \frac {1}{16}$ ?
 A: In general, to complete the square of something like $x^2 \pm Bx = \pm C$, you take half the coefficient of $x$, which is $B$, and then square it. 
For the third step, they first take half of the $x$ coefficient, which is $-\frac{1}{2}$. Half of $-\frac{1}{2}$ is $-\frac{1}{4}$ since
$$ \frac{-\frac{1}{2}}{2} = \frac{-\frac{1}{2}}{\frac{2}{1}}= -\frac{1}{2} \cdot \frac{1}{2} = -\frac{1}{4}.$$
Then, they square $-\frac{1}{4}$ which is $\frac{1}{16}$ since
$$ \left(-\frac{1}{4}\right)^2 = -\frac{1}{4} \cdot -\frac{1}{4} = \frac{1}{16}.$$
The reason why they add $\left (\frac{B}{2} \right)^2$ to both sides of the equation is to make a squared binomial:
$$x^2 + Bx + \left (\frac{B}{2} \right)^2 = \left(x + \frac{B}{2} \right)^2.$$
A: Let's begin with the equation 
$$x^2 - \frac{1}{2}x = \frac{5}{4}$$
What the author wants to do is to create a perfect square on the left hand side.  That is, the author wants to transform the expression on the left hand side into the form $(a + b)^2 = a^2 + 2ab + b^2$.  Assume that 
$$a^2 + 2ab = x^2 - \frac{1}{2}x$$
If we let $a = x$, then we obtain
\begin{align*}
x^2 + 2bx & = x^2 - \frac{1}{2}x\\
2bx & = -\frac{1}{2}x\\
\end{align*}
Since the equation $2bx = -\frac{1}{2}x$ is an algebraic identity that holds for each real number $x$, it holds when $x = 1$.  Thus,
\begin{align*}
2b & = -\frac{1}{2}\\
b & = -\frac{1}{4}
\end{align*}
Therefore, 
\begin{align*}
a^2 + 2ab + b^2 & = x^2 + 2\left(-\frac{1}{4}\right)x + \left(-\frac{1}{4}\right)^2\\
                & = x^2 - \frac{1}{2}x + \frac{1}{16}
\end{align*}
If we add $1/16$ to the left hand side of the equation, we must add $1/16$ to 
the right hand side of the equation to balance it, which yields
$$x^2 - \frac{1}{2}x + \frac{1}{16} = \frac{5}{4} + \frac{1}{16}$$
By construction, the expression on the left hand side is the perfect square $(x - \frac{1}{4})^2$, so we obtain
$$\left(x - \frac{1}{4}\right)^2 = \frac{21}{16}$$
We can now solve the quadratic equation by taking square roots, which is why we wanted to transform the left hand side into a perfect square.
A: If you have $(a+b)^2 = a^2 + 2ab + b^2$ and $a^2 = x^2, 2ab = -x/2$, then $a=x, b = -1/4$.
$1/16$ is $b^2$ which is needed to form $a^2 + 2ab + b^2$ in the LHS and move remain elements in the RHS.
