how to solve a problem involving quadratic equation?