Completing the square, why it works (PDF)