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.
 A: 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. 
A: 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: 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}}$.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\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}
