<s>[INST] What wolfram does to factor $x^6+x^2+2$? I am learning polynomials and I am trying to understand what wolfram did to obtain $$(x^2+1)(x^4-x^2+2)$$ from $$x^6+x^2+2$$
It does not show me the step-by-step option in this case and I got confused. I only see $$x^2(x^4+1)+2$$ for this case.
Thank you.
 [/INST] Notice that $x^6+x^2+2=(x^6+1) + (x^2+1)$.
 Since $x^6+1$ is a sum of cubes it factors like this: $$x^6+1=(x^2+1)(x^4-x^2+1).$$ Putting these together gives $$x^6+x^2+2=(x^2+1)(x^4-x^2+1)+(x^2+1)=(x^2+1)(x^4-x^2+2).$$
Not sure about Wolfram's actual algorithm though. For algorithms see Wikipedia. For an explanation of one algorithm that isn't too hard to follow, check out page 12 in 
Milne's course notes on fields and Galois theory, it is remark 1.17.
</s>