Notice, we have $$\sec\theta+\tan\theta=p\tag 1$$
$$\sec\theta\tan\theta=q\tag 2$$
$$(\sec\theta-\tan\theta)^2=(\sec\theta+\tan\theta)^2-4\sec\theta\tan\theta$$
$$(\sec\theta-\tan\theta)^2=p^2-4q$$
$$\sec\theta-\tan\theta=\sqrt{p^2-4q}\tag 3$$
adding (1) & (3), $$2\sec\theta=p+\sqrt{p^2-4q}\tag 4$$
& subtracting (3)from (1), $$2\tan\theta=p-\sqrt{p^2-4q}\tag 5$$
Now, squaring & subtracting (5) from (4), one should have
$$4\sec^2\theta-4\tan^2\theta=\left(p+\sqrt{p^2-4q}\right)^2-\left(p-\sqrt{p^2-4q}\right)^2$$
$$4(\sec^2\theta-\tan^2\theta)=\left(p+\sqrt{p^2-4q}+p-\sqrt{p^2-4q}\right)\left(p+\sqrt{p^2-4q}-p+\sqrt{p^2-4q}\right)$$
$$4(1)=\left(2p\right)\left(2\sqrt{p^2-4q}\right)$$
$$p\sqrt{p^2-4q}=1$$
$$\color{red}{p^2(p^2-4q)=1}$$