Evaluate $$\int_0^\infty x^{-s}\sin x\,\mathrm{d}x$$ for $0 < \Re(s) < 2$.
This is an exercise from an elementary complex analysis textbook.
My attempt:
If $0 < \Re(s) < 1$, we can evaluate
$$\int_0^\infty x^{-s}e^{ix}\,\mathrm{d}x$$
and
$$\int_0^\infty x^{-s}e^{-ix}\,\mathrm{d}x$$
using residues (the integration paths are sectors in the 1st and 4st quadrants, respectively), yielding
$$\int_0^\infty x^{-s}\sin x\,\mathrm{d}x = \Gamma(1-s)\cos\frac{\pi}{2}s$$
and
$$\int_0^\infty x^{-s}\cos x\,\mathrm{d}x = \Gamma(1-s)\sin\frac{\pi}{2}s.$$
If $1 < \Re(s) < 2$, we can integrate by part,
\begin{align}
& \int_0^\infty x^{-s}\sin x\,\mathrm{d}x \\
= & \frac{1}{1-s}\left.x^{1-s}\sin x\right|_0^\infty
- \frac{1}{1-s}\int_0^\infty x^{1-s}\cos x\,\mathrm{d}x \\
= & \Gamma(1-s)\cos\frac{\pi}{2}s
\end{align}
using results obtained above.
However, when $\Re(s) = 1$, integration by part breaks down, as $\lim_{x\to\infty}x^{1-s}\sin x$ diverges in this case.
If uniform convergence for $\int_0^\infty x^{-s}\sin x\,\mathrm{d}x$ when $0 < \Re(s) < 2$ can be proved, then even integration by part is unnecessary, as we can extend the result from $0 < \Re(s) < 1$ using analytic continuation. But I can at most do it with real $s$; I can't work around the complex case.
Could someone show me how to get past the line $\Re(s) = 1$?
As noted in the comment, let's show that $$f(s)=\int_0^\infty x^{-s}\sin x\,\mathrm{d}x$$ is (defined and) analytic on $\Omega$ given by $0 < \Re s <2$, so by analytic continuation the result obtained for $0 < \Re s <1$ extends to $\Omega$
Fix a compact set $K \subset \Omega$ so $0<a \le \sigma \le b <2$ and $|t| \le C$ for $s=\sigma+it \in K$ and let's show that the integrals converge uniformly on $K$ which implies the analyticity of $f$ by Morera as then we can switch integrals in $\int_{\Delta}f(s)ds$ for any triangle $\Delta \subset \Omega$.
Note that for $1 \le x \le 2C$ the integrals are clearly absolutely and uniformly bounded by a constant so there is no problem, while for $0 \le x \le 1$ we use $\sin x \le x$ so $$\int_0^1 |x^{-s}\sin x|\,\mathrm{d}x \le \int_0^1 x^{1-b}dx<\infty$$ hence we just need to show uniform convergence on $[2C, \infty)$ and we will show uniform Cauchy so $|\int_A^B x^{-s}\sin x\,\mathrm{d}x| \to 0, A,B \to \infty, A,B \ge 2C, x \in K$
We write $$\int_A^B x^{-s}\sin x\,\mathrm{d}x=\int_A^B x^{-\sigma}(\cos (t \log x) - i \sin (t \log x))\sin x\,\mathrm{d}x$$ so we need to analyze integrals of the type $$\int_A^B x^{-\sigma}\sin (x \pm t \log x)\,\mathrm{d}x$$ and the same with cosine instead.
By the second mean value theorem for integrals there is $A \le B_s \le B$ st $$\int_A^B x^{-\sigma}\sin (x - t \log x)\,\mathrm{d}x=A^{-\sigma}\int_A^{B_s} \sin (x - t \log x)\,\mathrm{d}x$$
But the derivative of $x - t \log x$ is $1-t/x$ so is between $1/2$ and $3/2$ and is monotonic since $|t/x| \le 1/2$ for $s \in K, x \ge A \ge 2C$ so with $h(x)=\sin (x - t \log x)$ we have $\int_A^{B_s} \sin h(x)\,\mathrm{d}x=\int_A^{B_s} (h'(x)\sin h(x))/h'(x)dx$ so another application of the second mean value theorem gives that $$|\int_A^{B_s} (h'(x)\sin h(x))/h'(x)dx| \le (\max_{[A, B_s]}1/h')|\int_{A'}^{B'}h'(x)\sin h(x)dx| \le 4$$
(here $1/h'$ will be either increasing or decreasing depending on the sign of $t$ so the second mean value theorem applies at either end of the interval and the formula above covers both cases)
Hence $$|\int_A^B x^{-\sigma}\sin (x - t \log x)\,\mathrm{d}x| \le 4A^{-\sigma} \le 4A^{-a}$$ and similarly for the other integrals involved, so $$|\int_A^B x^{-s}\sin x\,\mathrm{d}x| \le 16A^{-a}$$ for all $x \in K$ and we are done