<s>[INST] How to factor equations with the form $x^2 + xy + y^2$? Title says it all. I'm having a hard time factoring anything looking like the equation $x + xy + y$. Especially trig ones, like $9\sin^2x + 12\sin x\cos x + 4\cos^2x$. 
Thanks!
 [/INST] If you want to factor expressions of the form $\alpha x^2+\beta xy+\gamma y^2$, observe that $$\begin{align*}\alpha x^2+\beta xy+\gamma y^2&=\alpha y^2\left((xy^{-1})^2+\beta\alpha^{-1} (xy^{-1})+\gamma\alpha^{-1}\right)\\&=\alpha y^2\left(xy^{-1}-\frac{-\beta+ \sqrt{\beta^2-4\alpha\gamma}}{2\alpha}\right)\left(xy^{-1}-\frac{-\beta- \sqrt{\beta^2-4\alpha\gamma}}{2\alpha}\right)\\&=\boxed{\left(\sqrt{\alpha}x-\frac{-\beta+ \sqrt{\beta^2-4\alpha\gamma}}{2\sqrt{\alpha}}y\right)\left(\sqrt{\alpha}x-\frac{-\beta- \sqrt{\beta^2-4\alpha\gamma}}{2\sqrt{\alpha}}y\right)}\end{align*}$$
Of course, the usual warnings involving principal square roots apply.
In the case of $x^2+xy+y^2$ this gives us the factorization $$x^2+xy+y^2=\left(x-\tfrac{-1+i\sqrt{3}}{2}y\right)\left(x-\tfrac{-1-i\sqrt{3}}{2}y\right)$$
</s>