Prove that

$$\int^1_0 \frac{\cos(\log x)}{x^2+1}\,dx = \frac{\pi}{4}\mathrm{sech}\left( \frac{\pi}{2}\right)$$

First note that

$$2 \int^1_0 \frac{\cos(\log x) }{x^2+1}\,dx = \int^\infty_0 \frac{\cos(\log x)}{x^2+1}\,dx$$

Integrate the following function

$$f(z) = \frac{e^{i\log(z)}}{z^2+1}$$

Around a semi-circle in the upper half place. Where we avoid the branch point at $z=0$ by a semi-circle. We assume that the branch cut is taken on the negative imaginary axis.

$$\int^{-r}_{-R}f(z) \,dz +\int^{R}_{r}f(z) \,dz+ \int_{C_R}f(z)\,dz+\int_{c_r}f(z)\,dz =2\pi i \mathrm{Res}(f,i)$$

The integral on semi-circles

\begin{align}\left|\int_{C_R} \frac{e^{i\log(z)}}{z^2+1}\right|
&\leq R \int^{\pi}_0 \left|\frac{e^{i \log(R e^{it})}}{R^2e^{2it}+1}\right| dt\\
&\leq R \int^{\pi}_0 \frac{e^{i \log R-t}}{|R^2-1|} dt\\
&\leq \frac{R}{R^2-1} \int^{\pi}_0 e^{-t} dt\\
&\leq \frac{R(1-e^{-\pi})}{R^2-1} dt \sim_{\infty} 0
\end{align}

Similarily

$$\lim_{r \to 0}\int_{C_r} \frac{e^{i\log(z)}}{z^2+1} = 0$$

Hence we have as $R \to \infty , r \to 0$
$$\int_{-\infty}^0 \frac{e^{i\log|x|-\pi}}{x^2+1}\,dx +\int^\infty_0 \frac{e^{i\log(x)}}{x^2+1}\,dx =2\pi i \mathrm{Res}(f,i)$$

$$(1+e^{-\pi})\int^\infty_0 \frac{e^{i\log(x)}}{x^2+1}\,dx =2\pi i \mathrm{Res}(f,i)$$

Note that

$$\mathrm{Res}(f,i) = \frac{e^{i\log(i)}}{2i} = \frac{e^{-\pi/2}}{2i}$$

Hence

$$\int^\infty_0 \frac{e^{i\log(x)}}{x^2+1}\,dx =\pi \frac{e^{-\pi/2}}{1+e^{-\pi}} = \frac{\pi}{e^{\pi/2}+e^{-\pi/2}} = \frac{\pi}{2}\mathrm{sech}\left( \frac{\pi}{2}\right)$$

Which implies that

$$\int^\infty_0 \frac{\cos(\log x)}{x^2+1}\,dx = \frac{\pi}{2}\mathrm{sech}\left( \frac{\pi}{2}\right)$$

Hence we have our result
$$\int^1_0 \frac{\cos(\log x)}{x^2+1}\,dx = \frac{\pi}{4}\mathrm{sech}\left( \frac{\pi}{2}\right)$$

Posted in Contour Integration | Tagged , , , , , , , | Leave a comment

## Creating Difficult integrals by the residue theorem

Theorem

Let $f$ be analytic function in the unit circle $|z|\leq 1$  such that $f\neq 0$ . Then $$\int^{2\pi}_0f(e^{it})\,dt =2\pi \, f(0)$$

$$\textit{proof}$$

Since the function $f$ is analytic in and on the contour we have by the Cauchy integral theorem

$$\oint_{|z|=1}\frac{f(z)}{z}\,dz = 2\pi i\,\mathrm{Res}(f/z,0)$$

Use $z = e^{it}$ whenere $0\leq t \leq 2\pi$

$$i\int_{0}^{2\pi}\frac{f(e^{it})}{e^{it}}e^{it}\,dt = 2\pi i\,\mathrm{Res}(f/z,0)$$

Note that

