TITLE: Module and square of a complex number
QUESTION [0 upvotes]: if I have the square module of a complex number, how can I solve it?
Example:
$|e^{-1}\cos(2 \pi f t)-e^{-1}j\sin(2 \pi f t)-1|^2$
First idea:
$[e^{-1}\cos(2 \pi f t)]^2 +[-e^{-1}\sin(2 \pi f t)-1] ^2$  theoretically   $a^{2}+b^{2}+c^{2}+2bc$
Second idea:
$[e^{-1}\cos(2 \pi f t) -e^{-1}\sin(2 \pi f t)-1] ^2$  theoretically  $ a^{2}+b^{2}+c^{2}-2ab+2bc-2ac $
what is the correct solution?
Thanks

REPLY [2 votes]: $$|z|^2=\Re^2z+\Im^2z=(r\cos\theta-1)^2+(r\sin\theta)^2.$$
You can rewrite as
$$r^2-2r\cos\theta+1.$$

Here it is not a very good idea to square before taking the modulus. If you want to, the correct way is
$$(a-ib+c)^2=a^2-b^2+c^2-2iab+2ac-2ibc$$
and
$$|a-ib+c|^2=\sqrt{(a^2-b^2+c^2+2ac)^2+(2ab+2bc)^2}.$$
If you aggreate $s:=a+c$,
$$\sqrt{(s^2-b^2)^2+(2sb)^2}=\sqrt{s^4+2s^2b^2+b^4}=s^2+b^2.$$
{"set_name": "stack_exchange", "score": 0, "question_id": 3688337}