The coding is simple. You can use the [sup] tag to make it work. Thus:
P(x) = x[sup]4[/sup] - x[sup]3[/sup] - 7x[sup]2[/sup] + x + 6
As for the math, that’s also easy. Since you can’t be expected to guess a whole plethora of real numbers, you have to try certain simple tricks to see if specific types of real numbers will work. Make a list for yourself of the sorts of things to look for:
Rational roots - these will all be of the form p/q, where p is a factor of the constant term and q is a factor of the leading coefficient. You make a list of the possible rational roots, then start checking them with synthetic division.
Look for patterns that are familiar, such as difference if squares, trinomial squares, etc.
See if a factor pattern can be discerned, such as ax[sup]3[/sup] + bx[sup]2[/sup] + ax + b, which factors easily to (ax + b) * (x[sup]2[/sup] + 1).
For the problem in question, it is readily determined that all for possible real roots are all not only rational, but integer roots, each a factor of the constant term. This makes it easy; any factor of 6 you pick will produce a result by synthetic division, and from there, factoring patterns and difference of squares seal the deal.
Your first step should be to test out the easy solutions of x=0, x=1, and x=-1. In this case, two of the zeros are located at x=1 and x=-1, so that you can reduce the equation to (x-1)(x+1)(some trinomial) {You can find what the trinomial is by using long division on the initial pentanomial and each of the (x-1) and (x+1) successively}. Once you have the trinomial, you can factor it into two binomials using the quadratic formula.
If none of the easy solutions worked, you’d have to use Ferrari’s method, described in the article.
Ferrari’s method isn’t generally taught at the pre-calc level (and honestly, I would need a pretty good reason to use it over some much simpler numerical method). The rational root theorem, as mentioned by DSYoungEsq, is the way to go here.