$$\mathrm{Res}\left( \frac{f(z)}{z},0\right) = \lim_{z\to 0}z \frac{f(z)}{z} = f(0)$$

Hence

$$\int^{2\pi}_0f(e^{it})\,dt =2\pi \, f(0)$$

Example 1

Consider the function

$$f(z)=\exp(\exp(z))$$

It then follows from the theorem

$$\int^{2\pi}_0 \exp(\exp(\exp(it)))\,dt = 2\pi \, e$$

Note that

\begin{align}\exp(\exp(\exp(it)))
&= e^{e^{\cos t+ i\sin t}} \\
&= e^{e^{\cos t}(\cos( \sin t)+i\sin(\sin t))}\\
&= e^{e^{\cos t}\cos(\sin t)}(\cos(e^{\cos t}\sin(\sin t))+i\sin(e^{\cos t}\sin(\sin t)))\end{align}

By taking the real part

$$\int^{2\pi}_0 e^{e^{\cos t}\cos(\sin t)} \cos(e^{\cos t}\sin(\sin t))\,dt = 2\pi \,e$$

Example 2

$$f(z) = \log(2+z)$$

Where we take the principal logarithm which the branch cut located at $y=0,x \leq -2$

$$\int^{2\pi}_0 \log(2+e^{it}) = 2\pi \log(2)$$

Note that

\begin{align}\log(2+e^{it}) &=\log|(2+\cos t)^2+\sin^2t|+i\arctan \left( \frac{\sin t}{1+\cos t}\right) \\
&= \frac{1}{2}\log(5+4\cos t)+ i\arctan \left( \frac{\sin t}{2+\cos t}\right)
\end{align}

It follows then

$$\int^{2\pi}_0 \log(5+4\cos t)\,dt = 8\pi \log(2)$$

Example 3

By compining the two functions

$$f(z) = \exp(\exp(z)) \log(2+z)$$

We deduce that

$$\small \int^{2\pi}_0 \exp(e^{\cos t}\cos(\sin t)) ( \cos(e^{\cos t}\sin(\sin t))\log(5+4\cos t)-2\arctan \left( \frac{\sin t}{2+\cos t}\right)\sin(e^{\cos t}\sin(\sin t))) \,dt= 4\pi e \log(2)$$

## Proving a trigonometric integral by integrating around an ellipse in the complex plain

Prove for $a,b > 0$

$$\int^{2\pi}_0\frac{dt}{a^2\cos^2 t +b^2\sin^2 t} = \frac{2\pi}{ab}$$

$$\textit{solution}$$

Let us integrate the following function
$$f(z) = \frac{1}{z}$$

Around the ellipse

$$\oint_{\gamma}f(z)\,dz =2\pi i\,\mathrm{Res}(f,0)$$

The parametrization of the ellipse $\gamma(t) = a\cos(t)+ib\sin(t)$

$$\oint_{\gamma}f(z)\,dz=\int^{2\pi}_0 \frac{-a\sin t+ib\cos t}{a\cos t+ib\sin t} \,dt$$

This simplifies to the following
$$\frac{-a\sin t+ib\cos t}{a\cos t+ib\sin t} \times \frac{a\cos t-ib\sin t}{a\cos t-ib\sin t} = \frac{(b^2-a^2)\sin t \cos t+iab}{a^2\cos^2 t +\sin^2 t}$$

Hence

$$\int^{2\pi}_0\frac{(b^2-a^2)\sin t \cos t+iab}{a^2\cos^2 t +b^2\sin^2 t}\,dt = 2\pi i \, \mathrm{Res}(f,0) = 2\pi i$$

By equating the imaginary parts

$$iab\int^{2\pi}_0\frac{dt}{a^2\cos^2 t +b^2\sin^2 t} = 2\pi i$$

Which implies the result

$$\int^{2\pi}_0\frac{dt}{a^2\cos^2 t +b^2\sin^2 t} = \frac{2\pi}{ab}$$

