Roots of the equation $x^2 + px + q = 0$ If $\tan A$ and $\tan B$ are the roots of the equation $x^2 + px + q = 0 $ , show that  $$\sin^2(A+B) + p \sin(A+B)\cos(A+B) + q \cos^2(A+B) = q$$
I tried using the result that $\tan A + \tan B = -p $ and $(\tan A)(\tan B) = q$ and tried substituting in the original equation but was unable to make any headway.
 A: you have $$\tan A + \tan B = -p, \tan A \tan B = q \implies \tan(A+B) = \frac{\tan A + \tan B}{1- \tan A \tan B}=\frac p{q-1} $$ and $$\sin(A+B) = \pm\frac p{\sqrt{p^2 + (q-1)^2}},\quad \cos(A+B) = \pm \frac {q-1}{\sqrt{p^2 + (q-1)^2}} $$
now, $$\begin{align}\sin^2(A+B) & + p \sin(A+B)\cos(A+B) + q \cos^2(A+B)\\ 
& = \frac1{p^2+(q-1)^2}\left(p^2+p^2(q-1)+q(q-1)^2\right)\\
&= \frac1{p^2+(q-1)^2}\left(p^2q+q(q-1)^2\right)\\
&= q\end{align} $$
A: As $\tan(A+B)=\cdots=\dfrac p{q-1}$
Method $\#1:$
$\implies(1-q)\sin(A+B)+p\cos(A+B)=0$
Multiplying both sides by $\sin(A+B),$
$(1-q)\sin^2(A+B)+p\cos(A+B)\sin(A+B)=0$
$\iff\sin^2(A+B)+p\cos(A+B)\sin(A+B)+q(\cos^2(A+B)-1)=0$
$\iff\sin^2(A+B)+p\cos(A+B)\sin(A+B)+q\cos^2(A+B)=q$
Method $\#2:$
Dividing the numerator & the denominator by $\cos^2(A+B)=\dfrac1{\sec^2(A+B)}=\dfrac1{1+\tan^2(A+B)},$
$$\sin^2(A+B) + p \sin(A+B)\cos(A+B) + q \cos^2(A+B) =\dfrac{\tan^2(A+B)+p\tan(A+B)+q}{\tan^2(A+B)+1}$$
$$=\dfrac{p^2+p^2(q-1)+q(q-1)^2}{p^2+(q-1)^2}$$
Now, $p^2+p^2(q-1)+q(q-1)^2=q[p^2+(q-1)^2]$
