How to evaluate this nonelementary integral? Let $x>0$. I have to prove that
$$
\int_{0}^{\infty}\frac{\cos x}{x^p}dx=\frac{\pi}{2\Gamma(p)\cos(p\frac{\pi}{2})}\tag{1}
$$
by converting the integral on the left side to a double integral using the expression below:
$$
\frac{1}{x^p}=\frac{1}{\Gamma(p)}\int_{0}^{\infty}e^{-xt}t^{p-1}dt\tag{2}
$$
By plugging $(2)$ into $(1)$ I get the following double integral:
$$
\frac{1}{\Gamma(p)}\int_{0}^{\infty}\int_{0}^{\infty}e^{-xt}t^{p-1}\cos xdtdx\tag{3}
$$
However, I unable to proceed any further as I am unclear as to what method should I use in order to compute this integral. I thought that an appropriate change of variables could transform it into a product of two gamma functions but I cannot see how that would work. Any help would be greatly appreciated.
 A: The Laplace transform of $\cos x$ is $\frac{s}{1+s^2}$ and the inverse Laplace transform of $\frac{1}{x^p}$ is $\frac{s^{p-1}}{\Gamma(p)}$, hence
$$ \int_{0}^{+\infty}\frac{\cos x}{x^p}\,dx = \frac{1}{\Gamma(p)}\int_{0}^{+\infty}\frac{s^p}{s^2+1}\,ds=\frac{1}{\Gamma(p)}\int_{0}^{\pi/2}\left(\tan u\right)^p\,du $$
equals
$$ \begin{eqnarray*}\frac{1}{\Gamma(p)}\int_{0}^{1} v^p (1-v^2)^{-(p+1)/2}\,dv&=&\frac{1}{2\,\Gamma(p)}\int_{0}^{1}w^{(p-1)/2}(1-w)^{-(p+1)/2}\,dw\\& =& \frac{B\left(\tfrac{1+p}{2},\tfrac{1-p}{2}\right)}{2\,\Gamma(p)}\end{eqnarray*} $$
or
$$ \frac{\Gamma\left(\frac{1+p}{2}\right)\Gamma\left(\frac{1-p}{2}\right)}{2\,\Gamma(p)}= \frac{\pi}{2\,\Gamma(p)\sin\left(\frac{\pi}{2}(p+1)\right)}=\frac{\pi}{2\,\Gamma(p)\cos\left(\frac{\pi p}{2}\right)}$$
as wanted. We have exploited the Beta function and the reflection formula for the $\Gamma$ function.
A: Your given integral is closely related to the Mellin transform and can be evaluated by using Ramanujan's Master Theorem.

Ramanujan's Master Theorem
Let $f(x)$ be an analytic function with a MacLaurin Expansion of the form
$$f(x)=\sum_{k=0}^{\infty}\frac{\phi(k)}{k!}(-x)^k$$then the Mellin Transform of this function is given by
$$\int_0^{\infty}x^{s-1}f(x)dx=\Gamma(s)\phi(-s)$$

Therefore expand the cosine function as Taylor series expansion to get
$$\begin{align}
\mathfrak{I}=\int_0^{\infty}\cos(x)x^{-p}dx&=\int_0^{\infty}x^{-p}\sum_{n=0}^{\infty}(-1)^n\frac{x^{2n}}{(2n)!}dx
\end{align}$$
In order to bring the above integral in the wanted form for the usage of Ramanujan's Master Theorem apply the substitution $x^2=u$. So we further get
$$\begin{align}
\mathfrak{I}=\int_0^{\infty}x^{-p}\sum_{n=0}^{\infty}(-1)^n\frac{x^{2n}}{(2n)!}dx&=\int_0^{\infty}x^{-p}\sum_{n=0}^{\infty}\frac{1}{(2n)!}(-x^2)^ndx\\
&=\int_0^{\infty}u^{-p/2}\sum_{n=0}^{\infty}\frac{1}{(2n)!}(-u)^n\frac{du}{2\sqrt{u}}\\
&=\frac12\int_0^{\infty}u^{-(p+1)/2}\sum_{n=0}^{\infty}\frac{1}{(2n)!}(-u)^ndu\\
&=\frac12\int_0^{\infty}u^{-(p+1)/2}\sum_{n=0}^{\infty}\frac{n!/(2n)!}{n!}(-u)^ndu
\end{align}$$
By using the relation $\Gamma(n)=(n-1)!$ which is valid for all $n\in\mathbb N$ we can consider the last integral as an application of Ramanujan's Master Theorem with $s=-\frac{p-1}2$ and $\phi(n)=\frac{\Gamma(n+1)}{\Gamma(2n+1)}$. By finally using the Theorem we obtain
$$\begin{align}
\mathfrak{I}=\frac12\int_0^{\infty}u^{-(p+1)/2}\sum_{n=0}^{\infty}\frac{n!/(2n)!}{n!}(-u)^ndu&=\frac12\Gamma\left(-\frac{p-1}2\right)\frac{\Gamma\left(\frac{p-1}2+1\right)}{\Gamma\left(2\left(\frac{p-1}2\right)+1\right)}\\
&=\frac1{2\Gamma(p)}\Gamma\left(1+\frac{p-1}2\right)\Gamma\left(-\frac{p-1}2\right)
\end{align}$$
Now by applying Euler's Reflection Formula with $z=1+\frac{p-1}2$ we moreover get
$$\begin{align}
\mathfrak{I}=\frac1{2\Gamma(p)}\Gamma\left(1+\frac{p-1}2\right)\Gamma\left(-\frac{p-1}2\right)&=\frac1{2\Gamma(p)}\frac{\pi}{\sin\left(\pi\left(1+\frac{p-1}2\right)\right)}\\
&=\frac1{2\Gamma(p)}\frac{\pi}{\sin\left(\frac{p\pi}2+\frac{\pi}2\right)}\\
&=\frac1{2\Gamma(p)}\frac{\pi}{\cos\left(\frac{p\pi}2\right)}
\end{align}$$
where within the last step the fundamental relation $\sin\left(x+\frac{\pi}2\right)=\cos(x)$ was used. Thus for the original integral $\mathfrak{I}$ we get