## Integrating a fraction of exponential and trignometric using rectangular contour

[Ex 41 ] Watson’s complex integration

$$\int^\infty_0 \frac{\sin(ax)}{e^{2\pi x}-1}\,dx = \frac{1}{4}\coth\left(\frac{a}{2} \right)-\frac{1}{2a}$$

$$\textit{solution}$$

By integrating the following function

$$f(z) = \frac{e^{iaz}}{e^{2\pi z}-1}$$

The function is analytic in and on the contour, indented at the poles of the function

Hence by the residue theorem

$$\int_{\gamma_{\epsilon_2}}f(z)\,dz+\int^R_{\epsilon_2}f(x)\,dx+\int^{R+i}_{R}f(x)\,dx\\+\int_{R+i}^{i+\epsilon_2}f(x)\,dx+\int_{\gamma_{\epsilon_1}}f(z)\,dz-\int^{i-i\epsilon_1}_{i\epsilon_2}f(x)\,dx=0$$

Let us first look at with $R \to \infty$

\begin{align}\left|\int_{R}^{R+i} \frac{e^{iax}}{e^{2\pi x}-1} \,dx\right| &=\left|iR\int^1_0\frac{e^{ia(R+ixR)}}{e^{2\pi (R+ixR)}-1} \,dx\right| \\&\leq R\int^1_0\frac{|e^{ia(R+ixR)}|}{|e^{2\pi (R+ixR)}-1|} \,dx
\\&\leq \frac{R}{|e^{2\pi R}-1|} \int^1_0 e^{-axR} \,dx
\\&= \frac{1}{a|e^{2\pi R}-1|} (1-e^{-aR}) \sim_{\infty} 0\end{align}

The next integral can be reduced to
\begin{align}
\int^{i(1-\epsilon_1)}_{i\epsilon_2}\frac{e^{iax}}{e^{2\pi x}-1} \,dx &= i \int^{(1-\epsilon_1)}_{\epsilon_2}\frac{e^{-ax}}{e^{2\pi i x}-1} \,dx \\&= \frac{1}{2}\int^{(1-\epsilon_1)}_{\epsilon_2}\frac{e^{-ax}}{\sin(\pi x) e^{i\pi x}} \,dx
\\ &= \frac{1}{2}\int^{(1-\epsilon_1)}_{\epsilon_2}\frac{e^{-ax}}{\sin(\pi x) e^{i\pi x}} \,dx
\\ &= \frac{1}{2}\int^{(1-\epsilon_1)}_{\epsilon_2}\frac{\cos(\pi x)}{\sin(\pi x) }e^{-ax} \,dx-\frac{i}{2}\int^{(1-\epsilon_1)}_{\epsilon_2}e^{-ax} \,dx\end{align}

Since the first integral diverges when $\epsilon_1,\epsilon_2 \to 0$

$$PV\int^{i}_{0}\frac{e^{iax}}{e^{2\pi x}-1} \,dx =PV \int^{1}_{0}\frac{\cos(\pi x)}{2\sin(\pi x) }e^{-ax} \,dx-i\frac{1-e^{-a}}{2a}$$

The remaining integrals can be evaluated using residues
$$\lim_{\epsilon_2 \to 0} \int_{\gamma_{\epsilon_2}}f(z)\,dz = -\frac{\pi i}{2}\mathrm{Res}(f,0)= -\frac{i}{4}$$

$$\lim_{\epsilon_1 \to 0} \int_{\gamma_{\epsilon_1}}f(z)\,dz = -\frac{\pi\,i}{2}\mathrm{Res}(f,i)= -\frac{i}{4}e^{-a}$$

By combining the results together

$$PV\int^\infty_{0}\frac{e^{iax}}{e^{2\pi x}-1}\,dx -PV\int^\infty_{0}\frac{e^{ia(x+i)}}{e^{2\pi (x+i)}-1}\,dx \\-PV \int^{1}_{0}\frac{\cos(\pi x)}{2\sin(\pi x) }e^{-ax} \,dx+i\frac{1-e^{-a}}{2a} = i\frac{e^{-a}+1}{4}$$

