In THIS ANSWER, I used straightforward contour integration to evaluate the integral $$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{x^a}{1+x^2}\,dx=\frac{\pi}{2}\sec\left(\frac{\pi a}{2}\right)}$$for $|a|<1$.

An alternative approach is to enforce the substitution $x\to e^x$ to obtain

$$\begin{align} \int_0^\infty \frac{x^a}{1+x^2}\,dx&=\int_{-\infty}^\infty \frac{e^{(a+1)x}}{1+e^{2x}}\,dx\\\\ &=\int_{-\infty}^0\frac{e^{(a+1)x}}{1+e^{2x}}\,dx+\int_{0}^\infty\frac{e^{(a-1)x}}{1+e^{-2x}}\,dx\\\\ &=\sum_{n=0}^\infty (-1)^n\left(\int_{-\infty}^0 e^{(2n+1+a)x}\,dx+\int_{0}^\infty e^{-(2n+1-a)x}\,dx\right)\\\\ &=\sum_{n=0}^\infty (-1)^n \left(\frac{1}{2n+1+a}+\frac{1}{2n+1-a}\right)\\\\ &=2\sum_{n=0}^\infty (-1)^n\left(\frac{2n+1}{(2n+1)^2-a^2}\right) \tag 1\\\\ &=\frac{\pi}{2}\sec\left(\frac{\pi a}{2}\right)\tag 2 \end{align}$$

Other possible ways forward include writing the integral of interest as

$$\begin{align} \int_0^\infty \frac{x^a}{1+x^2}\,dx&=\int_{0}^1 \frac{x^{a}+x^{-a}}{1+x^2}\,dx \end{align}$$

and proceeding similarly, using $\frac{1}{1+x^2}=\sum_{n=0}^\infty (-1)^nx^{2n}$.

Without appealing to complex analysis, what are other approaches one can use to evaluate this very standard integral?


Note that we can show that $(1)$ is the partial fraction representation of $(2)$ using Fourier series analysis. I've included this development for completeness in the appendix of the solution I posted on THIS PAGE.

  • $\begingroup$ How did you come from the 2th to the 3th line of your calculation? $\endgroup$
    – Imago
    Sep 3, 2016 at 17:09
  • 2
    $\begingroup$ Is there a simple real-only proof of the last step of your derivation? (i.e. sum to sec) $\endgroup$
    – robjohn
    Sep 3, 2016 at 17:30
  • $\begingroup$ @Imago Straightforward analysis. Split the integral into the sum of integrals. In the latter one, simply multiply numerator and denominator by $e^{-x}$. To arrive at the third line, expand the denominator as a geometric series. $\endgroup$
    – Mark Viola
    Sep 3, 2016 at 17:31
  • $\begingroup$ I think that the Fourier series of some trigonometric function can be used to find the aforementioned sum $\endgroup$ Sep 3, 2016 at 17:54
  • $\begingroup$ @robjohn Rob, I've provided a real analysis proof in the appendix of the answer I posted to this question. I'm not certain as to whether you would consider it simple. -Mark $\endgroup$
    – Mark Viola
    Feb 11, 2017 at 0:00

6 Answers 6


I'll assume $\lvert a\rvert < 1$. Letting $x = \tan \theta$, we have

$$\int_0^\infty \frac{x^a}{1 + x^2}\, dx = \int_0^{\pi/2}\tan^a\theta\, d\theta = \int_0^{\pi/2} \sin^a\theta \cos^{-a}\theta\, d\theta$$

The last integral is half the beta integral $B((a + 1)/2, (1 - a)/2)$, Thus

$$\int_0^{\pi/2}\sin^a\theta\, \cos^{-a}\theta\, d\theta = \frac{1}{2}\frac{\Gamma\left(\frac{a+1}{2}\right)\Gamma\left(\frac{1-a}{2}\right)}{\Gamma\left(\frac{a+1}{2} + \frac{1-a}{2}\right)} = \frac{1}{2}\Gamma\left(\frac{a+1}{2}\right)\Gamma\left(\frac{1-a}{2}\right)$$

