evaluate $\int_{0}^{\infty}\cos(t) t^{z-1}dt=\Gamma(z)\cos(\frac{\pi z}{2})$ I need to prove $\int_{0}^{\infty}\cos(t) t^{z-1}dt=\Gamma(z)\cos(\frac{\pi z}{2})$ for $0<Re(z)<1$. I tried $\cos t=\frac{e^{it}+e^{-it}}{2}$ and to integrate it along the contour from $\epsilon $ to R, then to $Ri$ via a quarter of a circle, then downward to $\epsilon i$, finally back to $\epsilon$ via a small quarter of a circle. However, I find that $e^{-it}t^{z-1} $ does not converge when $R\to \infty$, can anyone give a correction of my integration or offer another method to evaluate the integral?(would be better if using complex contours) thanks in advance.
 A: Use $$\cos \theta = \frac{1}{2} (e^{i\theta} + e^{-i\theta})$$ to split the integral into two parts, namely
$$ \frac{1}{2} \int_0^\infty e^{it} t^{s-1} dt
\quad\text{and}\quad
\frac{1}{2} \int_0^\infty e^{-it} t^{s-1} dt.$$
Let $t^{s-1} = e^{(\log t)(s-1)}$ where the logarithm is the branch with the cut along the negative real axis. 
To evaluate the first integral, let $t = iu$, so that $u$ runs along the negative imaginary axis, giving
$$i \int_0^{-i\infty} e^{-u} e^{\log(iu)(s-1)} du.$$
Now we must have $\log(iu) = \log|u|$ because $iu$ is on the positive real axis. Furthermore $\log u = \log|u|-i\pi/2.$ Substituting, we have $\log(iu) = \log u +i\pi/2.$
This gives the integral
$$i \int_0^{-i\infty} e^{-u} e^{(\log(u)+i\pi/2)(s-1)} du
= e^{i\pi/2(s-1)} e^{i\pi/2} \int_0^{-i\infty} e^{-u} u^{s-1} du =
e^{i\pi/2 s} \Gamma(s).$$
For the second integral, let $t = -iu$, so that $u$ runs along the positive imaginary axis, giving
$$ -i \int_0^{+i\infty} e^{-u} e^{\log(-iu)(s-1)} du.$$
As before, $-iu$ is on the positive real axis so that $\log(-iu) = \log|u|.$ Furthermore, $\log u = \log|u|+i\pi/2.$ Substituting, we have $\log(-iu) = \log u -i\pi/2.$
This gives the integral
$$-i \int_0^{+i\infty} e^{-u} e^{(\log(u)-i\pi/2)(s-1)} du
= e^{-i\pi/2(s-1)} e^{-i\pi/2} \int_0^{+i\infty} e^{-u} u^{s-1} du =
e^{-i\pi/2 s} \Gamma(s).$$
Put these two together to obtain
$$\frac{1}{2}e^{i\pi/2 s} \Gamma(s) + \frac{1}{2} e^{-i\pi/2 s} \Gamma(s) =
\cos(s \pi/2)\Gamma(s).$$
The computation of $\log(iu)$ and $\log(-iu)$ in terms of $\log u$ is necessary because in general we can't use $\log(zw) = \log z + \log w$ as with positive reals.
Remark. To complete the above argument you still need to show that those integrals along the imaginary axis in fact represent the Gamma function integral. Use a quarter-circle contour (first and fourth quadrant) to achieve this. I will do this myself later if no one solves it before I do and if it gets done sooner, even better.
A: Substituting $e^{it}$ for $\cos(t)$ and taking the real part of the integral becomes complicated when we let $z$ be non-real, so I simply use $\cos(t)=\frac{e^{it}+e^{-it}}{2}$.
One must also justify the vanishing of the integral over the arc at infinity since that only vanishes when $\mathrm{Re}(z)\lt1$.
$$
\begin{align}
\int_0^\infty\cos(t)\,t^{z-1}\,\mathrm{d}t
&=\frac12\int_0^\infty e^{it}\,t^{z-1}\,\mathrm{d}t
+\frac12\int_0^\infty e^{-it}\,t^{z-1}\,\mathrm{d}t\tag{1}\\
&=\frac12\int_0^{i\infty} e^{it}\,t^{z-1}\,\mathrm{d}t
+\frac12\int_0^{-i\infty} e^{-it}\,t^{z-1}\,\mathrm{d}t\tag{2}\\
&=\frac12e^{\pi iz/2}\int_0^\infty e^{-t}\,t^{z-1}\,\mathrm{d}t
+\frac12e^{-\pi iz/2}\int_0^\infty e^{-t}\,t^{z-1}\,\mathrm{d}t\tag{3}\\[9pt]
&=\cos(\pi z/2)\Gamma(z)\tag{4}
\end{align}
$$
Justification:
$(1)$: $\cos(t)=\frac{e^{it}+e^{-it}}{2}$
$(2)$ left: integral over $[0,R]\cup Re^{i[0,\pi/2]}\cup[iR,0]$ is $0$
$\hphantom{(2)}$ right:integral over $[0,R]\cup Re^{i[0,-\pi/2]}\cup[-iR,0]$ is $0$
$(3)$: change variables
$(4)$: $\cos(t)=\frac{e^{it}+e^{-it}}{2}$
The integrals of $e^{it}\,t^{z-1}$ along $Re^{i[0,\pi/2]}$ and $e^{-it}\,t^{z-1}$ along $Re^{i[0,-\pi/2]}$ are bounded by
$$
\begin{align}
\int_0^{\pi/2}R^{\mathrm{Re}(z)}e^{\pi|\mathrm{Im}(z)|/2}e^{-R\sin(t)}\,\mathrm{d}t
&\le\int_0^{\pi/2}R^{\mathrm{Re}(z)}e^{\pi|\mathrm{Im}(z)|/2}e^{-2Rt/\pi}\,\mathrm{d}t\\
&=\frac\pi2R^{\mathrm{Re}(z)-1}e^{\pi|\mathrm{Im}(z)|/2}(1-e^{-R})\\[6pt]
&\to0
\end{align}
$$
when $\mathrm{Re}(z)\lt1$.
A: You can use the nice result Ramanujan's master theorem

