Given two polynomials with real coefficients $g(x)$ and $h(x)$.
Additionally, $x^2+x+1$ is a factor of $f(x^3)= h(x^3)+xg(x^3)$.
Prove that $x-1|h(x)$ and $x-1|g(x)$
I have tried to solve it by doing this;
$(x-1)(x^2+x+1)|(x-1)(h(x^3)+xg(x^3))$
then; $(x^3-1)|(x)(h(x^3)-g(x^3)) + (x^2)g(x^3) - h(x^3)$
consider degree of $3k, 3k+1, 3k+2$ separately, I got;
$(x^3-1)|(x^2)g(x^3)$ and $h(x^3)$
Lastly, $(x^3-1)|g(x^3), h(x^3)$ and so on finish proving.
I wonder, is it correct to separate three cases of degrees in this problem?