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!
 A: Since an equation of the form $x^2 + xy + y^2$ does not have a standard factorization, it really depends on the given problem and what you want to achieve. One kind of manipulation that is used a lot, though, is :
$$x^2 + xy + y^2 = (x+y)^2 - xy$$
For the given trigonometric expression though, you can factorize it perfectly, as one can easily see that :
$$9\sin^2 x + 12\sin x\cos x + 4\cos^2x = (3\sin x + 2\cos x)^2$$
A: The basic technique is called completing the square. You know that you have, in general,
$$(a+b)^2 = a^2 + 2ab + b^2.$$
So if you have a trinomial you can try to pattern-match what $a$ and $2ab$ must be, and then recover $b$. For instance, in your second example, $9\sin^2 x$ is a perfect square so a good candidate is $a=3\sin x$, $2ab = 12\sin x \cos x$ so that you have $b= 2\cos x$. And then since $b^2 = 4\cos^2 x$, the expression does factor.
For your first example, you can try $a=x$ but then you end up with
$$x^2 + xy + y^2 = (x+y/2)^2 + \frac{3y^2}{4}$$
and you can't really do better since the left-hand side doesn't factor.
Even if the expression doesn't factor, completing the square is useful in solving quadratic-like equations, for instance
$$9\sin^2 x + 12 \sin x - 8 = 0.$$
You can partially factor this as
$$(3\sin x + 2)^2 - 12 = 0$$
which you can then solve for $x$.
A: 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)$$
A: $$x^2+xy+y^2$$ is homogeneous, and with $t:=y/x$
$$x^2+xy+y^2=x^2(1+t+t^2).$$ Now you are able to find the roots of the second factor.
