Completing the square equations