Which reduces to

$$(1-e^{-a})PV\int^\infty_{0}\frac{e^{iax}}{e^{2\pi x}-1}\,dx -PV \int^{1}_{0}\frac{\cos(\pi x)}{2\sin(\pi x) }e^{-ax} \,dx = i\frac{e^{-a}+1}{4}-i\frac{1-e^{-a}}{2a}$$

By equating the real part

$$\int^\infty_0 \frac{\sin(ax)}{e^{2\pi x}-1}\,dx = \frac{1}{4}\coth\left(\frac{a}{2} \right)-\frac{1}{2a}$$

## Integrating around a triangular contour for Fresnel integral

$$\int^\infty_0\frac{\cos(x)}{\sqrt{x}}\,dx =\int^\infty_0\frac{\sin(x)}{\sqrt{x}}\,dx =\sqrt{\frac{\pi}{2}}$$

$$\textit{solution}$$

Consider the following function

$$f(z)=z^{-1/2}\,e^{iz}$$

Where we choose the principle root for $z^{-1/2}=e^{-1/2\log(z)}$. By integrating around the following contour

$$\int_{C_r}f(z)\,dz+\int_{r}^R f(x)\,dx+\int_{\gamma}f(z)\,dz+\int^{iR}_{ir}f(x)\,dx = 0$$

Taking the integral around the small quarter circle with $r\to 0$
$$\left| \int_{C_r}f(z)\,dz\right|\leq \left|\sqrt{r}\int^{\pi/2}_{0}e^{it/2} e^{rie^{it}}\,dt\right| \leq \sqrt{r}\int^{\pi/2}_{0}\left|e^{-r\sin(t)}\right|\,dt\sim 0$$

On $\gamma(t)=(1-t)R+iRt$ where $0\leq t \leq 1$

$$\left|\int_{\gamma}f(z)\,dz\right| = \left| R(i-1)\int^1_0e^{-1/2\log(R(1-t)+iRt)}e^{i(1-t)R-Rt}\,dt\right| \\ \leq \frac{\sqrt{2}}{\sqrt{R}} \int^1_0 \frac{e^{-Rt}}{\sqrt[4]{(1-t)^2+t^2}}\,dt$$

Hence we have

$$\left|\int_{\gamma}f(z)\,dz\right| \leq \frac{\sqrt{2}}{\sqrt{R}} \int^1_0 e^{-Rt}\,dt=\frac{\sqrt{2}}{R\sqrt{R}}\left(1-e^{-R}\right)\sim_{\infty}0$$

Finally what is remaining when $r\to 0$ and $R \to \infty$

$$\int^\infty_0 \frac{e^{ix}}{\sqrt{x}}\,dx =i \int^{\infty}_{0}(ix)^{-1/2}e^{-x}\,dx$$

Note that $i^{-1/2}=e^{-i\pi/4}$

$$\int^\infty_0\frac{e^{ix}}{\sqrt{x}}\,dx = ie^{-i\pi/4}\int^{\infty}_{0}x^{-1/2}e^{-x}\,dx =ie^{-i\pi/4} \sqrt{\pi}$$

Using that we have

$$\boxed{\int^\infty_0\frac{\cos(x)}{\sqrt{x}}\,dx =\int^\infty_0\frac{\sin(x)}{\sqrt{x}}\,dx =\sqrt{\frac{\pi}{2}}}$$

## Integrating a function around three branches using a semi-circle contour

[Ex] Watson’s complex integration

$$\int^{\pi/2}_{0}\cos(nt)\cos^m(t)\,dt=\frac{\pi \Gamma(m+1)}{2^{m+1}\Gamma\left(\frac{n+m+2}{2}\right)\Gamma\left(\frac{2-n+m}{2}\right)}$$

$$\textit {solution}$$

Let us integrate the following function

