text: # Complex Contour Integration - Complex Analysis
  
  I'm just practising for my upcoming exam, and I've come across a question I'm having a bit of difficulty with.
  
  I've been asked to show the following; $$\int_{0}^{\infty} \frac{dz}{\cosh(z)} = \frac{\pi}{2}$$
  
  Which, we're told, needs to be integrated around an appropriate contour, with the hint that this countour should be a rectangle with vertices at $-R$, $R$, $R + \pi i$, $-R + \pi i$, oriented in the positive sense.
  
  So, I started by noting that the function $f(z) = \frac{1}{\cosh(z)}$ is even, so we can say that, as $R \rightarrow \infty$, $\int_{-R}^{R} f(z)\cdot dz = PV \int_{-\infty}^{\infty} f(z)\cdot dz = \int_{-\infty}^{\infty} f(z)\cdot dz$
  
  So, now, we can evaluate the contour using Cauchy's Residue Theorem, noting that the only singularity to occur within this contour is $z = \frac{\pi i}{2}$, which has the residue $-i$, so the integral simply becomes; $$\int_C \frac{dz}{\cosh(z)} = 2 \pi i \times -i = 2 \pi$$
  
  Then, I need to deal with the integrals above the real axis. So, let's do the following; $$\Gamma_{1} = \int_{0}^{R + \pi i} f(z) \cdot dz$$ $$\Gamma_{2} = \int_{R + \pi i}^{-R + \pi i} f(z) \cdot dz$$ $$\Gamma_{3} = \int_{0}^{-R + \pi i} f(z) \cdot dz$$ Then; $$\int_{\Gamma_{1} + \Gamma_{2} + \Gamma_{3}}f(z) \cdot dz = \int_{\Gamma_1}f(z) \cdot dz + \int_{\Gamma_2}f(z) \cdot dz + \int_{\Gamma_3}f(z) \cdot dz$$ $$= \int_{0}^{R + \pi i} f(z) \cdot dz + \int_{R + \pi i}^{-R + \pi i} f(z) \cdot dz - \int_{-R + \pi i}^{0} f(z) \cdot dz$$ $$= \int_{0}^{R + \pi i} f(z) \cdot dz + \int_{0}^{-R + \pi i} f(z) \cdot dz +\int_{R + \pi i}^{0} f(z) \cdot dz - \int_{0}^{-R + \pi i} f(z) \cdot dz$$ $$= \int_{0}^{R + \pi i} f(z) \cdot dz +\int_{R + \pi i}^{0} f(z) \cdot dz = 0$$
  
  Assuming I've done all of that correctly, I get; $$Lim(R \rightarrow \infty) \int_{-R}^{R} \frac{dz}{\cosh(z)} = \int_{-\infty}^{\infty} \frac{dz}{\cosh(z)} = 2\pi$$
  
  And, as $f(z)$ is even, we have;
  
  $$\int_{0}^{\infty} \frac{dz}{\cosh(z)} = \pi$$
  
  What have I missed?? Unless those three gamma integrads are meant to equate to give $\pi$, I can't see what I've done incorrectly here. I know it's a lot of working to go through, but any help would be fantastic. :)
  
  • $\Gamma_1$ and $\Gamma_3$ should go from $R$ to $R+i\pi$ resp. $-R$ to $-R+i\pi$ respectively. They tend to $0$ The integral $\Gamma_2$ does not vanish. – Daniel Fischer Jun 12 '14 at 12:19
  • Aha, that'll be it then!! Outside of evaluating the integral of $1 / cosh(z)$, is there any quicker way/trick of getting the $\Gamma_2$ integral?? – Jack Jun 12 '14 at 12:21
  • Hint: $\cosh(z+\pi i)=-\cosh(z)$. – Harald Hanche-Olsen Jun 12 '14 at 12:21
  • Well, what Harald said. – Daniel Fischer Jun 12 '14 at 12:22
  • Does that essentially turn the $\Gamma_2$ integral into $\int_{-R}^{R} f(z) \cdot dz$ ?? – Jack Jun 12 '14 at 12:27
  
  $\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{\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]{\vphantom{\large A}\,#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} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{\int_{0}^{\infty}{\dd z \over \cosh\pars{z}} = {\pi \over 2}:\ {\large ?}}$
  Besides the $\ds{\color{#c00000}{\tt 'tricky' complex\ integration}}$, it's indeed quite simple: