Computing a derivative from a function that involves an integral Let $f$ be a function such that
$$f(t)=\int_0^\infty \frac{\sin(x^2)e^{-tx^2}}{x^2}\,dx,\;t>0:$$
find $f'(t)$.
My attempt:
$$\begin{align}
f(t)&=\int_0^\infty\frac{\sin(x^2)e^{-tx^2}}{x^2}\,dx\\
\frac{df}{dt}&=\frac{d}{dt}\int_0^\infty\frac{\sin(x^2)e^{-tx^2}}{x^2}\,dx\\
&=\int_0^\infty\frac{d}{dt}\frac{\sin(x^2)e^{-tx^2}}{x^2}\,dx\\
&=\int_0^\infty\frac{\sin(x^2)}{x^2}\frac{d(e^{-tx^2})}{dt}\,dx\\
&=-\int_0^\infty\sin(x^2)\,e^{-tx^2}\,dx.
\end{align}$$
Then I used that $2i\sin(x)=e^{ix}-e^{-ix}$ and $\displaystyle\int_{-\infty}^{+\infty}e^{-ax^2}\,dx=\sqrt{\frac{\pi}{a}}$ to achieve
$$\begin{align}
\int_0^\infty\sin(x^2)\,e^{-tx^2}\,dx&=\int_0^\infty\frac{e^{ix^2}-e^{-ix^2}}{2i}\,e^{-tx^2}\,dx\\
&=\frac{1}{2i}\int_0^\infty\left[e^{(i-t)x^2}-e^{-(i+t)x^2}\right]\,dx\\
&=\frac{1}{2i}\left[\int_0^\infty e^{(i-t)x^2}\,dx-\int_{0}^{\infty}e^{-(i+t)x^2}\,dx\right]\\
&=\frac{\sqrt{\pi}}{4i}\left(\sqrt{\frac{1}{t-i}}-\sqrt{\frac{1}{t+i}}\right).
\end{align}$$
Is my answer correct? And how can I approach this problem?
 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}$
\begin{align}
\left.\rule{0pt}{4mm}\mrm{f}\pars{t}\,\right\vert_{\ t\ >\ 0} & \equiv
\int_{0}^{\infty}\sin\pars{x^{2}}\expo{-tx^{2}}\,\dd x
\,\,\,\stackrel{x^{2}\ \mapsto\ x}{=}\,\,\,
{1 \over 2}\int_{0}^{\infty}{\sin\pars{x}\expo{-tx} \over x^{1/2}}\,\dd x
\\ & =
{1 \over 2}\int_{0}^{\infty}x^{1/2}\expo{-tx}\
\overbrace{\pars{{1 \over 2}\int_{-1}^{1}\expo{-\ic kx}\dd k}}
^{\ds{\sin\pars{x} \over x}}\
\,\dd x =
{1 \over 4}\int_{-1}^{1}\int_{0}^{\infty}x^{1/2}\expo{-\pars{t + \ic k}x}
\,\dd x\,\dd k
\end{align}

Under the change $\ds{\pars{t + \ic k}x \mapsto x}$, the integral over
  $\ds{x}$ is performed along the 'ray' $\ds{t + \ic k}$ where $\ds{z^{1/2}}$ is its principal branch. A 'closed contour' is built by adding an integration along an arc and along $\ds{\mathbb{R}_{>0}}$. The integral , along the arc vanishes out as its radius $\ds{\to \infty}$ such that  

\begin{align}
\left.\rule{0pt}{4mm}\mrm{f}\pars{t}\,\right\vert_{\ t\ >\ 0} & =
{1 \over 4}\int_{-1}^{1}\pars{t + \ic k}^{-3/2}\
\underbrace{\int_{0}^{\infty}x^{1/2}\expo{-x}\,\dd x}
_{\ds{\Gamma\pars{3 \over 2} = {\root{\pi} \over 2}}}\
\,\dd k =
{\root{\pi} \over 4}
\Re\bracks{\pars{-\,{2 \over \ic}}\pars{t + \ic k}^{-1/2}}_{0}^{1}
\\[2mm] & =
-\,{\root{\pi} \over 2}\Im\pars{t + \ic}^{-1/2} =
-\,{\root{\pi} \over 2}\Im\bracks{\root{t^{2} + 1}\exp\pars{\ic\arctan\pars{1 \over t}}}^{-1/2}
\\[5mm] & =
{\root{\pi} \over 2}\pars{t^{2} + 1}^{-1/4}
\,\sin\pars{\arctan\pars{1/t} \over 2}
\\[5mm] & =
{\root{\pi} \over 2}\pars{t^{2} + 1}^{-1/4}
\root{1 - \cos\pars{\arctan\pars{1/t}} \over 2}
\\[5mm] & =
{\root{2\pi} \over 4}\pars{t^{2} + 1}^{-1/4}
\root{\sec\pars{\arctan\pars{1/t}} - 1 \over \sec\pars{\arctan\pars{1/t}}}
\\[5mm] & =
{\root{2\pi} \over 4}\pars{t^{2} + 1}^{-1/4}
\root{\root{1/t^{2} + 1} - 1 \over \root{1/t^{2} + 1}}
\\[2mm] & =
{\root{2\pi} \over 4}{1 \over \root{\root{t^{2} + 1}}}
\root{\root{t^{2} + 1} - t \over \root{t^{2} + 1}} =
\bbx{{\root{2\pi} \over 4}\,
{\root{\root{t^{2} + 1} - t} \over \root{t^{2} + 1}}}
\end{align}
A: Since
$$
(t\pm i)^{1/2}=\sqrt{\frac{t+\sqrt{t^2+1}}2}\pm i\sqrt{\frac{-t+\sqrt{t^2+1}}2}\tag1
$$
we can simplify the integral using contour integration as
$$\newcommand{\Im}{\operatorname{Im}}
\begin{align}
\int_0^\infty\sin\left(x^2\right)\,e^{-tx^2}\,\mathrm{d}x
&=\Im\left((t-i)^{-1/2}\int_0^\infty e^{-(t-i)x^2}\,\mathrm{d}(t-i)^{1/2}x\right)\tag2\\
&=\Im\left((t-i)^{-1/2}\int_0^{(t-i)^{1/2}\infty} e^{-x^2}\,\mathrm{d}x\right)\tag3\\
&=\Im\left((t-i)^{-1/2}\int_\gamma e^{-z^2}\,\mathrm{d}z\right)\tag4\\
&=\Im\left((t-i)^{-1/2}\int_0^\infty e^{-z^2}\,\mathrm{d}z\right)\tag5\\
&=\frac{\sqrt{-t+\sqrt{t^2+1}}}{\sqrt{t^2+1}}\frac{\sqrt\pi}{2\sqrt2}\tag6
\end{align}
$$
Explanation:
$(2)$: $\sin\left(x^2\right)=\Im\left(e^{ix^2}\right)$
$(3)$: Substitute $x\mapsto(t-i)^{-1/2}x$
$(4)$: no singularities between $\left[0,(t-i)^{1/2}R\right]$
$\phantom{(4)\text{:}}$ and $\gamma=\left[0,R\right]\cup\left[R,(t-i)^{1/2}R\right]$
$(5)$: integral along $\left[R,(t-i)^{1/2}R\right]$ vanishes
$(6)$: apply $(1)$
The complex change of variables needs justification by contour integration.