$$f(z) = z^{n-m-1}\left(1+z^2\right)^m$$

We choose the principle logarithm where

$$\log(z) = \log|z|+\mathrm{Arg}(z)$$

Note that the function $z^{n-m-1} = e^{(n-m-1)\log(z)}$ will have a branch cut on the negative $x$ axis. Also we have

$$\left(1+z^2 \right)^m = e^{m\log(1+z^2)}$$

The principle branch will be on the imaginary $y$ axis where $|y| \geq 1$ which implies that $y \geq 1$ or $y \leq -1$

By the residue theorem

$$\int_{\gamma_{\epsilon_1}}f(z)\,dz+\int_{\gamma_{\epsilon_2}}f(z)\,dz+\int_{\gamma_{\epsilon_3}}f(z)\,dz\\+\int_{i-i\epsilon_1}^{i\epsilon_2}f(z)\,dz+\int_{-i\epsilon_2}^{-i+i\epsilon_3}f(z)\,dz+\int_{C}f(z)\,dz=0$$
I’ll prove the second integral goes to 0

Use the parametrization $\gamma_{\epsilon_2}(t)= \epsilon_2e^{it}\,\,,-\pi/2\leq t \leq \,\pi/2$
$$\left|i\epsilon_2^{n-m}\int_{-\pi/2}^{\pi/2}e^{int}\log(1+(\epsilon_2e^{it})^2)\,dt\right|\leq \pi \log(2)\epsilon_2^{n-m}$$

By taking the limit we deduce the integral goes to 0. Similarly we have

$$\lim_{\epsilon_1 \to 0}\int_{\gamma_{\epsilon_1}}f(z)\,dz=\lim_{\epsilon_2 \to 0}\int_{\gamma_{\epsilon_3}}f(z)\,dz=0$$

Note on on the circular part of $|z|=1$

\begin{align}\int_{C}f(z)\,dz &=i\,\int^{\pi/2}_{-\pi/2}e^{it}e^{int-imt-it}\left(1+e^{2it}\right)^m\,dt \\ &=i\,\int^{\pi/2}_{-\pi/2}e^{int}(e^{-it}+e^{it})^m\,dt\\ &=i2^m\, \int^{\pi/2}_{-\pi/2}e^{int}\cos^m(t)\,dt \end{align}

The integrals reduce to

$$\int_{i}^{0}x^{n-m-1}\left(1+x^2 \right)^m\,dx+\int_{0}^{-i}x^{n-m-1}\left(1+x^2 \right)^m\,dx=-i2^m\int^{\pi/2}_{-\pi/2}e^{int}\cos^m(t)\,dt$$

By taking $x=it$ and $x=-it$ respectively

$$-i\int_{0}^{1}(it)^{n-m-1}\left(1-t^2 \right)^m\,dt-i\int_{0}^{1}(-it)^{n-m-1}\left(1-t^2 \right)^m\,dt=-i2^m\int^{\pi/2}_{-\pi/2}e^{int}\cos^m(t)\,dt$$

We then can combine the integrals
$$-i((i)^{n-m-1}+ (-i)^{n-m-1})\int_{0}^{1}t^{n-m-1}\left(1-t^2 \right)^m\,dt=-i2^m\int^{\pi/2}_{-\pi/2}e^{int}\cos^m(t)\,dt$$

Note that

$$-(i^{n-m}-(-i)^{n-m})= -\left(e^{i(n-m)\pi/2} -e^{-i(n-m)\pi/2} \right)=-2i\sin\left(\frac{n\pi -m\pi}{2} \right)$$

We deduce that

$$\int^{\pi/2}_{-\pi/2}e^{int}\cos^m(t)\,dt=2^{1-m}\sin\left(\frac{n\pi -m\pi}{2} \right)\int^1_{0}t^{n-m-1}(1-t^2)^m\,dt$$

Using the Euler formula we have

