How to derive the last term of the expansion of $\cos n\theta$ using De Moivre's Theorem?

If n be odd, then the last term in the expansion of $\cos n\theta$ is $(-1)^{\frac{n-1}{2}}\displaystyle\binom n{n-1}\cos\theta\sin^{n-1}\theta\,.$

If $n$ be even, then the last term in the expansion of $\cos n\theta$ is $(-1)^\frac n2 \sin^n\theta\,.$

This is what the author of my book asserted regarding the expansion of $\cos n\theta$ using De Moivre's Theorem.

Well, expanding $\cos n\theta$ from De Moivre's Theorem is quite easy:

$$\cos n\theta= \cos^n\theta - \binom n2 \cos^{n-2}\theta\sin^2\theta+ \binom n4\cos^{n-4}\theta\sin^4\theta - \ldots$$

But I'm not getting how to conclude the last terms as stated by the author.

Could anyone shed light on how the author concluded the last terms for $n$ being even and odd?

For $r = 0, 1, \ldots, \lfloor{n/2}\rfloor$, the $r^\text{th}$ term in the expansion of the identity $$2\cos n\theta = (\cos n\theta + i\sin n\theta) + (\cos n\theta - i\sin n\theta) = (\cos\theta + i\sin\theta)^n + (\cos\theta - i\sin\theta)^n$$ (after dividing both sides by $2$) is $$(-1)^r\binom{n}{2r}\cos^{n-2r}\theta\sin^{2r}\theta.$$ If $n$ is odd, say $n = 2k + 1$ ($k \geqslant 0$), the last term is given by $r = k = (n - 1)/2$, and $2r = n - 1$. If, on the other hand, $n$ is even, say $n = 2k$ ($k \geqslant 0$), the last term is given by $r = k = n/2$, and $2r = n$.
In a bit more detail, as requested: $$(\cos\theta + i\sin\theta)^n + (\cos\theta - i\sin\theta)^n = \sum_{m=0}^n \binom{n}{m}\left(i^m + (-i)^m\right)\cos^{n-m}\theta\sin^m\theta,$$ and the RHS can be written as $S_0$ + $S_1$, where $$S_0 = \sum_{r=0}^{\lfloor{n/2}\rfloor} \binom{n}{2r}\left(i^{2r} + (-i)^{2r}\right)\cos^{n-2r}\theta\sin^{2r}\theta,$$ and $$S_1 = \sum_{s=0}^{\lfloor{(n-1)/2}\rfloor} \binom{n}{2s+1}\left(i^{2s+1} + (-i)^{2s+1}\right)\cos^{n-2s-1}\theta\sin^{2s+1}\theta.$$ In $S_0$, the subexpression $i^{2r} + (-i)^{2r}$ can be simplified, thus: $$i^{2r} + (-i)^{2r} = 2(i^2)^r = 2(-1)^r,$$ whereas in $S_1$, we have $$i^{2s+1} + (-i)^{2s+1} = i^{2s+1} - i^{2s+1} = 0.$$ So $S_1 = 0$, and we end up with: $$(\cos\theta + i\sin\theta)^n + (\cos\theta - i\sin\theta)^n = 2\sum_{r=0}^{\lfloor{n/2}\rfloor} (-1)^r\binom{n}{2r}\cos^{n-2r}\theta\sin^{2r}\theta,$$ as was stated earlier.
• Thanks for the answer. Well, that was a clever trick; however when I binomially expanded the two and added, for $n$ being odd, I got $\displaystyle \binom n{n-1}\cos\theta (i\sin\theta)^{n-1}/2;$ it is not the same as the one stated by the author for $n$ being odd; why is there no $i$ and $2$ in the author's expression? Could you please tell? – user142971 Oct 3 '16 at 12:04
• @MAFIA36790 I confess to feeling tension in my stomach when I see a floor expression in the middle of a formula: I think it always means that there's a small hidden argument, which may need to be made explicit. In $S_0$, we sum for all values of $r$ such that $2r \leqslant n$, i.e. such that $r \leqslant n/2$. For any real number $x$, $\lfloor{x}\rfloor$ is the largest integer $\leqslant x$. So in this case, with $x = n/2$, the largest value of $r$ in the summation is $\lfloor{n/2}\rfloor$. Similarly in $S_1$, with $2s + 1 \leqslant n$, i.e. $2s \leqslant n - 1$, i.e. $s \leqslant (n - 1)/2$. – Calum Gilhooley Oct 3 '16 at 13:55