Computing $\lim\limits_{n\to+\infty}n\int_{0}^{\pi/2}xf(x)\cos ^n xdx$

I got stuck at the following problem.

Let $f\in C([0,\pi/2])$, then compute
$$
\lim_{n\to+\infty}n\int\limits_{0}^{\pi/2}xf(x)\cos ^n xdx
$$

Could you suggest a helpful idea?

Solutions Collecting From Web of "Computing $\lim\limits_{n\to+\infty}n\int_{0}^{\pi/2}xf(x)\cos ^n xdx$"

Note that $|x-\sin x|\ll x$ when $x\to0$. Hence, as soon as the function $f:[0,\pi/2]\to\mathbb R$ is

  1. measurable bounded,  2.  continuous at $0$,

(no other property being necessary for the proof below to hold),
there exists a function $g:[0,\pi/2]\to\mathbb R$ such that

  1. $g$ is measurable bounded,  2.  $g(x)\to0$ when $x\to0$,

and such that, for every $x$ in $[0,\pi/2]$,
$$
xf(x)=f(0)\sin x+g(x)\sin x.
$$
Thus, the $n$th integral one is interested in is
$$
I_n=\dfrac{n}{n+1}(f(0)\,J_n+K_n),
$$
with
$$
J_n=(n+1)\int_0^{\pi/2}\sin x\,(\cos x)^n\,\mathrm dx=\left[-(\cos x)^{n+1}\right]_0^{\pi/2}=1,
$$
and
$$
K_n=(n+1)\int_0^{\pi/2}g(x)\sin x\,(\cos x)^n\,\mathrm dx.
$$
By (1.), there exists $C$ such that $|g(x)|\leqslant C$ for every $x$. By (2.), for every $\varepsilon\gt0$, there exists $x_\varepsilon\gt0$ such that $|g(x)|\leqslant\varepsilon$ for every $x\leqslant x_\varepsilon$. Hence,
$$
|K_n|\leqslant\varepsilon J_n+(n+1)C\int_{x_\varepsilon}^{\pi/2}\sin x(\cos x)^n\,\mathrm dx=\varepsilon+C\,(\cos x_\varepsilon)^{n+1}.
$$
When $n\to\infty$, $(\cos x_\varepsilon)^{n+1}\to0$ because $x_\varepsilon\gt0$, hence $\limsup\limits_{n\to\infty}|K_n|\leqslant\varepsilon$. This holds for every $\varepsilon\gt0$ hence $\lim\limits_{n\to\infty}K_n=0$. Finally,
$$
\lim\limits_{n\to\infty}I_n=f(0).
$$

Here is a statistical solution. Let $X_1,\dots, X_n$ be i.i.d. random variables
on $[0,\pi/2]$ with density $f_X(x)=\sin(x)$. The distribution function of $X$ is $F(x)=1-\cos(x)$.
Now let $M=\min(X_1,\dots, X_n)$; its density function is
$$f_M(x)=n(1-F(x))^{n-1}f_X(x)=n\,\cos^{n-1}(x)\sin(x).$$ Also, it is not hard to see
that $M\to 0$ in distribution as $n\to\infty$.
Now $$\int_0^{\pi/2} n \cos(x)^n xf(x)\,dx =\int_0^{\pi/2} f_M(x) \,\cos(x)\,{x\over \sin(x)}f(x)\,dx
=\mathbb{E}\left(\cos(M)\,{M\over \sin(M)}\,f(M)\right).$$ Since $f$ is continuous, this converges to
$\cos(0)\cdot1\cdot f(0)=f(0)$ as $n\to\infty$.

This answer was completed using Robert’s ideas in the comments.

By the Weierstraß approximation theorem, we can approximate $f$ arbitrarily well (in the supremum norm) by a polynomial. For a polynomial $p$, we have

$$
\begin{align}
n\int_0^{\pi/2}xp(x)\cos ^n x\,\mathrm dx
&=
\int_0^{\pi/2}\frac{x\cos x}{\sin x}p(x)n\sin x\cos ^{n-1} x\,\mathrm dx
\\
&=
\left[-\frac{x\cos x}{\sin x}p(x)\cos^n x\right]_0^{\pi/2}+\int_0^{\pi/2}\left(\frac{x\cos x}{\sin x}p(x)\right)’\cos^n x\,\mathrm dx\;.
\end{align}
$$

The boundary term evaluates to $p(0)$ for all $n$, and the integral goes to $0$, so the limit is $p(0)$. Now

$$
\begin{align}
\left|n\int_0^{\pi/2}xf(x)\cos ^n x\,\mathrm dx-n\int_0^{\pi/2}xp(x)\cos ^n x\,\mathrm dx\right|
&=
n\int_0^{\pi/2}x|f(x)-p(x)|\cos ^n x\,\mathrm dx
\\
&\le
\epsilon n\int_0^{\pi/2}x\cos ^n x\,\mathrm dx\;,
\end{align}
$$

which is just $\epsilon$ times the desired integral for $f\equiv1$ and thus by the above goes to $\epsilon$ for $n\to\infty$. Since both the function values at $0$ and the limits of the integrals differ at most by $\epsilon$, which can be made arbitrarily small, the desired limit is $f(0)$.

Call $I_n =n \int_0^{\frac{\pi}{2}} xf(x)\cos^n xdx$. You can rewrite it $I_n = \int_0^{\frac{\pi}{2}} \frac{xf(x)}{\sin x}n \sin x \cos^n xdx$, and now if we make the change of variable $u = \cos^{n+1}x$, we have $du = -(n+1)\sin x \cos^n x dx$, and $x = \arccos(u^{1/n})$. So now we can rewrite $I_n$:

$$
I_n = \int_0^1 \frac{\arccos(u^{1/n}) }{\sin(\arccos(u^{1/n}))} f(\arccos(u^{1/n}))\frac{n}{n+1} du
$$

We have the quantity $\frac{\arccos(u^{1/n}) }{\sin(\arccos(u^{1/n}))} f(\arccos(u^{1/n}))\frac{n}{n+1}$ that goes towards $f(0)$ when $n$ goes towards $+\infty$, so by virtue of the dominated convergence, $I_n \rightarrow \int_0^1 f(0) du = f(0)$

We have

$$
\int_{0}^{\pi/2}xf(x)\cos^n x \,dx = \int_0^{\pi/2} x f(x) \exp\Bigl(n\log \cos x\Bigr)\,dx.
$$

The quantity $\log \cos x$ has a maximum at $x = 0$ and

$$
\log \cos x = -\frac{x^2}{2} + O(x^4)
$$

as $x \to 0$, so it can be shown by the Laplace method that

$$
\int_{0}^{\pi/2}xf(x)\cos^n x \,dx \sim \int_0^\infty x f(0) e^{-nx^2/2}\,dx = \frac{f(0)}{n}
$$

as $n \to \infty$.