Solving two steps algebraic equations