I was trying to understand why the absolute value of the sum/difference of two complex numbers to the second power (squared) can be given as:
$$\left| |a| \exp(-i c)+|b| \exp(-i d) \right|^2=|a|^2+2\cos(c-d)|a||b| +|b|^2$$
$$\left| |a| \exp(-i c)-|b| \exp(-i d) \right|^2=|a|^2-2\cos(c-d)|a||b| +|b|^2$$
I found this answer to a similar question, where I understand all steps except this: $$\left| |a| \exp(-i c)-|b| \exp(-i d) \right|^2=(|a| \exp(-i c)-|b| \exp(-i d) )\times( |a| \exp(i c)-|b| \exp(i d))$$
Could you help me understand why the last equation is true?
$a, b, c, d$ are real numbers in this scenario.
As for your question: $$|(|a|e^{ic}-|b|e^{id})|^2=(|a|e^{-ic}-|b|e^{-id})(|a|e^{ic}-|b|e^{id})$$ This equality holds iff the RHS is just a real number, as these clearly have the same magnitudes. Now we have $$ (|a|e^{-ic}-|b|e^{-id})(|a|e^{ic}-|b|e^{id}) = |a|^2+|b^2| -2|a||b| (e^{ic}e^{-id}+e^{-ic}e^{id})$$ $$(|a|e^{-ic}-|b|e^{-id})(|a|e^{ic}-|b|e^{id}) = |a|^2+|b^2| -2|a||b|(e^{i(c-d)}+e^{-i(c-d)})$$ Since $e^{i\theta}$ and $e^{-i\theta}$ are conjugates, their sum is real, and thus the whole RHS is real and is then equal to the LHS.
That solution is great and all but a nicer way of thinking of this is as the law of cosines in a triangle, namely that if you have sides of length, $a$, $b$, $c$, and an angle opposite side $c$, $C$, then $$c^2=a^2-2ab\cos(C) +b^2$$ Our complex numbers $ae^{ic}$ and $be^{id}$ have lengths $a$ and $b$, and the angle between the vectors from the origin to these numbers in the complex plane is simply $c-d$ so you can combine both equations into $$||a|e^{ic}-|b|e^{id}|^2 = |a|^2+|b^2| -2|a||b|\cos(c-d)$$ From which you can also derive the addition case. We can use $e=\pi+d$ and get $$||a|e^{ic}-|b|e^{ie}|^2 = |a|^2+|b^2| -2|a||b|\cos(c-(\pi+d)) $$ $$||a|e^{ic}+|b|e^{id}|^2= |a|^2+|b^2| +2|a||b|\cos(c-d)$$ Hope this helps!