I am trying to integrate $\sec(z)$ over the whole imaginary axis using the residue theorem. i.e., I want to calculate the integral

$$\int_{\Gamma} \frac{dz}{\cos{z}}$$

where $\Gamma$ is the (open) contour that moves along the straight line $x=0$ from $y=-\infty$ to $y=\infty$. $1/\cos(z)$ has infintely many simple poles at either side of the contour. The residues at these poles are $$\text{Res}_{z=-\frac{\pi}{2}+ 2n\pi}\left(\frac{1}{\cos(x)}\right)=1$$ and $$\text{Res}_{z=\frac{\pi}{2}+ 2n\pi}\left(\frac{1}{\cos(x)}\right)=1$$ for $n\in \mathbb{Z}$. My question doesn't really concern the calculation, I just want to find the appropriate contour(s). My initial idea was to use two contours so that the infinite poles on either side of $x=0$ would somehow cancel out, but I haven't gotten very far.

  • $\begingroup$ $\pi\mathrm{i}$. $\endgroup$ Commented Nov 23, 2020 at 20:55

1 Answer 1


Use a rectangular contour with vertices $-i R$, $i R$, $-\pi + i R$, and $-\pi - i R$. The contour integral is then

$$i \int_{-R}^R \frac{dy}{\cosh{y}} + \int_0^{-\pi} \frac{dx}{\cos{(x+i R)}} - i \int_R^{-R} \frac{dy}{\cosh{y}} + \int_{-\pi}^0 \frac{dx}{\cos{(x-i R)}}$$

As $R \to \infty$, the second and fourth integrals vanish. Thus, by the residue theorem, your contour integral is

$$i 2 \int_{-\infty}^{\infty} \frac{dy}{\cosh{y}} = i 2 \pi $$

because the residue at the simple pole $z=-\pi/2$ is $1$.

  • $\begingroup$ Thanks, this gives me good new insight! $\endgroup$ Commented Jan 5, 2016 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .