<s>[INST] 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.
 [/INST] 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} $$
</s>