And also I know that one of the divisors of the constant term of a polynomial is a root of it.
The question is that the second method for factoring I mentioned is not always valid. Why ? And when it is valid ?
To me, this sounds like you're talking about the
Rational Root Theoremhttp://www.purplemath.com/modules/rtnlroot.htm, although you appear to have some misconceptions about how it works. Obviously, this theorem can only apply if the constant term has integer divisors, so right there you're restricted to a very small subset of polynomials (although here "very small" may seem like a bit of a misnomer, as there's still infinitely many such polynomials). The rational root theorem also depends not just on the divisors of the constant term, but also of the coefficient of the highest power. Further, the rational root theorem isn't guaranteed to generate a root, only a list of numbers that
might be roots., and even if it does generate one or more roots, it probably won't generate all the roots of an arbitrary polynomial. As its name indicates, it can only ever find rational roots. To find any irrational or complex roots, you'll need other methods.
As an example, take the polynomial \(\displaystyle 2x^3+3x^2+4x+16\). If we apply the rational root theorem, we see that the possible rational roots are \(\displaystyle \pm 1, \pm 2, \pm 4, \pm 8, \pm 16, \text{ and } \pm \dfrac{1}{2}\). However, checking these roots reveals that none of them are actually roots. In fact, the one real root is at \(\displaystyle x \approx 2.2211\) and the other two roots are complex.