$$\int^{\pi/2}_{0}\cos(nt)\cos^m(t)\,dt=2^{-m}\sin\left(\frac{n\pi -m\pi}{2} \right)\int^1_{0}t^{n-m-1}(1-t^2)^m\,dt$$

Note the beta integral

$$\int^1_{0}t^{n-m-1}(1-t^2)^m\,dt = \frac{\Gamma(m+1)\Gamma\left( \frac{n-m}{2}\right)}{2\Gamma\left(\frac{n+m+2}{2}\right)}$$

By the reflection formula we have

$$\Gamma\left( \frac{n-m}{2}\right)\Gamma\left(1- \frac{n-m}{2}\right)=\frac{\pi}{\sin\left(\frac{n\pi -m\pi}{2} \right)}$$

We deduce then that

$$\int^{\pi/2}_{0}\cos(nt)\cos^m(t)\,dt=\frac{\pi \Gamma(m+1)}{2^{m+1}\Gamma\left(\frac{n+m+2}{2}\right)\Gamma\left(\frac{2-n+m}{2}\right)}$$

## Integration related to gamma function using rectangle contour

[Ex 9] Watson’s complex integration
$$\int^{\infty}_{-\infty}e^{-x^2}\,\cos(2ax)dx=e^{-a^2}\sqrt{\pi}$$
$$proof$$
Integrate the following function

$$f(z) = e^{-z^2}$$

Use the following contour

Note that the function is entire, hence
$$\int^{L}_{-L} e^{-t^2}\,dt+\int^{L+ai}_{L} e^{-t^2}\,dt+\int^{-L}_{-L+ai} e^{-t^2}\,dt+\int^{-L+ai}_{L+ai}e^{-t^2}\,dt=0$$
For the forth integral use the substitution $x= t-ai$

$$\int^{-L+ai}_{L+ai}e^{-t^2}\,dt=\int^{-L}_{L}e^{-(x+ai)^2}\,dx=-e^{a^2}\int^{L}_{-L}e^{-x^2}\,e^{-2iax}dx$$

Take $L \to \infty$

$$\left|\int^{L+ai}_{L} e^{-z^2}\,dz \right|=\left|\int^{ai}_{0} e^{-(x-L)^2}\,dt \right|\leq a e^{-L^2}\sim_{\infty} 0$$

Similarly

$$\left|\int^{-L}_{-L+ai} e^{-z^2}\,dz \right|=\left|\int^{ai}_{0} e^{-(x+L)^2}\,dt \right|\leq a e^{-L^2}\sim_{\infty} 0$$

Hence we dedeuce that

$$e^{a^2}\int^{\infty}_{-\infty}e^{-x^2}\,e^{-2iax}dx=\int^{\infty}_{-\infty} e^{-t^2}\,dt =\Gamma\left( \frac{1}{2}\right)=\sqrt{\pi}$$

By taking the real part and imaginary part

$$\boxed{\int^{\infty}_{-\infty}e^{-x^2}\,\cos(2ax)dx=e^{-a^2}\sqrt{\pi}}$$

## Integral of arctan and log using contour integration

$$\int^\infty_0\frac{\log\left(x^2+1 \right)\arctan^2\left(x\right)}{x^2}\,dx = \frac{\pi^3}{12}+\pi \log^2(2)$$

Lemma

$$\int^\infty_0 \frac{\log^3(1 + x^2)}{x^2}\,dx = \pi^3+ 3 \pi \log^2(4)$$

Start by the following

$$\int^{\infty}_0 x^{-p}(1+x)^{s-1} dx= \frac{\Gamma(1-p)\Gamma(p-s)}{\Gamma(1-s)}$$

Let $x\to x^2$

$$\int^{\infty}_0 x^{-2p+1}(1+x^2)^{s-1} dx= \frac{\Gamma(1-p)\Gamma(p-s)}{2\Gamma(1-s)}$$

Let $p = 3/2$
$$\int^{\infty}_0 \frac{1}{x^2(1+x^2)^{1-s}} dx= \frac{\Gamma(-1/2)\Gamma(3/2-s)}{2\Gamma(1-s)}$$

