how to transfer algebraic equation into a quadratic equation