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.

You can try $$x^4+2x^3y+3x^2y^2+2xy^3+y^4= x^2y^2({x^2\over y^2}+2{x\over y}+3+2{y\over x}+ {y^2\over x^2})$$
Let $t= {x\over y}+{y\over x}$ then we have ${x^2\over y^2}+{y^2\over x^2}=t^2-2$, so $$...= x^2y^2(t^2-2+2t+3) =x^2y^2(t+1)^2= $$ $$=x^2y^2({x\over y}+{y\over x}+1)^2 =(x^2+y^2+xy)^2$$
