If $\cos A+\cos B=p$ and $\sin A+\sin B=q$, then find $\cos\left( \frac {A+B}{2}\right)$ in terms of $p$ and $q$ If $\cos A+\cos B=p$ and $\sin A+\sin B=q$ then find $\cos \left( \dfrac {A+B}{2}\right)$ in terms of $p$ and $q$. 
My Attempt:
$$\cos A+\cos B=p$$
$$2\cos \left( \dfrac {A+B}{2}\right)\cos \left( \dfrac {A-B}{2}\right)=p$$
And,
$$\sin A+ \sin B=q$$
$$2\sin \left( \dfrac {A+B}{2} \right)\cos \left( \dfrac {A-B}{2} \right)=q$$
Now,
$$\tan \left( \dfrac {A+B}{2}\right)=\dfrac {q}{p}$$.
How do I proceed further?

Let, $\dfrac{A+B}{2}=x\implies\tan x=\dfrac{q}{p}=\dfrac{\text{height}}{\text{base}}$.
Now suppose for a right angle triangle the height is $aq$ units and base is $ap$ units $(a\neq0)$. So the length of hypotenuse is $=a\sqrt{q^2+p^2}$ units.
$\cos x=\dfrac{\text{base}}{\text{hypotenuse}}=\dfrac{ap}{a\sqrt{q^2+p^2}}=\dfrac{p}{\sqrt{q^2+p^2}}$.
$\implies\cos\left(\dfrac{A+B}{2}\right)=\dfrac{p}{\sqrt{q^2+p^2}}$.
