If $\frac{\cos x+\cos y+\cos z}{\cos(x+y+z)}=\frac{\sin x+\sin y+\sin z}{\sin(x+y+z)}=k$, then find $\cos(x+y)+\cos(y+z)+\cos(z+x)$. 
If $x,y,z \in\mathbb{R}$ and  $$\frac{\cos x+\cos y+\cos z}{\cos \left(x+y+z\right)}=\frac{\sin x+\sin y+\sin z}{\sin \left(x+y+z\right)}=k$$
Find the value of $\cos(x+y)+\cos(y+z)+\cos(z+x)$.

I was working through this problem and found an interesting solution to it. How would you solve it?

Edit: I found the same question here and here. So, this should be marked as duplicate.
 A: Rewrite the equations as
$$\cos x +\cos y+\cos z =k\cos(x+y+z) \\ \sin x+\sin y+\sin z=k\sin(x+y+z)$$

Multiply the second equation by $i$ (where $i=\sqrt{-1}$) , and add both the equations. Using Euler's formula, we are left with a single equation, that is,$$e^{ix}+e^{iy}+e^{iz}=ke^{i(x+y+z)}$$
Now, we have to find $\cos(x+y)+\cos(y+z)+\cos(z+x)=\Re\left(e^{i(x+y)}+e^{i(y+z)}+e^{i(z+x)}\right)$.


 Now, we let $\alpha=e^{ix},\beta=e^{iy},\gamma=e^{iz}$, so that we have $\alpha+\beta+\gamma=k\alpha \beta\gamma $ and we need to find $\alpha\beta+\beta\gamma+\gamma\alpha$.


 Dividing by $\alpha\beta\gamma$ in the last equation results in $(\alpha\beta)^{-1}+(\beta\gamma)^{-1}+(\gamma\alpha)^{-1}=k$.


 But notice that $\Re(\alpha\beta)=\Re\left((\alpha\beta)^{-1}\right)$ since cosine is an even function and hence $\Re\left((\alpha\beta)^{-1}+(\beta\gamma)^{-1}+(\gamma\alpha)^{-1}\right)=\Re(\alpha\beta+\beta\gamma+\gamma\alpha)=k$.


 If instead of real part, we take the imaginary parts, we get $\Im\left((\alpha\beta)^{-1}+(\beta\gamma)^{-1}+(\gamma\alpha)^{-1}\right)=-\Im\left(\alpha\beta+\beta\gamma+\gamma\alpha\right) \implies \sin(x+y)+\sin(y+z)+\sin(z+x)=0$.

