Evaluate $\int \cos(2018x)\sin^{2016}(x)dx$
I could solve this using IBP, $$I=\int \cos(2017x+x)\sin^{2016}(x)dx$$ $$=\int \cos(2017x)\sin^{2016}(x) \cos(x)dx -\int \sin^{2017}(x)\sin(2017x)$$ $$=\frac{\cos(2017x)\sin^{2017}(x)}{2017} +\int \frac{2017\sin^{2017}(x)\sin(2017x)}{2017}dx - \int \sin^{2017}(x)\sin(2017x)$$ $$=\frac{\cos(2017x)\sin^{2017}(x)}{2017}+c$$
However I while trying to solve this question using complex numbers, I didn't obtain the final result. Here's what I did:
The give integral is $\int e^{2018ix} (\frac{e^{ix}-e^{-ix}}{2i})^{2016} dx$(considering real of this and in subsequent steps)
$$=\frac{1}{2^{2016}} \int e^{2ix}(e^{2ix}-1)^{2016} dx$$.
$e^{2ix}-1=t$, $e^{2ix}2idx=dt$
$$=\frac{1}{2^{2016}} \int t^{2017} dt/2i$$.
$$=\frac{t^{2017}}{2^{2017}i \cdot 2017}+c$$
So answer is $$-Im(\frac{t^{2017}}{2^{2017} \cdot 2017})$$
I'm unable to evaluate $t^{2017}=(e^{2ix}-1)^{2017}$ and get it to the form as obtained by IBP. I did the binomial expansion however, I wasn't able to get it to a nice form.
Also is there a generalisation to this problem? Can $\int \cos(mx) \sin^{n}(x) dx$ also be evaluated like this?(not by using reduction formula)
$$t^{2017}=(e^{2ix}-1)^{2017}=(e^{ix})^{2017}(e^{ix}-e^{-ix})^{2017}$$ So, $$t^{2017}=(e^{2017ix})(2i\sin x)^{2017}=(\cos 2017x+i\sin 2017x)(2i\sin x)^{2017}$$ If you take Im part of this expression, you get $$Im(t^{2017})=2^{2017}\cos(2017 x)(\sin x)^{2017}$$ So, the answer $$\frac{Im(t^{2017})}{2017\cdot 2^{2017}}=\frac{\cos(2017 x)(\sin x)^{2017}}{2017}$$ Coincides with your other answer.