By Euler reflection,

$$\Gamma\left(\frac{a+1}{2}\right)\Gamma\left(\frac{1-a}{2}\right) = \pi \csc\left[\pi\left(\frac{1+a}{2}\right)\right] = \pi \sec\left(\frac{\pi a}{2}\right)$$

and the result follows.

Edit: For a proof of Euler reflection without contour integration, start with the integral function $f(x) = \int_0^\infty u^{x-1}(1 + u)^{-1}\, du$, and show that $f$ solves the differential equation $y''y - (y')^2 = y^4$, $y(1/2) = \pi$, $y'(1/2) = 0$. The solution is $\pi \csc \pi x$. On the other hand, $f(x)$ is the beta integral $B(1+x,1-x)$, which is equal to $\Gamma(x)\Gamma(1-x)$. I believe this method is due to Dedekind.

  • $\begingroup$ @Dr.MV we can avoid using product representations by developing a differential equation for the beta function $B(1+x,1-x)$ and solving it explicitly, as I've explained in the edit. Nice question, btw. $\endgroup$
    – kobe
    Sep 4, 2016 at 6:34
  • $\begingroup$ Yes; another way to circumvent the product representation of the Gamma function is outlined in the answer I posted. That approach does rely on the product representation of the sine function, which can be developed using Fourier series. In your edit, you discuss the ODE (with initial condition) that the Beta function satisfies. This ODE is second order and non-linear and might have more than one solution (i.e., uniqueness and even existence come into question). How does one know if both $B(1+x,1-x)$ and $\pi \csc(\pi x)$ represent the same solution (i.e., they are equal)? -Mark $\endgroup$
    – Mark Viola
    Sep 4, 2016 at 13:33
  • $\begingroup$ @Dr.MV surprisingly, there is only one solution to that equation with the given initial conditions, which is $\pi \csc(\pi x)$. $\endgroup$
    – kobe
    Sep 4, 2016 at 13:38
  • $\begingroup$ How does one show the uniqueness of one, and only one solution? It's interesting that a second order, but non-linear, ODE has only one solution. But the non-linear nature gives rise to that possibility. $\endgroup$
    – Mark Viola
    Sep 4, 2016 at 13:41
  • $\begingroup$ Since $f > 0$, the equation $f''f - (f')^2 = f^4$ is equivalent to $(\log f)'' = f^2$. Letting $g = \log f$, we have $g'' = e^{2g}$; multiplying by $g'$ and integrating results in $(g')^2 = e^{2g} + C$ for some constant $C$. Since $g(1/2) = \log \pi$ and $g'(1/2) = f'(1/2)/f(1/2) = 0$, we deduce $C = -\pi^2$. $\endgroup$
    – kobe
    Sep 4, 2016 at 14:46

In the same spirit as the previously posted answers, we enforce the substitution $x\to\sqrt{\frac{1-x}{x}}$ to reveal

$$\begin{align} \int_0^\infty \frac{x^a}{1+x^2}\,dx&=\frac12\int_0^1 x^{(a-1)/2}(1-x)^{-(a+1)/2}\,dx\\\\ &=\frac12 B\left(\frac{1+a}{2},\frac{1-a}{2}\right) \end{align}$$

which after applying the relationships $B(x,y)=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$ and $\Gamma(z)\Gamma(1-z)=\pi \csc(\pi z)$ recovers the closed form $\frac{\pi}{2}\sec(\pi a/2)$.


In order to be more self-contained, I thought it might be useful to provide herein proofs of the mechanisms used in the evaluation of the integral of record. To that end, we proceed.

Relationship Between Beta and Gamma

Note that we can write the product $\Gamma(x)\Gamma(y)$ for $x>0$, $y>0$ as

$$\begin{align} \Gamma(x)\Gamma(y)&=\int_0^\infty s^{x-1}e^{-s}\,ds\,\int_0^\infty t^{x-1}e^{-t}\,dt\\\\ &=\int_0^\infty \, \int_0^\infty s^{x-1}t^{y-1}e^{-(s+t)}\,ds\,dt\\\\ &=\int_0^\infty t^{y-1} \int_t^\infty (s-t)^{x-1}e^{-s}\,ds\,dt\\\\ &=\int_0^\infty e^{-s}\int_0^s t^{y-1}(s-t)^{x-1}\,dt\,ds\\\\ &=\int_0^\infty s^{x+y-1}e^{-s} \int_0^1 t^{y-1}(1-t)^{x-1}\,dt\,ds\\\\ &=\Gamma(x+y)B(x,y) \end{align}$$

as was to be shown.

Limit Definition of Gamma

Let $G_n(x)$ be the sequence of functions given by

$$G_n(x)=\int_0^n s^{x-1}\left(1-\frac{s}{n}\right)^n\,ds$$

I showed in THIS ANSWER, using only Bernoulli's Inequality, that the sequence $\left(1-\frac{s}{n}\right)^n$ monotonically increases for $s\le n$. Therefore, $\left|s^{x-1} \left(1-\frac{s}{n}\right)^n\right|\le s^{x-1}e^{-s}$ for $s\le n$. The Dominated Convergence Theorem guarantees that we can write

$$\begin{align} \lim_{n\to \infty} G_n(x)=&\lim_{n\to \infty}\int_0^n s^{x-1}\left(1-\frac{s}{n}\right)^n\,ds\\\\ &=\lim_{n\to \infty}\int_0^\infty \xi_{[0,n]}\,s^{x-1}\left(1-\frac{s}{n}\right)^n\,ds\\\\ &=\int_0^\infty \lim_{n\to \infty} \left(\xi_{[0,n]}\,\left(1-\frac{s}{n}\right)^n\right)\,s^{x-1}\,\,ds\\\\ &=\int_0^\infty s^{x-1}e^{-s}\,ds\\\\ &=\Gamma(x) \end{align}$$

ALTERNATIVE PROOF: Limit Definition of Gamma

If one is unfamiliar with the Dominated Convergence Theorem, then we can simply show that

$$\lim_{n\to \infty}\int_0^n s^{x-1}e^{-s}\left(1-e^s\left(1-\frac{s}{n}\right)^n\right)=0$$

To do this, we appeal again to the analysis in THIS ANSWER. Proceeding, we have

$$\begin{align} 1-e^s\left(1-\frac{s}{n}\right)^n &\le 1-\left(1+\frac{s}{n}\right)^n\left(1-\frac{s}{n}\right)^n\\\\ &=1-\left(1-\frac{s^2}{n^2}\right)^n\\\\ &\le 1-\left(1-\frac{s^2}{n}\right)\\\\ &=\frac{s^2}{n} \end{align}$$

where Bernoulli's Inequality was used to arrive at the last inequality. Similarly, we see that

$$\begin{align} 1-e^s\left(1-\frac{s}{n}\right)^n &\ge 1-e^se^{-s}\\\\ &=0 \end{align}$$

Therefore, applying the squeeze theorem yields to coveted limit

$$\lim_{n\to \infty}\int_0^n s^{x-1}e^{-s}\left(1-e^s\left(1-\frac{s}{n}\right)^n\right)=0$$

which implies $\lim_{n\to \infty}G_n(x)=\Gamma(x)$.

Integrating by parts repeatedly the integral representation of $G_n(x)$ reveals

$$G_n(x)=\frac{n^x\,n!}{x(x+1)(x+2)\cdots (x+n)}$$

so that

$$\bbox[5px,border:2px solid #C0A000]{\Gamma(x)=\lim_{n\to \infty}\frac{n^x\,n!}{x(x+1)(x+2)\cdots (x+n)}}$$

Reflection Formula

Finally, we can write

$$\begin{align} \Gamma(x)\Gamma(1-x)&=\lim_{n\to \infty}\frac{n\,(n!)^2}{x(1-x^2)(4-x^2)\cdots (n^2-x^2)(n+1-x) }\\\\ &=\lim_{n\to \infty}\frac{1}{x\prod_{k=1}^n \left(1-\frac{x^2}{k^2}\right)}\\\\ &=\frac{\pi}{\sin(\pi x)} \end{align}$$

In arriving at the last equality, we used the infinite product representation of the sine function $\sin(\pi x)=\pi x\,\prod_{k=1}^n \left(1-\frac{x^2}{k^2}\right)$, which was proven in THIS ANSWER using real analysis.


Again, to be self-contained, we will show in this appendix that Equation $(1)$ of the OP is indeed the partial fraction representation of $(2)$.

We begin by expanding the function $\cos(ax)$ in a Fourier series,

$$\cos(xy)=a_0/2+\sum_{n=1}^\infty a_n\cos(nx) \tag{A1}$$

for $x\in [-\pi/\pi]$. The Fourier coefficients are given by

$$\begin{align} a_n&=\frac{2}{\pi}\int_0^\pi \cos(xy)\cos(nx)\,dx\\\\ &=\frac1\pi (-1)^n \sin(\pi y)\left(\frac{1}{y +n}+\frac{1}{y -n}\right)\tag {A2} \end{align}$$

Substituting $(A2)$ into $(A1)$, setting $x=0$, and dividing by $\sin(\pi y)$ reveals

$$\begin{align} \pi \csc(\pi y)&=\frac1y +\sum_{n=1}^\infty (-1)^n\left(\frac{1}{y -n}+\frac{1}{y +n}\right)\\\\ &=\sum_{n=-\infty}^\infty \frac{(-1)^n}{y-n}\tag {A3} \end{align}$$

Next, letting $y=(1+a)/2$ in $(A3)$,then letting $y=(1-a)/2$ in $(A3)$ we find after combining results and dividing by $2$

$$\begin{align} \pi \sec(\pi a/2)&=\sum_{n=-\infty}^\infty (-1)^n\left(\frac{1}{a-(2n-1)}-\frac{1}{a+(2n-1)}\right)\\\\ &=\sum_{n=1}^\infty (-1)^n\left(\frac{1}{a-(2n-1)}-\frac{1}{a+(2n-1)}\right)\\\\ &+\sum_{n=-\infty}^0 (-1)^n\left(\frac{1}{a-(2n-1)}-\frac{1}{a+(2n-1)}\right)\\\\ &=\sum_{n=0}^\infty (-1)^{n+1}\left(\frac{1}{a-(2n+1)}-\frac{1}{a+(2n+1)}\right)\\\\ &+\sum_{n=\infty}^{0} (-1)^n\left(\frac{1}{a-(-2n-1)}-\frac{1}{a+(-2n-1)}\right)\\\\ &=2\sum_{n=0}^\infty (-1)^n\left(\frac{1}{a-(-2n-1)}-\frac{1}{a+(-2n-1)}\right)\\\\ \end{align}$$

Finally, dividing by $2$ yields the coveted representation

$$\frac{\pi}{2}\sec\left(\frac{\pi a}{2}\right)=\sum_{n=0}^\infty (-1)^n\left(\frac{1}{a-(-2n-1)}-\frac{1}{a+(-2n-1)}\right)$$

as was to be shown!


Hint. Assume $|a|<1$. Another equivalent approach would be to write $$\begin{align} \int_0^\infty \frac{x^a}{1+x^2}\,dx&=\int_0^\infty x^a \left(\int_0^\infty e^{-(1+x^2)t}dt\right)dx \\\\&=\int_0^\infty e^{-t}\left(\int_0^\infty x^a e^{-tx^2}dx\right)dt\\\\ &=\frac12\Gamma\left(\frac{1+a}{2}\right)\int_0^\infty t^{\frac{1-a}{2}-1}e^{-t}dt\\\\ &=\frac12\Gamma\left(\frac{1+a}{2}\right)\Gamma\left(\frac{1-a}{2}\right)\\\\ &=\frac{\pi}{2}\sec\left(\frac{\pi a}{2}\right) \end{align}$$ by using the standard integral representation of the $\Gamma$ function and (6.1.30).


$$ \begin{align} \int_0^\infty\frac{x^a}{1+x^2}\,\mathrm{d}x &=\frac12\int_0^\infty\frac{x^{(a-1)/2}}{1+x}\,\mathrm{d}x\\ &=\frac12\int_0^1\frac{\left(\frac{t}{1-t}\right)^{(a-1)/2}}{1+\left(\frac{t}{1-t}\right)}\frac{\mathrm{d}t}{(1-t)^2}\\ &=\frac12\int_0^1t^{(a-1)/2}(1-t)^{(-1-a)/2}\,\mathrm{d}t\\ &=\frac12\mathrm{B}\left(\frac{1+a}2,\frac{1-a}2\right)\\ &=\frac12\frac{\Gamma\left(\frac{1+a}2\right)\Gamma\left(\frac{1-a}2\right)}{\Gamma(1)}\\ &=\frac\pi2\sec\left(\frac{\pi a}2\right) \end{align} $$ As in kobe's answer, we've used Euler's Reflection Formula. However, most proofs of that I've seen use contour integration.


\begin{align} \int_0^\infty \frac{x^a}{1+x^2}\,dx&= \int_0^\infty x^a \int_0^\infty e^{-xt} \sin t \,dt\, dx\\ &=\int_0^\infty \sin t \int_0^\infty e^{-xt} x^a \,dx\, dt\\ &=\Gamma (a+1)\int_0^\infty t^{-a-1} \sin t \,dt\\ &=-\Gamma (a+1)\Gamma (-a) \sin (\pi a/2)\\ &=\frac{\pi}{2}\sec\left(\frac{\pi a}{2}\right) \end{align}

  • 1
    $\begingroup$ How was the fourth (next to last) line obtained without complex analysis? $\endgroup$
    – Mark Viola
    Sep 4, 2016 at 4:34
  • 1
    $\begingroup$ @Dr.MV We can use Ramanujan Master Theorem, which can be proved without complex analysis. $\endgroup$
    – MathGod
    Oct 12, 2016 at 18:29
  • 1
    $\begingroup$ I'd like to see a proof of the RMT that uses real analysis only. $\endgroup$
    – Mark Viola
    Oct 12, 2016 at 18:41
  • $\begingroup$ Just for information. Mathematica calculates the integral on the spot $\int_0^\infty t^{-a-1} \sin t \,dt=-\Gamma (-a) \sin (\pi a/2)$ for $-1\lt \Re(a) \lt 1$ $\endgroup$ May 16, 2021 at 11:02

This is an elaboration of the last step in Dr. MV's original solution.

The Mittag-Leffler expansion of the secant function is $$\sec(z) = \pi \sum\limits_{n = 0}^{\infty} \frac{(-1)^{n}(2n+1)}{(\pi /2)^{2}(2n+1)^{2} - z^{2}}$$

Thus we have \begin{align} \frac{\pi}{2} \sec\left(\frac{\pi a}{2} \right) &= \frac{\pi ^{2}}{2} \sum\limits_{n = 0}^{\infty} \frac{(-1)^{n}(2n+1)}{(\pi /2)^{2}(2n+1)^{2} - (\pi a/2)^{2}} \\ &= 2 \sum\limits_{n = 0}^{\infty} \frac{(-1)^{n}(2n+1)}{(2n+1)^{2} - a^{2}} \end{align}

  • 2
    $\begingroup$ Thank you, but this development is based on complex analysis. Therefore, this answer defies the title of the posted question. $\endgroup$
    – Mark Viola
    Feb 11, 2017 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.