Help factorising a sixth degree polynomial I have to factorise- $$x^6+5x^3+8$$Answer is $$(x^2−x+2)(x^4+x^3−x^2+2x+4)$$.I have also used factor theorem.Please help me.Thanks in advance.

It can be factored with help of following identities (applied twice below, marked by a '*')
$$u^3 \pm v^3 = (u \pm v)(u^2 \pm uv + v^2)$$
Let $u = x^2 + 2$, we have
$$\begin{align}
x^6 + 5x^3 + 8 
&= (x^2)^3 + 2^3 + 5x^3\tag{1}\\
&\stackrel{*}{=} (x^2+2)(x^4 - 2x^2 + 4) + 5x^3\\
&= u(u^2 - 6x^2) + 5x^3\tag{2}\\
&= (u^3 - x^3) - 6x^2(u-x)\\
&\stackrel{*}{=} (u-x)(u^2 + ux + x^2 - 6x^2)\\
&= (x^2 - x + 2)((x^2 + 2)^2 + x(x^2+2) - 5x^2)\\
&= (x^2 - x + 2)(x^4 + x^3 - x^2 + 2x + 4)
\end{align}
$$
Rationale behind the steps


*

*The motivation for step 1 is the non-zero coefficients of $x^k$ are symmetric
around $k = 3$ term. i.e
$$x^6 + 5x^3 + 8 = x^3 \left(x^3 + 5 + \left(\frac{2}{x}\right)^3\right)$$
I try to express everything in terms of $x + \frac{2}{x}$ and looks for simplification.

*Some where in the process, I notice the $1, -6, 5$ pattern in some
expression equivalent to $(2)$. This implies the existence of a factor $u - x$
in the original expression. The rest is more or less following the nose.

