I just noticed this today and I'm a bit confused by it.
If we represent cos(x) as the real part of exp(ix), then I always thought that we could then say that cos(x)^2 is equal to the real part of exp(ix)exp(ix)=exp(2*i*x). However, this clearly cannot be correct, as the real part of exp(2*i*x) is actually cos(2*x), which of course is not equal to cos(x)^2.
So what rule am I violating here when I try to represent cos(x)^2 as exp(2*ix)? Why can't I just say cos(x)^2 is equal to the real part of exp(ix)exp(ix)=exp(2*i*x)?
I know I'm going wrong somewhere but can't see where. Thanks!
$\endgroup$ 13 Answers
$\begingroup$You are not violating a rule, rather, you are making up a rule which does not exist. You are assuming that the real part of $z^2$ is (the real part of $z$), squared. But in fact if we write $z=a+ib$ then $$z^2=a^2-b^2+2iab\ ,\quad \Re(z^2)=a^2-b^2$$ while $$\Re z=a\ ,\quad (\Re z)^2=a^2\ ,$$ and these are not equal (except in the special case $b=0$).
$\endgroup$ $\begingroup$Be slow when you're writing these things out; $e^{2ix}=\left(e^{ ix}\right)^2=\left(\cos(x)+i\sin(x)\right)^2=\cos^2(x)-\sin^2(x)+2i\cos(x)\sin(x)$. Hence, $\Re(e^{2ix})=\cos^2(x)-\sin^2(x)\neq \cos^2(x)$.
$\endgroup$ $\begingroup$You just can't assume that the following holds:
$$\Re^2(z)=\Re(z^2).$$
($\Re$ denotes the real part of.)
Indeed,
$$\Re^2(x+iy)=x^2$$ while
$$\Re((x+iy)^2)=x^2-y^2.$$
Anyway, you can exploit the squaring as follows:
$$(e^{i\theta})^2=e^{i2\theta}$$ so that, taking the real parts,
$$\cos^2\theta-\sin^2\theta=\cos2\theta.$$
Then using $\cos^2\theta+\sin^2\theta=1$ (from $|e^{i\theta}|^2=1$),
$$2\cos^2\theta=\cos2\theta+1.$$
$\endgroup$