Trigonometry with Quadratic Equations If $\tan A$ and $\tan B$ are the roots of $x^2+px+q=0$, then prove that 
$$\sin^2(A+B)+p \sin(A+B) \cos(A+B) + q \cos^2(A+B) = q$$
I tried the question but with $q$ other terms came associated.

Hint : Let $E=\sin^2(A+B)+p \sin(A+B) \cos(A+B) + q \cos^2(A+B) $
Divide  $E$  by  $\cos^2(A+B)$.
Then you will get $$E\sec^2(A+B)= \tan^2(A+B)+p \tan(A+B)  + q $$
Since $$\tan(A+B)=\frac{−p}{1−q} \Rightarrow \sec^2(A+B)=1+\frac{p^2}{(1−q)^2}$$, provided $q≠1$.
$$E\sec^2(A+B)= \frac{p^2}{(1−q)^2}-\frac{p^2}{1−q}  + q $$
$$E\cdot \left(1+\frac{p^2}{(1−q)^2}\right) = \frac{p^2}{(1−q)^2}-\frac{p^2}{1−q}  + q $$
Provided $q≠1$.$$\Rightarrow E((1-q)^2+p^2)=p^2-p^2(1-q)+q(1-q)^2$$
$$\Rightarrow E((1-q)^2+p^2)=p^2q+q(1-q)^2$$
$$\Rightarrow E((1-q)^2+p^2)=q(p^2+(1-q)^2)$$
$$\Rightarrow E=q$$ .
