I came across this problem from my high school calculus textbook, the textbook said to evaluate the following integral using integration by parts
$$\int_{0}^{\frac{\pi}{2}}\cos^{n}(x)dx$$
But instead of doing what the book suggested, I tried to find a workaround and rewrite the $\cos x$ in terms of $$\frac{e^{-ix}+e^{ix}}{2}$$ and now I’m stuck to have any working progress after trying to evaluate it, here is my approach
$$\int_{0}^{\frac{\pi}{2}}\left(\frac{e^{-ix}+e^{ix}}{2}\right)^{n}dx=\frac{1}{2^{n}}\int_{0}^{\frac{\pi}{2}}(e^{-ix}+e^{ix})^{n}dx$$
Now, $$u=ix\rightarrow du=idx$$ then:
$$\frac{-i}{2^{n}}\int_{0}^{\frac{i\pi}{2}}\left(e^{-u}+e^{u}\right)^{n}du$$ expanding the RHS we get
$$\frac{-i}{2^{n}}\int_{0}^{\frac{i\pi}{2}}\sum_{k=0}^{\infty}\frac{n^{k}}{k!}\ln^{k}(e^{-u}+e^{u})du$$ interchange the sum:
$$\sum_{k=0}^{\infty}\frac{n^{k}}{k!}\left(\frac{-i}{2^{n}}\int_{0}^{\frac{i\pi}{2}}\ln^{k}(e^{-u}+e^{u})du\right)$$
and since
$$\sum_{k=0}^{\infty}\frac{n^{k}}{k!}=e^{n}$$
$$\rightarrow e^{n}\left[\frac{-i}{2^{n}}\int_{0}^{\frac{i\pi}{2}}\ln^{k}(e^{-u}+e^{u})du)\right]$$ where $$e^{-u}+e^{u}=2\cosh u$$ and thus $$\frac{-i}{2^{n}}\int_{0}^{\frac{i\pi}{2}}\ln^{k}(2\cosh u)du$$ the problem here is how can I evaluate this integral? The $$\ln^{k}(2\cosh u)$$ prompt to be the biggest problem I can’t find any elementary approach for evaluating this integral, any suggestions?
It's not an answer to you question, but for $\int_{0}^{\frac{\pi}{2}}\cos^{n}(x)dx$ you can get a formula expanding the power: $$\begin{align} \int_{0}^{\frac{\pi}{2}}\cos^{n}(x)dx=&\int_{0}^{\frac{\pi}{2}}(\frac{e^{-ix}+e^{ix}}{2})^{n}dx\\ =&\frac{1}{2^{n}}\int_{0}^{\frac{\pi}{2}}\sum_{k=0}^n\binom nke^{-ixk}e^{ix(n-k)}dx\\=&\frac{1}{2^{n}}\sum_{k=0}^n\binom nk\frac{1}{i(n-2k)}(e^{i\frac{\pi}{2}(n-2k)}-1)\end{align}$$