solving polynomial by factoring