# Evaluate $\lim_{r\to\infty}\frac{\int_0^{\pi/2}x^{r-1}\cos x\,\mathrm dx}{\int_0^{\pi/2}x^r\cos x\,\mathrm dx}$

How I can evaluate

$$\lim_{r\to\infty}\frac{\int_0^{\pi/2}x^{r-1}\cos x\,\mathrm dx}{\int_0^{\pi/2}x^r\cos x\,\mathrm dx}$$

I have tried by replacing $x$ with $y\pi/2$ then the limits would change from zero to $1$ but the integrals would cancel as both are nearly zero leaving the answer $2/\pi$.

But the difficulty I am having is that why cant $x$ be replaced with $y\pi/4$ which would result in a different answer according to me.

• Welcome to MSE! Try using mathjax to make your question more presentable. – Mohammad Zuhair Khan Dec 29 '17 at 16:41
• consider $r\in\Bbb N$ and integrate it, that is, if the limit exists then it must exists the limit defined for $r\in\Bbb N$. After show that indeed the limit exists for real $r$. – Masacroso Dec 29 '17 at 16:49
• To me it is not obvious that both integral will be approximately the same after the susbtitution $x=y\pi/2$... – Shashi Dec 29 '17 at 17:30
• @tired ohhh I had the same idea, see my answer!! – Shashi Dec 29 '17 at 18:15
• I've posted an answer, but I have no idea how you used $x\to y\pi/4$ to get another answer, nor even what that other answer was. If you showed how you got a different answer, perhaps it would be easier to explain what went wrong. – robjohn Dec 29 '17 at 20:36

You have said that after substitution $x=y\pi/2$ the answer was obvious, but in my opninion it is not obvious. I will show why it is not obvious in general. In mathematics one must make claims as "two terms are both near zero" rigorous. After the substitution you have got something like: \begin{align} \frac{\int^{\pi/2}_0 x^{r-1}\cos(x)\,dx}{\int^{\pi/2}_0 x^{r}\cos(x)\,dx}=\frac{2}{\pi}\frac{\int^{1}_0 y^{r-1}\cos(y\pi/2)\,dy}{\int^{1}_0 y^{r}\cos(y\pi/2)\,dy}\to\frac{2}{\pi} \ \ \text{ when } r\to \infty \end{align} You said indirectly that because both integrals are near zero they would cancel meaning that the fraction with the two integrals go to $1$. What about the following one then? \begin{align} \frac{\int^{1}_0 y^{r^2-1}\,dy}{\int^{1}_0 y^r\,dy} \end{align} When $r\to \infty$ that expression goes to zero. No "cancellation" in this case, so one must be careful with those kind of things.

Now let's prove the claim rigorously. I use asympototic expansions, in particular Watson's Lemma. Set $x=e^{-u}$ (to get in the form of the standard Watson's Lemma). \begin{align} \int^{\pi/2}_0 x^r\cos(x)\,dx&=\int^{-\ln(\pi/2)}_{\infty} e^{-ru} \cos(e^{-u})(-e^{-u})\,du \\ &=\int^\infty_{-\ln(\pi/2)}e^{-(r+1)u}\cos(e^{-u})\,du\\ &=\int^\infty_0 e^{-(r+1)(u-\ln(\pi/2))}\cos(e^{-u+\ln(\pi/2)})\,du\\ &=\left(\frac{\pi}{2}\right)^{r+1}\int^\infty_0 e^{-(r+1)u}\cos\left(\frac{\pi}{2}e^{-u}\right)\,du \end{align} Note that when $u\to 0$ we have $\cos\left(\frac{\pi}{2}e^{-u}\right)\sim \frac{\pi}{2}u +O(u^2)$. By invoking Watson's Lemma we get: \begin{align} \int^\infty_0 e^{-(r+1)u}\cos\left(\frac{\pi}{2}e^{-u}\right)\,du \sim \frac{\pi}{2(r+1)^2} \end{align} as $r\to\infty$. Hence finally: \begin{align} \int^{\pi/2}_0 x^r\cos(x)\,dx \sim \left(\frac{\pi}{2}\right)^{r+1}\frac{\pi}{2(r+1)^2} \end{align} as $r\to\infty$. Similarly we get: \begin{align} \int^{\pi/2}_0 x^{r-1}\cos(x)\,dx \sim \left(\frac{\pi}{2}\right)^{r}\frac{\pi}{2r^2} \end{align} Finally we get: \begin{align} \lim_{r\to\infty}\frac{\int^{\pi/2}_0 x^{r-1}\cos(x)\,dx}{\int^{\pi/2}_0 x^{r}\cos(x)\,dx}&=\lim_{r\to\infty}\frac{\left(\frac{\pi}{2}\right)^{r}\frac{\pi}{2r^2}}{\left(\frac{\pi}{2}\right)^{r+1}\frac{\pi}{2(r+1)^2}}\\ &=\frac{2}{\pi} \end{align} And that is exactly what was claimed.

• nice (+1). you can also appy Watson without the transform $x=e^{-u}$ – tired Dec 29 '17 at 18:16
• Yes? I did not know that. I have just taught the standard form of Watson's Lemma. Maybe you can put that as an answer too? To let people see that it can be made faster? I would appreciate to see how that works. – Shashi Dec 29 '17 at 18:18
• it is not difficult, just approximate the integrand in a consistent fashion around $x=\pi/2$ ;-). Anyway, i think your method is definitly cleaner.. – tired Dec 29 '17 at 18:20
• As in "manually" creating an asymptotic expansion? I think I got it, if that is what you mean – Shashi Dec 29 '17 at 18:23
• (+1) Nice proof. A think the highlighted constant in $$\int_{0}^{\pi/2}x^r\cos(x)\,dx \sim \left(\frac{\pi}{2}\right)^{r+1}\frac{1}{(r+\color{red}{1})^2}$$ can be further improved through elementary manipulations. This exercise is very close to finding the first terms of the asymptotic expansion of $\log\Gamma$ through Wallis product/approximations for the central binomial coefficients, indeed. – Jack D'Aurizio Dec 29 '17 at 21:48

