It is given that, sinx+siny=p, and cosx+cosy=q
So, on squaring and adding, we get 2+2cos(x−y)=p2+q2...(i)
On squaring and subtracting, we get cos2x+cos2y+2cos(x+y)=q2−p2 ⇒2cos(x+y)[cos(x−y)+1]=q2−p2...(ii)
From Eqs. (i) and (ii), we get sec(x+y)=q2−p2p2+q2