How do I factorize this thing?
$x^4+x^2+1$
I tried to solve the integral $\int{\frac{1}{x^4+x^2+1}}$ and after trying some substitutions that did not work, I plugged the integral into an integral calculator and it turns out that $x^4+x^2+1$ can be written as $(x^2-x+1)(x^2+x+1)$ and at first I thought it was factorized using the formula $(a-b)(a+b) = a^2 - b^2$ where $a = x^2$ and $b = x+1$ but after trying that I realized it is wrong because $b = -(x-1)$ in the first parantheses and in the second $b = x+1$.
So what is the intuition behind this factorization?
You are right! But look at it this way:
$a = x^2 + 1$
$b = x$