Integral from MIT Integration Bee 2023 Quarterfinals - $\lim_{n\to\infty} \frac{1}{n} \int_{0}^{n} \cos^2(\pi x^2/\sqrt{2}) \, \mathrm{d}x$ This question is from the MIT Integration Bee 2023 Quarterfinal #2. I'm doing these integrals to improve my quick math skills, and was wondering if there's a way to solve this within two minutes.
The goal is to show that $$\lim_{n\to\infty} \frac{1}{n} \int_{0}^{n} \cos^2\left(\frac{\pi x^2}{\sqrt{2}}\right) \,\textrm{d}x = \frac{1}{2} $$
I've tried L'Hospital's Rule then FTC1 but I don't think the first part would even apply here. I'm not sure how to approach such a problem, especially if it's to be solved within two minutes.
 A: Let $x=nt$ and then
\begin{eqnarray}
&&\frac{1}{n} \int_{0}^{n} \cos^2\left(\frac{\pi x^2}{\sqrt{2}}\right) \,\textrm{d}x \\
&=&\frac12 + \frac12\int_0^1\cos\left(\sqrt2\pi n^2t^2\right) \textrm{d}t\\
&=&\frac12 + \frac12\int_0^1\frac{1}{2\sqrt2\pi n^2t}\textrm{d}\sin\left(\sqrt2\pi n^2t^2\right)\\
&=&\frac12 + \frac{1}{4\sqrt2\pi n^2t}\sin\left(\sqrt2\pi n^2t^2\right)\bigg|_0^1+\frac{1}{4\sqrt2\pi n^2}\int_0^1\frac{\sin\left(\sqrt2\pi n^2t^2\right)}{t^2}\textrm{d}x.
\end{eqnarray}
Note
$$ \frac{1}{4\sqrt2\pi n^2t}\sin\left(\sqrt2\pi n^2t^2\right)\bigg|_0^1=\frac{1}{4\sqrt2\pi n^2}\sin\left(\sqrt2\pi n^2\right). $$
Since
$$\frac{1}{4\sqrt2\pi n^2}\bigg|\frac{\sin\left(\sqrt2\pi n^2t^2\right)}{t^2}\bigg|\le\frac14,$$
one has, by DCT,
$$ \lim_{n\to\infty}\frac{1}{4\sqrt2\pi n^2}\int_0^1\frac{\sin\left(\sqrt2\pi n^2t^2\right)}{t^2}\textrm{d}x=\int_0^1\lim_{n\to\infty}\frac{1}{4\sqrt2\pi n^2}\frac{\sin\left(\sqrt2\pi n^2t^2\right)}{t^2}\textrm{d}x=0.$$
So
$$\lim_{n\to\infty} \frac{1}{n} \int_{0}^{n} \cos^2\left(\frac{\pi x^2}{\sqrt{2}}\right) \,\textrm{d}x = \frac{1}{2}. $$
A: Let's denote
$$I(n)=\int_0^{n} \cos^2 \left( \frac{\pi x^2}{\sqrt 2}\right) dx$$
then
$$I(n)=\frac{1}{2}\int_0^{n} \Big(1+\cos \left( \pi \sqrt2 x^2\right)\Big) dx=\frac{n}{2}+\frac{1}{4}\frac{1}{\sqrt{\pi\sqrt2}}\int_0^{n^2\pi\sqrt2}\frac{\cos x}{\sqrt x}dx$$
integrating by part
$$=\frac{n}{2}+\frac{1}{4}\frac{1}{\sqrt{\pi\sqrt2}}\int_0^\infty\frac{\cos x}{\sqrt x}dx-\frac{1}{4}\frac{1}{\sqrt{\pi\sqrt2}}\int_{n^2\pi\sqrt 2}^\infty\frac{\cos x}{\sqrt x}dx$$
$$=\frac{n}{2}+\frac{1}{4}\frac{1}{\sqrt{\pi\sqrt2}}\int_0^\infty\frac{\cos x}{\sqrt x}dx+\frac{\sin(n^2\pi\sqrt 2)}{4n\pi\sqrt2}-\frac{1}{8}\frac{1}{\sqrt{\pi\sqrt2}}\int_{n^2\pi\sqrt 2}^\infty\frac{\sin x}{(\sqrt x)^3}dx$$
Using a closed contour in the complex plane (quarter-circle), we can show that
$$\,\int_0^\infty\frac{\cos x}{\sqrt x}dx=\Re\int_0^\infty\frac{e^{ix}}{\sqrt x}dx=\Re e^{\frac{\pi i}{4}}\int_0^\infty\frac{e^{-t}}{\sqrt t}dt=\sqrt\frac{\pi}{2}$$
then
$$I(n)=\frac{n}{2}\,+\,\frac{2^\frac{1}{4}}{8}\,+\,\frac{\sin(n^2\pi\sqrt 2)}{4n\pi\sqrt2}\,-\,\frac{1}{8}\frac{1}{\sqrt{\pi\sqrt2}}\int_{n^2\pi\sqrt 2}^\infty\frac{\sin x}{(\sqrt x)^3}dx=\frac{n}{2}\,+\,\frac{2^\frac{1}{4}}{8}\,+\,O\left(\frac{1}{n}\right)$$
$$\boxed{\,\,\frac{1}{n}I(n)=\frac{1}{2}\,+\,\frac{2^\frac{1}{4}}{8\,n}\,+\,O\left(\frac{1}{n^2}\right)\,\,}$$
The limit follows.
A: Transforming the integral by cosine half-angle formula yields
$$
\begin{aligned}
I(n) :& =\int_0^n \cos ^2\left(\frac{\pi x^2}{\sqrt{2}}\right) d x \\
& =\frac{1}{2} \int_0^n\left[1+\cos \left(\pi \sqrt{2} x^2\right)\right] d x \\
& =\frac{n}{2}+\frac{1}{2} \int_0^n \cos \left(\pi \sqrt{2} x^2\right) d x
\end{aligned}
$$Letting $\sqrt{\pi \sqrt{2}} x \rightarrow x$, then
$$
\begin{aligned}
I(n)&=\frac{n}{2} +\frac{1}{2 \sqrt{\pi \sqrt{2}}} \int_0^{n \sqrt{\pi \sqrt{2}}} \cos \left(x^2\right) d x  \\
\lim _{n \rightarrow \infty}\left[\frac{1}{n} I(n)\right] & =\frac{1}{2}+\frac{1}{2 \sqrt{\pi \sqrt{2}}}\left(\lim _{n \rightarrow \infty} \frac{1}{n}\right)\left(\lim _{n \rightarrow \infty} \int_0^{n \sqrt{\pi \sqrt{2}}} \cos \left(x^2\right) d x\right)\\
& =\frac{1}{2}+\frac{1}{2 \sqrt{\pi \sqrt{2}}} \cdot 0 \cdot \sqrt{\frac{\pi}{8}}\quad  (*) \\
& =\frac{1}{2}
\end{aligned}
$$
where (*) comes from the post.