Theorem: Assume function $f(x)$ has an expansion of the form
  $$f(x)=\sum_{k=0}^\infty \frac{\phi(k)}{k!}(-x)^k $$
  then Mellin transform of $f(x)$  is given by
  $$\int_0^\infty x^{s-1} f(x) \, dx = \Gamma(s)\phi(-s) $$
  where $\Gamma(s)$ is the Gamma function.

A: \begin{align}
\int_{0}^{\infty}\cos\left(t\right)\,t^{z - 1}\,{\rm d}t
&=
\Re\int_{0}^{\infty}{\rm e}^{{\rm i}t}\,t^{z - 1}\,{\rm d}t
=
\Re\int_{-{\rm i}\,0}^{-{\rm i}\,\infty}{\rm e}^{{\rm i}\left({\rm i}x\right)}\,
\left({\rm i}x\right)^{z - 1}\left({\rm i}\,{\rm d}x\right)
\\[3mm]&=
-\Im\left\lbrack%
{\rm i}^{z - 1}\int_{-{\rm i}\,0}^{-{\rm i}\,\infty}{\rm e}^{-x}\,x^{z - 1}\,{\rm d}x
\right\rbrack
=
-\Im\left({\rm i}^{z - 1}\right)\ \
\overbrace{\int_{0}^{\infty}{\rm e}^{-x}\,x^{z - 1}\,{\rm d}x}^{\Gamma\left(z\right)}
\\[3mm]&=
-\,\Im\left[%
{\rm e}^{{\rm i}\pi\left(z - 1\right)/2}\,\,\,\right]
\Gamma\left(z\right)
=
-\sin\left({\pi z \over 2} - {\pi \over 2}\right)\Gamma\left(z\right)
\\[3mm] &=
{\large\Gamma\left(z\right)\cos\left(\pi z \over 2\right)}
\end{align}
A: (Edit, now that other answers have fleshed out various arguments, I wanted to elaborate on why solving the real case is good enough)
First, let $z$ be real, $z=x, 0<x<1$. Use any method to compute the answer (Felix Marin seems most direct towards this condition, and of course in all answers need residue theorem to justify the transfer, and that the quarter-circle vanishes towards $\infty$).
Given the solution for real $z=x$, we now apply uniqueness theorem, which states that two analytic functions agreeing on a set containing an accumulation point (i.e. an interval on the real line) must agree everywhere (in the domain both are defined).
Now on one hand, $\Gamma(z)\cos(\pi z/2)$ is meromorphic, and in particular analytic on $0 < \Re{z} < 1$. The integral is also analytic in the same region by using uniform convergence of the integral on regions such as $0 < \epsilon \leq \Re{z} \leq 1-\epsilon$. This completes the argument, since we showed they agree on the segment of the real line $(0,1)$.
Anyway, any method is just fine, but I think uniqueness theorem really should be emphasized for complex analysis, as not often do we get to use such a powerful theorem :).
[Original comment: 
I think your contour is right, and you should just use $f(z) = e^{iz} z^{x-1}$. You will need to define an appropriate branch of $z^{x-1}$ of course. On the positive real axis the desired integral is the real part of the integral of $f$. On the positive imaginary axis the integral is a Gamma function integral, multiplied by a constant. Any residues? Quarter-circle integral for large radius vanish?   Then take the real part of resulting application of residue theorem. ]
A: To complete this argument we need to show that the two integrals along the negative and the positive imaginary axis do indeed represent the gamma function. There are several possible methods here having various degrees of difficulty ranging from simple to quite involved. We will treat the case of $s$ being a real number where $0<s<1,$ the goal being to keep the effort within reasonable limits.
Let $$f(z) = e^{-z} z^{s-1}.$$ Start with the first integral and use the contour consisting of a segment from the origin to $-Ri$ (call this $\Gamma_1$, with $R$ eventually going to infinity), a straight line to $R$ (call this $\Gamma_2$) and a segment from $R$ back to zero (call this $\Gamma_3$). The segment $\Gamma_1$ is the integral we obtained during the calculation (in the limit) and the segment $\Gamma_3$ is $-\Gamma(s).$ So if we can show that the contribution from $\Gamma_2$ goes to zero we are done (no poles).
Parameterize $\Gamma_2$ by $z = -Ri(1-t) + Rt = R(1+i)t-Ri$ with $t$ between zero and one and $dz = R (1+i) dt.$ We have 
$$\Re(\log z) = \log \sqrt{R^2(1-t)^2+R^2 t^2} = \log R +
\frac{1}{2} \log\left((1-t)^2 + t^2\right).$$
This gives the following bound for $|z^{s-1}|$ on $\Gamma_2$ (note that $s-1$ is negative):
$$|z^{s-1}| = |e^{(\log z) (s-1)}| \\ =
e^{( \log R + \frac{1}{2} \log\left((1-t)^2 + t^2\right) ) (s-1)} =
R^{s-1} \sqrt{(1-t)^2 + t^2}^{s-1} =
R^{s-1} \sqrt{\frac{1}{(1-t)^2 + t^2}}^{1-s}.$$
Since the term under the root sign is at least one and $1-s$ is positive the whole is maximized when the inner term is maximized, which occurs when $t=1/2,$ giving the upper bound
$$ R^{s-1} \sqrt{2}^{1-s} = \left(\frac{R}{\sqrt 2}\right)^{s-1}.$$
Returning to the integral we thus have
$$\left|\int_{\Gamma_2} f(z) dz \right|
\le \int_0^1 \left|e^{Ri(1-t)-Rt}\right| 
\left(\frac{R}{\sqrt 2}\right)^{s-1} |R (1+i)| dt.$$
This is
$$\frac{R^s}{\sqrt{2}^{s-2}} \int_0^1 e^{-Rt} dt
= \frac{R^s}{\sqrt{2}^{s-2}} \left[ \frac{e^{-Rt}}{-R}\right]_0^1
= \frac{R^{s-1}}{\sqrt{2}^{s-2}} \left(1 - e^{-R}\right).$$ 
But $s-1<0$ so this integral (along $\Gamma_2$) vanishes as claimed and the integral along $\Gamma_1$ is indeed equal to $\Gamma(s),$ which was to be shown. The second integral (along the positive imaginary axis) may be treated in a similar manner.
