# calculating cos(nθ) and sin(nθ) with de Moivre

#### Bart

I'm not sure in which subforum I should post this, feel free to move it to another subforum.

From my course:

$$\displaystyle (cos(\theta) + jsin(\theta))^3 = cos(3\theta) + jsin(3\theta)$$
$$\displaystyle cos^3(\theta) + 3jcos^2(\theta)sin(\theta) - 3cos(\theta)sin^2(\theta) - jsin^3(\theta) = cos(3\theta) + jsin(3\theta)$$
<->
$$\displaystyle cos(3\theta) = cos^3(\theta) - 3cos(\theta)sin^2(\theta)$$ and $$\displaystyle sin(3\theta) = 3cos^2(\theta)sin(\theta) - sin^3(\theta)$$

I have no problem with the first two lines, I don't understand how you can logically deduce the last line from the first two lines.
After all, $$\displaystyle cos(3\theta) = cos^3(\theta) + 3jcos^2(\theta)sin(\theta) - 3cos(\theta)sin^2(\theta) - jsin^3(\theta) - jsin(3\theta)$$

#### Ackbeet

MHF Hall of Honor
In order to get the third line, they equated the real parts of both sides of the second line, and the imaginary parts of both sides of the second line.