Factorize Trigonometric Equation: $ 3\sin(x)^2 - 2\sin(x)\cos(x) - \cos(x)^2 = 0 $ I have a problem with the following trigonometric equation:
$$ 3\sin(x)^2 - 2\sin(x)\cos(x) - \cos(x)^2 = 0 $$
It's from the book Engineering Mathematics 7th edition by Stroud.
The book is giving the answer, but I can't seem to be able to find out how to factorize it. I can't figure it out.
Consider the following solution:

This equation can be written as $3\sin ^2x-\cos ^2x = 2\sin x \cos x.$
That is: $3\sin ^2x-2\sin x \cos x-\cos ^2 x = 0.$
That is: $(3\sin x + \cos x)(\sin x - \cos x) = 0.$
So that $3 \sin x \cos x = 0$ or $\sin x - \cos x = 0.$
If $3 \sin x + \cos x = 0,$ then $\tan x = \frac{-1}{3},$ and so $x = -0.3218 ± n \pi,$ and if $\sin x - \cos x = 0,$ then $\tan x = 1,$ and so $x = \frac{\pi}{4}.$

If anyone could help me understand how to factorize this equation to get the one shown in the image it would help me very much.
Thank you in advance.
 A: If you put $\sin x = a$, and $\cos x = b$, then you might be able to see the "structure" of the equation:
$$\begin{align} 3\sin^2x - 2\sin x \cos x - \cos^2x & = 3a^2 - 2ab - b^2 \\ 
&= 3a^2-3ab+ab-b^2\\ & =3a(a-b)+b(a-b)\\ & =(a-b)(3a+b)\\ & = (3a+ b)(a-b) \\ & = (3\sin x + \cos x)(\sin x - \cos x) = 0\end{align}$$
A: Think of it like this:
Take $a=\sin x$ and $b=\cos x$. Then you have,
$$3a^2-2ab-b^2=3a^2-3ab+ab-b^2=3a(a-b)+b(a-b)=(a-b)(3a+b)$$
Substitute everything back and you have,
$$3\sin^2 x-2\sin x\cos x-\cos^2 x=(\sin x-\cos x)(3\sin x+\cos x)$$
A: Let $u = \sin x$; let $v = \cos x$.  Then the equation
$$3\sin^2x - 2\sin x\cos x - \cos^2x = 0$$
becomes
$$3u^2 - 2uv - v^2 = 0$$
To split the linear term, we must find two numbers with product $3 \cdot -1 = -3$ and sum $-2$.  They are $-3$ and $1$.  Hence,
\begin{align*}
3u^2 - 2uv - v^2 & = 0\\
3u^2 - 3uv + uv - v^2 & = 0 && \text{split the linear term}\\
3u(u - v) + v(u - v) & = 0 && \text{factor by grouping}\\
(3u + v)(u - v) & = 0 && \text{extract the common factor}
\end{align*}
Now, substitute $\sin x$ for $u$ and $\cos x$ for $v$.