By differentiation

$$\int^\infty_0 \frac{\log^3(1+x^2)}{x^2}\,dx = \frac{\Gamma(-1/2)}{2} \left [ \frac{d^3}{ds^3}\frac{\Gamma(3/2-s)}{2\Gamma(1-s)} \right ]_{s = 1} = \pi^3+ 3 \pi \log^2(4)$$

Now, Consider the function

$$f(z) = \frac{\log^3(1-iz)}{z^2}$$

Define the principle logarithm as follows

$$\log z = \log|z| + i\mathrm{Arg}(z) \,\,\,$$

Note that for $x > 0$ the argument can be evaluated as

$$\log z = \log\sqrt{x^2+y^2} + i\arctan(y/x)$$
For the principle logarithm the branch cut is defined as $\Im(1-iz) =0 ,\Re(1-iz) \leq 0$ which then reduces for $z = x+iy$ to $x=0 , 1+ y \leq 0$ . Hence the branch cut on the imaginary axis where $x=0 , y < -1$ . Also note that $f(z)$  is analytic on the punctured plane since around $z =0$

$$\frac{\log^3(1-iz)}{z^2} = -\frac{((iz)+(iz)^2/2+(iz)^3/3 +\mathcal{O}(z^4))^3}{z^2} =\mathcal{O}(z^2)$$

Hence at $z = 0$ we have a removable singularity. Define the following contour were we avoid the branch cut

$$\int_{C_R}f(z)\,dz+\int_{-R}^{0}\frac{\left(\log(\sqrt{1+x^2})+i\arctan(x)\right)^3}{x^2}dx + \int_{0}^R\frac{(\log(\sqrt{1+x^2})+i\arctan(x))^3}{x^2}dx= 0$$
$$\int_{C_R}f(z)\,dz+\int_{0}^{R}\frac{\left(\log(\sqrt{1+x^2})-i\arctan(x)\right)^3}{x^2}dx + \int_{0}^R\frac{(\log(\sqrt{1+x^2})+i\arctan(x))^3}{x^2}dx= 0$$

Note that

$$(x+y)^3 = x^3+y^3+3x^2y+3yx^2$$

This simplifies to

$$\int_{C_R}f(z)\,dz+\int_{0}^{R}\frac{-3 \arctan^2(x) \log(1 + x^2) + 1/4 \log^3(1 + x^2)}{x^2}\,dx= 0$$

Taking the limit

$$\left|\int_{C_R}f(z)\,dz \right| = \left|\int_{C_R}\frac{\log^3(1-iz)}{z^2}\,dz \right| \leq \pi R \frac{(\log |1+R| + 2\pi )^3}{R^2} \sim_{\infty} 0$$

So this simplifies to

$$\int_{0}^{\infty}\frac{ \arctan^2(x) \log(1 + x^2)}{x^2} \,dx = \frac{1}{12} \int^\infty_0 \frac{\log^3(1 + x^2)}{x^2}\,dx$$

Using the Lemma we reach our result.

Posted in Beta function, Contour Integration | | 4 Comments

## Contour integration for a rational function of cos and cosh

$$\int^{\infty}_{-\infty} \frac{\cos(ax)}{\cosh(x)} \,dx = \pi \, \mathrm{sech} \left( \frac{\pi a}{2}\right)$$

$$\textit{proof}$$

Consider
$$f(z) = \frac{e^{iaz}}{\sinh(z)}$$

If we integrate around a contour of height $\pi$ and stretch it to infinity we get

By taking $T \to \infty$

$$\color{red}{\int^{i\pi/2+\infty}_{-i\pi/2+\infty}f(x)\,dx}+\color{blue}{\int^{i\pi/2-\infty}_{i\pi/2+\infty}f(x)\,dx}+\\\color{red}{\int^{-i\pi/2-\infty}_{i\pi/2-\infty}f(x)\,dx}+ \color{blue}{\int^{-i\pi/2+\infty}_{-i\pi/2-\infty}f(x)\,dx} = 2\pi i \mathrm{Res}(f,0)$$

