Computations with complex numbers and trigonometric functions

complex numberscomplex-analysistrigonometry

I have the following expression:

$$\frac{(\cos x + i \sin x)-(\cos nx + i \sin nx)(\cos x + i \sin x)}{1-(\cos x + i \sin x)}$$
$$=\frac{\sin (\frac{nx}{2})}{\sin (\frac{x}{2})}\cos\biggl(\frac{(n + 1)x}{2}\biggr)+ i\frac{\sin (\frac{nx}{2})}{\sin(\frac{x}{2})}\sin\biggl(\frac{(n + 1)x}{2}\biggr)$$

I am not understanding how the author derives the second term of the equality. I have tried to use the definition of division, but I did not succeed:
($\frac{z_1\times\overline{z_2}}{|z_2|})$. I need to separate the real and imaginary parts, but I am not seeing how the author did it.

Question:

How does the author derives the expression?

Thanks in advance!

Best Answer

The left side has expressions of the form $\cos\theta + i \sin\theta,$ which can be written as $e^{i\theta}$ by Euler's formula:

$$e^{ix}-e^{inx}e^{ix} \over {1-e^{ix}}$$

$$={ e^{ix}(1-e^{inx}) \over {1-e^{ix}}}$$

$$={ e^{ix}e^{ {inx/2}}(e^{{-inx}/2}-e^{inx/2}) \over {e^{ix/2}(e^{-ix/2}-e^{ix/2})}}.$$

$$={{e^{ix/2}e^{inx/2}(-2i\sin{\frac {nx} 2)}}\over{-2i\sin{\frac x2}}}$$

$$=e^{i(n+1)x/2}{\frac{\sin(\frac {nx}2)}{\sin (\frac x2)}}$$

$$={\frac{\sin(\frac{nx}2)}{\sin(\frac x2)}}\biggl(\cos \biggl({\frac {(n+1)x} 2\biggr) +i\sin\biggl({\frac {(n+1)x} 2}}\biggr)\biggr)$$

That's basically it, right?