Integrals involving Gamma function I am trying to solve the following two integral for general $n$.
\begin{equation}
\int_{0}^{\infty}\frac{1 - {\rm e}^{-x}}{x^{n}}\,{\rm d}x\qquad\mbox{and}\qquad
\int_{0}^{\infty}\frac{1 - \cos\left(x\right)}{x^{n}}\,{\rm d}x
\end{equation}
I was told there are related to the Gamma function
$$
\Gamma\left(z\right) =
\int_{0}^{\infty}\frac{{\rm e}^{-t}}{t^{1-z}\,}\,{\rm d}t\,,
$$
but I can only map one part of the first integral into
$\Gamma\left(1 - n\right)$, cannot get anything else.
Any thoughts $?$.
 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{\on}[1]{\operatorname{#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}
&\bbox[5px,#ffd]{\left.\int_{0}^{\infty}{1 - \expo{-x} \over x^{n}}\dd x
\,\right\vert_{1\ <\ \Re\pars{n}\ <\ 2}}\,\,\,\, \stackrel{\rm IBP}{=}
{1 \over n - 1}\ \overbrace{\int_{0}^{\infty}x^{-n + 1}\,\,\expo{-x}\dd x}
^{\ds{\Gamma\pars{-n + 2}}} = \bbx{-\,\Gamma\pars{1 - n}}
\end{align}
In the last step I used the $Gammma\ Recursion\ Formula$.

\begin{align}
&\bbox[5px,#ffd]{\left.\int_{0}^{\infty}{1 - \cos\pars{x} \over x^{n}}
\dd x\,\right\vert_{1\ <\ \Re\pars{n}\ <\ 3}}\,\,\,\,
\stackrel{\rm IBP}{=}
{1 \over n - 1}\int_{0}^{\infty}
x^{-n + 1}\,\,\sin\pars{x}\,\dd x
\\[5mm] \stackrel{x\ \mapsto\ x^{1/2}}{=}\quad &
{1 \over 2\pars{n - 1}}\int_{0}^{\infty}
x^{\pars{\color{red}{3/2\ -\ n/2}}\, -\, 1}\quad
{\sin\pars{\root{x}} \over \root{x}}\,\dd x
\end{align}
Note that $\ds{{\sin\pars{\root{x}} \over \root{x}} =
\sum_{k = 0}^{\infty}{\Gamma\pars{1 + k} \over \Gamma\pars{2 + 2k}}{\pars{-x}^{k} \over k!}}$ such that
\begin{align}
&\bbox[5px,#ffd]{\left.\int_{0}^{\infty}
{1 - \cos\pars{x} \over x^{n}}\dd x
\,\right\vert_{1\ <\ \Re\pars{n}\ <\ 3}} =
{1 \over 2\pars{n - 1}}\ \overbrace{\Gamma\pars{{3 \over 2} - {n \over 2}}
{\Gamma\pars{1 - \bracks{3/2-n/2}} \over \Gamma\pars{2 -2\bracks{3/2- n/2}}}}
^{Ramanujan\,'s\ Master\ Theorem}
\\[5mm] = & \
{1 \over 2\pars{n - 1}}{\pi \over \sin\pars{\pi\bracks{3/2 - n/2}}}
{1 \over \Gamma\pars{n - 1}} =
-\,{\pi \over 2}{1 \over \cos\pars{n\pi/2}}{1 \over \Gamma\pars{n}}
\\[5mm] = & \
-\,{\pi \over 2}{1 \over \cos\pars{n\pi/2}}
{\sin\pars{\pi n}\Gamma\pars{1 - n} \over \pi} =
\bbx{n\,\Gamma\pars{-n}\sin\pars{n\pi \over 2}}
\end{align}
where I used repeatedly the $Euler\ Reflection\ Formula$.
A: Let me do details for the first integral. Let $u_n(x) = \frac{1-e^{-x}}{x^n}$. Notice that $u_n(x)\sim x^{1-n}$ when $x\to 0$, and $u_n(x)\sim x^{-n}$ when $x\to \infty$. Therefore, $u_n$ is only integrable for $1 < n < 2$.
Hence, assume that $n\in(1,2)$. Then it follows by integration by parts that
$$
U_n := \int_0^\infty u_n(x)\,\mathrm d x = \left[\frac{x^{1-n}}{1-n}(1-e^{-x})\right]_0^\infty - \int_0^\infty \frac{x^{1-n}}{1-n} e^{-x}\,\mathrm d x
\\
 = 0 + \frac{1}{n-1} \int_0^\infty x^{1-n}\, e^{-x}\,\mathrm d x = \frac{\Gamma(2-n)}{n-1}
$$
Now notice that $U_n$ is an analytic function of $n$. On the other side, for any $n>0$, the relation $\Gamma(n+1) = n\,\Gamma(n)$ holds. The definition of $\Gamma$ for other $n\in\Bbb C\setminus \{0, -1, -2,\dots\}$ is that $\Gamma$ is the unique analytic continuation of the function defined on $\Bbb R_+$. In particular, $\Gamma(n+1)$ and $n\,\Gamma(n)$ are both analytic functions. Since they are equal on $\Bbb R_+$, they are also equal on all $\Bbb C\setminus \{-1, -2,\dots\}$ and so
$$
U_n = \frac{\Gamma(1-n+1)}{n-1} = \frac{(1-n)\,\Gamma(1-n)}{n-1} = -\Gamma(1-n).
$$
For the second integrals, things are similar, but you have to deal with complex numbers. First, with the same integration by parts as before
$$
V_n := \int_0^\infty \frac{1-\cos(x)}{x^n}\,\mathrm d x = \frac{1}{2}\left(\int_0^\infty\frac{1-e^{ix}}{x^n}\,\mathrm d x + \int_0^\infty \frac{1-e^{-ix}}{x^n}\,\mathrm d x\right)
\\
= \frac{i}{2(n-1)}\left(\int_0^\infty x^{1-n}\,(e^{ix}-e^{-ix})\,\mathrm d x\right) = \frac{-1}{(n-1)}\,\Im\left(\int_0^\infty x^{1-n}\,e^{ix}\,\mathrm d x\right)
$$
Now one can use the fact that $\int_0^\infty x^{k-1}\,e^{-ix}\,\mathrm d x = i^{-k}\,\Gamma(k)$ (i.e., all works as if we can do the normal change of variable, even if $i$ is a complex number). This is proved for instance here using the Fourier transform Can we find a closed form for this integral?
Hence using again $\Gamma(2-n) = (1-n)\,\Gamma(1-n)$
$$
V_n = \frac{-1}{n-1} \Im(i^{n-2})\, \Gamma(2-n)) =  \Im(i^{n-2})\, \Gamma(1-n)
$$
Hence
$$
V_n = -\sin(n\pi/2)\, \Gamma(1-n)
$$
