You may want to review factoring polynomials first.

Not all polynomials can be factored. Some are prime, which just
means that their only factors are 1, −1, themselves and
−themselves. For the polynomials we've been dealing with,
there are two steps to see if they're prime. First, look for a GCD
(besides 1 or −1). If it has one, then you can factor it, so
it's not prime. If not, then try to factor it using the AC method.
(If the *x*^{2} has nothing in front of it, then you
can use the easier method you learned for that case instead.) If
that doesn't work either (that is, if you can't find two numbers
whose sum and product is what they need to be), then it's
prime.