solving by completing the square