TITLE: Asymptotic evaluation of $\int_0^{\pi/4}\cos(x t^2)\tan^2(t)dt$
QUESTION [15 upvotes]: In Bender-Orszag's  Advanced Mathematical Methods for Scientists and Engineers on page 313 we encounter the following integral 

$$
I(x)=\int_0^{\pi/4}\cos(x t^2)\tan^2(t)dt
$$

and it is asked to derive the first two terms of the asymptotic expansion of $I(x)$ as $x\rightarrow +\infty$ . 
Setting $x=i y$ and analytically continuing at the end of the calcultion I was able to show that

$$
I(x)\sim 2\frac{\sin(\frac{x\pi^2}{16})}{\pi x}+\mathcal{O}(x^{-2})
$$

using standard Laplace method. Despite the fact that this seems to fit comparsion with numerical data, I am not satisfied by this approach for three reasons:

1) It is quiet cumbersome (at least for me) to derive higher order terms with my method. Is there a fast way to do so?
2) The question can be found in relation with "Method of steepest descent" so I suppose one should attack it by this method. How can it be applied? I somehow fail here
3) I am not totally satisfied by my analytic continuation argument. How can this made rigourous?

I am grateful to anyone who can shed light on any of my questions!

REPLY [4 votes]: I know that this may not be the direction that OP want, but we can revive @Olivier Oloa's idea to give an elementary solution. Taking integration by parts, we get
\begin{align*}
I_0(x)
:\!\!&= \int_{0}^{\frac{\pi}{4}} \cos(xt^2)\tan^2 t \, dt \\
&= \frac{2}{\pi}\frac{\sin\big(\frac{\pi^2}{16}x\big)}{x} + \frac{1}{2x} \underbrace{\int_{0}^{\frac{\pi}{4}} \sin(xt^2) \bigg( \frac{\tan^2 t}{t^2} - \frac{2\tan t\sec^2 t}{t} \bigg) \, dt}_{=:I_1(x)}.
\end{align*}
Now we want to apply a similar technique to $I_1(x)$ to extract higher order terms, but this technique need a modification in the following way: Write
\begin{align*}
I_1(x)
&= \int_{0}^{\frac{\pi}{4}} \sin(xt^2) \bigg( 1 + \frac{\tan^2 t}{t^2} - \frac{2\tan t\sec^2 t}{t} \bigg) \, dt - \int_{0}^{\frac{\pi}{4}} \sin(xt^2) \, dt.
\end{align*}
This modification takes care of the singularity that would otherwise have popped up under integration by parts. So the same technique applies to the first integral above and shows that it is of order $\mathcal{O}(x^{-1})$. So we get
$$ I_1(x) = - \int_{0}^{\frac{\pi}{4}} \sin(xt^2) \, dt + \mathcal{O}(x^{-1}). $$
On the other hand, using the substitution $u = xt^2$ and assuming $x > 0$, we have
\begin{align*}
\int_{0}^{\frac{\pi}{4}} \sin(xt^2) \, dt
&= \frac{1}{2\sqrt{x}} \int_{0}^{\frac{\pi^2}{16}x} \frac{\sin u}{\sqrt{u}} \, du \\
&= \frac{1}{2\sqrt{x}} \int_{0}^{\infty} \frac{\sin u}{\sqrt{u}} \, du - \frac{1}{2\sqrt{x}} \int_{\frac{\pi^2}{16}x}^{\infty} \frac{\sin u}{\sqrt{u}} \, du \\
&= \frac{1}{2\sqrt{x}} \sqrt{\frac{\pi}{2}} - \frac{1}{2\sqrt{x}} \bigg( \underbrace{\frac{4}{\pi}\frac{\cos \big(\frac{\pi^2}{16}x\big)}{\sqrt{x}} + \frac{1}{2} \int_{\frac{\pi^2}{16}x}^{\infty} \frac{\cos u}{u^{3/2}} \, du}_{=\mathcal{O}(x^{-1/2})} \bigg).
\end{align*}
Combining altogether, we get
$$ I_0(x) = \frac{2}{\pi}\frac{\sin\big(\frac{\pi^2}{16}x\big)}{x} - \frac{1}{4}\sqrt{\frac{\pi}{2}}x^{-3/2}+ \mathcal{O}(x^{-2}). $$