Evaluate a limit involving definite integral Evaluate the following limit:
$$\lim_{n \to \infty} \left[n - n^2 \int_{0}^{\pi/4}(\cos x - \sin x)^n dx\right]$$
I've tried to rewrite the expression as follows:
$$\lim_{n \to \infty} \left[n - n^2 \sqrt{2}^n \int_{0}^{\pi/4}\sin^n \left( \frac{\pi}{4} - x \right) dx\right]$$
However, this doesn't seem to help too much. Thank you!
 A: Writing
$$ (\cos x - \sin x)^n = \color{blue}{\frac{\cos x - \sin x}{\cos x + \sin x}} \cdot \color{red}{ (\cos x + \sin x)(\cos x - \sin x)^{n-1}} $$
and applying integrating by parts, we have
$$ \int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx
= \frac{1}{n} - \frac{2}{n} \int_{0}^{\frac{\pi}{4}}  \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx. $$
Plugging this back,
$$ n - n^2 \int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx = 2n \int_{0}^{\frac{\pi}{4}}  \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx. $$
Now from the observation
$$ n \int_{0}^{\frac{\pi}{4}} (\sin x + \cos x)(\cos x - \sin x)^n \, dx
= \frac{n}{n+1}, $$
we can apply the usual approximation-to-the-identity argument to obtain
\begin{align*}
\lim_{n\to\infty} \left[ n - n^2 \int_{0}^{\frac{\pi}{4}} (\cos x - \sin x)^n \, dx \right]
&= \lim_{n\to\infty} 2n \int_{0}^{\frac{\pi}{4}}  \frac{(\cos x - \sin x)^n}{(\sin x + \cos x)^2} \, dx \\
&= \lim_{x \to 0^+} \frac{2}{(\sin x + \cos x)^3} \\
&= \color{red}{\boxed{2}}.
\end{align*}
A: We may go through Laplace's method. $\cos(x)-\sin(x)$ is positive and concentrated in a right neighbourhood of the origin; by expanding $\log(\cos(x)-\sin(x))$ as a Taylor series we get $\cos(x)-\sin(x)= e^{-x-x^2+O(x^3)}$. In particular the first two terms of the asymptotic expansion of
$$ I(n) = \int_{0}^{\pi/4}\left(\cos(x)-\sin(x)\right)^n\,dx $$
are the same as
$$ J(n) = \int_{0}^{+\infty}\exp\left(-nx-nx^2\right)\,dx = \frac{1}{n}-\frac{2}{n^2}+O\left(\frac{1}{n^3}\right)$$
and the wanted limit is $\color{red}{\large 2}$. In terms of hypergeometric functions we are stating that
$$ \lim_{n\to +\infty}\left[n-\frac{n^2}{n+1}\;\phantom{}_2 F_1\left(\frac{1}{2},1;\frac{n+3}{2};-1\right)\right]=2.$$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,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}$
Note that
\begin{align}
&\lim_{n \to \infty}\braces{n - n^{2}\int_{0}^{\pi/4}\bracks{\cos\pars{x} - \sin\pars{x}}^{\,n}\,\dd x}
\\[5mm] = &\
\lim_{n \to \infty}\bracks{n - 2^{n/2}\,n^{2}
\int_{0}^{\pi/4}\cos^{n}\pars{x + {\pi \over 4}}\,\dd x}\label{1}\tag{1}
\end{align}

When $\ds{n \to \infty}$, the main contribution to the integral comes from values of $\ds{x \gtrsim 0}$ such that it's is a 'candidate' to be evaluated by means of the Laplace Method. Namely,

\begin{align}
\int_{0}^{\pi/4}\cos^{n}\pars{x + {\pi \over 4}}\,\dd x & =
\int_{0}^{\pi/4}\exp\pars{n\ln\pars{\cos\pars{x + {\pi \over 4}}}}\,\dd x
\\[5mm] & \sim
\int_{0}^{\infty}\exp\pars{n\bracks{-\,{\ln\pars{2} \over 2} - x}}
\pars{1 - nx^{2}}\,\dd x
\\[5mm] & = 
2^{-n/2}\,\pars{{1 \over n} - {2 \over n^{2}}}\quad
\mbox{as}\ n \to \infty\label{2}\tag{2}
\end{align}


With \eqref{1} and \eqref{2}:

\begin{align}
&\lim_{n \to \infty}\braces{n - n^{2}\int_{0}^{\pi/4}\bracks{\cos\pars{x} - \sin\pars{x}}^{\,n}\,\dd x} =
\lim_{n \to \infty}\braces{n - 2^{n/2}\,n^{2}
\bracks{2^{-n/2}\,\pars{{1 \over n} - {2 \over n^{2}}}}}
\\[5mm] = &\
\bbx{\ds{2}}
\end{align}
