Closed form for $\int_{0}^{\pi/2}x\cos^n x \ dx$, $n\in\mathbb{N}$ Closed form for the definite integral $$I(n)=\int_{0}^{\pi/2}x\cos^n x \ dx$$ where $n\in\mathbb{N}$.
I tried using $\int_{0}^a f(x)\ dx= \int_{0}^a f(a-x)\ dx$ to get $$I(n)= \int_{0}^{\pi/2}\left(\frac{\pi}{2}-x\right)\sin^n x \ dx$$
So we have $$I(n)=\frac{\pi}{2^2}\frac{\Gamma(\frac{n+1}{2})\Gamma(1/2)}{\Gamma(\frac{n+2}{2})} -\int_{0}^{\pi/2}x\sin^n x \ dx$$

Utilize the expansions
\begin{align}
&\cos^{2m}x= \frac1{2^{2m}}\binom {2m}{m}+\frac1{2^{2m-1}}\sum_{k=1}^{m} \binom {2m}{m-k} \cos2kx\\
&\cos^{2m+1}x= \frac1{2^{2m}}\sum_{k=0}^{m} \binom {2m+1}{m-k} \cos(2k+1)x\\
\end{align}
and the results
\begin{align}
&\int_0^{\pi/2}x\cos2mx\ dx= \frac{(-1)^m-1}{(2m)^2}\\
&\int_0^{\pi/2}x\cos(2m+1)x\ dx= \frac{\frac\pi2(2m+1)(-1)^m-1}{(2m+1)^2}
\end{align}
to obtain
\begin{align}
&\int_0^{\pi/2}x\cos^{2m}xdx
= \frac{\pi^2}{2^{2m+3}}\binom {2m}{m}+\frac1{2^{2m-1}}\sum_{k=1}^m \binom {2m}{m-k} \frac{(-1)^{k}-1}{(2k)^2}\\
&\int_0^{\pi/2}x\cos^{2m+1}x\ dx
=\frac1{2^{2m}}\sum_{k=0}^{m} \binom {2m+1}{m-k} \frac{\frac\pi2(2k+1)(-1)^k-1}{(2k+1)^2}\\
\end{align}