Even though $\cos(x)\sim\frac\pi2-x$ near $x=\frac\pi2$, $\left(\frac{2x}\pi\right)^r,\left(\frac{2x}\pi\right)^{r-1}\to0$ for all $x\lt\frac\pi2$. So the main action goes on near $x=\frac\pi2$. Therefore, things are easier to work with (in my opinion) if we substitute $x\mapsto\frac\pi2-x$. \begin{align} \frac{\int_0^{\pi/2}x^{r-1}\cos(x)\,\mathrm{d}x}{\int_0^{\pi/2}x^r\cos(x)\,\mathrm{d}x} &=\frac{\int_0^{\pi/2}\left(\frac\pi2-x\right)^{r-1}\sin(x)\,\mathrm{d}x}{\int_0^{\pi/2}\left(\frac\pi2-x\right)^r\sin(x)\,\mathrm{d}x}\tag1\\ &=\frac2\pi\frac{\int_0^1\left(1-x\right)^{r-1}\sin\left(\frac{\pi x}2\right)\,\mathrm{d}x}{\int_0^1\left(1-x\right)^r\sin\left(\frac{\pi x}2\right)\,\mathrm{d}x}\tag2\\ &=\frac2\pi\frac{\int_0^1\left(1-x\right)^{r-1}\left(\frac{\pi x}2+O\!\left(x^3\right)\right)\,\mathrm{d}x}{\int_0^1\left(1-x\right)^r\left(\frac{\pi x}2+O\!\left(x^3\right)\right)\,\mathrm{d}x}\tag3\\ &=\frac2\pi\frac{\frac\pi2\frac{\Gamma(r)\,\Gamma(2)}{\Gamma(r+2)}+O\!\left(\frac{\Gamma(r)\,\Gamma(4)}{\Gamma(r+4)}\right)}{\frac\pi2\frac{\Gamma(r+1)\,\Gamma(2)}{\Gamma(r+3)}+O\!\left(\frac{\Gamma(r+1)\,\Gamma(4)}{\Gamma(r+5)}\right)}\tag4\\ &=\frac2\pi\frac{\frac\pi2\frac1{r(r+1)}+O\!\left(\frac1{r^4}\right)}{\frac\pi2\frac1{(r+1)(r+2)}+O\!\left(\frac1{r^4}\right)}\tag5\\[6pt] &=\frac2\pi\frac{(r+1)(r+2)}{r(r+1)}+O\!\left(\frac1{r^2}\right)\tag6 \end{align} Explanation:
$(1)$: substitute $x\mapsto\frac\pi2-x$
$(2)$: substitute $x\mapsto\frac{\pi x}2$
$(3)$: $\sin(x)=x+O\!\left(x^3\right)$
$(4)$: $\int_0^1(1-x)^{\alpha-1}x^{\beta-1}\,\mathrm{d}x=\frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}$ (see Beta Function)
$(5)$: $\Gamma(x+1)=x\Gamma(x)$
$(6)$: multiply numerator and denominator by $(r+1)(r+2)$

