<s>[INST] How do I get from $x^4+2x^3y+3x^2y^2+2xy^3+y^4$ to $(x^2+xy+y^2)^2$? I was doing an example $$(x+y)^4+x^4+y^4$$ and I need to factor it. I've tried and couldn't really do much, so I checked if there was anything to help, and I came across a post asking about the same thing. But my question is how do I know that $$x^4+2x^3y+3x^2y^2+2xy^3+y^4=(x^2+xy+y^2)^2$$ without knowing the answer.
I know about $$(a+b+c)^2$$ but then how would i chose my $a, b$ and $c$?
There are many $xy$ combinations here, with different powers, so would I chose the lowest as my $b$, and $x^2$ as my $a$ and $y^2$ as my $c$, or perhaps is there another formula that can help me.
 [/INST] In cases like $\,x^4+2x^3y+3x^2y^2+2xy^3+y^4\,$ where the difference between consecutive coefficients is "simpler" than the original sequence, it is worth trying to multiply by $\,x-y\,$:
$$
(x-y)(x^4+2x^3y+3x^2y^2+2xy^3+y^4) \,=\, x^5 + x^4 y + x^3 y^2 - x^2 y^3 - x y^4 - y^5
$$
The same pattern of "simpler" differences applies here, so multiplying by $\,x-y\,$ one more time:
$$
\begin{align}
(x-y)^2(x^4+2x^3y+3x^2y^2+2xy^3+y^4) \,&=\, (x-y)(x^5 + x^4 y + x^3 y^2 - x^2 y^3 - x y^4 - y^5)
\\ &=\, x^6 - 2 x^3 y^3 + y^6
\\ &=\, (x^3-y^3)^2
\\ &=\, (x-y)^2(x^2+xy+y^2)^2
\end{align}
$$
</s>