Solving quadratic equation by completing square