Solve a quadratic equation by completing the square