Convergence of the improper integral $\int_{0}^{\pi/2}\tan^{p}(x) \; dx$ I need help solving this integral: for which values of the parameter $p$ is this improper integral convergent?
$$\int_{0}^{\pi/2}\tan^{p}(x) \; dx$$
Thanks a lot!
 A: Hint: substitute $u=\tan{x}$. Then $x=\arctan{u}$, $dx=\dfrac{du}{1+u^2}$, and the integral becomes,
$$\int_{0}^{\pi/2}\tan^{p}{x}\,dx=\int_0^{\infty}\dfrac{u^p}{1+u^2}du.$$
A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\down}{\downarrow}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
With
$\ds{t \equiv {1 \over u^{2} + 1}\quad\iff\quad u = \pars{1 - t \over t}^{1/2}}$:
\begin{align}
\color{#00f}{\large\int_{0}^{\infty}{u^{p} \over u^{2} + 1}\,\dd u}&=
\int_{1}^{0}t\,\pars{1 - t \over t}^{p/2}\,\half\,\pars{1 - t \over t}^{-1/2}
\pars{-\,{\dd t \over t^{2}}}
\\[3mm]&=\half\int^{1}_{0}t^{-\pars{p + 1}/2}\pars{1 - t}^{\pars{p - 1}/2}\,\dd t
=\half\,{\rm B}\pars{-p + \half,p + \half}
\\[3mm]&=\half\,{\Gamma\pars{-p + 1/2}\Gamma\pars{p + 1/2}
  \over \Gamma\pars{\bracks{-p + 1/2} + \bracks{p + 1/2}}}
=\half\,{\pi \over \sin\pars{\pi\bracks{p + 1/2}}}
= {\pi \over 2\cos\pars{\pi p}}\\[3mm]&
= \color{#00f}{\large\half\,\pi\,\sec\pars{\pi p}}\,,\qquad
\verts{\Re\pars{p}} < 1
\end{align}
A: The result seems to be $\frac{1}{2} \pi  \sec \left(\frac{\pi  p}{2}\right)$ provided that $-1<\Re(p)<1$
A: Hint 
Continue using David H's suggestion. My contribution will be very minor : notice that
$$u^p=u^{p-2} [u^2 + 1 - 1]$$
