<s>[INST] Find $a-b$ from $(\cos(a)+\cos(b))^{2}+(\sin(a)+\sin(b))^{2}=2\cos^{2}(\frac{a-b}{2})$ $a,b\in \mathbb{R}$ and these numbers satisfy this egality:
$(\cos(a)+\cos(b))^{2}+(\sin(a)+\sin(b))^{2}=2\cos^{2}(\frac{a-b}{2})$
I need to find $a-b$ (The right answer is $a-b=2k\pi+\pi|k\in \mathbb{Z}$)
My try: I know that the expression $(\cos(a)+\cos(b))^{2}+(\sin(a)+\sin(b))^{2}=4\cos^{2}(\frac{a-b}{2})$
So I get $4\cos^{2}(\frac{a-b}{2})=2\cos^{2}(\frac{a-b}{2})$ and I get $\cos^{2}(\frac{a-b}{2})=0$ but my result is $+-\pi+4k\pi$
Where's my mistake?
 [/INST] Clayton has the answer for what is wrong with your answer.
An alternative answer is to remember $2\cos^2{x}-1=\cos 2x$ so:
$$2\cos^2\left(\frac{a-b}{2}\right)=\cos(a-b)+1$$
And you have the left side is, after expanding and canceling $\cos^2 a+\sin^2 a = 1=\cos^2b +\sin^2 b$
$$2+2(\cos a \cos b + \sin a \sin b)=2+2\cos(a-b)$$
This gives you the equation $2\cos(a-b)+2=\cos(a-b)+1$ which means $\cos(a-b)=-1.$
</s>