# Integrating $\sin^2(x)$ using imaginary numbers.

I know I can change "$\sin^2\theta$" to "$\frac{1}{2}(1-\cos(2\theta))$" or use integration by parts, but I was curious about doing it using imaginary numbers. I tried this but it didn't work.

$$\int \sin^2\theta d\theta= \operatorname{Im}\left\{ \int e^{2i\theta }\right\} = \operatorname{Im}\left\{ \frac{1}{2i} e^{2i\theta }\right\}= \operatorname{Im}\left\{ \frac{\cos2\theta + \sin2\theta i}{2i}\right \}= -\frac{1}{2}\cos2\theta$$

this is not the same answer I get using the other methods. I assume I did something wrong somewhere. How should I do this?

-
No imaginary tag? – Aaron de Windt Mar 4 '13 at 0:05
$\Im e^{2i\theta}\neq \sin^2\theta$ – L. F. Mar 4 '13 at 0:05
ok. how is it then? – Aaron de Windt Mar 4 '13 at 0:07
You can do it like that if you want, but you have to use $\sin\theta=(e^{i\theta}-e^{-i\theta})/2i$ and then square. – 1015 Mar 4 '13 at 0:07
@AarondeWindt How is what? – L. F. Mar 4 '13 at 0:08

$$e^{2 i\theta} = \cos (2\theta) + i\sin (2\theta)$$
and the $\sin$ is not squared. To integrate $\sin$ with exponentials, note
$$\sin^2 x = \left(\frac{e^{ix} - e^{-ix}}{2i}\right)^2 = -\frac{e^{2 i x} - 2 + e^{-2 i x}}{4} = \frac{2-e^{2 i x} - e^{-2 i x}}{4}$$