<s>[INST] 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.
 [/INST] 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.
</s>