Consider

$$\color{blue}{\int^{-i\pi/2+\infty}_{-i\pi/2-\infty}\frac{e^{iax}}{\sinh(x)}\,dx}$$

Let $x = -\pi i/2+y$

$$i e^{\frac{\pi a}{2}}\int^{\infty}_{-\infty}\frac{e^{iay}}{ \cosh(y)}\,dy$$

Similarly we have for

$$\color{blue}{\int^{i\pi/2-\infty}_{i\pi/2+\infty}\frac{e^{iax}}{\sinh(x)}\,dx}$$

By letting $x =\pi i/2+ y$

$$i e^{-\frac{\pi a}{2}}\int^{\infty}_{-\infty}\frac{e^{iay}}{ \cosh(y)}\,dy$$

The other integrals go to 0 hence

$$i \left(e^{\frac{\pi a}{2}}+e^{- \frac{\pi a}{2}} \right)\int^{\infty}_{-\infty}\frac{e^{iay}}{ \cosh(y)}\,dy =2\pi i \mathrm{Res}(f,0)$$

Calculating the residue we have

$$\mathrm{Res}(f,0) = \lim_{z \to 0} z\frac{e^{iaz}}{\sinh(z)} = \lim_{z \to 0}\frac{e^{iaz}}{\cosh(z)} = 1$$

Using that we get

$$\int^{\infty}_{-\infty}\frac{e^{iay}}{ \cosh(y)}\,dy =\frac{2\pi}{e^{\frac{\pi a}{2}}+e^{- \frac{\pi a}{2}}}$$

By taking the real part

$$\boxed{\int^{\infty}_{-\infty}\frac{\cos(ay)}{ \cosh(y)}\,dy =\pi \, \mathrm{sech}\left( \frac{\pi}{2} a\right)}$$

## Integrating along the unit circle

Prove that

$$\int^{2\pi}_0e^{\cos \theta}\cos(n\theta -\sin \theta)\,d \theta=\frac{2\pi}{n!}$$

$$\textit{proof}$$

Consider the following function

$$f(z)=e^{z^{-1}}z^{n-1}$$

Now we integrate the function along a circle of radius 1

The contour encloses a pole at $z = 0$

$$\oint_{|z|=1}e^{z^{-1}}z^{n-1} dz=2\pi i\mathrm{Res}(f(z),0)$$

Now we need to find the residue which is the coefficient of $1/z$

$$e^{z^{-1}}z^{n-1} = \sum_{k\geq 0}\frac{1}{k!}z^{n-k-1}$$

The coefficient of $z^{-1}$ implies that $k=n$, hence

$$\mathrm{Res}(f(z),0) =\frac{1}{n!}$$

So we have

$$\oint_{|z|=1}e^{z^{-1}}z^{n-1} dz= 2\pi i \frac{1}{n!}$$

Using a parametirzation of the circle $z = e^{it}$ where $t \in (0,2\pi)$

$$i\int_{0}^{2\pi }e^{e^{-i\theta }}e^{i n\theta } d\theta = 2\pi i \frac{1}{n!}$$

Finally we have

$$\int_{0}^{2\pi }e^{e^{-i\theta }}e^{i n\theta } d\theta = 2\pi\frac{1}{n!}$$

Notice that

$$e^{e^{-i\theta }}e^{i n\theta } = e^{\cos(\theta)} (\cos(\sin \theta)-i\sin(\sin \theta ))(\cos(n\theta)+i\sin(n\theta))$$

Take the real part

$$\boxed{\int^{2\pi }_0 e^{\cos \theta} \cos(n\theta-\sin \theta)\, d\theta= \frac{2\pi}{n!}}$$

As a bonus we have

$$\boxed{\int^{2\pi }_0 e^{\cos \theta} \sin(n\theta-\sin \theta)\, d\theta= 0}$$