<s>[INST] How find the value of $\cos{x}+\cos{y}$ let 

$$\dfrac{\cos{x}\cos{\dfrac{y}{2}}}{\cos{(x-\dfrac{y}{2})}}+\dfrac{\cos{y}\cos{\dfrac{x}{2}}}{\cos{(y-\dfrac{x}{2})}}=1$$

Find the value $$cos{x}+\cos{y}=?$$
this following My  ugly solution: let

$$\tan{\dfrac{x}{2}}=a,\tan{\dfrac{y}{2}}=b$$
  then
  $$\cos{x}=\dfrac{1-a^2}{1+b^2},\cos{y}=\dfrac{1-b^2}{1+b^2}$$
  then
  $$\dfrac{\cos{x}\cos{\dfrac{y}{2}}}{\cos{(x-\dfrac{y}{2})}}=\dfrac{1}{1+\tan{x}\tan{\dfrac{y}{2}}}=\dfrac{1-a^2}{1-a^2+2ab}$$
  and
  $$\dfrac{\cos{y}\cos{\dfrac{x}{2}}}{\cos{(y-\dfrac{x}{2})}}=\dfrac{1-b^2}{1-b^2+2ab}$$
  so
  $$\dfrac{1-a^2}{1-a^2+2ab}+\dfrac{1-b^2}{1-b^2+2ab}=1$$
  then
  $$\Longrightarrow (1-a^2)(1-b^2+2ab)+(1-b^2)(1-a^2+2ab)=(1-a^2+2ab)(1-b^2+2ab)$$
  then
  $$(1-b^2)(1-a^2+2ab)=2ab(1-b^2+2ab)$$
  $$a^2+b^2=1-3a^2b^2$$
  so
  $$\cos{x}+\cos{y}=\dfrac{2-2a^2b^2}{1+a^2+b^2+a^2b^2}=1$$
  My question: this problem have nice methods? Thank you,because My methods is very ugly.Thank you 

 [/INST] $$\dfrac{\cos x\cos{\dfrac y2}}{\cos\left(x-\dfrac y2\right)}+\dfrac{\cos y\cos{\dfrac x2}}{\cos\left(y-\dfrac{x}{2}\right)}=1$$
$$\implies\dfrac{\cos x\cos{\dfrac y2}}{\cos\left(x-\dfrac y2\right)}=1-\dfrac{\cos y\cos{\dfrac x2}}{\cos\left(y-\dfrac{x}{2}\right)}$$
$$\implies\frac1{1+\tan x\tan\frac y2}=\frac{\sin y\sin \frac y2}{\cos\left(y-\dfrac{x}{2}\right)}=\frac1{\cot y\cot\frac x2+1}$$
$$\implies \tan x\tan\frac y2=\cot y\cot\frac x2\iff \tan x\tan\frac y2\tan y\tan\frac x2=1$$
Now, $\displaystyle \tan x\tan\frac x2=\frac{2\tan\frac x2}{1-\tan^2\frac x2}\tan\frac x2=\frac{2\sin^2\frac x2}{\cos^2\frac x2-\sin^2\frac x2}$ (multiplying the numerator & the denominator by $\cos^2\frac x2$)
$\displaystyle\implies \tan x\tan\frac x2=\frac{1-\cos x}{\cos x}$
and similarly for $\displaystyle \tan y\tan\frac y2$
</s>