<s>[INST] How to calculate $\int_0^\pi x\,\cos^4x\, dx$ Assume that $$\int_{0}^\pi x\,f(\sin(x))dx=\frac{\pi}2 \int_{0}^\pi f(\sin(x))dx$$
and use it to calculate $$\int_{0}^\pi x\,\cos^{4}(x)\, dx$$
Can anyone help me with that? I proved the identity but I am stuck with the rest.
 [/INST] With different approach. First note:
\begin{align}
I=\int_0^\pi \cos^4(x) dx = 2 \int_0^{\pi/2} \cos^4(x)dx
\end{align}
Substitute $z=\tan(x)$ so that $\cos^4(x)= \frac{1}{(1+z^2)^2}$ and $dx=\frac{dz}{1+z^2}$. So we get:
\begin{align}
I=2\int^\infty_0 \frac{1}{(1+z^2)^3}dz = \int_{-\infty}^\infty \frac{1}{(1+z^2)^3} dz
\end{align}
Use a semi circle contour in the upperhalf plane and by the Residue Theorem we get:
\begin{align}
I= 2\pi i\text{Res}_{z=i} \frac{1}{(1+z^2)^3} = 2\pi i \cdot \left( -i\frac{3}{16} \right) = \frac{3\pi}{8}
\end{align}
Finally use the formula you stated and get:
\begin{align}
\int^\pi_0 x\cos^4(x)dx = \frac{\pi}{2} I =\frac{3\pi^2}{16}
\end{align}
</s>