Thus, taking the limit of $(6)$, we get $$\lim_{r\to\infty}\frac{\int_0^{\pi/2}x^{r-1}\cos(x)\,\mathrm{d}x}{\int_0^{\pi/2}x^r\cos(x)\,\mathrm{d}x}=\frac2\pi\tag7$$

A solution inspired by Stieltjes theory on moments and continued fractions.

$$M(r)=\int_{0}^{\pi/2}x^r \cos(x)\,dx$$ is a continuous function over $\mathbb{R}^+$ and a (log-)convex function, since $M(r)$ is clearly positive and it is midpoint-log-convex by the Cauchy-Schwarz inequality: $$M(r_1)\,M(r_2) \geq M\left(\frac{r_1+r_2}{2}\right)^2.$$

By integration by parts $$\begin{eqnarray*} M(r+2) &=& \left[x^{r+2}\sin x\right]_0^{\pi/2}-(r+2)\int_{0}^{\pi/2}x^{r+1}\sin x\,dx\\&=&\left(\tfrac{\pi}{2}\right)^{r+2}-(r+1)(r+2)\,M(r)\end{eqnarray*}$$ hence by setting $M(r)=\left(\frac{\pi}{2}\right)^{r+2}\frac{1}{E(r)}$ we get $$E(r+2)=\frac{1}{\frac{4}{\pi^2}-\frac{4(r+1)(r+2)}{\pi^2 E(r)}}$$ and by setting $E(r)=\frac{(r+1)(r+2)}{F(r)}$ we get: $$F(r+2)=\frac{4}{\pi^2}(r+3)(r+4)\left[1-F(r)\right]$$ a recursion that can be solved through hypergeometric functions. In particular we have $\lim_{r\to +\infty}F(r)=1$, ensuring that the wanted limit equals $\color{red}{\frac{2}{\pi}}$.

• (+1) I think it would be interesting and instructive to see how the last equation is solved through hypergeometric functions. – robjohn Dec 30 '17 at 1:11


$\ds{\lim_{r\to\infty}{\int_{0}^{\pi/2}x^{r - 1}\cos\pars{x}\,\dd x \over \int_{0}^{\pi/2}x^{r}\cos\pars{x}\,\dd x} = {2 \over \pi}:\ {\large ?}}$.

With Laplace's Method $\ds{\pars{~\mbox{note that the integrand is 'highly concentrated' around}\ x = \pi/2~}}$: \begin{align} \lim_{r\to\infty}{\int_{0}^{\pi/2}x^{r - 1}\cos\pars{x}\,\dd x \over \int_{0}^{\pi/2}x^{r}\cos\pars{x}\,\dd x} & = \lim_{r\to\infty}{\ds{\int_{0}^{\pi/2}\pars{\pi/2 - x}^{r - 1}\sin\pars{x}\,\dd x} \over \ds{\int_{0}^{\pi/2}\pars{\pi/2 - x}^{r}\sin\pars{x}\,\dd x}} \\[5mm] & = \lim_{r\to\infty}{\ds{\int_{0}^{\pi/2}\exp\pars{\bracks{r - 1}\ln\pars{\pi/2 - x} + \ln\pars{\sin\pars{x}}}\,\dd x} \over \ds{\int_{0}^{\pi/2}\exp\pars{r\ln\pars{\pi/2 - x} + \ln\pars{\sin\pars{x}}}\,\dd x}} \\[5mm] & = \lim_{r\to\infty}{\ds{\int_{0}^{\infty} \exp\pars{-2\bracks{r - 1}x/\pi}\pars{\pi/2}^{\,r - 1}\, x\,\dd x} \over \ds{\int_{0}^{\infty}\exp\pars{-2rx/\pi}\pars{\pi/2}^{\,r}\, x\,\dd x}} \\[5mm] & = \lim_{r\to\infty}{\ds{\pars{2/\pi}^{-1 - r}/\pars{r - 1}^{2}} \over \ds{\pars{2/\pi}^{-2 - r}/r^{2}}} = \bbx{2 \over \pi} \approx 0.6366 \end{align}