$$\mathfrak{I}=\int_0^{\infty}\cos(x)x^{-p}dx=\frac{\pi}{2\Gamma(p)\cos\left(p\frac{\pi}2\right)}$$

A: Hint: $\displaystyle\int_{0}^{\infty}\frac{\cos x}{x^p}dx= \text{Real part of}\:\int_{0}^{\infty}\frac{e^{iz}}{z^p}dz$ and use residue theorem. This has a pole of order $p$ hence the term $\Gamma (p)$ in the denominator.
A: So let us follow your initial line of thought and convert the integral to a double integral. As you correctly observe, as
$$\frac{1}{x^p} = \frac{1}{\Gamma (p)} \int_0^\infty e^{-xt} t^{p - 1} \, dt,$$
which, by the way, is just the Laplace transform for the function $x^{p -1}$, as a double integral your integral can be rewritten as
$$\int_0^\infty \frac{\cos x}{x^p} \, dx = \frac{1}{\Gamma (p)} \int_0^\infty \int_0^\infty e^{-xt} \cos x t^{p - 1} \, dt \, dx,$$
or
$$\int_0^\infty \frac{\cos x}{x^p} \, dx = \frac{1}{\Gamma (p)} \int_0^\infty t^{p - 1} \int_0^\infty e^{-xt} \cos x \, dx \, dt,$$
after changing the order of integration.
The inner $x$-integral can be readily found. Either using integration by parts twice, or recognising the integral as the Laplace transform for the function $\cos x$, as
$$\int_0^\infty e^{-xt} \cos x \, dx = \frac{t}{1 + t^2},$$
we have
$$\int_0^\infty \frac{\cos x}{x^p} \, dx = \frac{1}{\Gamma (p)} \int_0^\infty \frac{t^p}{1 + t^2} \, dt.$$
Enforcing a substitution of $t \mapsto \sqrt{t}$ leads to
\begin{align}
\int_0^\infty \frac{\cos x}{x^p} \, dx &= \frac{1}{2 \Gamma (p)} \int_0^\infty \frac{t^{\frac{p}{2} - \frac{1}{2}}}{1 + t} \, dt = \frac{1}{2 \Gamma (p)} \int_0^\infty \frac{t^{\frac{p + 1}{2} - 1}}{(1 + t)^{\frac{p + 1}{2} + \frac{1 - p}{2}}}.
\end{align}
As this is exactly of the form of the Beta function (see the second of the integral representations in the link) we have
\begin{align}
\int_0^\infty \frac{\cos x}{x^p} \, dx &= \frac{1}{2 \Gamma (p)} \text{B} \left (\frac{p + 1}{2}, \frac{1 - p}{2} \right )\\
&= \frac{1}{2 \Gamma (p)} \Gamma \left (\frac{p}{2} + \frac{1}{2} \right ) \Gamma \left (\frac{1}{2} - \frac{p}{2} \right ) \\
&= \frac{1}{2 \Gamma (p)} \Gamma \left (\frac{p}{2} + \frac{1}{2} \right ) \Gamma \left [1 - \left (\frac{p}{2} + \frac{1}{2} \right ) \right ] \\
&= \frac{1}{2 \Gamma (p)} \frac{\pi}{\sin (p + 1)\pi/2} \qquad (*)\\
&= \frac{\pi}{2 \Gamma (p) \cos \left (\frac{\pi p}{2} \right )},
\end{align}
as required. Note Euler's reflection formula was used in ($*$).  
